Skip to content

Set Application.targetFrameRate to display refresh rate #50

Open

Description

@DuFF14

https://github.com/OSVR/OSVR-Unity/blob/master/OSVR-Unity/Assets/OSVRUnity/src/VRHead.cs#L199

Application.targetFrameRate should be set to the refresh rate of the display. I believe the plan is for this to be added to the display descriptor along with other properties necessary for rendering updates.

Might also want to consider setting Time.fixedDeltaTime to 1/Application.targetFramerate. Our default TimeManager.FixedTimestep is set to 0.016667 or 60Hz, but someone using a DK2 might want this set at 75Hz.

http://www.reddit.com/r/oculus/comments/2odahu/unity_developers_change_your_fixed_timestep_to/
http://docs.unity3d.com/Manual/TimeFrameManagement.html (fixed timestep section)

Activity

  1. heptamind commented on Jun 5, 2015

    @heptamind

    I don't think we need to change the Time.fixedDeltaTime, as it is independent from rendering framerate. It is used for physics and related things.

    Edit: I should have read the reddit post before commenting...
    I still think we should leave it to the developers using OSVR and maybe mention it in our readme file.

  2. rpavlik commented on Jun 5, 2015

    @rpavlik
    Member

    Once/if this data is available from the display, it seems reasonable to do this.

  3. chase-cobb commented on Apr 1, 2016

    @chase-cobb

    Why not turn on vsync in this case?

    Fixed timestep is adjustable by the developer, and should be to optimize physics. This is also affected by modifying the time scale.
    http://docs.unity3d.com/ScriptReference/Time-fixedDeltaTime.html

  4. DuFF14 commented on Apr 1, 2016

    @DuFF14
    MemberAuthor

    Vsync should be enabled in RenderManager, but having it on in Unity is a choppy experience for me. The fixed timestep thing was something that developers were recommending that seemed to make things feel better (sometimes?).

    I had an issue open regarding looking into the timing of Unity's vsync setting. Dunno if it's worth re-opening the issue, it's more of a to-do #76

  5. chase-cobb commented on Apr 1, 2016

    @chase-cobb

    The fixed timestep is a slippery slope and I would caution against it. It primarily changes the resolution rate of physics interactions. So in physics heavy games it can drag performance way down, if the game is already on the fence. Ideally, developers should be able to freely tweak this setting to best suit their game/experience.

    Can the server expose the display timings to the client? That seems like a more scale-able solution.

  6. DuFF14 commented on Apr 1, 2016

    @DuFF14
    MemberAuthor

    A DisplayInterface is on the roadmap for 1.0, not sure what the current status is OSVR/OSVR-Core#35

    I think we could get the value from RenderManager as a workaround. Did a qucik test in Unity Palace Demo -- if I set Application.targetFrameRate to 75 and run in DirectMode on the DK2, it looks much better (less tearing) than if the framerate is not set (the default right now).

    I don't know if the timestep trick is still applicable, that was from before we had a RenderManager and might even have been a bug in an earlier version of Unity where Physics interpolation was not compensating for Physics update rates that were slower than the refresh rate. I agree we should leave it up to developers to set it, but it's worth noting if there's an observed effect in Unity.

    As a side note, the asset store version comes with the uploaded Unity Project Settings because it's in the "Complete Projects" category on the Asset Store. I'd prefer to be in the "Scripting" category and have an in-editor gui for changing any relevant project settings, similar to the SteamVR Unity plugin.

  7. DuFF14 commented on Apr 5, 2016

    @DuFF14
    MemberAuthor

    It looks like SteamVR has an option for setting the physics update rate equal to the display refresh rate, on by default, and Application.targetFrameRate = -1
    https://github.com/ValveSoftware/openvr/blob/master/unity_package/Assets/SteamVR/Scripts/SteamVR_Render.cs#L397

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions