您的位置:首页 > 其它

VR系列——Oculus Rift 开发者指南:三、Oculus Rift的渲染(五)

2017-06-01 21:46 330 查看

帧计时

Oculus SDK通过ovr_GetPredictedDisplayTime方法来记录帧计时信息,该方法依赖应用程序提供的帧索引来确保不同线程的计时正确。

头部运动预测需要精确的帧数据和传感器时间,这对良好的VR体验来说是必需的。预测要准确地知道当前帧会在将来的哪个时候出现。如果我们知道传感器和显示器的扫描时间,我们可以预测出将来的头部动作,提高图像的稳定性。若这些值计算错误,可能会造成过少或过度预测,画面延迟的可能性增加,并可能导致画面过度“摇晃”。

为确保时间准确,Oculus SDK使用绝对系统时间,一式两份,来表示传感器和帧计时的值。ovr_GetTimeInSeconds返回当前的绝对时间。但是当前时间要尽量少用,因为仿真和动作预测使用ovr_GetPredictedDisplayTime函数返回时间值,这个时间值比当前时间更准确。函数的签名如下:

ovr_GetPredictedDisplayTime(ovrSession session, long long frameIndex);


参数frameIndex用来指定要渲染的应用帧。使用多线程渲染的应用必须内置帧索引,并手动增量,将帧索引和帧数据一起传递给线程,来确保时间和预测准确。同样的,frameIndex值也要传递给ovr_SubmitFrame函数,为帧数据提供时间值。更多关于多线程计时的内容将在下一章“不同线程上的渲染”(第19页)中介绍。

frameIndex的特殊值0在函数中可用于请求SDK自动记录帧索引。但这只能在所有帧时间发出请求且同一线程内的渲染提交都已完成的情况下运行。

原文如下

Frame Timing

The Oculus SDK reports frame timing information through the ovr_GetPredictedDisplayTime function, relying on the application-provided frame index to ensure correct timing is reported across different threads.

Accurate frame and sensor timing are required for accurate head motion prediction, which is essential for a good VR experience. Prediction requires knowing exactly when in the future the current frame will appear on the screen. If we know both sensor and display scanout times, we can predict the future head pose and improve image stability. Computing these values incorrectly can lead to under or over-prediction, degrading perceived latency, and potentially causing overshoot “wobbles”.

To ensure accurate timing, the Oculus SDK uses absolute system time, stored as a double, to represent sensor and frame timing values. The current absolute time is returned by ovr_GetTimeInSeconds. Current time should rarely be used, however, since simulation and motion prediction will produce better results when relying on the timing values returned by ovr_GetPredictedDisplayTime. This function has the following signature:

ovr_GetPredictedDisplayTime(ovrSession session, long long frameIndex);


The frameIndex argument specifies which application frame we are rendering. Applications that make use of multi-threaded rendering must keep an internal frame index and manually increm
4000
ent it, passing it across threads along with frame data to ensure correct timing and prediction. The same frameIndex value must be passed to ovr_SubmitFrame as was used to obtain timing for the frame. The details of multi-threaded timing are covered in the next section, Rendering on Different Threads on page 19.

A special frameIndex value of 0 can be used in both functions to request that the SDK keep track of frame indices automatically. However, this only works when all frame timing requests and render submission is done on the same thread.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