游戏邦在:
杂志专栏:
gamerboom.com订阅到鲜果订阅到抓虾google reader订阅到有道订阅到QQ邮箱订阅到帮看

解析游戏中的帧率与刷新率等不同概念

发布时间:2012-12-03 13:59:48 Tags:,,,,

作者:Roger Haagensen

帧率和刷新率,游戏和电影都是不同的。为什么24帧/秒的电影比60赫兹的游戏更加出色?真实的动态模糊vs.虚拟的动态模糊,30帧/秒vs.60帧/秒的游戏,到底存在着何种不同?

电影与光速

不管是主机游戏还是PC游戏的引擎都会处理光的时间片。电影也需要面对光速。也就是意味着电影院中的电影的帧率仅为24帧/每秒,其中每帧的光速为1/24th秒。而游戏的帧率为30帧/秒,每帧的光速却达到1/1000th秒。60帧/秒的游戏亦是如此。

“曝光时间”

怎么会这样?熟悉摄影的人应该都很了解“曝光时间”。而对于一般人来说,这便意味着将1000帧除以24而获得24组41.66+的“帧”,并将这41+的帧整合到一个单一的帧中。基于这种方法我们便能够在1/24th秒中看到“所有的”光——即使帧率仅为24帧/秒。

渲染

电子游戏也能利用这一原理,就像我就看过帧率为1000帧/秒的游戏。但是实际上我并不认可那些起初基于较高帧率进行渲染并在之后混合压缩帧的游戏。答案很简单,因为这么做只会浪费资源,即使硬件拥有足够能力,你也仍需呈现出较高帧率(如60帧/秒)。如果硬件能够更快地进行渲染(快于60帧/秒),并且刷新率为60赫兹,而渲染引擎也支持混合,你便能够通过两次渲染而获得更棒的“胶片”动态模糊效果。

计算机模拟

那么计算机能否模拟这种“动态模糊”效果?当然可以。但是与胶片曝光不同的是,游戏只能基于帧去创造动态模糊(换句话说也就是基于30帧/秒而使用模糊效果进行渲染)。的确也有许多开发者尝试着使用游戏世界的细节内容去调整帧间的模糊效果。如果设置合理的话,带有帧间模糊的30帧/秒的游戏将呈现出60帧/秒的最终效果。同样也有许多游戏正在使用这种方法。但是因为计算机还不能基于稳定帧率去播放电影,所以这仍是开发者需要面对的一大问题。

基于毫秒的时间设定

出现这种时间问题的一部分原因便是NTSC并未达到60赫兹。我们总是能够很轻松地处理50赫兹的刷新时间。1000毫秒除以50赫兹=20毫秒/帧,但是基于NTSC你便会获得一个相反的数值。为什么这是问题所在?60赫兹(或59.97赫兹)是个很正常的数值,1000除以60=16.66+,并且因为大多数时间都是基于毫秒,所以我们可以围绕着16.66去思考如何解决问题。就像许多游戏引擎都通过在15至17毫秒之间做调整而努力达到60赫兹的效果。如果是基于30帧/秒的帧率,这种问题便不是那么明显了,但是这时候的动画也会显得较为呆板,并且视觉反馈vs.用户输入速度也会变得更加缓慢。

帧率和刷新率

不要将帧率与刷新率混淆在一起。刷新率是指我们能够看到的显示器(如显示卡,TV或监视器)的更新。而帧率则是指经过渲染的每秒的帧速。渲染过多帧(比起刷新率而言)便意味着浪费更多资源,并在最后不得不抛弃那些无用的帧。我们总是希望能够基于所使用设备的原生率去设定刷新率,并顺畅地渲染帧率。例如刷新率为120赫兹而帧率为60帧/秒,或刷新率为60赫兹帧率为24帧/秒。刷新率越高也就意味着游戏的反应越快。但是很遗憾的是,许多游戏所设定的帧率和刷新率都不能有效地做到这一点。

