Creating 3D texture volume?

Started by
9 comments, last by NitroGL 22 years, 9 months ago
Volume fog through 3D textures is extremly inefficient. There is a fundamental difference between 2D and 3D textures, lots of people oversee: if you draw a quad with a 2D texture on it, you can actually see the texture, but if you draw a 3D cube with a 3D texture on it, you won''t see anything but some single border texels. In order to visualize a 3D texture volume, you have to cut 2D polygonal slices through it, the more slices, the better the representation. For a 256*256*256 texture, an optimal number of slices would be 256 if viewed along a major axis. This is absolutely deadly for fillrate on anything else than Onyx-like workstations.
But, this effect can be used for lighting: imagine a 3D texture containing a gradient sphere (the 3D version of a glow). Now render any geometry with standard 2D textures as material and in a second pass with 3D texture coordinates while using a modulting blend. Here you go with an extremly cool full realtime pointlight effect. If you pre-raytrace shadows into the 3D texture, you can even have realtime shadow casting for free, but you''ll need a higher resolution 3D texture.
Last but not least: don''t underestimate the memory requirements for 3D textures: A 256*256 2D texture with one component takes 64kb, a 256*256*256 3D texture 16Mb !

-AH

This topic is closed to new replies.

Advertisement