Jump to content

Animation performance help


Rick
 Share

Recommended Posts

Looking for debugging tips to find out what's going on.

 

I have some first person shooting arms in an empty scene. I'm using the old AnimationManager.lua for animating. When I comment it's Update() I get about 700-900 fps. When I uncomment it (animate the arms in an idle animation) I get about 350 fps.

 

I noticed if I comment out the self.entity:UnlockMatrix() that's inside AnimationManager:Update() I get about 500 so that function for sure has a pretty big impact on fps.

 

self.arms:SetShadowMode(0) I have this set for the arms model but it doesn't seem to do anything. I would assume that turns off shadows which is what I would want.

 

Any other ideas?

 

 

[EDIT]

 

I'm noticing that SetPosition()/SetRotation()/Move() are big fps killers too. Move() easily took about 300 fps. SetPosition() about 100, and SetRotation() about 50. Why would that be?

Link to comment
Share on other sites

How complex is the bonestructure of the firearms? Although even, if it were dozens, those kind of transformation calculations should be fairly cheap for the engine. Locking the animation update to the refreshrate should also increase performance.

 

Just for reference:

Locking the matrix should be done before any animations are done.

Unlocking the matrix should be done after the animations are done.

http://www.leadwerks.com/werkspace/page/api-reference/_/entity/entityunlockmatrix-r140

Link to comment
Share on other sites

Measuring in terms if framerate is pretty wrong. If something only takes one millisecond, at 1000 FPS It will drop to 500, but at 60 FPS it will only drop to 56 FPS. So saying something takes x FPS isn't very specific. Instead you should use Time::Millisecs() to get the time before and after an operation, and display how long it actually took to perform.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I'll throw those in and check, but they would be correlated since something that takes longer would cause less fps, but I agree it would show more solid numbers to work from.

 

 

[EDIT]

 

Am I going about this right:

 

local s = Time:Millisecs()
self.arms:SetPosition(pos) -- 100 fps
local e = Time:Millisecs()
local diff = e - s
System:Print("Arms SetPosition time = "..diff)

 

This is showing me a value of 0 or 1 for SetPosition()/SetRotation() and a value of 1 for Move(). I'm assuming Millisecs() isn't small enough to get a real meaningful value.

 

 

I guess I don't get why we can't measure something in fps. If without feature A I get 100 fps and then I add feature A in and get 75 fps, then feature A is costing my game 25 fps. So them I can look at feature A and see if I can make it faster so it costs less fps. That seems like valid logic. Sure that's specific to my machine/gfx card but it's all relative and that's fine. If I can make feature A cost less fps on my machine then it'll cost less fps on a different machine as well. So if a feature cuts my fps in half it catches my attention because it'll drop a good amount on all machines.

  • Upvote 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...