PDA

View Full Version : How to maintain animation speed!?!?



GL_ZERO
08-27-2003, 02:30 AM
With animation i mean any animation. For example blending how do i make sure that the blend speed is the same on every PC. Intro logo blending from black fo full -> full to black. Light that is glowing etc.

errno
08-27-2003, 02:42 AM
for example for fade in/out you have to update a fade speed according to the actual fps.

GL_ZERO
08-27-2003, 03:32 AM
But wont the fade go faster with that!? What i meant was to make sure the the fade will take for example 3sec.

edit

I was thinking about using "Sleep(msec)" but thats so newbish lol

[This message has been edited by GL_ZERO (edited 08-27-2003).]

PanzerSchreck
08-27-2003, 03:54 AM
Use the high performance counter to query the time needed to draw a frame and the calculate your speedfactor depending of the hpc's counters before the frame and after the frame.
If you do that, then you'll get a timefactor that you'll have to use on all your animations to get the same speed on all systems.
Take a look at QueryPerformanceCounter for more info.

nexusone
08-27-2003, 04:05 AM
I think that you should look at it in a larger view.

You have the following things that effect your animation.

1. Speed of the computer
2. Speed of the video card
3. How detailed the scene is being rendered.

Now we want to fade from one scene to another in X seconds.

So we need to come up with a rate of fade based on the above items.

To do this we can get the system time at start of rendering and after rendering.

render_start = time();
fade();
render_end = time();

render_time = render_end - render_start;

render_rate = 3 (seconds) / render_time;

render_rate is how may frames we will have to make the fade transition. A slower computer will have less frames to complete the transition vs. a faster computer will have more frames.

Hope this helps.

torisutan
08-28-2003, 12:04 AM
as PanzerSchreck said, using a timer is the way to go. so search google for QueryPerformanceCounter, and play with that a bit. nexusone solution would most likely work, but it isn't very flexable, and is more work than u really need to do.

I personally have some predefined classes that i've written using QueryPerformanceCounter, and i just move those classes from one program to another, with no difficulty at all.