Texture Attribute issues

It’s currently 2:30 AM so sorry in advance for any typos.

I am trying to use the Tex attribute to assign different slices from a 3D Texture to rectangles I have copied via a Copy POP (you could also try via Instancing but it wouldn’t change the output) but no matter how I try to rerange, round, sort, reorder values and other shenanigans the following happens:

First, the furthest rectangle is updated;
Secondly, the closest one is updated;
Finally the rest of the rectangles update properly.

I’ll attach my sceneTemplate in hope that anyone can shine a light on this, only thing you’ll need to change is to add any movie of your choice.

Thanks in advance :smiley:

Ruben Jaime Papacci

Extra

Software: TouchDesigner version 2025.33230

O.S.: Microsoft Windows 10 Pro version 10.0.19045 Build 19045

Hardware:

CPU: AMD Ryzen 7 5800X 8-Core Processor

RAM: 32 Gb (4x8GB) Crucial Ballistix 3200 MHz RGB

GPU: NVidia GeForce RTX 3070 Ti ZOTAC Gaming AMP Holo

sceneTemplate2.tox (5.2 KB)

Hi ruben

I solved the issue with another approach - using the cache top to separate all the slices and instance the textures on the geo by the index points.
It works good and I feel is a cleaner approach in POPs management, although this doesn’t explain the reason why your approach was not working.
Somehow the texture3d breaks the order of the indexes but no clue why.

I hope is useful:)

sceneTemplate2.6.toe (6.0 KB)

Hello @Papacci20

The odd update behavior you’re seeing is tied to how 3D textures manage incoming slices under the hood.

Internally, the Texture 3D TOP stores new slices at incremented indices, but when materials sample the texture, an offset (POffset) is applied so that the first W coordinates point to the newest frame (as detailed in the 3D Texture Wiki).

Because of this offset behavior, sampling at a W coordinate of 0 + one half texel doesn’t strictly hit the raw array index 0 the way you might expect. To map the oldest frame cleanly to your first rectangle, you need to factor in a one-texel offset to align your W coordinates properly.

Here’s how it can be done:
sceneTemplate2.toe (7.7 KB)
I also replaced the Pattern and Math POP with a single Math Mix instance

This was in fact what I was looking for, I had just finished doing some tests earlier and I also got to the correct behaviour by shifting the phase parameter of my PatternPOP by -(1/op('tex3d1').par.cachesize)which gave me the needed values to obtain what I wanted tho your solution is an improvement as using built-in Attribute and avoiding the PatternPOP entirely makes for a smoother approach.

This is an interesting spin on the overall issue by taking a different approach (I had considered Instancing but only tried it via Tex Coord instead of Instancing Textures) but it still didn’t explain for the observed behaviour :smiley: