Horde3D
http://horde3d.org/forums/

Rendering crowds with Horde3D?
http://horde3d.org/forums/viewtopic.php?f=1&t=1653
Page 1 of 1

Author:  pete [ 20.03.2012, 20:29 ]
Post subject:  Rendering crowds with Horde3D?

The name "Horde" implies that this engine was made for scenes with a lot of characters on screen. That is exactly what I need for my project. Let's say I want to render this (the game is called Hitman Bloodmoney from 2006):
Image

There are about 10 distinctive models, repeated randomly to create that crowd. Notice how some models are recycled - for example that guy with the yellow birdhat also walks around without the hat or has a slightly differently colored skin in another case.
Let's say they average to about 5000 low poly characters on screen at a time with about 50 unique model combinations (different skins, different hats) in total. If I create a similar scene in Horde3D (based on the chicago demo), I get really horrible performance since no batching takes place. What can I do to speed things up and render a huge crowd in realtime, just like that 2006 game does without breaking a sweat?

- How do I batch all models into 1 rendercall?
- How do I efficiently batch differently textured models (or ones with a hat) into that same rendercall?
- What are realistic figures that you would expect Horde3D to render this way? Are 5000 objects simply too much for this engine?

PS: I notice there is batching going on in the particle engine - maybe that can be used for this? My models need individual shadows etc. though.

Author:  MistaED [ 21.03.2012, 10:16 ]
Post subject:  Re: Rendering crowds with Horde3D?

Hi Pete,

To batch like this you will need to make one mesh all merged and do skining on CPU as theres a limit on shader uniforms for bone matrices (75 for shader model 2).

Alternatively you can encode bone matrices into textures to read out animations in a vertex shader via a sampler lookup but you would need to make a draw instanced call and you cant cull them as easily... Horde doesn't support this out of the box unfortunately.

Author:  johannes [ 07.04.2012, 09:45 ]
Post subject:  Re: Rendering crowds with Horde3D?

I have a similar question on this. How would you render a lot of dynamic particles? Let's say I want to render this (2048 particles for a swarm visualization):
Image

Each dot in the swarm is a particle, but they move around individually to create other shapes besides spheres and react to user input. Currently, I use a single particle model with a billboard shader as a base and create 2048 instances via h3dAddMeshNode(). This way, every dot is a node that I can manipulate the way I want. However, this is pretty slow to render since no batching occurs. If I used the built in H3DEmitter, I have no problem rendering 2048 dots, but sadly the individual dots can not be moved independently. How can I batch this?

Author:  DarkAngel [ 08.04.2012, 03:19 ]
Post subject:  Re: Rendering crowds with Horde3D?

One option is to store the positions of each particle in a texture. Each vertex in the mesh would have a unique UV coordinate in this texture.
You can render the mesh in one go, and to move a particular particle, you just have to write a new position into the right texel.

Author:  johannes [ 08.04.2012, 11:13 ]
Post subject:  Re: Rendering crowds with Horde3D?

DarkAngel wrote:
One option is to store the positions of each particle in a texture. Each vertex in the mesh would have a unique UV coordinate in this texture.
You can render the mesh in one go, and to move a particular particle, you just have to write a new position into the right texel.


Brilliant idea! Thanks! I will try this.

Author:  johannes [ 11.04.2012, 16:36 ]
Post subject:  Re: Rendering crowds with Horde3D?

I tried this. It's pretty slow though. Here is what I did, maybe I am missing something:

The batch-model itself consists of 2048 quads (=2 polygons) and each vertex is given the following information:
TextureUV (xy)
VertPosition (not actually used for rendering) (xyz)
LookupID [0-2047] (x)

The LookupID is used to look up dynamic data from a texture that I can edit every frame. I use a RGBA32F texture with a size of 2048x2 pixel where all that data fits in nicely. The texture represents:
- Particle position (xyz) & Size (a)
- Colors, FX etc. (xyza)

Is this what you thought of too, DarkAngel? How can I find out what's so hard to render about this?

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/