Results 1 to 6 of 6

Thread: Texture3d ?

  1. #1
    Member Contributor
    Join Date
    Feb 2000
    Location
    France
    Posts
    55

    Texture3d ?

    What the use of 3d texture ? Is it used for bump mapping or what ? And how do i use it ?
    Thank you.
    Antoche

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Feb 2000
    Location
    London
    Posts
    503

    Re: Texture3d ?

    Some example uses of 3d textures:

    1) Volume rendering. Draw a stack of quads with a slight offset between each one. Each quad bumps up the r texcoord, and so displays the next "slice" of the volume.

    2) Lightmapping. If you've got a point lightsource with a fairly small illumination area, build a 3d texture, bright at the centre fading to dim at the edges, and map it onto nearby polygons. That way you can move the lightsource around and still get good lightmapping on polys at any angle.

    3) Terrain rendering; change terrain types over r, and get smooth blending based on the y coord of terrain verts.

    Just a few possibilities - there are many more. Not bumpmapping though - that's a different technique.

  3. #3
    Member Contributor
    Join Date
    Feb 2000
    Location
    France
    Posts
    55

    Re: Texture3d ?

    So the 3D texture is an array of 2d textures if I understand ? A kind of cube with pixels in it instead of a plane, isn't it ?

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Feb 2000
    Location
    London
    Posts
    503

    Re: Texture3d ?

    Right, in the same way that 2d textures are arrays of 1d textures, and 1d textures are arrays of 0d textures (i.e. pixels).

    Another use just occurred to me - 2d cel animation. One r-layer per animation frame, with the texture filter doing subpixel interpolation between frames. Cute...

    (Side note - the "arrays of arrays" concept is useful for visualizing things, but if you're creating 3d or 2d textures on the heap, it's better to allocate one big block of memory for the whole thing than to create a multidimensional array. Some compilers, including MSVC, insert "guard bytes" before and after heap-allocated arrays when building in debug mode, in order to detect subscripting overruns. Unfortunately this means that the lines/planes of the texture are no longer contiguous in memory, so when you upload them the results may not be quite what you expected...)

  5. #5
    Member Contributor
    Join Date
    Feb 2000
    Location
    France
    Posts
    55

    Re: Texture3d ?

    And can i use a floating value for r so as to make a transition between 2 textures ? this could be *very* useful !

  6. #6
    Senior Member Frequent Contributor
    Join Date
    Feb 2000
    Location
    London
    Posts
    503

    Re: Texture3d ?

    Yup, r is just like the s and t coords for 2-dimensional textures. Floats are fine.

    Do bear in mind that 3d textures aren't in core OpenGL 1.1 - they were only available as an extension - and driver support for OpenGL 1.2 is still extremely patchy. So be prepared for the fact that 3d textures might not work on your system, and that there's a severe dearth of example code.

    I agree, though; I've only starting thinking about 3d textures in the last couple of days, but they just keep looking better and better.

Similar Threads

  1. Texture3D deprecated?
    By NeXEkho in forum OpenGL: GLSL
    Replies: 8
    Last Post: 08-07-2010, 05:14 AM
  2. FrameBuffer using Texture3D
    By Jose Ricardo in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 12-13-2009, 10:54 AM
  3. crashes with texture3d
    By Ralph in forum OpenGL: GLSL
    Replies: 4
    Last Post: 01-27-2009, 07:59 PM
  4. FBO and Texture3D
    By API in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 08-12-2005, 11:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean