[osg-users] How to document osgShadow?
Adrian Egli OpenSceneGraph (3D)
3dhelp at gmail.com
Thu May 15 01:34:41 PDT 2008
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 <lewandowski at ai.com.pl>:
> 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 at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
--
********************************************
Adrian Egli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080515/ec2875e5/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ParallelSplitShadowMap.cpp
Type: text/x-c++src
Size: 39691 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080515/ec2875e5/attachment.cpp>
More information about the osg-users
mailing list