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

2015-05-03 Thread Robert Osfield
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.n...@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@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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

2015-05-03 Thread Wojciech Lewandowski
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.osfi...@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.n...@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@lists.openscenegraph.org
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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

2015-05-03 Thread Trajce Nikolov NICK
Hi Wojtek,

thanks for the very techy reply :-). I was more into organizing these three
available algorithms at present available through #defines into more
structured form (into three separate .cpp files? CMake options). My target
is also flight sim and the work you have done there is really great -
actually I found your work the best from all the shadow mapping techniques
available in the OSG project. So again, maybe we all users of this code
think how to better organize it, maybe you propose since you are the
author. For a user to switch to another available algorithm after every
code update they have to change the #define at the header of the file every
time. What do you propose?

And thanks again !

Cheers,
Trajce



On Sun, May 3, 2015 at 11:55 PM, Wojciech Lewandowski 
w.p.lewandow...@gmail.com wrote:

 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.osfi...@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.n...@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@lists.openscenegraph.org
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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

2015-05-03 Thread Trajce Nikolov NICK
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@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org