Irrlicht State Sorting

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
spidersharma
Posts: 50
Joined: Thu Aug 13, 2009 7:16 am
Location: India

Irrlicht State Sorting

Post 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.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post 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.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
spidersharma
Posts: 50
Joined: Thu Aug 13, 2009 7:16 am
Location: India

Post 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?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post 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.
Last edited by CuteAlien on Mon Oct 12, 2009 5:18 am, edited 1 time in total.
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
biino
Posts: 7
Joined: Mon Apr 13, 2009 1:32 am

Post 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
tonic
Posts: 69
Joined: Mon Dec 10, 2007 6:18 pm
Contact:

Post 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
spidersharma
Posts: 50
Joined: Thu Aug 13, 2009 7:16 am
Location: India

Post 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.
spidersharma
Posts: 50
Joined: Thu Aug 13, 2009 7:16 am
Location: India

Post by spidersharma »

This is a useful link for understanding state sorting:
http://opengl.j3d.org/tutorials/statesorting.html
Post Reply