Hi J-S,

Duelling frusta can be really nasty. However, minLightMargin should not significantly affect precision of shadow map. It may affect performance but precision could get only a little worse in DrawBounds or CullBounds when some large object behind viewer gets classified as shadow casting, which in turn will cause ShadowVolume to grow a bit and hence ShadowMap will loose some precision. But on average it should not change much. maxFarPlane on the other hand can affect the precision significantly. Paritcularly with ViewBounds it can quickly show the ugliness of raserized shadows. minFarPlane is responisble for clipping frustum depth height. When frustum depth grows, the base of the pyramid ie size of far plane rectangle also grows proportionally, and ShadowVolume becomes also larger. With Duelling Frusta case, size of frustum far plane square is almost linearly projected to shadow map. So if for example we have 90 deg FOV and 1 km maxFarPlane, it translates to 2km x 2km (2 * 1km * tan( 45 deg ) ) size of frustum pyramid base. Projecting this into 2048x2048 map will give mapping close to 1m per texel resolution.

Now if using similar math to the above, you see that you get worse results than anticipated let me know. There is always a chance for some bug in shadow volume math. When you notice such thing, the best would be, if you could provide simple example illustrating the issue. Then I will gladly look at this problem.

Cheers,
Wojte

-----Oryginalna wiadomość----- From: Jean-Sébastien Guay
Sent: Tuesday, November 16, 2010 9:12 PM
To: OpenSceneGraph Users
Subject: [osg-users] ViewDependentShadow massive flickering problems

Hi Wojtek,

1: fix for a issue with MinimalShadowMap and
LightSpacePerspectiveShadowMapVB techniques ignoring minLightMargin
parameter.

I have tested your changes to LightSpacePerspectiveShadowMapVB in our
simulator, and it seems that taking into account the minLightMargin
parameter makes it have the same artifacts as the other two techniques
(CB and DB) in our simulators. Initially we had selected VB because it
did not present these artifacts, but it now seems likely that the
artifacts were a result of bad settings on our part, and the fact that
minLightMargin wasn't taken into account just masked the problems... So
perhaps I can describe the situation and with your help, eventually
solve it?

When walking in an avatar, if we look in a given direction the shadows
will look great, but then if I just turn around a bit, they will
pixelate a lot, or seem clipped in front of the avatar, possibly even
disappear completely at some angles. We're using a shadow map size of
2048x2048.

I tried tweaking the minLightMargin and maxFarPlane parameters, which in
the CB and DB cases should work. The values I tried were:

minLightMargin: 0 to 500 in increments of 100
maxFarPlane: 1000 to 5000 in increments of 1000.

It seemed to me that none of these made any difference at all. (I was
using DB in that case).

Admittedly, having the camera close to the floor is a tough case for
LiSPSM, but I don't think it should be that bad. I can send you a small
video showing the effect if you want.

The shadow casting objects (and indeed, the whole scene apart from an
osgOcean which casts no shadows) are in an area about, say, 120x100x100
meters in size.

I've turned on DebugDraw and indeed, at the view angles where there are
problems, the debug hud where the shadow map is drawn with volumes
around the relevant scene objects (the left-most hud) shows that the
volumes seem to go crazy (stretch to infinity). Perhaps that shows that
what I'm seeing is the "dueling frusta" singularity? I would have
thought it wouldn't be so apparent. And in fact I see the artifacts
sometimes even when the view vector is nowhere near the light direction
vector. And in any case, I would have thought the minLightMargin and
maxFarPlane parameters would prevent the shadow map from stretching to
infinity.

Would you have any ideas as to what I can do to help the situation? As I
said, I can send you a video showing this. It's hard for me to give you
a scene that demonstrates this though, and I guess this would be the
really useful thing for you... If you think it would help you give me
better answers I'll try to find a way. :-)

J-S
--
______________________________________________________
Jean-Sebastien Guay    [email protected]
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to