特定时刻的时间片

我们必须记住,电影的帧是指在一段时间内闪烁的光,而计算机/主机游戏的帧则是特定时刻的时间片。1秒=1000毫秒,而毫秒经常被用于为计算机上的视频定时。胶片帧(24帧/秒)占据着照相机光速的1/24th秒,并且也并非与1000毫秒维系在一起,而是光速本身。所以比起将1000除以4,我们更应该用每秒的光速去除以24。光速为299792458米每秒,所以基于24帧/秒在1米远的距离进行拍摄也就意味着光到达照相机的刷新率为299792458赫兹。

较高的成本

anti-aliasing(from hi-techmall)

anti-aliasing(from hi-techmall)

那么真正的胶片模糊(也就是胶片效果)是否能够用于游戏上?我们终有一天能够实现这一点。多年来我们一直在使用Anti-Aliasing(游戏邦注:指对图像边缘进行柔化措置,使图像边缘看起来更滑腻,更凑近什物的物体)去完善游戏的外观,它能够基于较高的分辨率(相较于显示器)去渲染帧,随后再按比例进行压缩。并且在压缩过程中像素将被整合在一起。这与渲染较高帧率再混合帧的做法并不一样。但是要做到这一点却需要较高的成本。是否存在有效的解决方法呢?考虑到计算机硬件(和软件)拥有anti-aliasing和镶嵌状格局(使用暗示去创造更多细节),我们也可以基于帧率创造出一些类似的效果。

帧率与刷新率相互独立

硬件和软件可以利用帧(或者说场景)暗示去创造帧间。但是因为这时候仍然存在着稳定的帧率问题,所以开发者仍需要投入更多时间去平衡帧率和刷新率。最关键的是确保帧率与刷新率相互独立,并且用户输入时间设定也需要与这两者相互分离。而Anti-Aliasing(高DPI显示器便不需要),镶嵌状格局,完善的时间设定以及帧间混合将能够让游戏上的胶片效果变成一种可能。

本文为游戏邦/gamerboom.com编译,拒绝任何不保留版权的转载,如需转载请联系:游戏邦

Framerate and Refresh, games and movies are not the same.

by Roger Haagensen

Framerate and Refresh, games and movies are not the same. Why does a 24FPS movie look better than a 60Hz game? Real motion blur vs fake motion blur. 30FPS vs 60FPS gaming. What is the difference?

I read this recently, Capcom Explains Why 30 FPS Isn’t That Bad, and I’m sorry to say that I think this is pure nonsense.

A movie deals with light over time.

Pretty much any game engine for consoles or PC deals with time slices of light. A movie deals with light over time. What this means is that a movie at the cinema which “only” has 24 FPS (Frames Per Second) with 1/24th of a second of light per frame. While a game has (crudely explained) 30 FPS of 1/1000th of a second of light per frame. The same is true with 60 FPS.

You get to see “all” the light during 1/24th of a second despite only having a 24 FPS rate.

How can this possibly be so? Well, those familiar with photography should know the term “exposure time” quite well. For the rest of you this means that if you took 1000 frames and divided by 24 you would get 24 sets of about 41.66+ “frames”, now those 41+ frames are blended into a single frame. This way you get to see “all” the light during 1/24th of a second despite only having a 24 FPS rate. Please note that although I’m saying “blend” this is not really true, check wikipedia for how film exposure really works as that article explains much better than I’m currently able to do.

I’ve yet to see a 1000FPS capable game.

A computer game would have to replicate this, and I’ve yet to see a 1000FPS capable game. In fact I can not recall any games that render at a higher FPS and blend down frames. Why? That is simple to answer, it would be wasting resources and you might as well show the frames at a higher rate instead (like 60FPS) if the hardware can handle it. Now if the hardware is able to render faster than 60FPS and the refresh rate is 60Hz and the rendering engine supported blending, then you could in theory get very good looking “film” motion blur by rendering twice as much.

