Results 1 to 3 of 3

Thread: Shadows when using alpha blending

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2010

    Shadows when using alpha blending

    Hi, I'm new to openGl, but I've managed to make an app to load and display medical MRI data. I make a cube for each voxel in the data set and colorize them. I've been experimenting with changing the opacity for each cube. I call

    glEnable (GL_BLEND);

    and then set the opacity for each cube to 0.5. This produces some strange results. On all the cubes in the left half of the screen, there is a dark shadow outlining the cubes from the left. The right half of the screen does not have this shadow and appears "normal". I have disabled all lights and lightning so I don't think that's the problem. However, when I rotate the data set, the shadows appear and disappear depending on the orientation... I think the alpha blending visually looks much better, so it would be very nice to be able to render the data sets with opacity, but without those shadows. Does anyone have an idea of whats going on here?


  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Grenoble - France

    Re: Shadows when using alpha blending

    Transparency does not work with depth testing.
    This is obvious when thinking about it, as depth testing only stores the nearest depth.

    Simplest fix is to use additive transparency and no depth testing.
    You will also need a very low alpha.

    Search volume rendering, there are loads of documentation, papers, techniques on the web.

    A simple system is to render a bunch of quads (with back to front oredering) using a 3D texture.
    Better systems use ray "tracing" within a fragment shader through the 3D texture.

  3. #3
    Senior Member Frequent Contributor
    Join Date
    Mar 2009
    Karachi, Pakistan

    Re: Shadows when using alpha blending

    I think generating a voxel out of the MRI dataset is not a good approach. As pointed out by ZBuffer, you may use volume rendering. The simplest approach of loading a 3d texture and slicing it is given here Check the books code samples. The book is a must have for any practioner/researcher for realtime volume rendering. For GPU raycasting, check this tutorial

    If u need any further help, just report here. We will guide u as and when needed.


Similar Threads

  1. Replies: 3
    Last Post: 06-16-2011, 12:51 PM
  2. alpha blending without modifying destination alpha
    By GordAllott in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 09-21-2009, 04:15 AM
  3. Source Alpha Blending without an Alpha Buffer
    By niallm in forum OpenGL ES
    Replies: 1
    Last Post: 06-18-2009, 02:51 AM
  4. Fake Shadows with alpha blending
    By Rodrix in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 03-11-2006, 10:42 PM
  5. Soft Shadows using alpha buffer
    By imported_tfpsly in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 10-14-2002, 08:14 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