Perhaps I didn't express the situation clearly. In fact, there are always
several passes in class Technique which are processed in cull traversal as
following:
pushStateSet(pass[0]);
traverse_children;
popStateSet();
pushStateSet(pass[1]);
traverse_children;
popStateSet();
In the first traverse_children, child drawables are saved in
stateGraph0(with stateset0) while in the second traverse_children, the same
child drawbles are saved in stateGraph1(with stateset1).And these
drawables(including those processed in the first traverse_children) are stored
in different stateGraphs in the same Level of a single RenderBin.And then these
drawables (if transparent) are sorted by depth.The drawable in stateGraph0 and
that in stateGraph1 are of the same depth as these two drawables' geometries
point to the same memory.If std::sort is used in sorting, the drawable with
stateset0 may appear after the drawable with stateset1 because the order can't
be guaranteed.Thus some techniques in osgFX may make wrong results.
If any mistake, please let me know.Thanks.
------------------
Failure is the mother of success.
Wu Zhicheng
------------------ Original ------------------
From: "Robert Osfield";<[email protected]>;
Date: Mon, Mar 10, 2014 04:52 PM
To: "OpenSceneGraph Users"<[email protected]>;
Subject: Re: [osg-users] Rendering order of passes of multi-passed technique
Hi Wu,
std::sort is only used by RenderBin's when they need to sort into depth order,
otherwise they just use the state sorted order provided by the state graph.
When std::sort() is used keys of 0 will always appear before 1. The only
difference with std::stabe_sort is that if there are two 0 values then it
preserves the order, while std::sort makes no such guarantee.
Robert.
On 9 March 2014 06:09, ttaw <[email protected]> wrote:
As we know, there may be several passes used in osgFX::Technique. My question
is whether different-passes-drawables would be rendered orderly as the passes
are added into Technique (pass 0 is rendered before pass 1). As I read the
source code of the file "RenderBin.cpp", I found that not std::stable_sort but
std::sort is used to sort tansparent drawables. Does it mean that pass 0 may be
rendered after pass 1 for transparent drawables? Thanks.
------------------
Failure is the mother of success.
Wu Zhicheng
_______________________________________________
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