Question on VBOs

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

This is the modification I used for 02.Quake3Map:

Code: Select all

	scene::IAnimatedMesh* animMesh = smgr->getMesh("20kdm2.bsp");
	scene::ISceneNode* node = 0;

	if (animMesh) {
		scene::IMesh *mesh = animMesh->getMesh(0);
		for (unsigned int i=0; i<mesh->getMeshBufferCount(); i++)
		{
			mesh->getMeshBuffer(i)->setHardwareMappingHint(scene::EHM_STATIC);
		}
		node = smgr->addMeshSceneNode(mesh);
	}
I'm getting 2850fps with DX9 on Vista. I'll test on XP when I get the chance.
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

Another issue is that the usage hint is for for both VB and IB's. Usually you'll want the VB to be static and the IB dynamic so you can dynamically update the indices.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

I also tested 02.Quake3Map with similar modification to Sio2 modification in it (without OCT node only normal addMeshSceneNode, bacause speedup in OCT nodes is very low), I will apply Sio2 improvments to DirectX code and I will test it again on my Radeon 2600 Pro (Catalyst 8.3).
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Thanks for the tips Sio2, I'll try them out right away and update the patch accordingly.
Performance penalty could be severe.
That could certainly explain a few things. :P

Please note that I didn't write all the code for this, I mostly just merged raedwulf's implementation with Luke's interface.
Another issue is that the usage hint is for for both VB and IB's. Usually you'll want the VB to be static and the IB dynamic so you can dynamically update the indices.
Or the other way for terrain rendering or the likes. Unfortunately Irrlicht normally seeks to provide ease of use at the cost of customisability. I simply followed Luke's interface so I had no say in this matter. Looking at what we've got it would be a 5 minute change to implement this, allowing setHardwareMappingHint() to set flags for boths indices and vertices, and providing 2 other functions eg setVertexHardwareMappingHint to allow the user to set this more discreetly.

Offcourse this would be quite pointless if the changed id dirty method wasn't altered to support both index buffers and vertex buffers individually. Currently it will upload both regardless of what changed. (Although looking at CMeshBuffer.h now it seems that hybrid recently changed the function header for setDirty() to allow for the user to specify the type buffer in question, so something along these lines must already be in the works.)

Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

My Windows XP is dead:( I will reinstall winxp and test this new patch tomorrow:) I hope than this modification allow heigh speedup similar to OpenGL speedup:)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

I repaired my WinXP and I tested this patch again with Sio2 modifications. With EHM_STATIC on my Radeon 2600 PRO works good:) SpeedUp is very good similar proportions to OpenGL SpeedUp. Good work:)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

I've submitted by fix to the patch tracker (includes original patch).
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Thanks guys, I'm glad it works now.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

Can you post a binary please for me to check too. Just for statistics :wink:
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

sorry I haven't been active lately.

thanks BlindSide and sio2, for the dx vbo patch, I'll look into applying it.
(Although looking at CMeshBuffer.h now it seems that hybrid recently changed the function header for setDirty() to allow for the user to specify the type buffer in question, so something along these lines must already be in the works.)
Yep, I think that was me, yep it’s in the works, usage hint will be updated to.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Hi, Do you think OCCTREE's in DX will benefit from this in DX? As someone given a code example to use the VBO (It's now implemented in the last SVN)
Raedwulf
Posts: 62
Joined: Sat Aug 20, 2005 7:08 am

Post by Raedwulf »

Octrees are quite possible to be optimised using vbos.... however, i believe i struggled a little last time attempted to do that.
I modified the interface to support chosing between dynamic indices/static vertices etc...
and proceeded to modify irrlicht to use VBOs everywhere... but it got terribly messy and i was a bit unhappy with it :P.

Ill search for my code to see how far i got with it.
Raedwulf
Post Reply