Re: [osg-users] Trouble with LightSpacePerspectiveShadowMap artifacts.

2012-08-29 Thread Wojciech Lewandowski
Hi, Dario

0: Ops I was sure these methods are available Thats awkward ommission
considering how old this technique is. We probably should add them. But as
a temporal workoaround you can derive your own class from LispSM and add
proper setter and getter for polygon offset...

1: Yes closed was not a stric term but you got it right: cube is closed
in this definition and single quad is not.

2: Yes you can. Assuming the vertices are oriented properly and it not
change how it looks of course.

Cheers,
WL

2012/8/28 Dario Minieri para...@cheapnet.it

 Hi,

 Thanks for your reply. Yes, I see now the polygonoffsetfactor and
 polygonoffsetunits variables even if there are no methods to set them (osg
 3.0.0), they are setted as attribute camera StateSet because shadow map
 generation. I can try to tweak these values in some way. You speaks about
 two stuffs which I would to discuss:

 1. You say that the model must be closed, but what do you means precisely?
 Closed in term of vertex mesh or closed in terms of shape? For example
 a cube is a closed model, my truck obviously not...

 2. I can set the cull faces on my objects stateset via GL_CULL_FACE, do
 you means that?

 Many thanks

 Thank you!

 Cheers,
 Dario

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=49624#49624





 ___
 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] Trouble with LightSpacePerspectiveShadowMap artifacts.

2012-08-29 Thread Dario Minieri
Hi

Yes, polygonoffset methods are presents in ShadowMap class only, but I use a 
technique derived from StandardShadowMap which redefines the polygonoffset 
variables and here we have no methods to set.

However, I've tried polygonoffset tweak and the final result is much better 
even if not perfect in all scenes. Thanks for your suggestions. However I 
will try the new robert's technique also in next days. I still have to try the 
the GL_CULL_FACE option in my models...

Best Regards


