Frame Length Calculation for Compilers & Animators

INTRODUCTION

This tutorial is aimed at fixing frame length / fps problems, where the custom animation made in 3ds max - or any other animation software for that matter - plays at a faster, or slower speed in game, than it appears in 3ds max itself.

The idea is to get the duration of both the animation slot in CS:S and 3ds max to be the same.The calculations require some rather simplistic math - or at least, to my Asian brains. (Don't worry. I got an 70% in grade 12 math, compared to my black friend who got 82%)

If you just want the formula, skip to "Get to the Point?" section. If you want the idea behind it, please read through everything.

Explanation

Basic Concepts

The duration of the animation, or the time it takes for the animation to play, depends on the animation's frame length, and frames per second (fps).

  • Frame length: The number of frames within the animation (Unit: frames)
  • Frames per Second (fps) = The number of frames played per second (Unit: frames/second)

If you were to divide the frame length by the fps:

  frames / (frames / second)
= frames * (second / frames)
= (frames * second) / frames
= second

Notice how we just proved that frame length/fps = seconds, which is the duration of the animation

The Formula

In order for the duration of the animation to be the same within 3ds max and source engine, the time (second) that the animation takes must be identical in both 3ds max, and source engine.

Let max represent anything related to 3ds max
Let css represent anything related to counter-strike source.

   max_second = css_second
=> max_frames / (max_frames / max_second) = css_frames / (css_frames / css_second) 
=> max_frames / max_fps = css_frames / css_fps

The formula to make the duration of both animations the same has now been determined.

Get to the Point?

By looking at the model viewer, the frame length and fps of the animation can be found for the weapon in CS:S. Also, the fps for animations in 3ds max is 30; unless you changed the default settings.

Taking the formula we have created:

max_frames / max_fps = css_frames / css_fps

Our known values:

css_frames and css_fps
max_fps

The value of max_frames can now be found.

After finding the value of max_frames, your animation in 3ds max will now be limited to that number of frames. Any more, it will be too long for the animation slot in CS:S. Any less, it will be too short.

During export, be sure to scale the animation up to the number of frames required in css. Please refer to the example below.

Ofcoures, you can always just change the fps in 3ds max to the fps in CS:S, and the frame length in CS:S will be the frame length in 3ds max. However, 3ds max's fps setting is limited to only a few values (it will change to the nearest valid value if you enter something invalid). In addition, most animators are used to the timing of 30 fps. (timing as the number of frames to use for a certain action).

Example

Case: I want to make an animation for a CS:S weapon's reload slot. The reload has 108 frames and is at 39 fps. What is the frame length to use in 3ds max?

Given: 
css_frames = 108
css_fps = 39
max_fps = 30

Unknown:
max_frames = ?

Formula:
   max_frames / max_fps = css_frames / css_fps
=> max_frames / 30 = 108/39
=> max_frames = 108/39 * 30  (multiply both sides by 30)
=> max_frames = 83.076923076923076923076923076923 (simply plug the above values to a calculator)

The decimal places have to be rounded out, since you cant get half a frame. Therefore, your animation must have 83 frames within 3ds max.

Upon export, I must scale the 83 frames back to 108 frames. If i exported with 83 frames, then CS:S will play the 83 frames at 39 fps, which would make the animation too fast.

You can scale the animation by going into the "Time Configuration" floater: (Look at screenshot) It is the button in the lower right corner of the zoomed section within the circle.

Conclusion

This concludes the tutorial. Nuff said. Have fun animating! :) - ImBrokeRU

Oh noes! You're not a Member!

Want access to cool stuff? As a member you can:

  • Post. Give the submitter your thoughts on this Tutorial.
  • Say Thanks. Show your appreciation by sending the submitter points.
  • Stamp Posts. Let other posters know what you think of their posts.
  • Rate. Give this Tutorial a rating out of 10.
  • Flag. Alert moderators and warn members of a problem with this Tutorial.
  • Vote. Vote the submitter for the Monthly Awards.
  • Subscribe. Get notified when this submitter submits again.

Interested? Register or Login

Comments

  • Zira's Levels
    • P2: Drudge
      Points: 2,604
    • C1: Member
    • A3: Apprentice
      Account Age: 2 years
    Posted 1 year ago

    Posted by Mario4155

    Edit that introduction of yours.It's fucking racist.

    He's Asian...How is he racist?

    Some heal, some scar.
  • Mario4155's Levels
    • P5: Peddler
      Points: 94,928
    • E3: Tutor
      EF: 75
    • C1: Member
    • A6: Elder
      Account Age: 7 years
    Posted 2 years ago

    Edit that introduction of yours.It's fucking racist.

    User Title
    Currently pursuing happiness
  • Poux's Levels
    • P2: Drudge
      Points: 4,746
    • E1: Helper
      EF: 3
    • C2: Treehouse Member
    • A4: Graduate
      Account Age: 4 years
    Username
    Poux
    Posted 2 years ago

    Upon export, I must scale the 83 frames back to 108 frames. If i exported with 83 frames, then CS:S will play the 83 frames at 39 fps, which would make the animation too fast.

    It's not necessary. The sequence FPS can be changed to 30fps in .qc script used for compiling, so CS:S will play the animation at 30fps.

    Anyway, I made a simple, HTML based calculator long time ago intended for frame length calculation. Let's see if I still have it and I'll post it here. Otherwise I'll try to make another one from scratch.

    EDIT: Well here it is, hope it helps. Edited some stuff so people understand the calculator so easily after reading this tut.

    User Title
    On hiatus

Credits

Submitter
ImBrokeRU's Levels
  • P2: Drudge
    Points: 2,718
  • C1: Member
  • A4: Graduate
    Account Age: 3 years
ImBrokeRU (Creator/Co-creator)
Key Authors
ImBrokeRU
Author

Rating

10.0/10
Based off 2 rating(s)

Additional Info

Genre
3D Animation, Compiling
Difficulty Level
Beginner

Stats

Post Count
3
ViewCount
1,250
Date Added
2 years ago
Date Modified
2 years ago

Share

Embed Code
Code to use:

More embeddable images

Bookmark and Share