Multisampling failing in shadow volume

I’m having some trouble getting multisampling to work properly in a 3D shadow volume I’m implementing.

This is a hobby project based on the renderer described in GPU Gems (chapter 39). It takes a 3D texture and renders it into a series of slices. To achieve a shadow effect, these slices are parallel planes which are normal to the half vector between the viewer and the light and clipped to the bounding cube. They are drawn with translucency so the image is built up one layer at a time.

Unfortunately, my result is suffering from a bad case of jaggies where the planes clip to the edges of the cube. Part of this is unavoidable, since each slice casts a shadow onto the layer below it, and since the planes are not perpendicular the viewer, you will see a bit of the cast shadow.

I thought I could disguise this by adding multisampling. While multisampling itself seems to work (the wireframe I draw around the shadow volume is anitaliased correctly), the slices themselves have jagged edges.

I am creating my buffers with sample buffers enabled and a sample size of 8. I am calling glEnable(GL_MULTISAMPLE) before doing my drawing. You can see the way it is implemented here:…

You can run the current implementation here (Select Demo/Opaque to see a clear example of the jagged lines):

If you wish, you can even download the project by going to:

Simply put, multi sampling works on polygon edges and rarely on textures that uses alpha testing

For alpha to be multisampled, search for alpha to coverage.