|
| Question about models for games |
ceeejay |
Which method is the best to use for games, a model with say 3 different parts (head, limbs and torso) and three different textures or one seamless mesh with one texture?
Are there any big advantage or disadvantages with each?
read 278 times 9/9/2010 5:33:54 AM (last edit: 9/9/2010 5:33:54 AM)
|
advance-software |
In general, the less changes the engine/hardware has to make, the faster things go, so one seamless mesh with one texture is the answer.
However, if the mesh is large - say a building, splitting it up into viewable parts can improve performance in some engines. Other engines do this "spacial partitioning" automatically.
One big texture is the way to go as long as you're packing content into it efficiently - no big wasted spaces.
The advantage of separate textures is you can swap components in & out more easily - e.g. same character with different type of trousers.
read 258 times 9/9/2010 11:06:49 AM (last edit: 9/9/2010 11:12:14 AM)
|
ceeejay |
Thanks.
Im building low poly players ( around 1000 polys) for a sports game and would like to be able to have different hair styles, faces etc.
If I make them all one mesh then I can change faces by editing the texture or by modelling unique faces on each different player.
For hairstyles, is it better to build it as a separate object for interchangability? Or is it fine to have dozens of the same mesh with different hairstyles/faces built into each one.
read 234 times 9/9/2010 4:20:36 PM (last edit: 9/9/2010 4:20:36 PM)
|
advance-software |
You're welcome.
I'd have each hair config as a separate mesh which you overlay on top of the base mesh.
If you duplicate the entire mesh x times, you waste a lot of video memory & that will result in lots of cache misses, which will slow the thing down.
When you need to partition like this, do it, but only when required.
Your engine could draw all the bodies in one go (same mesh, no geometry state changes), then all the hair meshes, for example.
You've got two things to think about - state changes (slow) and cache misses (slow). It can be tricky/trial & error to identity the optimal solution. The cost of each also varies from GPU to GPU.
It'd put together a couple of tests on your target system & measure the frame rate as you experiment. Some hardware has diagnostics tools that can help you identify how efficiently you're using the GPU.
read 228 times 9/9/2010 4:53:28 PM (last edit: 9/9/2010 5:01:52 PM)
|
ceeejay |
Thanks again.
What is a cache miss in layman terms!?
At the moment I have placeholder models that are all the same mesh and I change hair colour, jerseys etc by editing the texture. This works fine in the engine but I would like to add more variety. Im pretty sure at the moment all the players on the field are already duplicate meshes.
I think I will do what you say and test it out. I might even test it on the placeholders first. I can run it in the engine and check the frame rate.
As far as state changes go, when the game loads, all of the meshes and hairstyles will be loaded and no state changes should occur during the actual game. So, if it does slow it down it should hopefully only add to the loading time and not cause any frame drop during gameplay??
read 204 times 9/10/2010 2:02:51 AM (last edit: 9/10/2010 2:02:51 AM)
|
advance-software |
> What is a cache miss in layman terms!?
The stuff you use most is close to you - say on your desk - it's easy to get to so you can work fast. In a computer processor - the desk equivalent is called the cache.
When you're doing a lot of work, you can't have everything on your desk, so some of the stuff you need is filed away / in the next room, whatever. When you need some of that stuff, you have to take something off your desk so there's enough room (file that away) and put the new stuff on your desk so you can work with it. The process of swapping stuff around takes a little time. This is the "cache miss".
Ideally, you work with as little stuff as possible at a time so it all fits and you don't have to go fetching anything, but realistically, sometimes you must. Try to minimize as much as possible by working as efficiently as possible.
Re-state changes - nothing to do with loading - it's the stuff the processor has to change when it's drawing - so you draw all triangles with one shader first, then another, then another & so on.
However, it's not even that simple because usually it's better to draw front to back because most of the back stuff never gets written anyway because it's covered up by something in front of it (the z-buffer handles the reject).
On top of that, some engines use a process called deferred rendering which only lights stuff that's at the front (StarCraft II for example). Would love to hear from Jesse as to how effective that is.
You should also build 2 or 3 levels of detail variants - use hi-poly meshes when close, lower poly equivalents when further away.
read 183 times 9/10/2010 10:35:48 AM (last edit: 9/10/2010 2:40:14 PM)
|
ceeejay |
Thanks again for taking the time to help, I appreciate it.
I really dont know or understand much about how things are rendered in the engine. I just make, texture and animate the models then give them to a programer.
I think I will stick with a single mesh with hairstyles that can be added on like you mentioned.
I have another question, this time about animation. Is there a mininum amount of frames that I should be working with? I have made all of my walk/run loops etc 12 frames. Some other things have as few as 8 frames. When in the engine I can adjust the speed and when I slow them down they often get choppy. What is a good amount of frames to use for basic looping animations?
read 154 times 9/11/2010 2:23:46 PM (last edit: 9/11/2010 2:23:46 PM)
|
advance-software |
No worries - the invoice is on its way :)
Usually animations are interpolated by the engine so they should never get choppy.
If they are, your engine's animation system needs enhancing.
Use whatever keyframes you like.
Our engine analyses your animation, reduces it to the minimal set (to some given error tolerance level) then plays back with interpolation. Works well.
You'll need this capability anyway so you can blend animations - to go from run to walk to stand, etc.
I'd ask your programmer these exact same questions if you haven't already done so as he'll know more about the specifics of the engine you're using.
read 151 times 9/11/2010 2:27:43 PM (last edit: 9/11/2010 2:28:28 PM)
|
|
|