Render passes, transparent materials and custom scene nodes

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
aheymann
Posts: 153
Joined: Wed Aug 22, 2007 12:25 pm
Location: England

Render passes, transparent materials and custom scene nodes

Post by aheymann »

Hallo

Thought I would share information regarding implementation of a custom scene node and multiple materials. I have implemented a complex custom scene node based on a DCEL structure, ISceneNode and an OctTree for speeding up my display processing. My node can contain multiple materials and faces within the node can belong to a 'material list'. While looking at the code for COctTreeSceneNode, I noticed the following in OnRegisterSceneNode :


Code: Select all

		// register according to material types counted

		if (solidCount)
			SceneManager->registerNodeForRendering(this, scene::ESNRP_SOLID);

		if (transparentCount)
			SceneManager->registerNodeForRendering(this, scene::ESNRP_TRANSPARENT);

		ISceneNode::OnRegisterSceneNode();
This checks if a scene node should be included in a particular render pass. I did not fully appreciate what this does. In my first implemenation of my custom scene node, OnRegisterSceneNode, I had :

Code: Select all

   if (IsVisible) 
      {
      SceneManager->registerNodeForRendering(this); 
      ISceneNode::OnRegisterSceneNode(); 
      }
This means, that my scene node will be drawn AT LEAST TWICE! I replaced my logic with the logic contained in COctTreeSceneNode and now my FPS has doubled!

Anton
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

I don't think your node was being rendered twice.. you could probably check that by getting the primitive count that was sent to the gfx card.

smgr has 2 lists of nodes, one of which is solid nodes and one of which is transparent nodes. The transparent ones have to be drawn after the solid ones to get the correct transparency blending, hence why they're kept in a seperate list. It's not multiple render passes.
Image Image Image
aheymann
Posts: 153
Joined: Wed Aug 22, 2007 12:25 pm
Location: England

Post by aheymann »

Thanks for the information. I admid that I did not realise that there were 2 lists, however, my FPS have certainly increased. It is possible, that some of my nodes contained either transparent or solid materials (not both) and therefor my FPS increased, due to the fact that the node did not occur in both lists - I need to do some more research on this.

What I wanted to point out was that creating custom scene nodes, does require more thought.

Anton
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

yeah, i guess your material must have not been registering itself explicetly as solid or something... (although i imagine that's the default, maybe it's not).
Image Image Image
Post Reply