Re: [osg-users] transparency is hard! Drawing order of drawables inside a Geode?
> There is a traversal ordered render bin since some time. This one renders just > in the order you traverse your scenegraph with the cull visitor. > Of course you loose plenty of optimizations due to state sorting ... Ok, for the record here is how I solved it, the traversal order bin actually helped! Thank you. I place the geodes representing the transparent containers in a DepthSortedBin, so these containers get drawn in back to front order (no intersection between tanks is assumed). geodestate->setRenderBinDetails( render_bin, "DepthSortedBin", osg::StateSet::USE_RENDERBIN_DETAILS ); On each drawable I use the nesting feature for render bins, which I discovered in a search of the OSG code base. I am not sure if this is the correct way to do it, but the results look correct. Because the drawables that make up each tank are already added in the order they must be drawn, this seems to work fine. drawablestate->setRenderBinDetails( render_bin, "TraversalOrderBin", osg::StateSet::INHERIT_RENDERBIN_DETAILS ); drawablestate->setNestRenderBins(true); The render_bin variable passed here is 10 (the default for transparent bins). Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] transparency is hard! Drawing order of drawables inside a Geode?
Hi, On 27/10/2011 11:17, Christian Buchner wrote: Regardless which render bin order you're using, the order of the rendered triangles in a transparent object is still wrong, but there even isn't a right rendering order for triangles, because the ordering has to happen on fragment level. For simple convex objects like cylinders, spheres, boxes the trick with back face culling can be applied safely if they don't intersect :) cheers jp - unless OSG decides to change the render order to minimize state changes (which is what is happening in my case) I am a bit worried that advanced methods like depth peeling won't integrate that easily with my existing scene graph. I will check. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-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. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] transparency is hard! Drawing order of drawables inside a Geode?
Hi, On Thursday 27 October 2011, Christian Buchner wrote: > For simple convex objects like cylinders, spheres, boxes the trick > with back face culling can be applied safely - unless OSG decides to > change the render order to minimize state changes (which is what is > happening in my case) There is a traversal ordered render bin since some time. This one renders just in the order you traverse your scenegraph with the cull visitor. Of course you loose plenty of optimizations due to state sorting ... Greetings Mathias -- Dr. Mathias Fröhlich, science + computing ag, Software Solutions Hagellocher Weg 71-75, D-72070 Tuebingen, Germany Phone: +49 7071 9457-268, Fax: +49 7071 9457-511 -- Vorstand/Board of Management: Dr. Bernd Finkbeiner, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board: Philippe Miltin Sitz/Registered Office: Tuebingen Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No.: HRB 382196 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] transparency is hard! Drawing order of drawables inside a Geode?
> Regardless which render bin order you're using, the order of > the rendered triangles in a transparent object is still wrong, > but there even isn't a right rendering order for triangles, > because the ordering has to happen on fragment level. For simple convex objects like cylinders, spheres, boxes the trick with back face culling can be applied safely - unless OSG decides to change the render order to minimize state changes (which is what is happening in my case) I am a bit worried that advanced methods like depth peeling won't integrate that easily with my existing scene graph. I will check. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] transparency is hard! Drawing order of drawables inside a Geode?
Hi Christian, > I will also look into the "SceneGraphOrderRenderBin", which could be > useful in this context. Regardless which render bin order you're using, the order of the rendered triangles in a transparent object is still wrong, but there even isn't a right rendering order for triangles, because the ordering has to happen on fragment level. So, depth peeling is the way to go. Greetings, Daniel -- Daniel Trstenjak Tel : +49 (0)7071-9457-264 science + computing ag FAX : +49 (0)7071-9457-511 Hagellocher Weg 73 mailto: daniel.trsten...@science-computing.de D-72070 Tübingen WWW : http://www.science-computing.de/ -- Vorstand/Board of Management: Dr. Bernd Finkbeiner, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board: Philippe Miltin Sitz/Registered Office: Tuebingen Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No.: HRB 382196 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] transparency is hard! Drawing order of drawables inside a Geode?
> You might want to look at the osgdepthpeeling and/or the osgoit examples. Thanks for the pointers. I will also look into the "SceneGraphOrderRenderBin", which could be useful in this context. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] transparency is hard! Drawing order of drawables inside a Geode?
On 10/26/2011 02:35 PM, Christian Buchner wrote: Are there any insights for rendering transparent stuff from the OSG community? Are there proven approaches to rendering transparency correctly for objects? Hi, Christian, You might want to look at the osgdepthpeeling and/or the osgoit examples. --"J" ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] transparency is hard! Drawing order of drawables inside a Geode?
Hi, I am trying to render a semitransparent cylindrical container with the following strategy: Create a drawable for the cylinder's back faces first by relying on GL_CULL_FACE using a specific winding order of the quads to only render the rear wall. Add this drawable to the Geode first. Create a drawable for the cylinder's front faces first by relying on GL_CULL_FACE using the opposite winding order of the quads to only render the front wall. Add this drawable to the Geode next. I take the same approach with the top and bottom faces of the cylinder, carefully choosing an order in which the transparency looks correct for all viewing angles. And to make things even more complicated, I also display a transparent liquid that is contained inside the container. This worked reasonably well because it seemed that the drawables inside my geode were processed in the order that I added them to the geode. Now I added shaders to the individual drawables and some state sets are different among my various drawables. Unfortunately now the predictable drawing order has broken down and my transparency often looks incorrect. I have tried using render bins with the depth sorting flag enabled - this looks correct for each individual container but it looks horrible when one container is seen behind another. I wish there was such a thing as localized renderbins for drawables contained inside a geode. I need to achieve a guaranteed render order for drawables owned by a single geode. Are there any insights for rendering transparent stuff from the OSG community? Are there proven approaches to rendering transparency correctly for objects? I could override the drawImplementation, I guess... Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org