Re: [osg-users] osgShadow and model alpha textures
Hi Bob, Once you have finished implementing fog, and other features into the PSSM frag shader, may you could submitt it a s config file. regards adrian 2009/4/10 Bob Holcomb bob_holc...@hotmail.com Wojtek and Adrian, Hey guys, you were right on the money. I changed the PSSM frag shader to take the alpha channel from the current texture and it seemed to work well. I still need to wiggle my fog calculations into the shader and I think I'll be set. Thanks! Cheers, Bob -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=10048#10048 ___ 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
Re: [osg-users] osgShadow and model alpha textures
Hi all The PSSM has a GLSL shader inside the implementation. And this makes the lighting stuff different from default one. Even coloring, .. , transparancy isn't a easy task. So to solve such unwished behaviour you can replace the pssm glsl shader our self. i would copy the org pssm shader from the current pssm implementation and rewrite those part you need to fix. then you can pass the new glsl shader thourgh the pssm's shader exchange interface. /** * you can overwrite the fragment shader if you like to modify it yourself, own fragment shader can be used */ class OSGSHADOW_EXPORT FragmentShaderGenerator : public osg::Referenced { public: /** * generate the GLSL fragement shader */ virtual std::string generateGLSL_FragmentShader_BaseTex(bool debug, unsigned int splitCount,double textureRes, bool filtered, unsigned int nbrSplits,unsigned int textureOffset); }; /** set fragment shader generator */ inline void setFragmentShaderGenerator(FragmentShaderGenerator* fsw) { _FragmentShaderGenerator = fsw;} i hope this solve your problems. important to know : (SingleThreaded is a must) osgshadow --pssm --SingleThreaded /adrian 2009/4/8 Wojciech Lewandowski lewandow...@ai.com.pl Bob, Its hard for me to imagine how one could get the effect of lightening instead of dimming. But maybe color material set in vertices (GL_COLOR_MATERIAL) may be involved somehow. This attribute is not handled by vertex shaders. But its handled by fixed pipeline.You may look at the shaders code ( stored inside osgShadow\src\StandardShadowMap.cpp ). All classed derived from StandardShadowMap (Lispsm included) may work bit differenet than other techniques because they define Vertex Shader. If your fixed pipeline lighting setup is different than what is assumed in SSM vertex shader we may see some issues not observable with other techniques (which only use Fragment Shaders). SSM vertex shader assumes that we have one light and separately compute and pass diffuse and ambient components to fragment shader. If ambient is passed separately, fragment shader may properly remove only diffuse component in shadowed areas keeping ambient untouched. Cheers, Wojtek Cheers, Wojtek - Original Message - From: Bob Holcomb bob_holc...@hotmail.com To: osg-users@lists.openscenegraph.org Sent: Wednesday, April 08, 2009 2:34 AM Subject: [osg-users] osgShadow and model alpha textures Hello, I'm adding osgShadow to an existing osg project and I'm getting some weird results with PSSM (Parallel Split Shadow Maps). They don't seem to be respecting the alpha channel of my model's texture. For example, I have helicopter model who's rotor system is represented by a quad and a texture of the blades which is mostly transparent. When rendering before adding osgShadow it looked fine. After adding osgShadow the translucent part is white (but the shadows projected on the ground look pretty good!). This only affects the items under the shadowedScene node, any geometry not under that node is rendered correctly. I've also tried the Light Space Perspective Map technique and found that the self shadowing looks great, but the projected texture on the ground actually makes the ground lighter instead of darker. If anybody has any info on either of these issues I would also appreciate the help. Thanks! Cheers, Bob -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=9871#9871 ___ 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 -- Adrian Egli ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgShadow and model alpha textures
Wojtek and Adrian, Thanks for your help. I'll be working on the shaders to see what I can turn up. I'll let you know what I find. Thanks again! Cheers, Bob -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=9975#9975 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgShadow and model alpha textures
Wojtek and Adrian, Hey guys, you were right on the money. I changed the PSSM frag shader to take the alpha channel from the current texture and it seemed to work well. I still need to wiggle my fog calculations into the shader and I think I'll be set. Thanks! Cheers, Bob -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=10048#10048 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgShadow and model alpha textures
Bob, Its hard for me to imagine how one could get the effect of lightening instead of dimming. But maybe color material set in vertices (GL_COLOR_MATERIAL) may be involved somehow. This attribute is not handled by vertex shaders. But its handled by fixed pipeline.You may look at the shaders code ( stored inside osgShadow\src\StandardShadowMap.cpp ). All classed derived from StandardShadowMap (Lispsm included) may work bit differenet than other techniques because they define Vertex Shader. If your fixed pipeline lighting setup is different than what is assumed in SSM vertex shader we may see some issues not observable with other techniques (which only use Fragment Shaders). SSM vertex shader assumes that we have one light and separately compute and pass diffuse and ambient components to fragment shader. If ambient is passed separately, fragment shader may properly remove only diffuse component in shadowed areas keeping ambient untouched. Cheers, Wojtek Cheers, Wojtek - Original Message - From: Bob Holcomb bob_holc...@hotmail.com To: osg-users@lists.openscenegraph.org Sent: Wednesday, April 08, 2009 2:34 AM Subject: [osg-users] osgShadow and model alpha textures Hello, I'm adding osgShadow to an existing osg project and I'm getting some weird results with PSSM (Parallel Split Shadow Maps). They don't seem to be respecting the alpha channel of my model's texture. For example, I have helicopter model who's rotor system is represented by a quad and a texture of the blades which is mostly transparent. When rendering before adding osgShadow it looked fine. After adding osgShadow the translucent part is white (but the shadows projected on the ground look pretty good!). This only affects the items under the shadowedScene node, any geometry not under that node is rendered correctly. I've also tried the Light Space Perspective Map technique and found that the self shadowing looks great, but the projected texture on the ground actually makes the ground lighter instead of darker. If anybody has any info on either of these issues I would also appreciate the help. Thanks! Cheers, Bob -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=9871#9871 ___ 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] osgShadow and model alpha textures
I forgot to mention that I'm running an Nvidia 8600m and windows XP. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=9872#9872 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org