Texture3D animation as an instance texture - animation offset keeps changing

I am trying to create instances with an animation as their texture in a way that I can play that animation by using an instance attribute.

So I have a texture3D where I store the animation and then use the texture coordinate W to tell each instance what frame to use and when. I added a small script to restart the animation, store it in Tex3d and then lock the Tex3d to make sure that the animation frames keep in the same position in the Texture3D.

Otherwise it works fine, but for some reason the looping position of the animation keeps changing when I restart the project. I have added a math chop to map the W=0 to the first frame and W=1 to the last frame and it does the job. But when I close the project and open it later, the previously set offset does not work anymore and I need to adjust the offset values again.

I have attached a simple example. I adjusted the offsets so that W=0.065 is the first frame and W=1.006 is the last frame and that worked that time. But at least for me, when I opened it again, those offsets did not work anymore.

Why is it behaving this way and is there some other, more reliable way to do what I am trying to do?

tex3d-instance-animation.toe (26.9 KB)

Hi there,

There is another way to 'cache’ your texture3D. If you use the ‘pre fill’ toggle, it will prefill the tex3d when you start your patch. There is no need to lock it after. When it’s prefilling it takes the me.time.frame as frame iteration (so always starts at 1 and runs for the amount of frames specified in your cache size). You can use a patternCHOP instead of an LFO to align those frames to the start of the timeline.

The weird offsets you adjusted has to do with that in uv space the coordinates are pointing to the center of the pixel (or in this case voxel). If w == 0 or w == 1, it shows the last image, so to rerange a slider going from 0 to 1 to the right w coordinates you would need to do something like: 1.5/tex3DcacheSize.
This might be all confusing, so better to send you an updated version to show what I mean.

Hope this helps!
Cheers,
tim

tex3d-instance-animation.4.prefill.2.toe (5.5 KB)

Thanks Tim, it looks like that prefill setting solved the problem! Thank you very much!

Seems that I didn’t read the wiki close enough. There it is explained clearly. I think I just tested the prefill during playback and did not realize that it works best if you set it on, close the project and then open it again.

1 Like