Software vs Hardware skinning: Limits, speed.

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1894
Joined: Sun Mar 08, 2009 5:25 am
x 114

Software vs Hardware skinning: Limits, speed.

Post by mkultra333 »

I'm working on a setup where lots of robots are combined in a single mesh to cut the batches down, and then algorithmically moving all their bones so the robots can run about the map separately.

To put in some concrete numbers, lets say one option might be 1 mesh of 32 robots, while another option might be 4 meshes of 8 robots each mesh. Individual robots are pretty low poly, around 600 polys each, and have about 9 bones each.

I'm currently doing software skinning. I'm wondering if hardware skinning would be better. There are a number of factors.

1. Hardware skinning (Shader model 2.x) only allows a limited number of bones, say 64 to 72-ish. Do these same limits apply to software skinning?

2. If software skinning allows more bones per model, does it risk clogging up the cpu or is it a relatively light computation? I'd be looking perhaps at 288 bones moving 72 vertices each.

3. Even if software skinning allowed more bones, and thus less batches (since I can squeeze more robots into each batch), do you think perhaps what I gain in the cut batch count I'd lose in the cpu bottleneck? Perhaps I'm better off with hardware skinning, less robots (and therefore less bones) per batch, but more batches?

It's something of a design crossroad, and I'm just curious to know what people with more experience think.
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Re: Software vs Hardware skinning: Limits, speed.

Post by xavier »

mkultra333 wrote: 1. Hardware skinning (Shader model 2.x) only allows a limited number of bones, say 64 to 72-ish. Do these same limits apply to software skinning?
The code has a 256-bone limit in it somewhere.
2. If software skinning allows more bones per model, does it risk clogging up the cpu or is it a relatively light computation? I'd be looking perhaps at 288 bones moving 72 vertices each.
Any time spent on the CPU with one task takes time from all other tasks. That said, skinning is generally embarrassingly parallel (which is why it works so well on a GPU), so you could theoretically scale performance of it with core count (but Ogre itself does not multithread the skinning, that I recall). Also, the skinning code is SSE optimized as much as it can be.
3. Even if software skinning allowed more bones, and thus less batches (since I can squeeze more robots into each batch), do you think perhaps what I gain in the cut batch count I'd lose in the cpu bottleneck? Perhaps I'm better off with hardware skinning, less robots (and therefore less bones) per batch, but more batches?
This is one of those try-it-and-see things; if it's too slow, then you might be able to get better performance with 4 72-bone HW-skinned batches instead. The nice thing about it is, it doesn't have to be either-or -- you flip a switch in the material; it's really an art-based solution.
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1894
Joined: Sun Mar 08, 2009 5:25 am
x 114

Re: Software vs Hardware skinning: Limits, speed.

Post by mkultra333 »

Thanks xavier.

I think I'm mainly GPU bound from the fragment shaders (fairly complex lighting model), atm I probably have a bit of cpu to burn, especially if the user runs at high resolution.

So I might stick with software skinning for now, and only if the CPU suddenly becomes a serious bottleneck I'll try shifting the work to the the vertex program. I'm not that cluey about multithreading, but perhaps I could shift some other work like AI to another thread and reduce the software skinning impact.

(Hmm, then again, I have an old graphics card, gt7950. Modern users probably don't have the same fragment hit that I do... will have to test.)
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
Post Reply