当前位置:网站首页>Summary of several methods for FPS calculation

Summary of several methods for FPS calculation

2022-06-25 21:13:00 Rabbit cloud program

Frame rate (FPS, frame per second) Computing is a common topic in game programming , Because it is displayed in the picture refresh and visual sense , So relatively speaking , The frame rate has a great impact on the user experience . This is also a lot of large 3D Important points to be improved in the game , It means that you should constantly optimize the rendering speed and performance , Constantly improve the picture quality . Here are several calculated frame rates fps Methods .

One 、 Fixed time frame method

In fact, the core of this method is 1s How many frames have been refreshed in , Completely regardless of other equipment , Calculate the frame rate relative to the reference , The most accurate method can also be called dps, namely data per second.

The formula for calculating the frame rate is :

fps = frameNum / elapsedTime;

If you record the number of frames in a fixed time , You can calculate the synchronization rate . This method is often used .

 picture

The fixed time is 1s, In fact, the accuracy of this method is relatively low , That is, there is no high-precision method to obtain the timestamp , In some methods that require high data , It is better to use the method of obtaining time with high accuracy .

There's another way to write it :

 picture

Two 、 Fixed frame time method

The formula for calculating the frame rate is :

原网站

版权声明
本文为[Rabbit cloud program]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202181333005358.html