Hi J-S,
That may happen if projection matrix changed a little between your read and
rendering of ShadowMap. For example you read the projection matrix at some
point but later it gets refined by AdjustNearFarPlane callback or second
pass of MinimalShadowMap::frameShadowCastingCamera() method used in
MinimalShadowMapCB or MinimalShadowMapDB. In DB this adjustment is actually
done inside render traversal so you may be unable to read correct matrix
unless you override this method.
Cheers,
Wojtek Lewandowski
-----Oryginalna wiadomość-----
From: Jean-Sébastien Guay
Sent: Wednesday, November 17, 2010 4:35 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Getting light-space depth of main pass fragment
Hi Wojtek,
All your math seems correct to me. I would use ( lightSpaceDepth * 0.5 +
0.5 ) to compare with shadow map. But you said you tried it.
Yes, * 0.5 + 0.5 seemed "more correct" but still only seemed to use the
first part of the possible range, so I think you're right that one of my
matrices is probably not set correctly. I'll investigate this.
I wonder: Is it possible that the depth range given by the shadow
camera's projection matrix doesn't match the depth range in the shadow
map? I assumed that since that same camera renders to the shadow map,
the depth range should be the same, but is it possible it doesn't match?
Because the values I get for light-space main pass fragment depth seem
to increase when they get further from the light, as they should, but
they're just not in the right range.
I think I'll make a small example program to show it and see if you can
spot the error more clearly then.
Thanks,
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