[osg-users] Camera question
jpdelport at csir.co.za
Wed Nov 4 21:57:52 PST 2009
have a look at the osgstereomatch (read readme too) and osggameoflife
examples. There are examples of multiple passes, texture ping-pong and
switching cameras on and off.
Wyatt Earp wrote:
> Ok.. thanks for the information... Good stuff...
> One last question... Is it possible to switch off a camera(s) in the
> chain and only render with the remaining camera(s)? In other words
> render with 1, 2 or 3 passes?
> On Wed, Nov 4, 2009 at 2:39 PM, Paul Martz <pmartz at skew-matrix.com> wrote:
>> 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.
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
> osg-users mailing list
> osg-users at lists.openscenegraph.org
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard.
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean. MailScanner thanks Transtec Computers for their support.
More information about the osg-users