3D Texture

From TouchDesigner Documentation
Jump to: navigation, search

A 3D Texture is a texture that is sampled using three texture coordinates: u, v, and w. The easiest way to think of a 3D texture is as a stack of 2D textures. What makes a 3D texture special is that two neighboring layers will be sampled and blended together if the w coordinate is somewhere between two layers. For example if you have a 3D texture with a depth of 2 (i.e 2 layers, cache size of 2), the two layers will be at w coordinate 0.25 and w coordinate 0.75. If you sample the texture with a w coordinate of 0.5 (or 0.0 with Texture Extend Mode set to repeat), you'll get a 50/50 blend between the two layers. If you sample it at a w value of 0.3, you'll get mostly layer 1 and some of layer 2. The 3D texture will only blend between 2 layers at a time.

The true power of the 3D texture is in its ability to blend between multiple layers in a single pass. In a single draw you can have a very large 3D texture (up to 2048 layers on 8-series Geforce cards), and if you have w values ranging all the way from 0 to 1 on your geometry, you will be able to sample any or all of the layers in a single pass. This isn't possible with 2D textures as most graphics cards today only support 16 or 32 2D textures in a single draw pass.

The Phong MAT supports 3D textures. The Time Machine TOP supports the Texture 3D TOP as an input. The GLSL MAT can create 3D Textures, and the Feedback TOP and Cache TOP also support 3D Textures as inputs. Currently there are no other pre-made TOPs or MATs that support 3D textures.

Related Articles

2D Texture Array