Sign in to follow this  
mv348

Stencil shadow volumes - general tips and advice?

Recommended Posts

Hello!

 

After much hard work I have just finished my first implementation of stencil shadow volumes. It works perfectly about 98% of the time. But every now and then I see a small artifacts appear in isolated regions. It is so infrequent that it is probably acceptable but I think it might be worth going the extra mile to hunt down these artifacts.

 

But before I do that, I was wondering if anyone could offer some general tips or common sources of error that can create occasional artifacts.

 

Here are some of the measures I have tried (based on papers/articles i've read) to eliminate artifacts:

 

1. when determining if a triangle is facing the light, i take the dot product of the light-to-triangle vector with the triangle normal, and I return true if dotProduct > epsilon, where epsilon is a small positive value, rather than just zero.

 

2. when creating the front and back faces of the volume, I move the front-face along the direction of the light-vector by a small epsilon. Presumably this is because  "due to floating point errors we might encounter bizarre corruptions where the volume hides the front cap". Not sure i fully understand this but I thought it was worth a shot.

 

Neither of these fixed the occasional appearance of artifacts. Does anyone have any more tricks or tips that might help?

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this