3d textures

Started by
19 comments, last by Magnus Wootton 18 years, 8 months ago
Theyre slow becouse theyre huge, man! That 100*100*100 texture you were talking about is 100*100*100*3bytes (RGB) = 3 megs! Thats why getting them to the GPU, then selecting them as the current texture & reading from them will be slow...

Also, why this sick wish to have 3d textures? Every game and every movie with cg effects so far in history has used 2d textures.... well, 3d textures for some special effects maybe (where they actually need it, but certainly not the way you want to use them now). Its by far the best solution. Why do you want to use 3d textures instead?
Advertisement
Why would the fact that they're big make them slower? Mine are going to fit in video RAM. Is a 1024x1024 texture any slower than a 256x256 texture in OpenGL? Anyone know?

Mike
http://www.coolgroups.com/forum
Mike C.http://www.coolgroups.com/zoomer/http://www.coolgroups.com/ez/
Do you know what a BYTE is?
Quote:Original post by mike74
Why would 3d textures be slow? I'm not talking about filling the volume of anything - just getting the surface colors from a 3d texture. Can you point me to some of those demos?
NitroGL has a 3D texture demo which shows only one texture, and my radeon 9600pro runs it at only ~30 fps.

Quote:Original post by mike74
Why would the fact that they're big make them slower? Mine are going to fit in video RAM. Is a 1024x1024 texture any slower than a 256x256 texture in OpenGL? Anyone know?
if too big, of course it would. especially with shaders.
+-+-+-+-+-STR
3d textures are slow because they are fill-rate dependent, not vertices dependent. In order to render a 3d texture, you must slice the data with respect to the camera, starting from back to front. You create polygons in which you assign the 3d texture coordinates to a 2d representation.

-brad

ps. 3d textures aren't useful in games. period. Unless your thinking of storing a stack of 2d textures as a 3d texture, which I think you should reconsider your design efforts because that is a pretty lousy method.
-brad
Quote:Original post by Galapaegos
3d textures are slow because they are fill-rate dependent, not vertices dependent. In order to render a 3d texture, you must slice the data with respect to the camera, starting from back to front. You create polygons in which you assign the 3d texture coordinates to a 2d representation.


Wrong wrong wrong.

Fill-rate bottlenecks vs. vertex bottlenecks are highly scene and graphics card dependant. A 3d texture that takes up a few pixels on screen is hardly going to be fill-limited.

Secondly, 'slicing' the texture with view-aligned quads is only used with 3d textures for rendering volumes (like fog) where you're using the texture as an intensity/colour for each point in the volume. Rocks mapped with a 3d texture don't need to be rendered like this - you'd just use a normal bunch of rock geometry and use 3d texture coords rather than 2d.

3d textures tend to be slow because they're huge (and don't fit into the texture cache as well), because they tend to have a much more random access pattern (again, causing cache problems) and because filtering of 3d textures takes considerably more samples. And probably also because they're not commonly used so they'd be a non-optimal path in most hardware.
There's so much incorrect info in this thread, it gives me headaches :) OrangyTang already cleared up most of it, but here's some more:

Quote:
ps. 3d textures aren't useful in games. period.

Incorrect. 3D textures are very useful for many special effects, from volumetric explosions, over lighting system, BRDF lookup tables, to actual 3D diffuse texture mapping. A lot of research currently goes into procedural generation of 3D textures, because they can look *much* better than their 2D counterparts.

Quote:
Also, why this sick wish to have 3d textures? Every game and every movie with cg effects so far in history has used 2d textures....

Incorrect. Tell that Ken Perlin ;) 3D texturing, especially procedural, is absolutely common practice in highend CGI. It would be very difficult to achieve the quality of todays CG-based movies without the use of 3D texturing. Even in lower end graphics, every single 3D modelling application supports it - Max, Maya, Softimage - through procedural materials and surface shaders. 3D texturing is everywhere.
Quote:
Quote:
Also, why this sick wish to have 3d textures? Every game and every movie with cg effects so far in history has used 2d textures....


Incorrect. Tell that Ken Perlin ;) 3D texturing, especially procedural, is absolutely common practice in highend CGI. It would be very difficult to achieve the quality of todays CG-based movies without the use of 3D texturing. Even in lower end graphics, every single 3D modelling application supports it - Max, Maya, Softimage - through procedural materials and surface shaders. 3D texturing is everywhere.


You should quote me even further :)
I'll bet my 100$ that all those cases you mentioned were using 3d perlin noise or some other procedural approach, not actual 3d arrays of float3 :) Thats why I also said:
Quote:
for some special effects maybe (where they actually need it, but certainly not the way you want to use them now).

Of course the world is full of 3d procedural textures! But 3d textures as 3d arrays... well, I guess there might be a reason to use one of those someplace, but I cant think of one now.
Grr, again I dont say quite what I mean :) The last sentance should be: But 3d textures as 3d arrays... well, I guess there might be a reason to use one of those to texture some ordinary mesh (as opposed to lookup tables or lighting effects) someplace, but I cant think of one now.
3D textures, as precomputed "arrays", do have uses in games. They are used for lookup tables for complicated functions. I have used them, for instance, to do lookups into precomputed offset tables for jittered shadow map sampling.

There's also a neat thing you can do with animated textures; if you use a 3d texture for a animated texture (instead of page flipping 2d textures) you can get blending between the "pages" - good for some effects like fire.

Just because someone doesn't use 3d textures, they shouldn't say "3d textures have no uses in games. period." That's silly. It's just another tool you can use for various things, that has strengths and limitations like any other feature; there's no reason to fear it.

I don't know why people are slamming this guy just because he asked for some 3d textures. If he wants to make a renderer that uses 3d textures, why not? Maybe he'll make something cool. He didn't say "I'm thinking of using 3d textures, BUT MY ENGINE MUST BE AS TEXTURE CACHE-FRIENDLY AS POSSIBLE". For all we know, he's doing an offline renderer. And, at least he's not doing the same thing as everyone else. I think using 3d textures may be good for some types of rocks; it will be easy to get the mapping consistent.

Orangytang gave some of the real reasons that 3d textures may be slow, but those may be acceptable to the original poster.

It's true that most 3d textures will be procedurally generated. But it may be faster to pregenerate them rather then compute them in the actual shader at time of use. And then you have a 3d texture. For the original poster, I'd suggest that he look into generating these noise textures offline - look up perlin noise and you will find lots of examples. I'm sure you can get all kinds of marble textures and stuff like that going easily. One thing I would suggest is to make sure all of your 3d textures are power of 2, as it seems like the cost of memory alignment will be larger in 3 dimensions.



This topic is closed to new replies.

Advertisement