Sign in to follow this  
  • entries
  • comments
  • views

Faster Characters

Sign in to follow this  


Recently I had a strange problem with my new character's head. The old character was bald, so it didn't show up with him. On the new character, it was a bit of skin showing up on the top of the dude's head on its silhouette, even though he had a full head of hair. Since the game is played 3rd person, this was pretty distracting.

Step one was to open up the texture and copy the hair parts over the empty areas of the texture which were filled with skin color, even near the hair. That reduced it, but it still showed up with AA on.

I next forced skin textures to only have a few mipmaps, to make sure that wasn't the issue. Reduced, but still happened.

When I dumped the character model as a .x file and loaded it in Unwrap3d, I saw that the 3 submeshes of the texture were not all in the [0..1] range, two were translated, one left, and one down.

I remembered that issue, and realized that to 'fix' it, I had set the texture wrap mode on the characters to wrap. Turns out, the bottom of the char's skin texture was skin colored ( legitimately, for the hands ), so the wrapping was kicking in on near-horizontal triangles, bringing in the nice bright skin color when the texture wrapped around vertically.

I can't easily fix the character models, our last character artist flaked out a while ago and is not returning our e-mails, so I needed to fix it up on loading.

That caused me to go back into the character animation code to add code to bring UV coords into [0..1] range when first loading. While in that code, I realized that I could probably speed up things a bit by not copying the texcoords down every frame into the cached vertex array, but only do it once when fixing things up.

It did speed things up a bit, so then I experimented with not updating the normals and tangents every frame, and that gave a nice boost, too, so I added code to only animate the normals and tangents every few frames. Looks the same, and runs much better. It's actually a single counter for all submeshes, so the more characters on screen, the less often it's run.

Now the canyon level, with 7 chars on screen, plus corpses, is running almost 50% faster than before, and no more skin artifacts.

Here is a shot of my weak work-in-progress DNA-like cloning effect.

Sign in to follow this  


Recommended Comments

interesting bug to fix!

our last character artist flaked out a while ago and is not returning our e-mails
Sucks a bit, out of curiousity have you found it easy or hard to get a team behind this project?

I remember you advertising for places and it then went quiet - so I just assumed it was all ticking over just fine on that front [smile]


Share this comment

Link to comment
It's been brutal keeping folks, right now it's two full time folks ( me included ) and one part time level/model/texture artist.

Some of the issues that have come up with team members include serious illness, family member incarceration, and need to get a full-time job ( with no notice ), among others.

I really thought paying cash money would help, but I find it's really not the main issue. Now it's probably too late to bring on someone due to how long it would take to get someone up to speed...

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now