Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
sh0v0r's avatar
sh0v0r
Protege
13 years ago

FixedUpdate, Timestep & Camera Stretched Particles Issue

[Edit]
Looks like all I needed to do was turn on Interpolate on the rigidbody, my assumptions were correct still. So if you've got a cockpit or your OVRCamerController is attached to a rigidbody make sure its being interpolated.
-------------------------------------------------------------------------------------------------------------------------------
I made some interesting discoveries today which I thought would be of interest, maybe this hasn't been discovered before.

I am integrating Oculus into Lunar Flight and while adding camera stretched particles to help with the sense of movement and direction I had a problem with my particle system suddenly disappearing and then reappearing. I looked into solving this issue and made the assumption that it had something to do with the system being frustum culled somehow. But when I ran the build in a Window full screen the issue did not occur, it would only occur while wearing the Rift.

I thought about it a lot and then realised that the cockpit Camera is attached to a Rigidbody that is being updated in FixedUpdate but my Frame Rate was faster than the Fixed Timestep. I then realised that for several frames the camera did not move and therefore the particles did not get stretched in those frames.

I was using a Timestep of 0.016 for 60 FPS. I looked into the refreshrate of the rift display and found out it was 64hz, my monitor is 60hz. So there was a discrepancy of 4 frames with vsync. So I increased the Timestep to 65 thinking I would have one frame ahead and the camera would always have a new position and the particle would remain stretched.

This did reduce the time the particle system was missing (unstretched) but it was still ghosting a bit so I thought I would keep increasing the Timestep until they were solid. I arrived at 120FPS 0.0083, this almost resolved the particle stretching issues. It's much better but still seems fluctuate depending on the frame rate. It's always better when the frame rate is lower. I do suspect that there might be a VSync issue as I have on occasion noticed tearing but it doesn't always happen.

As a side effect I noticed something else, the Head Tracking felt more precise with a higher time step and then I realised that the same issue was effecting the Camera Rendering as it is attached to a Rigidbody. The Rigidbody wasn't being updated as fast as the world was being rendered and this introduced some sort of latency.

I'm not 100% about what's going on here but TLDR increasing the Fixed Time Step to 120 FPS when using a Camera attached to a Rigidbody is a good thing to do. My head tracking feels liquid smooth.

2 Replies

Replies have been turned off for this discussion
  • This is great information, thanks. I just noticed that some particles were not showing up on the OVR camera, it'll be interesting to see if the timestep is the issue.
  • "MikeArms24" wrote:
    This is great information, thanks. I just noticed that some particles were not showing up on the OVR camera, it'll be interesting to see if the timestep is the issue.


    Looks like I wasn't completely correct, it turns out I didn't have interpolate on the Rigidbody and this was the smoothing I was missing and trying to compensate for by increasing the Timestep.

    With Interpolate on the particles are now rock solid smooth.