Page 1 of 1

Optimisation Project

Posted: Thu Jun 25, 2009 3:10 pm
by Steel Style
Hi there I'm here to talk about a project about renders optimisations. I didn't find a proper scene like I asked to, but I think that I'll start small and get higher. Please link anything you know about optimisation and ask features, I'll try to find the best method this way.

I'll update soon with a todo list under.

Posted: Thu Jun 25, 2009 4:15 pm
by hybrid
I didn't get a word of what you intend to do, but it seems that this belongs to Open Discussion for now.

Posted: Thu Jun 25, 2009 8:39 pm
by Halifax
Essentially, I think he wants to work on optimizing Irrlicht. And it appears as though he didn't find any modeler to produce a scene that he could use to test certain optimizations (occlusion culling, etc.) Now he's looking to start small, and he wants people to suggest little things that he can start on.

That's what I gathered from his post.

Posted: Sun Jul 12, 2009 4:52 am
by grumpymonkey
Actually I think he was saying something different:
I didn't find a proper scene like I asked to, but I think that I'll start small and get higher.
He was high and tried to look for a scene but couldn't find it, so he decided to get higher.

The rest of the post proves he was high

Posted: Sun Jul 12, 2009 5:14 am
by MasterM
Ok, i want to ask which is the better way to load scenes into irrlicht...

Oh and which is the best optimized way to let a class share variable and pointers without using a singleton :)
Hope you can answer these questions, i have a whole book of optimized questions ready for you so ill just post them 2 by 2 :)

Posted: Sun Jul 12, 2009 9:12 pm
by Steel Style
Sorry guys I was away but Halifax you are right.

Posted: Sat Jul 18, 2009 5:00 am
by grumpymonkey
hows he going to optimize irrlicht if he cant even make a readable post? (no offence)

Posted: Sat Jul 18, 2009 5:27 am
by Halifax
grumpymonkey wrote:hows he going to optimize irrlicht if he cant even make a readable post? (no offence)
That's an exteremly ignorant question. Not everyone speaks english well, but that doesn't define their C++ engineering skills. For some people on this forum, English is their second language, not their first. C++ is a universal programming language, and programs using C++ generally don't make extensive use of English; furthermore, he clearly already has an intermediate grasp on English, which is all that is needed.

Secondly, have you every met Nadro? His English may be on the brink of incoherent, but he has certainly made a number of major contributions to Irrlicht.

Think a little bit before holding a person's mastery of the English language against them, when it comes to software engineering.

Possible optimization?

Posted: Tue Aug 18, 2009 2:10 am
by koscianski
Er.. maybe I spot a point in

void CSceneManager::drawAll ()

Instead of:

Code: Select all

	if (!Driver)
		return;
        ...
	// reset all transforms
	video::IVideoDriver* driver = getVideoDriver();
	if ( driver )
	{
		driver->setTransform ( video::ETS_PROJECTION, core::IdentityMatrix );
		driver->setTransform ( video::ETS_VIEW, core::IdentityMatrix );
		driver->setTransform ( video::ETS_WORLD, core::IdentityMatrix );
		driver->setTransform ( video::ETS_TEXTURE_0, core::IdentityMatrix );
		driver->setTransform ( video::ETS_TEXTURE_1, core::IdentityMatrix );
		driver->setTransform ( video::ETS_TEXTURE_2, core::IdentityMatrix );
		driver->setTransform ( video::ETS_TEXTURE_3, core::IdentityMatrix );
	}
it would be better:

Code: Select all

	if (!Driver)
		return;
        ...
	// reset all transforms
	video::IVideoDriver* driver = getVideoDriver();  // necessary?

	driver->setAllTransformsToIdentity ();   // <- here is the trick
	}
(en passant: what's the difference between variables "Driver" and "driver"? Seems a bad choice for identificators.)

Anyway, by creating "setAllTransformsToIdentity", we can drop 6 parameterized function calls per frame.

Next, looking into COpenGLDriver, CD3D8Driver and CD3D9Driver, we perceive that all the switches and ifs can be thrown away in this possible "setAllTransformsToIdentity".
In the case of COpenGLDriver, ETS_VIEW and ETS_WORLD are the same, so another function call could be avoided. For ETS_PROJECTION, the calculations are not needed in this particular case, since we want a constant matrix.

Probably not a dramatic speed improvement, but certainly not a reason not to implement it.

Posted: Thu Aug 27, 2009 1:02 am
by bitplane
Function calls are fast and this is only done once per frame. This isn't a good reason to add extra methods to the public API, which should be avoided where possible.