Inconsistent transparents
Posted: Tue Aug 16, 2016 12:09 am
When the depth of two or more transparents is the same, their sort order is random.
Any ideas in how to solve this ?
Link to source: https://bitbucket.org/sinbad/ogre/src/d ... ping.h-178
In this line
Result may vary for two renderables, since the comparison is based on the Random Memory Addresses of the passes.
Any ideas in how to solve this ?
Code: Select all
// Different renderables, sort by depth
Real adepth = a.renderable->getSquaredViewDepth(camera);
Real bdepth = b.renderable->getSquaredViewDepth(camera);
if (Math::RealEqual(adepth, bdepth))
{
// Must return deterministic result, doesn't matter what
return a.pass < b.pass; //THIS IS THE ISSUE
}
else
{
// Sort DESCENDING by depth (i.e. far objects first)
return (adepth > bdepth);
}
In this line
Code: Select all
return a.pass < b.pass; //THIS IS THE ISSUE