Rendering lots of moveable objects
-
- Gnoblar
- Posts: 18
- Joined: Tue Jan 18, 2005 8:33 pm
Rendering lots of moveable objects
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?
-
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
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.
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.
-
- Gnoblar
- Posts: 19
- Joined: Thu Feb 10, 2005 9:48 am
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?
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?
-
- OGRE Retired Team Member
- Posts: 3067
- Joined: Tue Feb 10, 2004 12:53 pm
- Location: The Netherlands
- x 1
-
- Gnoblar
- Posts: 19
- Joined: Thu Feb 10, 2005 9:48 am
-
- OGRE Retired Moderator
- Posts: 2653
- Joined: Wed Sep 24, 2003 8:07 am
- Location: Haute Garonne, France
- x 4
Technique using vertex shader allowing to reuse existing GPU datais faster.
(that's why md3 is way slower that vertex shader based animation/skinning)
- 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)
(that's why md3 is way slower that vertex shader based animation/skinning)
yes, provided that you :Would it be possible to render a lot of skeletally animeted meshes at once in RTS game?
- 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.
-
- OGRE Retired Team Member
- Posts: 3067
- Joined: Tue Feb 10, 2004 12:53 pm
- Location: The Netherlands
- x 1
-
- Gnoblar
- Posts: 19
- Joined: Thu Feb 10, 2005 9:48 am
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
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

-
- OGRE Retired Moderator
- Posts: 2653
- Joined: Wed Sep 24, 2003 8:07 am
- Location: Haute Garonne, France
- x 4
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.)
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.)
-
- OGRE Retired Team Member
- Posts: 3067
- Joined: Tue Feb 10, 2004 12:53 pm
- Location: The Netherlands
- x 1
-
- Halfling
- Posts: 88
- Joined: Wed Sep 29, 2004 3:33 am
- Location: Ohio, USA
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! 

-
- Kobold
- Posts: 30
- Joined: Thu Jun 03, 2004 12:39 pm
-
- OGRE Retired Team Member
- Posts: 3067
- Joined: Tue Feb 10, 2004 12:53 pm
- Location: The Netherlands
- x 1