Home Technical Talk

3D texture. What is it?

rube
polycounter lvl 17
Offline / Send Message
rube polycounter lvl 17
Ok, I understand what a 1D and a 2D texture is. But what exactly is a 3d texture? how would I as an artist make one? What would programmers do with it after I did make one?

Just curious as some of the programmers working on our in house engine just came and asked me if they needed to support 3d textures. I wasn't sure since I don't know exactly what they are. Best I can imagine is a 3d colour cube or something similar.



rube

Replies

  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    I would have thought it's something like voxels, your 3d colour cube is probably on the right track ... I guess it's much more likely to be a procedurally-generated texture (for example, those parametric noise/clouds/wood-grain procedurals that you get with most major 3D apps)... a 3D texture isn't really something you can do in Photoshop :)

    edit: did you ask the programmer what he meant by "3d texture" ? :p
    I've found a lot of the time when programmers talk to artists they use different words to describe the same thing (usually the artist use what they commonly understand by a certain term, whereas programmers tend to use the actual description which often sounds completely different even if it's the same thing!)
  • pixelmitherer
    Not heard of that before.

    My head hurts after reading that:poly142:....

    http://en.wikipedia.org/wiki/Voxel
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
  • monkeyscience
    Offline / Send Message
    monkeyscience polycounter lvl 12
    In graphics-programmer-talk 3D textures are a lot like voxels actually. You can think of it as a stack of 2D textures and the w texture coordinate (u,v,w) picks which layer of the stack is sampled by u and v.

    3D textures are primarily used in procedural effects like "Perlin Marble" or "Terrible Wood Shader" as found in your favorite rendering package. They're handy if you don't want to unwrap your UVs because you can use your vertex positions as texture coordinates directly (x,y,z -> u,v,w). If you picture the stack of 2D textures as a solid volume of voxels, this would be like putting your model in the volume and every point on the model's surface samples what voxel its touching.

    People use 3D textures for other, more programmery things as well. They're handy in some cases because they filter and mipmap across all 3 axes. DirectX 10 also has a concept of a "Texture Stack", in which each layer is mipmapped individually.
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    Out of interest, while 3dsmax has W-information editable and available on models (UVW editor - you can move things forward/back through W-space as well as the regular UV), Maya only allows editing of UV coordinates, indeed it doesn't even seem to have a concept of W-depth for UVs. I guess you can't do this sort of stuff in Maya without having a custom shader?
  • Ninjas
    Offline / Send Message
    Ninjas polycounter lvl 18
    yeah, texture slices. You can use them as lightmaps
  • Daaark
    Offline / Send Message
    Daaark polycounter lvl 17
    Problem is they take up a ton of memory, even at small sizes.
  • Eric Chadwick
    I wrote about using one here.
    http://ericchadwick.com/img/gmts_styles.html

    Used it for color-correcting the final rendered frame, in real-time. You can do this and much much more, any color filtering you can do in Photoshop, you can do with a colorcube (levels, curves, solarize, grayscale, inversions, etc).
    gmts_fx_curves.jpg

    We also did volume textures for atmospheric effects, like smoke in a light beam.
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    3d textures typically cant be compressed, hence they use more memory.

    Except for those now SM4 2d stacks that were mentioned. Which are just regular 2d textures in a big pack, so that you can easily pass many 2d textures to a shader, and not have to pass many 2d textures individually.

    A benefit of regular 3d textures is that you get interpolation between slices in all dimensions. Which is why they are used for effects mostly where you want some sort of smooth gradients over 3d dimension. Eric's colorcube is an excellent example for that type of use.

    For procedural stuff in real-time one mostly uses a combo of multiple low-res 3d textures to mix a hi-res noise. As storing hi-res noise would be too costly. And on-the-fly generating "noise" isn't trivial and less effecient on gpu.

    When doing sprite animation one could also pack them as 3d textures and get interpolation between slices for "free".

    The main use of 3d textures is in science however. I am working a lot with 3d textures of medical data on "volume rendering". Either generating surfaces from it (nasal cavities)
    http://isgwww.cs.uni-magdeburg.de/cv/pub/files/Vis2008_Krueger.png

    more details here, I am the second author to that paper responsible for the tech, which was my diploma thesis
    http://isgwww.cs.uni-magdeburg.de/cv/pub/files/Vis2008_Krueger.pdf

    Or colorizing the density values in the volume to be meaningful (coronary vessels to prevent heart attacks)
    http://crazybutcher.cottages.polycount.com/wip/vesselvis/preintfine.jpg

    Other uses in science next to CT/MRT data could be velocity vectors in 3d as result of simulations. Think aerodynamics.
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    I thought you might be using these, Christoph :)
    Thanks for sharing this info!
  • Eric Chadwick
Sign In or Register to comment.