Skip to main content
gamedev.net
🔒 Locked

Shadow mapping problem

Started by Theriomorph 1 reply 450+ views
Original Post
Theriomorph
Theriomorph
I've been working on shadow maps for the past few days by reading through some papers from nVidia and also following this tutorial -> http://www.paulsprojects.net/tutorials/smt/smt.html I have a problem with self shadowing artifacts (i'm not sure if this is related, but in the screenshot you can see that the floor is half shadowed for some reason). After getting this problem and trying different things out I ended up putting all the code from the tutorial into mine because I could not for the life of me see what I was missing but it still screws up Here's a screenshot of the problem: http://www24.brinkster.com/theriomorph/flicker.jpg Any ideas on what could be wrong? When I compile the code from the tutorial its little scene runs fine but when I run mine I get flickering shadows on objects... btw. the light in that pic is directly above the objects [edited by - Theriomorph on April 24, 2004 11:28:29 AM]
SimmerD
SimmerD
Sounds like you just have a bias problem. What sort of bias are you using for the plane?

The calculations done to calculate depth when creating the shadow map are not the exact same math when looking up into the shadow map ( extra * 0.5 + 0.5 bias, plus different resolutions & interpolation differences ), so you can''t rely on getting exactly right values.

Instead, you have to have a slop-factor, to either push objects in the shadow map away from the light during shadow map creation, or towards the light during shadow map testing.
Theriomorph
Theriomorph
I found that I only got flickering when I used glRotatef to makes the objects rotate, when they're stationary there aren't any artifacts - why would this happen?

I also think that i'm doing my matrix math wrong, I use a bias matrix which affects the final texture matrix (which is used to generate the tex coords for the shadow map) and I think that when i'm multiplying my matrices something isn't quite right.

When you multiply 2 4x4 matrices is it like this:


1,2,3,4 1,2,3,4
1,2,3,4 X 1,2,3,4
1,2,3,4 1,2,3,4
1,2,3,4 1,2,3,4


Equals:


1,4,9,16
1,4,9,16
1,4,9,16
1,4,9,16


ie. multiply the corresponding number in the other matrix

*Update: Ok, I was reading around and found what I thought about multiplying matrices to be horrifically wrong.

[edited by - Theriomorph on April 25, 2004 4:09:33 AM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.