Parallel-planes within semi-transparent volume

Hi all,

I’ve been racking my head over this problem. I’m drawing a volume mesh with a semi-transparency, and I get an odd effect at a certain angle when the volume is rotated: parallel planes are visible within the volume mesh. To add, the semi-transparency isn’t entirely consistent at different angles. The attached screen may better describe the issue. Of note, this effect does not show up when there is no transparency (i.e. when the surface is opaque).

Here’s the relevant source code:




// draw mesh



Thanks for any advice!

Depth testing does not work with blending.

The classic way is to change the planes in order to keep them roughly facing the camera, and back to front. With 4 possible orientations it should be ok.

Thanks for the quick reply ZbuffeR.
How would I go about controlling/changing the orientation of these planes? The ones showing up in my volume just ‘appear’ upon rotation (oriented in the xy-plane).

Ah sorry I completely misread your post ; I imagined that you were doing volume rendering, using a stack of parallel planes, like this :

You are rendering a simple shell, no actual volume right ?
You pic actually looks like like severe z-fighting, can be caused by lack of depth buffer precision.
A few typical causes :

  • having near and far planes too far away with a perspective projection (show your related code). Worst being near plane at 0 distance… Try to pack more tightly around the actual near and far values you really need.
  • not having a depth buffer in the first place. Check how you create the GL window, verify you ask for and get a depth buffer with 24 bits of precision

Yeah you’re right, I’m drawing a shell basically – I realize I was unclear.

I’m investigating whether it’s z-fighting that’s the issue, but I also wanted to mention that as the resolution of the mesh is improved (the vertex spacing are decreased), the distance between these ‘parallel planes’ is decreased proportionally.

As per your suggestions, I squeezed the near and far planes without much success, and I do have a depth buffer active.

These planes within the shell are perpendicular to the initial camera position (camera is on z-axis, planes are in xy), and will only appear when I have rotated such that I parallel (or close to parallel) to the xy-plane.

Well what I said earlier still holds : depth testing does not work with blending. In your case with a convex object it is easier, but you have to render front faces only:

glEnable(GL_CULL_FACE); /// to avoid drawing back faces.

Awesome. Enabling culling seems to have resolved the issue.