Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Crix

Voxels, volumes (stuff that ain't 2D)

Recommended Posts

How does all this "volumetric" stuff work anyway? Sprites are easy to understand, textures are easy to understand, meshes are easy to understand. But how the hell do you have a 3D texture?!

I found this page that talks about volumetric textures but it still doesn't really talk about what they are how they work.

http://w3imagis.imag.fr/Membres/Fabrice.Neyret/texels/index-eng.html

In the first, choose-skill-level, map in Tenebrae there is some smoke in the "easy" hallway with a texture from the window being projected through it. Is this a volumetric effect? I was checking this smoke out up close and it looks like a bunch of sprites that are always normal to your view and that come in your direction. I saw they're sprites only because you can see them intersecting the ground. I can't figure out how you can see from the side an extruded texture.

HOW? WHAT? WHERE? WHEN? WHO?!

What are the advantages? Will Doom3's successor make large use of them? Are they the ultimate and obvious evolutionary step with time? Are they superior in every way to 2D stuff?

Share this post


Link to post

:) You're probably right. I actually think I learned some stuff there that other sites haven't explained though.

It seems like there must be some benefit to using texels, like for fast rendering of lots of trees, hair, or grass. Can't figure out why or how it speeds things up. Are they extruded textures? But that would just make them meshes then....

Share this post


Link to post

3D textures are pretty easy (to understand)-- just think of a big, solid block of marble (complete with cool swirly designs). Now imagine that you can take a normal 3D mesh of triangle, and place it inside that solid block, like the mesh was a ghost. Now, just go through that block, molecule by molecule, and remove any molecule that DOESN'T directly touch any of the ghost meshes triangles. What you'd have left is a mesh-shaped shell of marble. The big thing of note here, is that all those swirly designs in the marble appear on the mesh in a realistic way-- they don't look like something "wrapped" on because there's no shearing and warping like there is when an artist has to map each mesh vertex onto a square texture, like in 2d texture maps.

This is the basic idea of 3D textures, and they can be used for any such effect where you need to give the illusion that something isn't "wrapped" around a mesh, but rather the design goes THRU the mesh. Some things you can do with 3D textures are:

- Real 3D lights, with proper attenuation. Just render the light as a volume into a block of space, and put the mesh into that block of space (there's a bit more to it than this, but it's the general idea).

- Marble, wood textures. As mentioned above, a mesh used with a volumetric texture wouldn't look as though it was "wrapped" in the texture, but as though the mesh where cut out of a block of whatever material that texture represented.

- Fog. Like light, just render the fog as a volume in a block of space. By placing a bunch of little square meshes in that block, they'd all be textured as if they were cut out of that block of fog. The effect would be as though you were in a real cloud of water droplets, as opposed to the normal rotating billboard look you get with alpha blended fog particles using 2D textures.

- Animated texture. 2 dimentions for the image, the third for time. This could improve performance, or something...?

- Voxels. If the hardware supports direct rendering of a volume texture, you could then create voxel objects (and easy fog). Basically, like someone mentioned earlier, you just take a bunch of screen sized, screen oriented polygonal quads (the mesh), and put them into this block with the texture in it. You would get a bunch of "slices" out of the block that, when put together, would look to the viewer as one big, very detailed solid object on the screen.

This is what I've heard, at anyrate. I hope it helps some.

Share this post


Link to post

I'd thought I'd make another reply about the other questions, if that's okay.

- I think Carmack wrote or said that there would be some "hooks" for things like 3D textures in the new engine. So, while 3D textures won't be required, but they might be used in some spots for some extra cool effects.

- 3D texture aren't better then 2D textures, any more than 2D textures are better than 1D textures. It's just a matter of using what you need, and not wasting resources. For example, a 3D texture would be totally inappropriate and inefficient for texturing clothes on a 3d mesh, because clothes ARE basically wrapped around the mesh, which is the solution domain of 2D textures. You could technically use a 3D texture for this too, but either you'd just wind up using the "dimentions" of a 2D texture anyway (while losing performance), or you'd be wasting a huge tone of space (and losing performance in this case, too). 3D textures are cool, and will open up a lot of possibilities, but they only replace things that 2D texture don't do well, not the things that 2D texture do do well.

As a side note, there are also things called 4D textures, which are like animated 3D textures. I think OpenGL already supports this in some implementations?

Share this post


Link to post

Hey, thanks for a great reply.

The idea of 3D textures is definately clearer now. Seems like a mesh with a 3d texture almost defines a window inside the texture.

So when applying a 3d texture do you have to orient the texture with a virtual gizmo thingie so that the wood grain or whatever lines up with the mesh properly?

And I guess only certain meshes are bound to certain 3d textures. So like a mesh that was passing through an area occupied by a 3d texture, it wouldn't suddenly have that texture placed on it.

That sounds really computationally intensive... especially when you use a molecule sized analogy. I guess that's the one thing that I'm still confused by. How is a 3d texture quantized? Does is really break a 3D-texture-solid into little bitty pieces and see which ones intersect the mesh? What's the resolution of this?

Anyway, this is pretty interesting stuff. Thanks again, EsH.

Share this post


Link to post

You don't have to have UV coordinates for a 3d texture because they are not bitmaps, but instead they are little algorithms that produce patterns.
That's why 2d textures will still have their place. Some materials can be simulated with patterns easily (marble), while others are too unique or complex to be easily simulated with patterns (a lot of woods).

Share this post


Link to post

So far the best use for 3D textures is terrain texturing. 3D textures, by themselves, look remarkably shitty, but they can be used to mathematically arrange/mix 2D textures placed in different channels of the terrain's material. This way you can texture an otherwise incredibly complex mesh without too much distortion.

Share this post


Link to post

Sorry about the late reply.

About "orienting" the 3d texture-- it's all done using transformations
on the mesh, so things just work properly. For example, if you want to "rotate the 3d texture" pi radians to the right on the mesh, you'd actually rotate the mesh pi radians to the left when assigning texture coords. Then, when actually rendering the mesh, you just rotate the mesh normally, and it will look like the texture is rotated throught the mesh pi radians to the right. I don't think you can "orient" a texture itself, because the 3d texture really isn't a compatible vector space with world space (or something like that).

A solid texure is quantized just like a 2d textures. The best way to visualize this is to look at the 3d texture as a series of ordinary 2d textures stacked on top of each other. The way the pixels of the cubemap are mapped onto the mesh is (most likely) the same proccess as with 2D textues: take the position of the 3 polygon vertices as the texture coordinates. Then, just take one of the texture coords components (such as the 'x' componenet), and interpolate that value between the three vertex texture coords, depending on where the polygon screen pixel being drawn is between those vertices. Do the same with the other components ('y' and 'z'). This is the texture coordinate of that screen pixel. So, we just go into the cube map, and pull out cubemap[x][y][z] (which basically uses a few multiplies and adds to make a linear array of pixels act like a 3d volume of pixels), and put that on the screen, and we're done (if we discount filtering, perspective correnction stuff, etc).

3D textures are much more memory intensize than computationaly intensive, I'd guess. Computationally, instead of interpolating 2 components, you'd just have to interpolate three components. That would take about 1.5 times longer. All the 3d textures's pixels would be stored in a simple linear fashion (just like a 2d textures), but the hardware to get the right pixel from 3 coordinates shouldn't be too much more horrendous then getting a pixel using 2 coordinates. But memory wise, if a typical 256x256x4 byte texture takes up 262,144 bytes, the quivalent cube map would take up 67,108,864 bytes. So, we'd go from an easy 200k texture to something that would burst the available video memory on the majority of cards out there today. Now that cards are coming out with 128MB video memories, at least smaller cube textures can be used in some places without shoving all the other textures out to AGP memory.

I'm certainly not an expert in this area, and you can probably learn a lot more hardware relevent stuff (and more over acurate) from the nvidia development site, or ati's development site.

DaJuice. Cube texture can be generated using procedural algorithms, but there's nothing stopping a person from painting a 3d texture layer by layer, or generating a 3d texture in anyway a 2d texture is generated. In the end, a 3d texture has to be accessed by texture coords, though, just like in the 2d case. Again, 2D textures have there place because they are much, much more efficient for certain things, not because a cube map can't (abeit expensively) do them.

Zaldron: didn't know 3d textures were being used in terrain setups yet-- I'll definately have to look that one up...thanks!

Share this post


Link to post
EsH said:

Zaldron: didn't know 3d textures were being used in terrain setups yet-- I'll definately have to look that one up...thanks!

I havent seen it in a game yet, I think. It's a common practice in 3D modelling, since without any real effort you can correctly texture a landscape. And if you're experienced enough, you can even "photorealistically" texture it by ONLY using simple 3D/Procedural textures.

Share this post


Link to post

Hey, interesting discussion so far.

there's nothing stopping a person from painting a 3d texture layer by layer, or generating a 3d texture in anyway a 2d texture is generated


Well, when talking about 2d "textures" I always think of bitmaps or whatever form of raster graphics, although I've seen 2d only procedurals (DarkTree has some although most are 3d).
However I have never seen or heard of a way to convert raster or even vector graphics into a 3d procedural texture. How would that work? I've never seen software that would let you do this.
Or by layer do you mean surface details instead of depth?
Also as far as I know, 3d textures don't need uv coordinates.
In 3d max (and Houdini) you can apply 3d textures to models without UVs, but if you try to do that with a bitmap, it will give you a warning to assign UVs first.


And a question: do any of the current video cards do hardware acceleration fo voxel rendering? I'm pretty sure sgi hardware does this, but how about common pc tech?

Share this post


Link to post
DaJuice said:

In 3d max (and Houdini) you can apply 3d textures to models without UVs, but if you try to do that with a bitmap, it will give you a warning to assign UVs first.

Well, yeah, that's a problem that won't fade away anytime soon. But with one single UVW wrapping, something along the lines of planar or box projection, you instantly have a pretty amazing terrain shader. Just a couple of bitmaps arranged in fallof maps, all tied up to a 3D procedural, say the Planet Map for instance.

Share this post


Link to post

Yeah, terrain is one thing that procedurals are great at. Layering a lot of noise shaders on top of each other can wield very good results.
You don't even need to model the terrain, just keep putting noise modifiers on top of each other (all with different settings and scales to get good variations in the terrain) and then throw some displacenment on there for good measure.

Share this post


Link to post

bryce used 3d textures to great effects, you can make awesome stuff easily

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×