Rendering lots of little soldiers...500 how to keep speed up?

Started by
23 comments, last by johnnyBravo 19 years, 8 months ago
All depends on what class hardware you are targeting. So set/choose a minimum target spec and work from there.

For DX7 class hardware you will be heavy on the cpu no matter what. Either you tranform vertices on the CPU or do one character per draw call(which can only be accomplished by what is stated in the next sentence). This also will up your memory consumption since you'll only be able to accomplish the above efficiently is by having each frame of animation store as post skeletal transformed vertices. If you want to go the CPU route the models need to be lowpoly enough to do the skeletal animation with sufficient speed if not use the technique from the previous sentence.

For DX8 class hardware you are inbetween, less CPU because you'll have enough matrix constants to perform skeletal animation in the GPU, but thats still one draw call per character. Your second option here is to again have the vertices stored for each frame of animation, and then use "one bone skinning" to instanciate N models per draw call.

For DX9a..b hardware same as DX8 except you can do more characters per draw call.

For DX9c you have instancing/vertex stream frequency which can be used to really effectively take advantage of the hardware.

So its all about what hardware you want to support, what code paths you want to implement, load/init time choice of optimal method for system, benchmarking to see whats optimal for your particular case, and of course proper choice of data structures for a particular code path. (i.e. if you choose to transform vertices on cpu, parallel arrays where position data is kept in its own array and each element is aligned on a 16 byte boundry)

-potential energy is easily made kinetic-

Advertisement
Quote:Original post by Infinisearch
For DX9c you have instancing/vertex stream frequency which can be used to really effectively take advantage of the hardware.


So the intancing/vertex stream frequency is an actual setting for the vertex buffer?

Quote:Original post by JohnBolton
Imposters work great when all the units are facing in the same direction and are doing the same animation like in the picture.

If each of the 500 units are doing a different animation or facing in a different direction, it will be slower because you end up rendering each unit twice.


Oh yeah, I never considered that, i guess if i gave the men only 16 rotations, and if I had only a few animations,, it should be quite fast.
Yeah, you need billboards, that's also how large groups of trees are rendered. Also, with large numbers of simple models, the fastest thing to do is rotate/translate them in software so you can draw them in batches on the same vertex buffers... but rotation is slow. So you should precompute the rotated vertices for all keyframes of all the models, maybe in 5 degree increments or even 15 degrees. In a RTS, things are only rotated around the vertical axis (yaw) so that makes this very feasible.
~CGameProgrammer( );Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
You could try grouping them and then using different levels of detail for each group. The closest ones to the camera could have a fully detailed model, and the furthest ones away could just be little billboarded images.
Quote:Original post by tolleyc
You could try grouping them and then using different levels of detail for each group. The closest ones to the camera could have a fully detailed model, and the furthest ones away could just be little billboarded images.


Ah I just want to draw all the units the same way, I think right now its just too much hassle.

Maybe once the games complete, but I don't think i'd get that much more better looking graphics by doing that.

This topic is closed to new replies.

Advertisement