[osg-users] osgOcean in CompositeViewer with multiple views

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Thu Apr 14 07:13:07 PDT 2011

Hi all,

I'd like to ask for feedback about something concerning osgOcean. We've 
been using it in multiple views for a while now, only activating the 
reflection effect, and it has worked well. We knew that one view would 
control the LOD of the ocean tiles (seems to be the last one rendered, 
so the last one added to the viewer). That's not a problem for us since 
the views' viewpoints are generally close to each other. Surprisingly, 
the reflection works correctly in all views.

A larger problem now occurs because we need to start using the 
transparency effect, which depends on a refraction MRT pass. It seems 
that this MRT, as opposed to the reflection, but similarly to LOD, only 
takes effect in the last view in the viewer.

I've put some details on this in this issue on the osgOcean bug tracker.


Our main problem stems from the fact that in all cases of viewer setup 
we've seen, the main view is always added first, and the inset view(s) 
are added after. That means that the inset views get the 
transparency/refraction effects, which is not what we want.

These effects should not depend on the order of views in the viewer. But 
the solution is not straightforward, and so I'm asking for comments. 
Would the correct solution be to do something like in the 
ViewDependentShadow classes in osgShadow, and have a ViewData class that 
would store separate target textures for each view, and when rendering 
the MRT camera we would switch these so they render to the right 
textures for the current view? Or is there a better / simpler solution?

The oceanExample that comes with osgOcean has new options to demonstrate 
this, these are explained in the issue linked above, and you can check 
out the trunk if you want to tinker with it.


I'll be thankful for any comments / suggestions.

Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com

More information about the osg-users mailing list