Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 8 of 8

Thread: Crazy 3d texture!!

  1. #1
    Intern Newbie
    Join Date
    Mar 2005
    Posts
    41

    Crazy 3d texture!!

    Hi Experts,

    I loaded a 3d image into a 3d texture. Using clipping planes, I saw that the cube was hollow from the inside. As if the cube was made of 6 2d textures. I even saw the boarder images from the inside!! Blending was disabled. It is a cool effect, but its not what I expected!

    Here is how I attached the 3D texture

    glActiveTextureARB(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_3D, TEXTURE_VOL);
    glTexImage3D( GL_TEXTURE_3D, 0, GL_Luminance, 256, 256,_Depth, 0, GL_Luminance,
    GL_UNSIGNED_BYTE, data);

    glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_Clamp);
    glTexParameterf(GL_TEXTURE_3D,GL_TEXTURE_WRAP_T, GL_Clamp);
    glTexParameterf(GL_TEXTURE_3D,GL_TEXTURE_WRAP_R, GL_Clamp);
    glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER,GL_NEAREST);
    glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER,GL_NEAREST);
    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

    glEnable (GL_TEXTURE_3D);

    Thanks

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: Crazy 3d texture!!

    Well, a 3D texture still has to be drawn on good old flat triangles. Common way to represent 3D textures is to draw a lot of parallel quads, a bit like cube slices.

  3. #3
    Junior Member Regular Contributor
    Join Date
    Jun 2004
    Location
    mexico
    Posts
    127

    Re: Crazy 3d texture!!

    could you post a screenshot of that 'effect' ?

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Jan 2003
    Location
    Virginia
    Posts
    601

    Re: Crazy 3d texture!!

    Don't draw all of the levels of the 3D texture unless you are using alpha to threshold the image. If you are keeping it solid just draw a set of tris, or a quad or a polygon where the clipping plane would be. Then set the tex coords for all points of the new faces. 3D textures are good for getting textures for slices that aren't in line with the original grid of the texture - much better and faster than trying to interpolate it yourself.

    Hope that helps.

  5. #5
    Intern Newbie
    Join Date
    Mar 2005
    Posts
    41

    Re: Crazy 3d texture!!

    Thanks everybody for replies,
    Who could have imagined that we should resample the volume with 2d planes!!! This bit of info, i really didn't find in any reference or tutorial!

    A little question, If I need alpha blending and need to view the volume data using clip planes from any direction, what is the optimum method of 2d sampling of the volume?

  6. #6
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: Crazy 3d texture!!

    >> Who could have imagined that we should resample the volume with 2d planes!!! This bit of info, i really didn't find in any reference or tutorial!
    You did not searched very hard apparently ? 30seconds google search for "hardware volumetric opengl" ...

    Some very detailed infos and papers about volumetric visualisation :
    http://www.vrvis.at/vis/resources/co...graphics-2004/
    http://astronomy.swin.edu.au/~pbourke/opengl/glvol/
    http://www.cs.utah.edu/~jmk/sigg_crs...rses_0067.html

  7. #7
    Intern Newbie
    Join Date
    Mar 2005
    Posts
    41

    Re: Crazy 3d texture!!

    Merci Beaucoup ZBuffer for the useful links

    Actually I did a lot of searching in the opengl programming guide, reference manual, online examples.. They all said, well, 3d textures are so much like 2d textures, you just have to replace the 2d functions with the 3d functions...so that's what I did! It seemed that I was the only creature in the world who wanted actually to use 3d textures!

    Anyway you saved a lost sailor, Thanks

  8. #8
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: Crazy 3d texture!!

    I'm very happy it helped, thank you, and good luck with 3d textures !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •