Just sharing a simple component here that I’ve refined a few times over a few projects, in case its useful to anybody, but also especially in case anyone has feedback. There’s some weak points/workarounds in it for sure, and I’m actually a little embarrassed at what a simple component has emerged from a rather long period of iteration.
image_cache_loader.tox (2.1 KB)
Essentially the ‘prefill’ approach for image caching was never feasible for the project requirements because of needing to load up many, many high res images in one cache and every mb of GPU memory was critical, so I wanted to dynamically load every image in a single movieFileIn and then release it from that once cached.
The way it works is that you give the component a reference to a table of images that is expected to be in the folder format, that is with a
path column, then
Load the chosen number of images, with or without a randomizer. The component has a parameter reference to its own image cache result as well as two
Outs, one with the Image Cache itself and one with a table containing info on which image has which cache index.
There’s a fair amount of scripting and I’m sure other inefficiencies in this approach. Perhaps relying on the MovieFileIn’s info chopexec vs. somehow polling the state of the Tex3d’s caching directly, for example?
And I’d be really interested to hear what the experts have to say about this in general. It’s a super basic function but I end up having to use something like this all the time and I’m sure my ignorance about TD has impacted the way I put this together.
But in any case it has worked for me and maybe its useful for someone. The next thing I’d be interested to try with this is a image cache pingpong-type swapping system for seamless new content uploading at runtime, or maybe something even more complex.
Thanks for taking a look