Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Categories
- All Discussions1,524
- General534
- Graphics109
- GPU Computing419
- Mobile141
- Pro Graphics163
- Tools158
In this Discussion
- Detlef Roettger February 13
Shadow map creation, Spot light Cut off Angle
-
Hi all,
after implementing VSM shadow, I would like to be able to change the Cut off Angle without affecting the shadow penumbra As Im using a blur filter on shadow map.
(that is, as in real life, shadow penumbra is same for spot light and point light)
Currently I receive these results (attached) :
1. setCutoffAngle(degToRad(40.0f))
2. setCutoffAngle(degToRad(90.0f))
3. setCutoffAngle(degToRad(175.0f))
You can see that it affects the aliasing of the shadow result and probably the shadow map.
So, is there a way to change the view angle without affecting the aliasing?
I would like my view angle to be wide enough to contain the entire scene.
1.jpg500 x 500 - 36K
2.jpg500 x 500 - 38K
3.jpg500 x 500 - 38K
ScreenHunter_02 Feb. 12 13.52.gif521 x 516 - 52K
ScreenHunter_01 Feb. 12 13.51.gif512 x 515 - 47K -
1 Comment sorted by
-
"So, is there a way to change the view angle without affecting the aliasing?"
To understand how that is connected, just dump your shadow maps and take a look at them while changing that cutoff angle.
Since the shadow map camera field of view is derived from the spotlight cutoff angle, it's created to fill the square shadow map exactly with the circle thrown by that spot light for optimal usage of the available texels.
If you blur that you will obviously lose data on the edges where there is almost no data except for the border, which is explicitly kept to throw shadows because all data outside the spot light cone doesn't receive light.
If you increase the camera field of view angle while keeping the shadow map resolution constant the shadow map precision decreases and if your blur is pixel based, you blur a lot bigger region when increasing the field of view, which gives you the softer shadow as result.
The way to define a spot light cone to contain the whole scene is pure linear algebra. All you need is Pythagoras and a tangens when the spot light is outside the world's bounding sphere.
Note that a the cutoff range of a spot light is the half-angle of the cone, it should be in the range of [0.0, 90.0) degrees. A bigger angle doesn't create a decent camera for rasterization because it would try to map stuff behind the camera in front.
