[osg-users] multiple views + instancing
Robert Osfield
robert.osfield at gmail.com
Wed Nov 15 13:27:05 PST 2017
Hi David,
You could write a custom subclass of osg::Geometry and override the
drawImplementation an do the cull and dispatch of the primitives and
instance count for each time the geometry is drawn, but do so in a
thread safe way such as my computing all the dynamic data on the fly.
The alternative would be to have two osg::Geometry, once for each view
and have a NodeMask for each osg::Geometry and have use a
Camera::CullTraversalMask for each view to select the appropriate one
for each context.
Robert.
On 15 November 2017 at 19:06, David Heitbrink <david-heitbrink at uiowa.edu> wrote:
> Right now I having problems setting unique uniforms and num instances on a per view basis (camera).
>
> Right now I am using hardware instancing, with a scene with 1000's of relatively complex objects, but only a handful of actual models. I was able to encode index's to textures + position and rotation transforms into a single texture buffer.
>
> To do the viewport culling for this I added "proxy" nodes, which are just osg::group nodes, with a compute bound + cull call backs. The cull call back, calls back to a class tracking which instances are visible in which view. Each view has a group attach to it between the camera and the main scene. In said group, the texture buffer object is attached here.
>
> The instanced models are further down in the scene graph. I in a draw callback from camera, I update each models uniform for its offset into the texture buffer, its instance count, plus texture buffer (transforms + some options for the fragment shader). All of this works great until I have multiple cameras.
>
> Basically I cannot figure out a good way of modifying the instance count + offset uniform so I get unique values for each camera. Does anyone have some advice for this?
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=72391#72391
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
More information about the osg-users
mailing list