Re: [osg-users] How does shadow technic work if geometry shaders are in use
Hi Nick, I failed to use the default Shadow-Mapping techniques in a deferred rendering context. I never fully understood how to split the shadow-map generation into later binding the resulting texture to my actual lighting/shadowmapping part. Any insights on this? Basically I've got multiple passes, one of which should create the shadowmap(s) and another others which need access to the resulting textures and states (in terms of an unifom for the matrix) Cheers Sebastian Hi Werner, I am doing the same and using the LightSpacePerspective shadow techinque. In your program you have to set your vertex and fragment shaders as well, and it will be picked up correctly if you set the masks for receiving/cast shadows So it should work. As long as they are part of the top ShadowedScene Nick Nick On Fri, May 29, 2015 at 5:56 PM, Werner Modenbach werner.modenb...@texion.eu mailto:werner.modenb...@texion.eu wrote: Hi all, My scene contains many objects, which are created by geometry shaders. So no vertices are created outside the graphics card for those objects. So I use state-setUseVertexAttributeAliasing(true) and state-setUseModelViewAndProjectionUniforms(true) Is it possible using a shadow technique in this case? If I'm right the shadow technique installs it's own shaders. Thanks for any hint. - Werner - ___ osg-users mailing list osg-users@lists.openscenegraph.org mailto:osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ 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] How does shadow technic work if geometry shaders are in use
Hi Sebastian, I am not DR expert ( I am reading now some papers though ). Marcin Hajder or Wojtek Lewandowski for sure can answer this. Hope they will give you some insights. Sorry :-) .. If my learning goes well, in few months I will revisit this topic ;-) Nick On Mon, Jun 8, 2015 at 9:03 PM, Sebastian Messerschmidt sebastian.messerschm...@gmx.de wrote: Hi Nick, I failed to use the default Shadow-Mapping techniques in a deferred rendering context. I never fully understood how to split the shadow-map generation into later binding the resulting texture to my actual lighting/shadowmapping part. Any insights on this? Basically I've got multiple passes, one of which should create the shadowmap(s) and another others which need access to the resulting textures and states (in terms of an unifom for the matrix) Cheers Sebastian Hi Werner, I am doing the same and using the LightSpacePerspective shadow techinque. In your program you have to set your vertex and fragment shaders as well, and it will be picked up correctly if you set the masks for receiving/cast shadows So it should work. As long as they are part of the top ShadowedScene Nick Nick On Fri, May 29, 2015 at 5:56 PM, Werner Modenbach werner.modenb...@texion.eu wrote: Hi all, My scene contains many objects, which are created by geometry shaders. So no vertices are created outside the graphics card for those objects. So I use state-setUseVertexAttributeAliasing(true) and state-setUseModelViewAndProjectionUniforms(true) Is it possible using a shadow technique in this case? If I'm right the shadow technique installs it's own shaders. Thanks for any hint. - Werner - ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing listosg-users@lists.openscenegraph.orghttp://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 -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How does shadow technic work if geometry shaders are in use
Hi Werner, I am not the author of the LISPSM technique (Wojtek Lewandowski is), but if it all works for GL2 (which I use too) I expect it is something with the GL3 support. And yes, the shadow technique has it's own shaders you can replace too (what I am doing for my project). Have a look at StandardShadowMap interface. Otherwise the code looks good, it is what I am doing it too. Again, if it works for GL2 and not for GL3 then it might be GL3 specific. Can you see any shadows with GL3 without using your shaders for the objectSwitch? On Mon, Jun 8, 2015 at 2:20 PM, Werner Modenbach werner.modenb...@texion.eu wrote: Sorry, was on a business trip for a while. Here is my code (shortened a little): osg::Group *rootNode = new osg::Group(); view-setSceneData(rootNode); shadowedScene = new osgShadow::ShadowedScene; shadowedScene-setReceivesShadowTraversalMask(ReceivesShadowTraversalMask ); shadowedScene-setCastsShadowTraversalMask(CastsShadowTraversalMask); rootNode-addChild(shadowedScene.get()); objectSwitch = new osg::Switch; shadowedScene-addChild(objectSwitch); lightSource = new osg::LightSource; lightSource-setLight(myLight); lightSource-setReferenceFrame(osg::LightSource::ABSOLUTE_RF); lightSource-setLocalStateSetModes(osg::StateAttribute::ON); shadowedScene-addChild(lightSource.get()); osg::StateSet * stateset = objectSwitch -getOrCreateStateSet(); // setting uniforms etc. here osg::Program * program = new osg::Program(); stateset-setAttribute( program ); program-addShader(Cl_ShaderGen::getShader(osg::Shader::VERTEX, forceGL3Mode, ...)); program-addShader(Cl_ShaderGen::getShader(osg:: Shader::GEOMETRY, forceGL3Mode, ...)); program-addShader(Cl_ShaderGen:: getShader(osg::Shader::FRAGMENT, forceGL3Mode, ...)); view-getCamera()-getGraphicsContext()-getState()- setUseModelViewAndProjectionUniforms(forceGL3Mode); view-getCamera()-getGraphicsContext()-getState()- setUseVertexAttributeAliasing(forceGL3Mode); If I use GL2 mode everything works like expected. In GL3 mode without shadow technique everything works fine (using geometry shader) In GL3 mode assigning a shadow technique doesn't change anything i.e. no shadow appears. If I assign the schaders to the state set of shadowedScene in GL3 mode without shadow technique everything appears the normal way but when assigning a shadow technique geometry shaders don't do their work any more. So my guess is that shadow technique just replaces the shaders. Is my approach wrong? Do I do something in a non standard way? Many thanks for hints and help. - Werner - Am 29.05.2015 um 18:53 schrieb Trajce Nikolov NICK: Hard to say without seeing your code I have modified shaders for the LSPSM. Can you share a sample app ? On Fri, May 29, 2015 at 6:38 PM, Werner Modenbach werner.modenb...@texion.eu wrote: Hi Nick, I'm using LightSpacePerspective shadow technique as well. But I set the shaders only inside the scene graph where reqired. Do I have to set them anywhere else? My graph looks like that: * --- * | RootNode| * --- * /\ *--- - *| ShadowScene ||evtl. PPU-Prozessor| *--- - */ \ *--- --- *| Switchnode | | LightSource | *--- --- * / \\\ Am 29.05.2015 um 18:16 schrieb Trajce Nikolov NICK: Hi Werner, I am doing the same and using the LightSpacePerspective shadow techinque. In your program you have to set your vertex and fragment shaders as well, and it will be picked up correctly if you set the masks for receiving/cast shadows So it should work. As long as they are part of the top ShadowedScene Nick Nick On Fri, May 29, 2015 at 5:56 PM, Werner Modenbach werner.modenb...@texion.eu wrote: Hi all, My scene contains many objects, which are created by geometry shaders. So no vertices are created outside the graphics card for those objects. So I use state-setUseVertexAttributeAliasing(true) and state-setUseModelViewAndProjectionUniforms(true) Is it possible using a shadow technique in this case? If I'm right the shadow technique installs it's own shaders. Thanks for any hint. - Werner - ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org --
Re: [osg-users] How does shadow technic work if geometry shaders are in use
Sorry, was on a business trip for a while. Here is my code (shortened a little): osg::Group*rootNode=newosg::Group(); view-setSceneData(rootNode); shadowedScene=newosgShadow::ShadowedScene; shadowedScene-setReceivesShadowTraversalMask(ReceivesShadowTraversalMask); shadowedScene-setCastsShadowTraversalMask(CastsShadowTraversalMask); rootNode-addChild(shadowedScene.get()); objectSwitch=newosg::Switch; shadowedScene-addChild(objectSwitch); lightSource=newosg::LightSource; lightSource-setLight(myLight); lightSource-setReferenceFrame(osg::LightSource::ABSOLUTE_RF); lightSource-setLocalStateSetModes(osg::StateAttribute::ON); shadowedScene-addChild(lightSource.get()); osg::StateSet*stateset=objectSwitch-getOrCreateStateSet(); // setting uniforms etc. here osg::Program*program=newosg::Program(); stateset-setAttribute(program); program-addShader(Cl_ShaderGen::getShader(osg::Shader::VERTEX,forceGL3Mode, ...));program-addShader(Cl_ShaderGen::getShader(osg::Shader::GEOMETRY,forceGL3Mode, ...));program-addShader(Cl_ShaderGen::getShader(osg::Shader::FRAGMENT,forceGL3Mode, ...)); view-getCamera()-getGraphicsContext()-getState()-setUseModelViewAndProjectionUniforms(forceGL3Mode); view-getCamera()-getGraphicsContext()-getState()-setUseVertexAttributeAliasing(forceGL3Mode); If I use GL2 mode everything works like expected. In GL3 mode without shadow technique everything works fine (using geometry shader) In GL3 mode assigning a shadow technique doesn't change anything i.e. no shadow appears. If I assign the schaders to the state set of shadowedScene in GL3 mode without shadow technique everything appears the normal way but when assigning a shadow technique geometry shaders don't do their work any more. So my guess is that shadow technique just replaces the shaders. Is my approach wrong? Do I do something in a non standard way? Many thanks for hints and help. - Werner - Am 29.05.2015 um 18:53 schrieb Trajce Nikolov NICK: Hard to say without seeing your code I have modified shaders for the LSPSM. Can you share a sample app ? On Fri, May 29, 2015 at 6:38 PM, Werner Modenbach werner.modenb...@texion.eu mailto:werner.modenb...@texion.eu wrote: Hi Nick, I'm using LightSpacePerspective shadow technique as well. But I set the shaders only inside the scene graph where reqired. Do I have to set them anywhere else? My graph looks like that: *--- * | RootNode | * --- */ \ * --- - * | ShadowScene | |evtl. PPU-Prozessor| * --- - * / \ * --- --- * | Switchnode | | LightSource | * --- --- * / \\\ Am 29.05.2015 um 18:16 schrieb Trajce Nikolov NICK: Hi Werner, I am doing the same and using the LightSpacePerspective shadow techinque. In your program you have to set your vertex and fragment shaders as well, and it will be picked up correctly if you set the masks for receiving/cast shadows So it should work. As long as they are part of the top ShadowedScene Nick Nick On Fri, May 29, 2015 at 5:56 PM, Werner Modenbach werner.modenb...@texion.eu mailto:werner.modenb...@texion.eu wrote: Hi all, My scene contains many objects, which are created by geometry shaders. So no vertices are created outside the graphics card for those objects. So I use state-setUseVertexAttributeAliasing(true) and state-setUseModelViewAndProjectionUniforms(true) Is it possible using a shadow technique in this case? If I'm right the shadow technique installs it's own shaders. Thanks for any hint. - Werner - ___ osg-users mailing list osg-users@lists.openscenegraph.org mailto:osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org mailto:osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- *TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen*
Re: [osg-users] How does shadow technic work if geometry shaders are in use
Hi Werner, I am doing the same and using the LightSpacePerspective shadow techinque. In your program you have to set your vertex and fragment shaders as well, and it will be picked up correctly if you set the masks for receiving/cast shadows So it should work. As long as they are part of the top ShadowedScene Nick Nick On Fri, May 29, 2015 at 5:56 PM, Werner Modenbach werner.modenb...@texion.eu wrote: Hi all, My scene contains many objects, which are created by geometry shaders. So no vertices are created outside the graphics card for those objects. So I use state-setUseVertexAttributeAliasing(true) and state-setUseModelViewAndProjectionUniforms(true) Is it possible using a shadow technique in this case? If I'm right the shadow technique installs it's own shaders. Thanks for any hint. - Werner - ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How does shadow technic work if geometry shaders are in use
Hi Nick, I'm using LightSpacePerspective shadow technique as well. But I set the shaders only inside the scene graph where reqired. Do I have to set them anywhere else? My graph looks like that: *--- * | RootNode | * --- */ \ * --- - * | ShadowScene | |evtl. PPU-Prozessor| * --- - * / \ * --- --- * | Switchnode | | LightSource | * --- --- * / \\\ Am 29.05.2015 um 18:16 schrieb Trajce Nikolov NICK: Hi Werner, I am doing the same and using the LightSpacePerspective shadow techinque. In your program you have to set your vertex and fragment shaders as well, and it will be picked up correctly if you set the masks for receiving/cast shadows So it should work. As long as they are part of the top ShadowedScene Nick Nick On Fri, May 29, 2015 at 5:56 PM, Werner Modenbach werner.modenb...@texion.eu mailto:werner.modenb...@texion.eu wrote: Hi all, My scene contains many objects, which are created by geometry shaders. So no vertices are created outside the graphics card for those objects. So I use state-setUseVertexAttributeAliasing(true) and state-setUseModelViewAndProjectionUniforms(true) Is it possible using a shadow technique in this case? If I'm right the shadow technique installs it's own shaders. Thanks for any hint. - Werner - ___ osg-users mailing list osg-users@lists.openscenegraph.org mailto:osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- *TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen* Phone: +49 241 475757-0 Fax: +49 241 475757-29 Web: http://texion.eu eMail: i...@texion.eu ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How does shadow technic work if geometry shaders are in use
Hi all, My scene contains many objects, which are created by geometry shaders. So no vertices are created outside the graphics card for those objects. So I use state-setUseVertexAttributeAliasing(true) and state-setUseModelViewAndProjectionUniforms(true) Is it possible using a shadow technique in this case? If I'm right the shadow technique installs it's own shaders. Thanks for any hint. - Werner - ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How does shadow technic work if geometry shaders are in use
Hard to say without seeing your code I have modified shaders for the LSPSM. Can you share a sample app ? On Fri, May 29, 2015 at 6:38 PM, Werner Modenbach werner.modenb...@texion.eu wrote: Hi Nick, I'm using LightSpacePerspective shadow technique as well. But I set the shaders only inside the scene graph where reqired. Do I have to set them anywhere else? My graph looks like that: * --- * | RootNode| * --- * /\ *--- - *| ShadowScene ||evtl. PPU-Prozessor| *--- - */ \ *--- --- *| Switchnode | | LightSource | *--- --- * / \\\ Am 29.05.2015 um 18:16 schrieb Trajce Nikolov NICK: Hi Werner, I am doing the same and using the LightSpacePerspective shadow techinque. In your program you have to set your vertex and fragment shaders as well, and it will be picked up correctly if you set the masks for receiving/cast shadows So it should work. As long as they are part of the top ShadowedScene Nick Nick On Fri, May 29, 2015 at 5:56 PM, Werner Modenbach werner.modenb...@texion.eu wrote: Hi all, My scene contains many objects, which are created by geometry shaders. So no vertices are created outside the graphics card for those objects. So I use state-setUseVertexAttributeAliasing(true) and state-setUseModelViewAndProjectionUniforms(true) Is it possible using a shadow technique in this case? If I'm right the shadow technique installs it's own shaders. Thanks for any hint. - Werner - ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- *TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen* Phone: +49 241 475757-0 Fax: +49 241 475757-29 Web: http://texion.eu eMail: i...@texion.eu ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org