I'm not sure why you think you should use a Camera as you describe, it seems like a misuse of the Camera class, which is intended for a complete frame rendering, and not for combining with data from other Cameras, which is what you have here (osgViewer / SceneView uses a Camera implicitly, above your root node).

That's not to say that you can't combine the renderings of two Cameras into a single frame; you can. But you need to be very aware of what OSG is doing for each Camera, and configure them to work together with respect to rendering order, clearing, etc.

You've already discovered that eliminating the Camera resolves the issue. This seems to be a clear case of, "if it hurts, don't do it".
   -Paul


On 12/20/2010 8:48 AM, George Bekos wrote:
Hello all,

I have a problem regarding transparency and osg::Cameras. Because my main graph 
is very complex I will describe here a simplified version of the graph that 
produces the problem.

What I want as a result is three colored spheres. The middle should be opaque 
and the left and right should be transparent. And I do it like this: I have a 
main root osg::Group node with two child osg::Group nodes.  At the first one's 
StateSet I set the rendering hint to StateSet::TRANSPARENT_BIN. Then I just 
attach to it two osg::Geodes. At the second one I add as a child an osg::Camera 
and then I attach a osg::Geode on the camera. Take a look at the diagram 
picture to understand my graph.

The result I get is really strange and not the expected of course. I can not 
see the middle sphere through the transparent ones but I can see a transparent 
sphere through the other transparent one. Even if the middle opaque sphere is 
between them. (I can't see the opaque one at all through the transparent 
spheres) Take a look at the picture to understand the exact problem. Looks like 
the osg::Camera somehow breaks the rendering order.

Now, the strange thing is that IF I use a osg::Group instead of the 
osg::Camera, then everything works! Any idea why is this happening? I have also 
attached my source code which is also available at this site:  
http://pastesite.com/20775

Thanks for your time guys!
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to