Nick,

I may look into the code but don't expect much this time.  You need to attach 
the code first, though ;-). Few academy guys wrote couple dissertations on 
rasterization and aliasing errors in shadow mapping. Unless you try to do some 
exotic stuff like variance or logarithmic map you will have to use polygon 
offset. I guess you will end up to cranking up PolygonOfset even more if 
current values fail at some distance.  I don't really have other tricks in my 
sleeve.  

Wojtek



From: Trajce Nikolov 
Sent: Friday, January 15, 2010 9:08 PM
To: OpenSceneGraph Users 
Subject: Re: [osg-users] light lobes and shadow maps


That is exactly what I did. Please have a look at the updated code. The uniform 
is updated thru a callback and it multiplies the matrices, still there is a 
visual artifact.I dont have compute_near_far. The projection matrix is fixed 
with very small far plane (100 units, with the znear of 0.01). 

Nick

http://www.linkedin.com/in/tnick



On Fri, Jan 15, 2010 at 9:47 PM, Wojciech Lewandowski <[email protected]> 
wrote:

  Hi,

  Light close to obstacles ? If you have COMPUTE_NEAR_FAR it may clamp near 
plane to very small value which may impact depth resolution. Other issue maybe 
related to GLSL float precision. The trick with multiplying view space coord by 
inverse view matrix to get world coord is performed on float values inside 
GLSL.  Precision wise it would be better to multiply light camera MVP matrix by 
main camera INVERSE VIEW on the CPU. Osg Matrices use  doubles. Put the result 
of the multiplication on GLSL matrix Uniform and use it to multiply gl_Vertex 
in the shader. Such approach multiplies matrices with high precision and 
resulting matrix will be better suited to be cast on single prec. GLSL matrix. 
The drawback of this solution is: you need to update the uniform every frame, 
because main camera view changes with each move. 

  Wojtek



  From: Trajce Nikolov 
  Sent: Friday, January 15, 2010 7:37 PM
  To: OpenSceneGraph Users 
  Subject: Re: [osg-users] light lobes and shadow maps


  Hi Wojtek, 


  now I spent more time exploring this, the polyoffset seam to work, but there 
is still a bit of shimmering. Its interesting, I put the light source in move, 
when it moves backwards, the obstacles are lighten ok, but forward, when the 
light comes close to the obstacles, the lighting is incorrect with shimmering . 
Any clue how to resolve this artifact ?

  Nick

  http://www.linkedin.com/in/tnick



  On Fri, Jan 15, 2010 at 4:48 PM, Trajce Nikolov <[email protected]> 
wrote:

    ok .. make sense. Here is updated code, if some one wants to benefit from. 
LightLobes with handling of obstacles :). Thanks to Wojiech, Robert and the 
online community 

    Nick

    http://www.linkedin.com/in/tnick
    Sent from Devlet, Ankara, Turkey 


    On Fri, Jan 15, 2010 at 3:53 PM, Wojciech Lewandowski 
<[email protected]> wrote:

      0.0 <= shadow2DProj( shadow_texture, projShadow ).r  <= 1.0 

      Shimering is a result of self shadowing. Boosting  depths in shadow map 
with glPolygonOffset usuallly fixes this. There are many schools for 
PolygonOffset settings. I usually set glPolygonOffset( 1.1, 4.0 ) and draw 
objects with front face culling (see StandardShadowMap::ViewData::init(0 for 
details ).  But for this setup models need to work correctly with backface 
culling on. If you do not enforce backface culling PolygonOffset may need 
different initialization.

      Wojtek

      ----- Original Message ----- 
        From: Trajce Nikolov 
        To: OpenSceneGraph Users 
        Sent: Friday, January 15, 2010 2:46 PM
        Subject: Re: [osg-users] light lobes and shadow maps


        one more question. What are the possible values for shadow2DProj( 
shadow_texture, projShadow ).r ? I am trying to put the light attenuation back 
..... and to avoid the shimmering
        Nick

        http://www.linkedin.com/in/tnick
        Sent from Devlet, Ankara, Turkey 


        On Fri, Jan 15, 2010 at 3:35 PM, Trajce Nikolov 
<[email protected]> wrote:

          Hey Wojtek !!!! Thanks a lot. !! I will tune it to fix the shimmering 



          Nick

          http://www.linkedin.com/in/tnick



          On Fri, Jan 15, 2010 at 3:08 PM, Wojciech Lewandowski 
<[email protected]> wrote:

            Trajce,

            Attached is a fixed source code. There is a lots of shadow 
shimmering on my GF8800. You will have to add some depth bias while rendering 
shadow map. Selection proper PolygonOffset values is usually a matter of trial 
and error so leave this for you.

            Wojtek

            ----- Original Message ----- 
              From: Trajce Nikolov 
              To: OpenSceneGraph Users 
              Sent: Friday, January 15, 2010 9:58 AM
              Subject: Re: [osg-users] light lobes and shadow maps


              ABout the code. I use shader to simulate lght lobes thru phong 
lighting in the shader. Then I use shadow maps to detect the area behind the 
obstacles that need not to be lighten. Most is mixture of shadow maps technique 
with lighting scheme. Code snippets borrowed from all around 

              Nick

              http://www.linkedin.com/in/tnick
              Sent from Devlet, Ankara, Turkey 


              On Fri, Jan 15, 2010 at 10:54 AM, Trajce Nikolov 
<[email protected]> wrote:

                Hi Guys, 


                here is the code.

                Nick

                http://www.linkedin.com/in/tnick

                Sent from Devlet, Ankara, Turkey 



                On Thu, Jan 14, 2010 at 11:42 PM, Wojciech Lewandowski 
<[email protected]> wrote:

                  Hi Nick,

                  Post the troublesome code and elaborate a bit more about the 
problem. If its really a minute or two I am sure someone will be able to help.

                  Wojtek Lewandowski


                  From: Trajce Nikolov 
                  Sent: Thursday, January 14, 2010 8:58 PM
                  To: OpenSceneGraph Users 
                  Subject: [osg-users] light lobes and shadow maps


                  Hi community,

                  I have some shader that does some lighting in the scene. Now 
studying osgShadow and the techniques. I want to a shadow map technique to 
disable the lightening of the scene behind obstacles. I have some code done, 
but not working. I need some help, someone experienced with GLSL to spend a 
minute or to to have a look and if possible to spot the problem. Anyone?

                  Thanks a lot

                  Nick

                  http://www.linkedin.com/in/tnick
                  Sent from Izmit, 41, Turkey 


--------------------------------------------------------------


                  _______________________________________________
                  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








------------------------------------------------------------------


              _______________________________________________
              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








------------------------------------------------------------------------


        _______________________________________________
        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








------------------------------------------------------------------------------


  _______________________________________________
  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






--------------------------------------------------------------------------------


_______________________________________________
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