Game Development Community

Changing updateSkin rate for distant characters

by Eylem Ugurel · in Torque Game Engine · 01/15/2007 (6:14 am) · 7 replies

How can I change the updateSkin() rate for distant characters so that their vertexes and normals are calculated less frequently (this will reduce the visible playing Hz of the animation) so i gain cpu time?

#1
01/17/2007 (2:35 am)
No comment?
#2
01/17/2007 (3:12 am)
Funny! I was thinking about doing this after work today.

It should definatly not be too hard unless there's something going around with the batcher that I have no clue about. If I get down to it today I'll post the changes.
#3
01/17/2007 (3:39 am)
Skinning is done in "tsMesh.cc" - TSSkinMesh class - updateSkin() function.

in order to not calculate the skin every frame, the calculated mesh must be stored in the mesh. But in the current source code, skinned result is stored in global variables for rendering immediately.
Vector gSkinVerts;
Vector gSkinNorms;
#4
01/17/2007 (6:37 am)
Yes, but updating those only within a certain interval should be enough - much like the waterblock is only rendered every odd tick (or whatever it is).
#5
08/19/2009 (8:59 am)
I tried to skip some of the frames and moved the global to the object but the animation is broken after it.
Maybe someone have a hint how to speed up the updateSkin since it is a really bad fps eater also if no animation is playing.
#6
08/19/2009 (1:12 pm)
Eylem hit the nail on the head:
Quote:in order to not calculate the skin every frame, the calculated mesh must be stored in the mesh. But in the current source code, skinned result is stored in global variables for rendering immediately.

if you have two Korks they share the same global mesh. TGE deforms the mesh each frame for each character. to make it so that distant characters do the mesh deformation less often than nearby characters, you would probably want to make a version of gSkinVerts and gSkinNormals inside the shapeInstance, and either pass pointers to them for rendering, or possibly just copy them into the global version each frame.
#7
08/20/2009 (8:23 am)
I did move the three global variables into TSSkinMesh, maybe this was wrong. But it did work when there was no skip. With skip the animation randomly stand still - runs very fast - runs normal. I make a little game where I need a lot of animated mills and found out the updateskin is a real performance eater - also if the model is exported without any animation - with bones only. I looked also in the T3D code with is quite different to the TGE TSSkinMesh but didn't try out if it is much faster so I may adapt this method to TGE.