Wyatt Earp wrote:
If I have a prerender camera for rtt, and another
camera which will take as input the texture from the rtt camera do
some "stuff" then render to texture the output, and then a third
camera which takes camera 2s output as input and performs then final
render... what would my scenegraph look like?
It really depends on how you want the Viewer's Camera manipulator to
work. Do you want it to manipulate Camera 1 or do you want it to
manipulate your final render camera? It also depends on what kind of
scene geometry you are rendering for each of your Cameras.
Here's one way to do it:
I would have your Camera 2 configured as prerender at the top of the
scene graph. I would have your Camera 1 also configured as prerender and
added as a child to Camera 2. The I would setSceneData in
osgViewer::Viewer, passing in Camera 2 -- osgViewer's built-in Camera
will be the "final render" camera in your example.
The problem you typically run into with this kind of setup is that you
want to attach a camera manipulator to the osgViewer::Viewer, but you
want it to manipulate the matrices in Camera 1, not the top-level Viewer
("final render") Camera. You can do this with some fairly hairy
rewiring, but...
Here's another way to do it:
Use the osgViewer::Viewer Camera as Camera 1 in your example. So you'll
need to call Viewer::getCamera()->attach to make it into an RTT Camera
(just like you would any Camera). For the top of your scene graph,
you'll probably want a Group with Camera 2 as a child. Camera 2 is
configured as post render, and it will have the "final render" Camera as
a child, also set up to post render. In addition to having Camera 2 as a
child, your top Group node will probably also be the parent of the
geometry you need to render in your first render pass.
With this configuration, the camera manipulator attached to Viewer will
manipulate the matrices in Camera 1 without the need for fancy rewiring.
That is the most common case, as Camera 1 in your example is usually the
parent of a large scene graph, whereas Camera 2 and the "final render"
Camera are usually just rendering screen-oriented textured quads and
therefore do not need a camera manipulator.
-Paul
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org