Wojtek wrote:
 Hi, Dario
 
 0: Ops I was sure these methods are available Thats awkward ommission 
 considering how old this technique is. We probably should add them. But as a 
 temporal workoaround you can derive your own class from LispSM and add proper 
 setter and getter for polygon offset...
 
 
 1: Yes closed was not a stric term but you got it right: cube is closed in 
 this definition and single quad is not. 
 
 
 2: Yes you can. Assuming the vertices are oriented properly and it not change 
 how it looks of course.
 
 
 Cheers,
 WL
 
 2012/8/28 Dario Minieri  ()
 
   Hi,
  
  Thanks for your reply. Yes, I see now the polygonoffsetfactor and 
  polygonoffsetunits variables even if there are no methods to set them (osg 
  3.0.0), they are setted as attribute camera StateSet because shadow map 
  generation. I can try to tweak these values in some way. You speaks about 
  two stuffs which I would to discuss:
  
  1. You say that the model must be closed, but what do you means precisely? 
  Closed in term of vertex mesh or closed in terms of shape? For example 
  a cube is a closed model, my truck obviously not...
  
  2. I can set the cull faces on my objects stateset via GL_CULL_FACE, do you 
  means that?
  
  Many thanks
  
  Thank you!
  
  Cheers,
  Dario
  
  --
  Read this topic online here:
  
  http://forum.openscenegraph.org/viewtopic.php?p=49624#49624 
  (http://forum.openscenegraph.org/viewtopic.php?p=49624#49624)
  
  
  
  
  
  ___
  osg-users mailing list
   ()
  http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org 
  (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)
  
  
  
 
 
  --
 Post generated by Mail2Forum


--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=49669#49669





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


Re: [osg-users] Trouble with LightSpacePerspectiveShadowMap artifacts.

2012-08-28 Thread Wojciech Lewandowski
Hi, Dario,

LispSM is setup by default to cast shadows using light space backfacing
polygons. That approach works well if models are closed and build with face
culling in mind. If your model does not utilize cull faces (and your truck
looks like that case), all front polygons will cast shadows. So the
artifact you see is false self shadowing on front polygons. To work around
that you will have to switch the sign of polygon offset factors and maybe
further tweak polygon offset factors magnitude if your field of view gets
big. You will find current polygon offset values in StandardShadowMap setup
code. There is a method to set new polygon offset for the technique.

PS:  I highly recommend reading some papers on principles of ShadowMaping.
There is a Mark Kilkgard presentation on the web that explains many of the
problems.

Cheers,
Wojtek Lewandowski

2012/8/28 Dario Minieri para...@cheapnet.it

 Hi!

 Nice to hear for the new your technique, I will try today checking the
 svn. Is a ShadowMap tech, so the shaders are the same of
 StandardShadowMap.cpp file?

 Meantime, I attach a debug shadow snapshot with CAST and NOCAST setted on
 terrain. I'm not sure to understand well the result...the artifacts are the
 same in both cases, but the depth calculation seems to be different to
 me...You can see some specific stuffs?

 Thanks again for your suggestions.

 Best regards


 robertosfield wrote:
  Hi Dario,
 
  On 27 August 2012 17:13, Dario Minieri  wrote:
 
   I've tried to use the CASTS_SHADOW_TRAVERSAL_MASK on my terrain but
 the final result is pretty the same.
  
   Code:
   GfxTerr-setNodeMask(m_GfxTerr-getNodeMask() 
 ~CASTS_SHADOW_TRAVERSAL_MASK);
  
 
  Run the debug shadow view to see if it's taking into account the terrain.
 
  Or... just try the ViewDependentShadowMap technique that now is
  available in svn/trunk.  This new technique is more robust than LispSM
  and offers similar functionality w.r.t projections.  It may or may not
  solve your problem, but as I'm the author of this particular technique
  I have a better chance of understand and helping address the issues.
  I'm not the author or or the implementator the OSG's LispSM technique
  so am a bit of disadvantage here.
 
  Robert.
  ___
  osg-users mailing list
 
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
   --
  Post generated by Mail2Forum


 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=49608#49608




 ___
 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] Trouble with LightSpacePerspectiveShadowMap artifacts.

2012-08-28 Thread Dario Minieri
Hi,

Thanks for your reply. Yes, I see now the polygonoffsetfactor and 
polygonoffsetunits variables even if there are no methods to set them (osg 
3.0.0), they are setted as attribute camera StateSet because shadow map 
generation. I can try to tweak these values in some way. You speaks about two 
stuffs which I would to discuss:

1. You say that the model must be closed, but what do you means precisely? 
Closed in term of vertex mesh or closed in terms of shape? For example a 
cube is a closed model, my truck obviously not... 

2. I can set the cull faces on my objects stateset via GL_CULL_FACE, do you 
means that? 

Many thanks

Thank you!

Cheers,
Dario

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=49624#49624





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


Re: [osg-users] Trouble with LightSpacePerspectiveShadowMap artifacts.

2012-08-27 Thread Dario Minieri
Hi,

I've tried to use the CASTS_SHADOW_TRAVERSAL_MASK on my terrain but the final 
result is pretty the same.


Code:
GfxTerr-setNodeMask(m_GfxTerr-getNodeMask()  ~CASTS_SHADOW_TRAVERSAL_MASK);



hummmartifacts don't go away...

Thank you!

Cheers,
Dario

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=49585#49585





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


Re: [osg-users] Trouble with LightSpacePerspectiveShadowMap artifacts.

2012-08-27 Thread Robert Osfield
Hi Dario,

On 27 August 2012 17:13, Dario Minieri para...@cheapnet.it wrote:
 I've tried to use the CASTS_SHADOW_TRAVERSAL_MASK on my terrain but the final 
 result is pretty the same.

 Code:
 GfxTerr-setNodeMask(m_GfxTerr-getNodeMask()  ~CASTS_SHADOW_TRAVERSAL_MASK);

