Mutliple transparent scenenode tips.

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
thanhle
Posts: 325
Joined: Wed Jun 12, 2013 8:09 am

Mutliple transparent scenenode tips.

Post by thanhle »

Hi Guys,
I have multiple transparent scenenodes lying close to each other using the option below, which works fine.

mNode->setMaterialType(E_MATERIAL_TYPE::EMT_TRANSPARENT_VERTEX_ALPHA);
meshManipulator->setVertexColorAlpha(mNode->getMesh()->getMeshBuffer(j), value);

At some camera angles they are drawn correctly per view distance.
However, at other angles the further scenenode are drawn ontop of the closer one.

Based on previous post, I found that there is the ESNRP option to make a node drawn first.
But it doesn't seem to be a good idea as my transparent object is dynamic (change their location) during simulation time.

Questions:

1) Is there an alternative fixed function technique to overcome multiple transparent objects draw orders?
2) Can shader resolve this drawcall sorting issue for multiple transparent objects?

thanks
thanh
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Mutliple transparent scenenode tips.

Post by CuteAlien »

The problem is that Irrlicht sorts transparent nodes by their distance to the camera. But for 2 node besides each other that sorting order doesn't alwas make sense as some polygons from the object further to the camera can be in front of the polygons of the other object. Maybe sorting per meshbuffer instead of per node would help a little as centers could be more correct (but that depends on the model). I do not know what happens when polygons _within_ a meshbuffer have to be sorted - if the graphic card does help there or not. Would have to experiment myself for that.

I don't think it's a problem of the fixed-function pipeline as shaders likely also need that sorting.

I know the sorting happens in CSceneManager in the line with TransparentNodeList.sort(), but I'm not really familiar yet with the algorithms used for the drawing - so can't help more for now.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply