<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hi all, I have an issue with order of rendering.<br>
I do know that OSG has rendering bins to provide the order of rendering, and that, inside a rendering bin, it optimizes drawing by sorting objects to render WRT the state sets.<o:p></o:p></p>
<p class="MsoNormal">That’s fine. But now I have an use case that I don’t know how to implement.<br>
My graphic object is made by a 2D rectangular box with a text on top, as shown in the picture a).<br>
Well, I do have many of them, which can overlap. I do disable depth test when I render them, because I want the last one to cover completely the others, when overlapping.<o:p></o:p></p>
<p class="MsoNormal">The visualization that I want to achieve is that shown in picture b).<o:p></o:p></p>
<p class="MsoNormal">In order to do that, my scenegraph is made by these nodes:<br>
<br>
Main root node<o:p></o:p></p>
<p class="MsoNormal"> | |<o:p></o:p></p>
<p class="MsoNormal"> Transf1 Transf2<br>
| | | |<o:p></o:p></p>
<p class="MsoNormal"> Box1 | Box2 |<o:p></o:p></p>
<p class="MsoNormal"> | |<o:p></o:p></p>
<p class="MsoNormal"> Text1 Text2<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Transf1 sets the position of Object1<o:p></o:p></p>
<p class="MsoNormal">Trasnf2 sets the position of Object2.<o:p></o:p></p>
<p class="MsoNormal">Box1 is a geode that contains a drawable that render the rectangular box for Object1.<o:p></o:p></p>
<p class="MsoNormal">Text1 is a text drawable for the text on top of the box1.<o:p></o:p></p>
<p class="MsoNormal">Box2 is a geode that contains a drawable that render the rectangular box for Object2.<o:p></o:p></p>
<p class="MsoNormal">Text2 is a text drawable for the text on top of the box2.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">So, my objects should be rendered in this order, to draw what I want:<br>
Box1, Text1, Box2, Text2, …<br>
I do have hundreds of graphic objects like those.<br>
So, how can I do this?<br>
I cannot set the same rendering bin for all Boxes, and a different rendering bin for all Texts, because OSG would render first all the boxes, and then all texts, which would overlap each other, like in picture c). Orrible!!!<br>
So, I thought that I have to assign the same rendering bin to all Transf, in order to make it render all my objects in the same bin, but I have to specify somehow that it has to render Box and Text in that order for each sub-graph,<br>
instead of optimizing rendering by state set order, which breaks my requirement.<br>
I would need to set some “offset” in rendering bins for Boxes and Texts (1 and 2 respectively), to force OSG to render the Box and Text in that order, for each subgraph connected to Transf.<br>
It seems an easy thing to do, and mine seems a silly question, but I cannot do that.<o:p></o:p></p>
<p class="MsoNormal">Any help is appreciated.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">Gianluca<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>