Re: [osg-users] Retrieving Z-Near Far per-frame
Well, I want to do it "in" the frame.. Basically, I'm hoping to get OSG to do the scene traversal for culling, etc, then read the znear/zfar values to be sent elsewhere while the geometry is pushed down the pipe. I don't need perfectly accurate znear/far, just the bounding box estimates. Trajce Nikolov NICK March 24, 2013 4:05 PM Hi Randal,it is easy . somewhere in the loop, probably after the frame all you have to do is to get the projection matrix likewhile (!viewer.done()){viewer.frame(); viewer.getCamera()-getProjectionMatrixAsFrustum(arguments )-- trajce nikolov nick ___osg-users mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org Randall Hand March 23, 2013 10:41 PM Is there (I'm sure there is) a way to retrieve the autocalculated ZNear ZFar from the scene graph on a per-frame basis? I figure it's somewhere in a traversal structure, but I'm not exactly sure where or how to get to it. Can someone enlighten me? -- Randall Hand www.yeraze.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Retrieving Z-Near Far per-frame
Hi Randall, On 29 March 2013 14:18, Randall Hand randall.h...@gmail.com wrote: Well, I want to do it in the frame.. Basically, I'm hoping to get OSG to do the scene traversal for culling, etc, then read the znear/zfar values to be sent elsewhere while the geometry is pushed down the pipe. I don't need perfectly accurate znear/far, just the bounding box estimates. The CullVisitor computes and maintains the near/far values when these need computing. Have a look at osgUtil::CullVisitor. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Retrieving Z-Near Far per-frame
I'm currently using the viewer.getCamera()-setUpdateCallback() to assigna custom callback that does stuff on a per-frame basis. Is it safe to retrieve the camera-getRenderer()-getSceneView(0)-getCullVisitor()-getCalculatedNear/FarPlane() ? are those values valid and available at that point? Robert Osfield March 29, 2013 9:35 AM Hi Randall,The CullVisitor computes and maintains the near/far values when these need computing. Have a look at osgUtil::CullVisitor. Robert. ___osg-users mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org Randall Hand March 29, 2013 9:18 AM Well, I want to do it "in" the frame.. Basically, I'm hoping to get OSG to do the scene traversal for culling, etc, then read the znear/zfar values to be sent elsewhere while the geometry is pushed down the pipe. I don't need perfectly accurate znear/far, just the bounding box estimates. Trajce Nikolov NICK March 24, 2013 4:05 PM Hi Randal,it is easy . somewhere in the loop, probably after the frame all you have to do is to get the projection matrix likewhile (!viewer.done()){viewer.frame(); viewer.getCamera()-getProjectionMatrixAsFrustum(arguments )-- trajce nikolov nick ___osg-users mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org Randall Hand March 23, 2013 10:41 PM Is there (I'm sure there is) a way to retrieve the autocalculated ZNear ZFar from the scene graph on a per-frame basis? I figure it's somewhere in a traversal structure, but I'm not exactly sure where or how to get to it. Can someone enlighten me? -- Randall Hand www.yeraze.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Retrieving Z-Near Far per-frame
Hi Randall, On 29 March 2013 14:55, Randall Hand randall.h...@gmail.com wrote: I'm currently using the viewer.getCamera()-setUpdateCallback() to assigna custom callback that does stuff on a per-frame basis. Is it safe to retrieve the camera-getRenderer()-getSceneView(0)-getCullVisitor()-getCalculatedNear/FarPlane() ? are those values valid and available at that point? These will be valid for the previous frame as the cull traversal happens after the update traversal. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Retrieving Z-Near Far per-frame
So... I need to attach instead to setCullCallback? I'm looking in ViewerBase and I see the order is event, update, rendering, and Rendering calls "renderer-cull()". I need to be after a completed cull, but before rendering actually starts (or at least as early into rendering as I can get). Could/should I register what I want as a custom "operation"? Or is this the job of the Camera's PreDrawCallback? Basic requirements: * Run once per frame (in a system with multiple viewers contexts per frame) * After Cull (so I have a valid znear/zfar estimate for the frame), but before/during the Render * I will not be modifying the scenegraph, only reading data shipping it elsewhere Robert Osfield March 29, 2013 10:09 AM Hi Randall,These will be valid for the previous frame as the cull traversal happens after the update traversal. Robert. ___osg-users mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org Randall Hand March 29, 2013 9:55 AM I'm currently using the viewer.getCamera()-setUpdateCallback() to assigna custom callback that does stuff on a per-frame basis. Is it safe to retrieve the camera-getRenderer()-getSceneView(0)-getCullVisitor()-getCalculatedNear/FarPlane() ? are those values valid and available at that point? Robert Osfield March 29, 2013 9:35 AM Hi Randall,The CullVisitor computes and maintains the near/far values when these need computing. Have a look at osgUtil::CullVisitor. Robert. ___osg-users mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org Randall Hand March 29, 2013 9:18 AM Well, I want to do it "in" the frame.. Basically, I'm hoping to get OSG to do the scene traversal for culling, etc, then read the znear/zfar values to be sent elsewhere while the geometry is pushed down the pipe. I don't need perfectly accurate znear/far, just the bounding box estimates. Trajce Nikolov NICK March 24, 2013 4:05 PM Hi Randal,it is easy . somewhere in the loop, probably after the frame all you have to do is to get the projection matrix likewhile (!viewer.done()){viewer.frame(); viewer.getCamera()-getProjectionMatrixAsFrustum(arguments )-- trajce nikolov nick ___osg-users mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Randall Hand www.yeraze.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Retrieving Z-Near Far per-frame
Hi Randal, it is easy . somewhere in the loop, probably after the frame all you have to do is to get the projection matrix like while (!viewer.done()) { viewer.frame(); viewer.getCamera()-getProjectionMatrixAsFrustum(arguments ) On Sun, Mar 24, 2013 at 4:41 AM, Randall Hand randall.h...@gmail.comwrote: Is there (I'm sure there is) a way to retrieve the autocalculated ZNear ZFar from the scene graph on a per-frame basis? I figure it's somewhere in a traversal structure, but I'm not exactly sure where or how to get to it. Can someone enlighten me? __**_ osg-users mailing list osg-users@lists.**openscenegraph.org osg-users@lists.openscenegraph.org http://lists.openscenegraph.**org/listinfo.cgi/osg-users-** openscenegraph.orghttp://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] Retrieving Z-Near Far per-frame
You might take a look at the osgthirdpersonview example, which draws two views of the same scene, one of which contains a wireframe representation of the view frustum used for the other view. On Sat, Mar 23, 2013 at 9:41 PM, Randall Hand randall.h...@gmail.comwrote: Is there (I'm sure there is) a way to retrieve the autocalculated ZNear ZFar from the scene graph on a per-frame basis? I figure it's somewhere in a traversal structure, but I'm not exactly sure where or how to get to it. Can someone enlighten me? __**_ osg-users mailing list osg-users@lists.**openscenegraph.org osg-users@lists.openscenegraph.org http://lists.openscenegraph.**org/listinfo.cgi/osg-users-** openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Paul Martz Skew Matrix Software LLC ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Retrieving Z-Near Far per-frame
Is there (I'm sure there is) a way to retrieve the autocalculated ZNear ZFar from the scene graph on a per-frame basis? I figure it's somewhere in a traversal structure, but I'm not exactly sure where or how to get to it. Can someone enlighten me? ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org