Render order issue

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
magoon
Posts: 7
Joined: Wed Mar 16, 2016 9:58 pm

Render order issue

Post by magoon »

Hello folks,
i`ve got an issue with the render order as you can see in the Screenshot:
http://imgur.com/2qnB2oH

I´ve set up a custom node and on the material initialization i do the following:

Code: Select all

      Material.setTexture(0,driver->getTexture("../../media/char.png"));
      Material.Wireframe = false;
      Material.Lighting = false;
      Material.setFlag(video::EMF_LIGHTING, false);
      Material.setFlag(video::EMF_BLEND_OPERATION, true);
      Material.setFlag(video::EMF_ZWRITE_ENABLE, true);
      Material.ZBuffer = ECFN_ALWAYS;
      Material.MaterialTypeParam = EMT_TRANSPARENT_ALPHA_CHANNEL;
I´ve tried to play with the parameter but I couldn´t solve it.
Any idea?

Thx in advance :)
REDDemon
Developer
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Re: Render order issue

Post by REDDemon »

the screenshot seems ok to me, what's the problem?

EDIT, you refer to the fact that the sprite has background showing behind? The problem is Zwrite, if you enable it, even transparent part of image are rendered to zbuffer preventing the room to be drawed (since in your case the room is rendered after the sprite)

You have to render the room before the sprite, or otherwise use the irrlicht material that write Z only on non-transparent points (just don't remember it now.. searching for it..

FOUND

Code: Select all

EMT_TRANSPARENT_ALPHA_CHANNEL_REF 
)
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
magoon
Posts: 7
Joined: Wed Mar 16, 2016 9:58 pm

Re: Render order issue

Post by magoon »

REDDemon wrote: You have to render the room before the sprite, or otherwise use the irrlicht material that write Z only on non-transparent points (just don't remember it now.. searching for it..

FOUND

Code: Select all

EMT_TRANSPARENT_ALPHA_CHANNEL_REF 
)
Ok, thank you.
How can I change the render order? Is it depending on the node creation time? I`ve swapped the room node with the player node and it works now.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Render order issue

Post by CuteAlien »

Render-order depends mostly on the E_SCENE_NODE_RENDER_PASS value with which a node registers itself to the scenemanager. Generally it's solid nodes first, transparent nodes later (you have no control except setting corresponding materials unless you create your own scenenode-classes). For nodes with the same material it might depend on the position in the scenegraph (which is set by creation time). But that only matter if nodes don't use the z-buffer (otherwise the one in front is always drawn in front no matter if it's drawn first or later).
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