PDA

View Full Version : 3d textures



mdog1234
10-27-2003, 04:45 AM
Can someone explain to me 3d textures? How are they better than 2d. Do they slow things down alot? How much harder are they to use? Do most games use them?

davepermen
10-27-2003, 08:35 AM
they are the same, just in 3d. a 3d array of texels wich you access with 3d texture coordinates to sample colour values out of it.

same as 1d, and 2d textures.

they are often used as lookuptables, for examle for dynamic lighting, distance attentuation and similar stuff..

mdog1234
10-27-2003, 10:10 AM
but there is not really a difference if i wanted to texture map an object?

davepermen
10-27-2003, 10:34 AM
no. its just a 3d array of pixels where you cut out the part you specify by your coordinates (you cut out a triangle wich get mapped onto your triangle).

just as for 2d textures, where you have a 2d array of pixels.

but be aware that 3d textures use much memory if they get big!

Leyder Dylan
10-27-2003, 12:27 PM
It's usefull for lightmapping.

Instead of using 2 texture units, you use only one.

With a 2d texture and lightmapping, you need :

- 1 texture unit for the X, Y coord.
- 1 texture unit for Z

With a 3D Texture, with only one, it's enough and the result is the same.

Zengar
10-27-2003, 03:14 PM
Originally posted by Leyder Dylan:
It's usefull for lightmapping.

Instead of using 2 texture units, you use only one.

With a 2d texture and lightmapping, you need :

- 1 texture unit for the X, Y coord.
- 1 texture unit for Z

With a 3D Texture, with only one, it's enough and the result is the same.

If we forget that one need 10 times more memory...

Leyder Dylan
10-28-2003, 12:58 AM
Really ? I didn't know that where have you grab this information ?

Tom Nuydens
10-28-2003, 01:12 AM
Originally posted by Leyder Dylan:
Really ? I didn't know that where have you grab this information ?

Duh!? If a grayscale 64x64 2D texture takes 4KB, then a 64x64x64 3D texture takes 256KB. Which is 64 times more. The main reason you would want to use a 3D texture for attenuation mapping is because it allows you to encode arbitrary attenuation functions, which is not possible with a 2D/1D combo.

-- Tom

Leyder Dylan
10-28-2003, 12:13 PM
Oups, damned, to the future, I need to close my mouth ... http://www.opengl.org/discussion_boards/ubb/smile.gif