Geometry Batching Tutorial [Advanced Tutorial ?]

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
User avatar
steven
Gnoll
Posts: 657
Joined: Mon Feb 28, 2005 1:53 pm
Location: Australia - Canberra (ex - Switzerland - Geneva)
Contact:

Geometry Batching Tutorial [Advanced Tutorial ?]

Post by steven »

Hey all,

Here is a small wip tutorial on the wiki about "Geometry Batching" using VerexData & HardwareBuffers.

Experimenting with HardwareBuffers and VertexData I found out that there is not much code sample demonstrating simple usage of vertex & hardware buffer manipulation.
And although the manual documentation is good I had difficulties to grasp the sequence needed to use

This tutorial is mostly a working code which shows how to send a simple cube to the hardware buffer. No texture, no colors to make the code as simple as possible but with a code that is still easily extensible.

Note that the code is a rip-off of the PagedGeometry Engine from JohnJ. To which I am indebted because without his code I wouldn't have been able to understand geometry batching :)

Any help to add to this tutorial is welcome and hopefully it will be promoted to an 'official' advanced tutorial ;)

Regards
Steven
User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 605
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
x 16
Contact:

Re: Geometry Batching Tutorial [Advanced Tutorial ?]

Post by AshMcConnell »

This is something I'd really like to get to grips with, but I haven't had time to fiddle with yet. Any pointers you have would be much appreciated! :)

Thanks!
Ash
User avatar
steven
Gnoll
Posts: 657
Joined: Mon Feb 28, 2005 1:53 pm
Location: Australia - Canberra (ex - Switzerland - Geneva)
Contact:

Re: Geometry Batching Tutorial [Advanced Tutorial ?]

Post by steven »

For now the only pointers I have are those I mentioned on the wiki article.
The whole purpose of this article is to gather links and tricks :)
User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 605
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
x 16
Contact:

Re: Geometry Batching Tutorial [Advanced Tutorial ?]

Post by AshMcConnell »

steven wrote:For now the only pointers I have are those I mentioned on the wiki article.
The whole purpose of this article is to gather links and tricks :)
Yeah, what i meant by it is "thanks for the wiki article", but I was half asleep when I typed :)
engel_sanchez
Gnoblar
Posts: 6
Joined: Tue Mar 24, 2009 6:24 pm

Re: Geometry Batching Tutorial [Advanced Tutorial ?]

Post by engel_sanchez »

Hi Steven. I have been playing with JohnJ's library and the concepts of batching and instancing in the last few days. I am glad that you are working in this tutorial! May I suggest this link?

http://http.developer.nvidia.com/GPUGem ... ter03.html

That's the online version of the GPU Gems 2 book. The chapter on instancing is very informative and lists several ways of doing it. I am myself exploring exactly how the forests (aka PagedGeometry) library does it in order to optimize a little demo I am working on. Good luck with the tutorial!
User avatar
Beauty
OGRE Community Helper
OGRE Community Helper
Posts: 767
Joined: Wed Oct 10, 2007 2:36 pm
Location: Germany
x 39
Contact:

Re: Geometry Batching Tutorial [Advanced Tutorial ?]

Post by Beauty »

Good work - thanks!
A clear style and many useful links :)

It seams to be nearly ready.
So please don't forget to link it from related wiki pages.
Also you can add it to cathegories like Tutorials or Code Snippet.

update:
Now I saw that you used HTML code for the table.
This is not nice and can cause errors by parsing of the wiki scripts.
I can translate it to wiki code, but not today.
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.
User avatar
Beauty
OGRE Community Helper
OGRE Community Helper
Posts: 767
Joined: Wed Oct 10, 2007 2:36 pm
Location: Germany
x 39
Contact:

Re: Geometry Batching Tutorial [Advanced Tutorial ?]

Post by Beauty »

Ok, I converted the table to wiki code (needed 45 minutes).
Also I tried to keep a good overview in the table by additionally line breaks.
So that forthcoming updates/edits are more easy.
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.
User avatar
aguru
Goblin
Posts: 236
Joined: Tue Feb 26, 2008 5:48 pm
x 3

Re: Geometry Batching Tutorial [Advanced Tutorial ?]

Post by aguru »

Thanks for your hard work on keeping the wiki a tidy and useful place, Beauty :)
User avatar
Beauty
OGRE Community Helper
OGRE Community Helper
Posts: 767
Joined: Wed Oct 10, 2007 2:36 pm
Location: Germany
x 39
Contact:

Re: Geometry Batching Tutorial [Advanced Tutorial ?]

Post by Beauty »

Well, the real work was done by steven.
Mostly I just make only tiny changes.
For tutorials etc. I have to less knowledge.
Also I use C# (Mogre) and my C++ skills aren't good.
But thanks for recognition :)
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Geometry Batching Tutorial [Advanced Tutorial ?]

Post by jacmoe »

I've elevated the tutorial as Advanced Tutorial 2 - but it needs some improvements, like a walk-through of the code.
I might backport it to MediaWiki, but now it's here:
http://test.ogitor.org/tiki/Advanced+Tutorial+2
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
Beauty
OGRE Community Helper
OGRE Community Helper
Posts: 767
Joined: Wed Oct 10, 2007 2:36 pm
Location: Germany
x 39
Contact:

Re: Geometry Batching Tutorial [Advanced Tutorial ?]

Post by Beauty »

Additionally we can put all source files to a zip file and attach is as a download to the wiki page. (This is possible with the new wiki.)
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1889
Joined: Sun Mar 08, 2009 5:25 am
x 107

Re: Geometry Batching Tutorial [Advanced Tutorial ?]

Post by mkultra333 »

I glanced through it, something I'd like clarified would be "Can I turn static geometry on and off? Is that fast or slow?"

The reason I ask is because at the moment I have a portal-zone system for my map. Think of space dungeons like in Doom3. As portals come into view, revealing new zones, I turn those zones on by attaching all their geometry to a scenenode, and I detach it as the geometry goes out of view. It works very smoothly, there don't seem to be any lags or glitches.

Since the geometry in zones is pretty much unchanging apart from being attached and removed from scenenodes, would I get even better performance if I turned those zones of geometry into static geometry? Can they be turned on and off just as fast or faster as it takes to attach/detach scene nodes? If there is a gain to be made, how much?
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
x 3
Contact:

Re: Geometry Batching Tutorial [Advanced Tutorial ?]

Post by Praetor »

"Baking" geometry into batches each time you turn it on and off would not be a good idea. But, if you built it once and then just attached and detached from scene nodes as you do now, that would be just as fast. All of the time factors that were in play with individual entities attached to individual scene nodes are in play with one larger batch.
Game Development, Engine Development, Porting
http://www.darkwindmedia.com
peacemaker
Gnoblar
Posts: 15
Joined: Wed Sep 15, 2010 10:51 am

Re: Geometry Batching Tutorial [Advanced Tutorial ?]

Post by peacemaker »

I would really like to read this tutorial however the links provided in this thread don't work?
User avatar
Beauty
OGRE Community Helper
OGRE Community Helper
Posts: 767
Joined: Wed Oct 10, 2007 2:36 pm
Location: Germany
x 39
Contact:

Re: Geometry Batching Tutorial [Advanced Tutorial ?]

Post by Beauty »

Hi,

it's a problem which happened after switching to an other wiki software.
The spaces of pagenames will be encoded by "+" instead by "_".
I fixed the wiki page - now the old link will work again.

By the way:
If you find again such a "broken page", just report the page on the linked forum thread.
You can find the link on the error page.
Page not found
Geometry_Batching

Please report the missing link here: Missing Links Forum Topic
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.
Post Reply