Okay, I'm just to stupid ....
1. JP is right about the render order, it works flawlessly if you place
the camera nodes one after another
2. Setting the camera transform in a camera drawcallback will give you
the matrices of the former frame.
3. RELATIVE_RF is working fine ... I was just using
gl_ModelViewProjection instead of gl_ModelView in my shader, so things
got screwed up, and seemed fixed with the callback, which was my error.
Thank you JP for your suggestions, at least I now know a bit more about
render-order and camera transforms ;-)
Hi,
On 05/10/2011 12:12, Sebastian Messerschmidt wrote:
Okay, I've tried all the stuff, and I might have found the real problem.
It is not that the cameras are rendered in the wrong order, it is more
the way I handle the camera view matrices.
Some days ago I've stumbled upon the question how to set the camera of a
second pass in a way it renderes the scene from the exact same view as
the first one.
To solve this I've done the following:
viewer.getCamera()->setInitialDrawCallback(new
CameraUpdateCallback(viewer.getCamera()->getOrCreateStateSet()));
and in the CameraUpdateCallback:: operator (const osg::Camera& camera)
const
I tried to achieve this via:
pass_2_cam->setViewMatrix(camera.getViewMatrix());
pass_2_cam->setProjectionMatrix(camera.getProjectionMatrix());
I guess this is not the way to do it.
Are there any options?
Because setting the camera to RELATIVE_RF didn't really work.
sorry, I'm not sure how to do it either. Someone with knowledge about
slave cameras might be able to help you. I suggest posting another
question with that as topic.
rgds
jp
cheers
Sebastian
Hi,
On 05/10/2011 11:39, Sebastian Messerschmidt wrote:
Hi JP
I've tried single and multithreaded, but this doesn't seem to change
anything.
OK, running singlethreaded can sometimes show if stateset variance is
not correctly set to dynamic.
So first camera attached should be the first one to be rendered If I
understood you correctly?
Yes, we build some image processing chains with FBO cameras and our
execution order is only specified using the order of attachment to the
same parent (we don't specify render_order).
Can you give me a pointer on how to force it with the renderbin
approach?
I've only set render bin on transparent objects, but see the code in
/include/RenderBin. One of the options in SortMode is TRAVERSAL_ORDER.
HTH
jp
cheers
Sebastian
Hi,
are you running SingleThreaded? Cameras (siblings) under the same
node
are normally rendered in the order they have been attached (you can
force this with TRAVERSAL_ORDER bin too).
jp
On 05/10/2011 11:05, Sebastian Messerschmidt wrote:
Hi,
I know this has been discussed more then once before, but I still
don't
get the details.
In my setup I'd like to use something like (this is supposed to be a
table
Input Cam Output
Tex1 Cam1 Tex2
Tex2 Cam2 Tex3
Tex3 Cam3 Tex4
... and so on
TexN OutCam FrameBuffer
I've setup the cameras to be PRE_RENDER with increasing render_order
exept for the last which is POST_RENDER.
All cameras have are in a separate Group which are all attached
to the
root.
The root is given to the viewer and a TrackballManipulator is
attached
to the viewer.
Now if I move the scene, I can clearly see, that e.g. Tex2 is from a
previous frame when processed in Cam2.
(I'm doing blending of different scene parts here, and you can
clearly
see that some parts are from the previous frame, as if the
rendering is
done in wrong order).
How do I have to place the cameras in the scene graph?
All under root like this:
root
--cam1
--cam2
...
or rather hierarchical?
root
--cam2
--cam1
Or do I have to add them to the viewer in a different way?
cheers
Sebastian
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org