Hi,

I've exhausted what references I could find without really coming up with a 
good way of doing this, so I am hoping someone can advise me on an efficient 
method of achieving the following outcome in OSG.

I have an arbitrary, large number of nodes scene that I don't control the 
contents of before it's loaded. (eg, assume a giant world scene that is created 
by an artist)

I would like to render the same scene in two views, without duplicating the 
nodes or assets (memory constraints). Lets say View A renders the scene as 
normal, View B renders the scene in an alternate mode (lets say, changes the 
output pixel from colour to greyscale for discussion purposes).

The current method uses a bool Uniform that is set on each camera and the 
fragment shader checks the bool to tell which view it is rendering in and 
changes the output pixel accordingly. This seems "bad" to me. It works, but 
surely there's got to be a better way than doing a branch (or multiple 
branches) in the fragment shader.

Ideally I would create two statesets (with optimal shaders etc), and switch 
between them at render time.

So I was thinking I might be able to use one of the various callback methods. 
Eg, I could attach an update callback to each model in the scene that checks 
"something" unique to each view, and sets the state as appropriate. However, 
I'm not sure if the update callback is called once for each view, or only once 
per frame etc. If the update callback is called per view, what's a fast way to 
check which view is the current render pass etc? Would a better method be to 
use the draw callback on Drawables perhaps?

Thank for any help/advice you can give me.

Cheers,
Damian

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=63246#63246





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to