[osg-users] multiple views + instancing

David Heitbrink david-heitbrink at uiowa.edu
Wed Nov 15 11:06:27 PST 2017

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:

More information about the osg-users mailing list