Adrian,

Example osgshadow --pssm -1 | -2 | -3 works (i see shadows moving correctly) on 
Windows XP, NVidia GeForce 7800 GTX.

Cheers,
Wojtek 

  ----- Original Message ----- 
  From: Adrian Egli OpenSceneGraph (3D) 
  To: [EMAIL PROTECTED] ; OpenSceneGraph Users 
  Sent: Thursday, May 15, 2008 10:34 AM
  Subject: Re: [osg-users] How to document osgShadow?


  
http://video.google.de/videoplay?docid=-2515828172031927314&q=parallel+splitted+&ei=AvUrSNzHKIaG2wLc1-TVCQ

  please test this latest PSSM implementation (ATI, NVidia,..) 

  second questions is, how should i document this shadow technic ?

  adrian



  2008/5/15 Wojciech Lewandowski <[EMAIL PROTECTED]>:

    Ben,

    I promised to answer some of your questions today. Some time ago I was
    studying SoftShadowMap code and I had the feeling that I understood it. But
    today when I tried to look at this again to find the answers for your
    questions about jitter scale and softness width I realized I am not so sure
    anymore. So its better if I will not try to spread confusion with some
    intuitions that may be incorrect. But I am ready to answer the question
    regarding AmbientBias.


    I guess that AmbientBias was introduced in early osgdepthshadowmap example
    (osg 1.2 ?) to achieve the similar result as fixed pipeline
    TEXTURE_COMPARE_FAIL_VALUE_ARB parameter. See
    http://oss.sgi.com/projects/ogl-sample/registry/ARB/shadow_ambient.txt

    If you look at shadow fragment shader, fragment coloring formula looks like
    this:

           vec4 color = gl_Color * texture2D( osgShadow_baseTexture,
    gl_TexCoord[0].xy );
           vec4 shadow = shadow2DProj( osgShadow_shadowTexture, gl_TexCoord[1] 
);
           gl_FragColor = color * ( osgShadow_ambientBias.x + 
osgShadow_ambientBias.y
    * shadow );


    AmbientBias variable is used in shadow & soft shadow mapping techiques. Its
    usually used to set up lower bound for shadowing factor. By default
    shadow2DProj returns value from range [0..1]. If such shadow factor was used
    directly, shadowed areas would be completely black. Sometimes we want to
    make them to be only a bit darker than lit areas. So essentially AmbientBias
    is used to define how much shadows darken the scene.

    By setting AmbientBias.x to some value from range 0..1 one limits minimal
    shadow value (hence AmbientBias because shadowed areas are lit only by
    ambient component). AmbientBias.y is usually set up to 1 - AmbientBias.x but
    I expect that it may be also set bit larger or smaller values used to make
    shadow range more dynamic or flat.



    Having said that, I should mention that I personally don't use AmbientBias
    and above shadowing formula. I often substitute default shaders with shaders
    using formula which is presented in many ShadowMapping papers. ie:

           uniform dimming; // similar to AmbientBias defines minimal Diffuse 
amount
    not darkened by shadow

           vec4 texColor = texture2D( osgShadow_baseTexture, gl_TexCoord[0].xy 
);
           float shade = shadow2DProj( osgShadow_shadowTexture, gl_TexCoord[1] 
).x;
           float diffuseShade = dimming + ( 1.0 - dimming ) * shade;

           gl_FragColor =  ( ambient + diffuseShade * diffuse) * texColor + 
specular *
    shade;

    But such formula requires usage of vertex shader to pass diffuse and ambient
    components separately. Fixed pipeline provides only gl_Color containing
    diffuse and ambient terms added together.


    Cheers,
    Wojtek Lewandowski

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




  -- 
  ********************************************
  Adrian Egli 
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to