Rendering lots of moveable objects

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Ephon
Gnoblar
Posts: 18
Joined: Tue Jan 18, 2005 8:33 pm

Rendering lots of moveable objects

Post by Ephon »

How does a game like WarCraft 3 handle and render so many objects, with all the animation and effects that it has? Talking only in units in the game, there can be as many as 500 units at the same time, and yet the game runs smoothly (on my machine that is). And if you play a custom map, there can be 1000-1500 units, and still no problem rendering. So my question is: How do they acheive this? Any ideas?
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66

Post by sinbad »

This is quite possible in OGRE too. I've rendered upwards of 2000 objects at once at decent speeds, especially if they use the same material.

They're not all visible at once is why. With something like an octree (which you get if you've loaded the octree plugin in Ogre) you can eliminate non-visible objects pretty quickly, and OGRE doesn't render or skeletally animate anything which is not visible. So in practice this isn't that difficult.
Mariusz Plaskowicki
Gnoblar
Posts: 19
Joined: Thu Feb 10, 2005 9:48 am

Post by Mariusz Plaskowicki »

Hi,
As for skeletal animation - would it be possible to animate so many entities at once? I mean 500-1000. Actually I'm thinking of RTS games - there are usually a lot of animated entities - will a skeletal animation do fine? Or should we use MD3 for such task?


NTW: Do we have any tool to conver from skeletal animation to MD3 or MD2 format?
User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »

Vertex morphing (MD3) is actually very inefficient compared to skeletal animation/hardware skinning.
Mariusz Plaskowicki
Gnoblar
Posts: 19
Joined: Thu Feb 10, 2005 9:48 am

Post by Mariusz Plaskowicki »

Hmm, I thought that MD3 is faster but if You say so. I must admit that I never took a closer look at MD3 format...

And how about my primary question? Would it be possible to render a lot of skeletally animeted meshes at once in RTS game?
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4

Post by tuan kuranes »

Technique using vertex shader allowing to reuse existing GPU datais faster.
(that's why md3 is way slower that vertex shader based animation/skinning)
Would it be possible to render a lot of skeletally animeted meshes at once in RTS game?
yes, provided that you :

- make sure most meshes possible share an uniq material (even if team colors changes(see the book game programming gems 4 for that)). That's what sinbad stated, and that's the most fps impacting parameters.
(ie : trooper unit must have 1 material, whatever team it's on. )

- use of skeletal animation/hardware skinning as stated by :wumpus:. (needs Vertex shader, because GPU does the transformation so that models data stay umodified in GPU)).

- and make sure meshes data and texture fits all in user memory (no 10.000 poly models or 2048x1048 textures...)

And that can be optimized a step further with Vertex Instancing, (read gdc2005 far cry paper). But there's a significant amount of work involved here (make group of meshes sharing the most common GPU parameters possible, using a GPU param for position, make sure render are grouped together.).

(Read nvidia slides and paper on GPU "batch" would explain you underlying of those answers)
Last edited by tuan kuranes on Tue Apr 05, 2005 12:14 pm, edited 1 time in total.
User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »

Yes. Didn't you read Sinbad's reply at all?
Mariusz Plaskowicki
Gnoblar
Posts: 19
Joined: Thu Feb 10, 2005 9:48 am

Post by Mariusz Plaskowicki »

tuan: Thanx for explanation. I'll take a look at the doc's You mentioned in my spare time. But I don't have GPG4 so I guess I will have to look for this info somewhere else.
wumpus: Yes' I'v read. But he didn't mentioned that he is talking about sa. This is why I'v asked about MD3 also. But I guess it was obvious that he was talking about sa - my mistake.

Thanx for Your patience for such a stupid questions guys :D
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4

Post by tuan kuranes »

Use an alpha separated map to specify team color zone.
Then for each object specify the team color using fixed function blending option. That way each trooper uses same textures, and thus doesn't require GPU texture switch (which costs much.)

(pixel shader parameter is also doable, using alpha maps or why not a predetermined color to be replaced.)
User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »

You shouldn't do things in pixel shaders you can do in vertex shaders/geometry/texture coordinate magic though. Larger pixel programs get slow very fast.
User avatar
Goosey
Halfling
Posts: 88
Joined: Wed Sep 29, 2004 3:33 am
Location: Ohio, USA

Post by Goosey »

Just wanted to throw my two cents in that I have succsessfully rendered ~10k onscreen sprites at once without a significant framerate drop. They were 2-poly plains using anim_texture units, but the result was still pretty impressive. If you have played any of the games in the Total War series previous to Rome, you will understand what I am talking about.
I <3 the OGRE Wiki, and SO SHOULD YOU! :)
michtoen
Kobold
Posts: 30
Joined: Thu Jun 03, 2004 12:39 pm

Post by michtoen »

That brings me to the next question:

What about a mmorpg like dark age of camelot?

We have there some different models AND they are all
different customized with different armor, weapons and all.

You will have a mass of unique materials.
User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »

You never have as much units on screen in a mmorpg as in a stratagy game. If you only have a few players/npcs onscreen (a la WoW) it doesn't matter if they all use different materials.