[osg-users] three versions of LightSpacePerspectiveShadowMap in one .cpp

Wojciech Lewandowski w.p.lewandowski at gmail.com
Sun May 3 14:55:54 PDT 2015


Trajce,

I wrote that code but its old enough to not remember details. But from what
I remember original LispSM paper provided some formula to compute
Perspecive Matrix which I implemented and their sample code used different
formula and also have found later version of code which used another
formula again. I was testing all those formulas and finally used one of
them but indeed there were differences. In my testing environment (flight
sims) one of them worked better for infinite directional lights and one of
them worked better for local lights. So I left all of them in the code for
reference. But in practice depending on the scene and projection it may
turn out that one of them works better than other. Its just lies in the
nature of the problem that you cannot have one linear transform which will
provide 1:1 distribution between scene pixels and shadow map texels. In my
opinion it would be best to look at the papers and try to compute the
formula yourself. Various perspective shadow maping algorithms differ by
metric used to compute optimized projection matrix. AFAIK LispSM attempts
to keep the same ratio (of shadow texel size to scene pixel size) at points
in near plane center and far plane center, while Trapezoidal Shadow Map
attempt to reach 1:1 ratio at center of projection volume (I could be wrong
though, see the papers). I believe other metrics could be invented too. And
depending on the metric, solution of optimal perspective matrix will bring
different formulas.

Because of above I believe the best for you would be deriving your own
technique and substituting default one with the best choice that works for
you.

Cheers,
Wojtek



2015-05-03 14:38 GMT+02:00 Robert Osfield <robert.osfield at gmail.com>:

> Hi Nick,
>
> I'm not the author of the LightSpacePerspectiveShadowMap.cpp so can't
> comment too specifically about it.
>
> This close to a stable release I don't want to go complicating the
> build and source code.
>
> Robert.
>
> On 3 May 2015 at 13:35, Trajce Nikolov NICK
> <trajce.nikolov.nick at gmail.com> wrote:
> > Hi again Robert,
> >
> > I am seeing your work in the mentioned shadow map technique and as you
> know
> > there are three versions of the algorithm available through #defines. I
> > found the one that is not default to work the best for me, but this
> means I
> > have to edit the code every time I update.
> >
> > Any ideas how to make this configurable? Via CMake? Or separate the
> versions
> > of the algorithm across different files? What are your thoughts?
> >
> >
> > Cheers,
> > Nick
> >
> > --
> > trajce nikolov nick
> >
> > _______________________________________________
> > osg-users mailing list
> > osg-users at lists.openscenegraph.org
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150503/aa2fcaea/attachment-0002.htm>


More information about the osg-users mailing list