Run the debug shadow view to see if it's taking into account the terrain.

Or... just try the ViewDependentShadowMap technique that now is
available in svn/trunk.  This new technique is more robust than LispSM
and offers similar functionality w.r.t projections.  It may or may not
solve your problem, but as I'm the author of this particular technique
I have a better chance of understand and helping address the issues.
I'm not the author or or the implementator the OSG's LispSM technique
so am a bit of disadvantage here.

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


Re: [osg-users] Trouble with LightSpacePerspectiveShadowMap artifacts.

2012-08-24 Thread Robert Osfield
Hi Dario,

The issue looks like one of depth precision of the shadow map such
that the depth test makes an erroneous judgment about whether the
front surface is in shadow or not, this often is a surface self
shadowing itself.  The normal solution is to use a polygon offset in
the shadow map generation so that the surface doesn't shadow itself,
if this polygon offset is too small you still get the self shadowing
artifact if the value is too large you no longer get shadows where you
should see them.

The better the depth precision of the shadow map the lower the polygon
offset will be required, and in your case perhaps it's the ground
layer that is very large and it part of the shadow casting scene to
pushes out the depth range of the shadow map reducing it's precision.
If this is the case then using the Cast/RecivesShadowMask
functionality would be appropriate as this will you could use the mask
to avoid the ground being used in the shadow map generation.

Robert.

On 24 August 2012 14:57, Dario Minieri para...@cheapnet.it wrote:
 Hi,

 I'm using a shadowed scene with LightSpacePerspectiveShadowMapCB technique 
 with a single light. I've seen that in some positions of the camera, the 
 shadows appear artifacts, while in other positions not. See snapshots. Moving 
 the camera in a continuous manner, this results in an annoying shadows 
 flickering on the objects.

 You have some kind of idea for that? GLSL Shadow shader issue? Graphix card 
 issue? Other?

 Thank you!

 Cheers,
 Dario

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=49505#49505




 ___
 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] Trouble with LightSpacePerspectiveShadowMap artifacts.

2012-08-24 Thread Dario Minieri
Hi

Thanks robert for your suggestion, yes this seems the case, the terrain is very 
very large. I wiil try your suggestion soon. Thanks! Bye!


robertosfield wrote:
 Hi Dario,
 
 The issue looks like one of depth precision of the shadow map such
 that the depth test makes an erroneous judgment about whether the
 front surface is in shadow or not, this often is a surface self
 shadowing itself.  The normal solution is to use a polygon offset in
 the shadow map generation so that the surface doesn't shadow itself,
 if this polygon offset is too small you still get the self shadowing
 artifact if the value is too large you no longer get shadows where you
 should see them.
 
 The better the depth precision of the shadow map the lower the polygon
 offset will be required, and in your case perhaps it's the ground
 layer that is very large and it part of the shadow casting scene to
 pushes out the depth range of the shadow map reducing it's precision.
 If this is the case then using the Cast/RecivesShadowMask
 functionality would be appropriate as this will you could use the mask
 to avoid the ground being used in the shadow map generation.
 
 Robert.
 
 On 24 August 2012 14:57, Dario Minieri  wrote:
 
  Hi,
  
  I'm using a shadowed scene with LightSpacePerspectiveShadowMapCB technique 
  with a single light. I've seen that in some positions of the camera, the 
  shadows appear artifacts, while in other positions not. See snapshots. 
  Moving the camera in a continuous manner, this results in an annoying 
  shadows flickering on the objects.
  
  You have some kind of idea for that? GLSL Shadow shader issue? Graphix card 
  issue? Other?
  
  Thank you!
  
  Cheers,
  Dario
  
  --
  Read this topic online here:
  http://forum.openscenegraph.org/viewtopic.php?p=49505#49505
  
  
  
  
  ___
  osg-users mailing list
  
  http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
  
  
 ___
 osg-users mailing list
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
  --
 Post generated by Mail2Forum


--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=49522#49522





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