Page 1 of 1

Irrlicht State Sorting

Posted: Thu Oct 08, 2009 10:41 am
by spidersharma
Hi,

I want to know if the irrlicht engine has implemented state sorting?
I saw the code and it looks as if only textures are sorted.
If the state sorting is not done fully, is there any plan in near future?
Please suggest.

Posted: Thu Oct 08, 2009 11:01 am
by BlindSide
I haven't heard of any plans on changing the sorting for the draw order.

If you want you can put things with distinct materials in a seperate render pass in the scene manager, this should render them together regardless of the texture.

Posted: Thu Oct 08, 2009 11:12 am
by spidersharma
I am actually new to state sorting.
However I saw the Aviatrix3D code, and this scenegraph sorts all the states of an object as a collection.
For example all the states like materials, textures, lineAttributes(width , antialiasing) , and more are bundeled together in a Appearance object.
it is the Appearance object, which is a collection of all possible states, is finally sorted.(in fact sorting appearance is nothing but sorting all states).
Whether such a plan feasible in Irrlicht?

Posted: Fri Oct 09, 2009 6:24 am
by CuteAlien
No need to repeat this post every few hours, if you don't get more answers then because no one has an answer. I've removed the other threads now.

If you want to know more about current render ordering in Irrlicht then please take a look at the sources. CSceneManager::drawAll() in CSceneManager.cpp is a good place to start looking. Also patches can be proposed, though you need good arguments to get changes right into the heart of the engine. Refering to some other code of which probably no-one here knows anything about won't get you too much answers as we miss any information about it.

Posted: Sat Oct 10, 2009 8:28 am
by biino
I had a look how Irrlicht sets states to fix a rendering issue on the iphone last night.

Although I can't say for sure if it does any state sorting, it does make an effort to place nodes in the scene graph to minimize the impact of state changes.

for example in COctTreeSceneNode:

Code: Select all

//! returns the material based on the zero based index i. To get the amount
		//! of materials used by this scene node, use getMaterialCount().
		//! This function is needed for inserting the node into the scene hirachy on a
		//! optimal position for minimizing renderstate changes, but can also be used
		//! to directly modify the material of a scene node.
	virtual video::SMaterial& getMaterial(u32 i);
Also the video driver implmentation does a few checks to minimize some changes.

I know OpenSceneGraph is pretty good with its state sorting but it's not as easy to use as Irrlicht.

Bino

Posted: Sun Oct 11, 2009 12:38 pm
by tonic
Here's one nice reference for implementing efficient state sorting, if somebody wants to try optimizing that stuff...
http://realtimecollisiondetection.net/blog/?p=86

Posted: Mon Oct 12, 2009 5:13 am
by spidersharma
Thanks
I will take a look at the openscenegraph.
However I love irrlicht because of its simplicity. Its a beautiful engine.
I dont like openscenegraph.

Posted: Mon Oct 12, 2009 5:40 am
by spidersharma
This is a useful link for understanding state sorting:
http://opengl.j3d.org/tutorials/statesorting.html