Re: [osg-users] Multiple Shaders Performance Question
Hi Paul, Different drivers manage compilation and linking in different ways on different drivers so it's hard to give any hard rules. In general making sure your scene graph is pre-compile before rendering helps avoid most problems with compiles occur during rendering. Robert. On Tue, Apr 28, 2009 at 2:46 AM, paul1...@yahoo.com wrote: I have multiple shaders. I attach one shader to the root of the scene graph. I then load in objects and attach one of another set of shaders to the root of the object and attach it to the main scene graph. When I say attach a shader, I'm loading a fragment and vertex shader from a file and attaching them to a new Program object each time. I then attach the Program object to the object's state set. Is there any performance advantage to doing it this way or creating one Program object for each shader and attach these same Program object to my objects. Or should I be creating a set of StateSet's and attaching the appropriate StateSet to my object based on the Shader I want to use. To complicate things, I have multiple cameras used to render to multiple Frame Buffer Objects. What I'm seeing is a (single) missed frame when an object with a new shader appears in the Field of View (running at 120Hz)? Could OSG be attempting to recompile my shader? Is driver downloading the shader each time to the video card. Paul P. ___ 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] Multiple Shaders Performance Question
Paul, Running at 120Hz is rather extreme since the human eye can't really appreciate a frame rate higher than 60Hz - OK monitors are normally rated at approx 75Hz to be flicker free, but 60Hz is the norm. With this in mind, you might be able to hide this missed frame by simply reducing your frame rate. PhilT -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org]on Behalf Of Robert Osfield Sent: 28 April 2009 09:29 To: OpenSceneGraph Users Subject: Re: [osg-users] Multiple Shaders Performance Question Hi Paul, Different drivers manage compilation and linking in different ways on different drivers so it's hard to give any hard rules. In general making sure your scene graph is pre-compile before rendering helps avoid most problems with compiles occur during rendering. Robert. On Tue, Apr 28, 2009 at 2:46 AM, paul1...@yahoo.com wrote: I have multiple shaders. I attach one shader to the root of the scene graph. I then load in objects and attach one of another set of shaders to the root of the object and attach it to the main scene graph. When I say attach a shader, I'm loading a fragment and vertex shader from a file and attaching them to a new Program object each time. I then attach the Program object to the object's state set. Is there any performance advantage to doing it this way or creating one Program object for each shader and attach these same Program object to my objects. Or should I be creating a set of StateSet's and attaching the appropriate StateSet to my object based on the Shader I want to use. To complicate things, I have multiple cameras used to render to multiple Frame Buffer Objects. What I'm seeing is a (single) missed frame when an object with a new shader appears in the Field of View (running at 120Hz)? Could OSG be attempting to recompile my shader? Is driver downloading the shader each time to the video card. Paul P. ___ 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 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Multiple Shaders Performance Question
On Tue, Apr 28, 2009 at 11:37 AM, paul1...@yahoo.com wrote: Thanks Robert, I am using OSG 2.6 on Linux with NVIDIA Quadro FX 4600 with driver version 173.14.09... How do I make sure my scene graph is precompiled? I thought OSG took care of this on its first frame using the GLObjectsVisitor in SceneView::init() but in your catch.cpp example, I see you are doing it manually. I am using osgViewer to render the scene. The osgViewer will compile OpenGL objects on the first frame, but if you add new scene graph elements once the viewer is running these won't be precompiled unless you explicitly request them to be managed. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Multiple Shaders Performance Question
Thanks Robert, I am using OSG 2.6 on Linux with NVIDIA Quadro FX 4600 with driver version 173.14.09... How do I make sure my scene graph is precompiled? I thought OSG took care of this on its first frame using the GLObjectsVisitor in SceneView::init() but in your catch.cpp example, I see you are doing it manually. I am using osgViewer to render the scene. Paul P. - Original Message From: Robert Osfield robert.osfi...@gmail.com To: OpenSceneGraph Users osg-users@lists.openscenegraph.org Sent: Tuesday, April 28, 2009 4:29:13 AM Subject: Re: [osg-users] Multiple Shaders Performance Question Hi Paul, Different drivers manage compilation and linking in different ways on different drivers so it's hard to give any hard rules. In general making sure your scene graph is pre-compile before rendering helps avoid most problems with compiles occur during rendering. Robert. On Tue, Apr 28, 2009 at 2:46 AM, paul1...@yahoo.com wrote: I have multiple shaders. I attach one shader to the root of the scene graph. I then load in objects and attach one of another set of shaders to the root of the object and attach it to the main scene graph. When I say attach a shader, I'm loading a fragment and vertex shader from a file and attaching them to a new Program object each time. I then attach the Program object to the object's state set. Is there any performance advantage to doing it this way or creating one Program object for each shader and attach these same Program object to my objects. Or should I be creating a set of StateSet's and attaching the appropriate StateSet to my object based on the Shader I want to use. To complicate things, I have multiple cameras used to render to multiple Frame Buffer Objects. What I'm seeing is a (single) missed frame when an object with a new shader appears in the Field of View (running at 120Hz)? Could OSG be attempting to recompile my shader? Is driver downloading the shader each time to the video card. Paul P. ___ 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 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Multiple Shaders Performance Question
To be pedantic... mostly because I've been on the wrong side of this argument before and been proven wrong... Only back then I could only dream of doing the type graphics we can do now at even 60 hz. Those arguments were related to film speeds. :) There is no reason to send frames to your display faster than its refresh but that doesn't mean that 120 hz display won't look better than a 60 hz display. Drive your display as fast as it will refresh and no faster. Ignoring for a second that some stereo displays will want to be driven at 120 hz... even assuming it's purely for aesthetic reasons the eye will notice a difference in smoothness of movement between 120 hz and 60 hz. Though it all depends on how much movement. As a thought experiment (unless you have access to 120 hz display and if so I'm envious), imagine moving something on screen one pixel per frame and something right next to it moving two pixels every two frames. The second simulates 60 hz movement compared to 120 hz movement. Increase the rate of movement until you notice the 60 hz object jerking... though I suspect the first object will look smoother right away. ...just saying. :) And in some industries, it is not a human eye that is using the display... -Paul Philip Taylor wrote: Paul, Running at 120Hz is rather extreme since the human eye can't really appreciate a frame rate higher than 60Hz - OK monitors are normally rated at approx 75Hz to be flicker free, but 60Hz is the norm. With this in mind, you might be able to hide this missed frame by simply reducing your frame rate. PhilT -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org]on Behalf Of Robert Osfield Sent: 28 April 2009 09:29 To: OpenSceneGraph Users Subject: Re: [osg-users] Multiple Shaders Performance Question Hi Paul, Different drivers manage compilation and linking in different ways on different drivers so it's hard to give any hard rules. In general making sure your scene graph is pre-compile before rendering helps avoid most problems with compiles occur during rendering. Robert. On Tue, Apr 28, 2009 at 2:46 AM, paul1...@yahoo.com wrote: I have multiple shaders. I attach one shader to the root of the scene graph. I then load in objects and attach one of another set of shaders to the root of the object and attach it to the main scene graph. When I say attach a shader, I'm loading a fragment and vertex shader from a file and attaching them to a new Program object each time. I then attach the Program object to the object's state set. Is there any performance advantage to doing it this way or creating one Program object for each shader and attach these same Program object to my objects. Or should I be creating a set of StateSet's and attaching the appropriate StateSet to my object based on the Shader I want to use. To complicate things, I have multiple cameras used to render to multiple Frame Buffer Objects. What I'm seeing is a (single) missed frame when an object with a new shader appears in the Field of View (running at 120Hz)? Could OSG be attempting to recompile my shader? Is driver downloading the shader each time to the video card. Paul P. ___ 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 ___ 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
[osg-users] Multiple Shaders Performance Question
I have multiple shaders. I attach one shader to the root of the scene graph. I then load in objects and attach one of another set of shaders to the root of the object and attach it to the main scene graph. When I say attach a shader, I'm loading a fragment and vertex shader from a file and attaching them to a new Program object each time. I then attach the Program object to the object's state set. Is there any performance advantage to doing it this way or creating one Program object for each shader and attach these same Program object to my objects. Or should I be creating a set of StateSet's and attaching the appropriate StateSet to my object based on the Shader I want to use. To complicate things, I have multiple cameras used to render to multiple Frame Buffer Objects. What I'm seeing is a (single) missed frame when an object with a new shader appears in the Field of View (running at 120Hz)? Could OSG be attempting to recompile my shader? Is driver downloading the shader each time to the video card. Paul P. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org