[osg-users] hide shadow map receiver
Hi, i use osgshadow in osgart, the shadow map work fine. the model is standing on a plane, shadow cast to the plane, the plane is attach to the pattern, what i want is to make the plane invisible but the shadow remains, to make it looks like shadow on the top of pattern. i try alpha blending the plane, the result is not good, shadow become transparency too. ... Thank you! Cheers, weihuan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=28718#28718 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] hide shadow map receiver
Hi weihuan, i use osgshadow in osgart, the shadow map work fine. the model is standing on a plane, shadow cast to the plane, the plane is attach to the pattern, what i want is to make the plane invisible but the shadow remains, to make it looks like shadow on the top of pattern. i try alpha blending the plane, the result is not good, shadow become transparency too. You'll have to create your own shader based on the one that shadow map uses (you didn't specify which shadow map class you use, but the shader code is in the source files, see for example osg/src/osgShadow/ShadowMap.cpp, or osg/src/osgShadow/SoftShadowMap.cpp, or osg/src/osgShadow/StandardShadowMap.cpp for LISPSM). Just copy the default shader code, and then change it to do what you want. For example, you could set a Uniform bool to false on your scene root, then to true on your plane, and in your shader you would test this value and if true, simply discard fragments if the shadow test fails and render the shadow color if the shadow test succeeds. There could be other ways to do what you want, this is just off the top of my head. Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] hide shadow map receiver
Hi, Skylark thanks a million for your advice. i was using shadow map, shadow volume did not work. one thing i was confuse, if i add an uniform bool varible to the scene node, is it can indicate which fragment(pixel) belong to shadow caster object or receiver object? maybe i just dont know that. ... Thank you! Cheers, Huan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=28790#28790 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] hide shadow map receiver
Hi Huan, thanks a million for your advice. i was using shadow map, shadow volume did not work. one thing i was confuse, if i add an uniform bool varible to the scene node, is it can indicate which fragment(pixel) belong to shadow caster object or receiver object? maybe i just dont know that. The fragment shader is called once for each fragment. If you set the uniform to false on your scene root, and true on the plane's node, then for each call of the fragment shader, the variable will evaluate to false if this fragment is part of any other object, and true if this fragment is part of the plane. That's all you need to know. Then if the variable is false, you render as usual, and if it's false then you only render the shadow and discard all other fragments (calling discard in a fragment shader will stop execution of the shader for that fragment and not write anything into the framebuffer or depth buffer). Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] hide shadow map receiver
Hi, Skylark thank you for the detailed explanation. i'll try it. ... Thank you! Cheers, Huan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=28808#28808 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org