Unlike film exposure a game just create a morphed blur over frames.

So what about the motion blur, can’t computers fake the “movie blur” as well? Yeah they can. But unlike film exposure a game just create a morphed blur over frames (in other words 30FPS rendering with blur effect applied). I’m sure there are developers trying to use game world details to help tweak the interframe blur. And if done well a 30FPS game with interframe blur and displayed at 60FPS could look good. But again, I’ve yet to see this in any current games. Computers has enough issues keeping a steady framerate playing regular movies, so tackling this is obviously a major issue.

A lot of timing is millisecond based.

Part of the reason for these timing issues is the NTSC not-quite-60Hz problem. The PAL (and majority of the rest of the world) 50Hz refresh timing is easier to handle. After all 1000ms / 50Hz = 20ms per frame, with NTSC you get a fractional number instead. Why is this an issue? Well 60Hz (~59.97Hz) is very common, and 1000/60=16.66+ and as a lot of timing is millisecond based you can imagine the issue with matching 16.66. A lot of game engines try to compensate by varying between 15 and 17 ms so that over time it evens out to 60Hz. At 30FPS this jerkyness is less noticeable, but animation feels more stiff instead, and visual feedback vs user input is slower.

Do not confuse frame rate with refresh rate.

Also do not confuse frame rate with refresh rate. Refresh Rate refer to the rate at which a display (like a graphics card or TV or monitor) update what you see. While frame rate refer to how many frames per second is rendered. And rendering more frames than the refresh is just wasting resources as frames will then get discarded as they can not be shown. Ideally you want the refresh rate set to the native rate of whatever devices you use, and the frame rate to what can be smoothly rendered. This can mean 60FPS at 120Hz, or 24FPS at 60Hz. A high refresh rate generally makes a game feel more responsive. (there are ways to avoid this even at low refresh rates though) Sadly many games have the frame rate and refresh rate locked which ternd to decrease responsiveness.

With film/cinema a frame is light over a period of time, while a computer/console game a frame is a slice from a particular moment in time.

So please remember that with film/cinema a frame is light over a period of time, while a computer/console game a frame is a slice from a particular moment in time. Oh and 1000 is how many milliseconds there are in a second, milliseconds (or ms for short) are often used for timing of video on computers. A film frame (24FPS) contains 1/24th of a second of all light the camera see, and is not tied to 1000ms, it is instead tied to the speed of light itself (or spectrum of captured light). So instead of dividing 1000 by 24 it would be more correct to take the speed of light per second and divide that by 24. Light moves at 299792458 meters per second, so filming something 1 meter away at 24FPS means the light reaching the camera has a refresh rate of 299792458Hz. Obviously the math is weird on this as it’s not easy to translate light to refresh rate, but it’s just a very rough example.

Very costly computationally.

Will real film blur (aka the film look) ever be possible with games? Yes, one day they will. For many years now Anti-Aliasing has been used to improve the look of games/rendering, in it’s most basic form this render a frame at a resolution higher than the display, then scale down. When it’s scaled down the pixels are blended. This is not unlike how rendering at a higher framerate and then blending frames would be done. But doing it like that is very costly computationally. So what is the solution? Considering how computer hardware (and software) has anti-aliasing and tesselation (creates more detail using hints), something similar should be possible with frame rates as well.

The key is to keep the framerate and the refreshrate independent of each other and keep user input timings separate from both of them.

Hardware or sotware could be made that uses frame (or rather scene) hints to create interframes. There is still the issue of a stable framerate, and computers will probably struggle a long time with that before framerate timing vs refresh rate is fully smooth, some developers get it right while many don’t. The key is to keep the framerate and the refreshrate independent of each other and keep user input timings separate from both of them. With Anti-Aliasing (not needed for really high DPI displays), Tesselation, improved timing, and in the near future (I hope) with Interframe Blending (my term for it) getting that film look should indeed be possible.(source:gamasutra)


上一篇:

下一篇: