Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Need different frame rates

Discussion in 'AR' started by EricHFrazer, Jan 24, 2023.

  1. EricHFrazer

    EricHFrazer

    Joined:
    Jun 30, 2020
    Posts:
    20
    I need to do an AR simulation. I need to clock the scene at about 270 fps, to calculate the IMU and gyro signals I am synthesizing. But I only want to RENDER at 60hz. I need the 270fps physics calculations for the sensors above, but I don't need to render that frequently. How could I approach this?
     
  2. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    525
  3. EricHFrazer

    EricHFrazer

    Joined:
    Jun 30, 2020
    Posts:
    20
    Thanks! BUT - I need BOTH of them to be "fixed". I need the app to not run in real time, I need every frame rendered, no matter how long it takes. But I need the IMU timestemp to be 270HZ and the fixed render rate to be 60HZ. Can that be done?
     
  4. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    525
  5. EricHFrazer

    EricHFrazer

    Joined:
    Jun 30, 2020
    Posts:
    20
    I get it that fixed update is for physics and can be a higher frame rate, say 270. What I don't understand is that setting targetFrameRate will set the time between "Updates" to be a TARGET of the frame rate given, but they won't be exact. I need the time between Updates() to be exactly the same, and at a lower rate than FixedUpdate(). Can I do this?
     
  6. EricHFrazer

    EricHFrazer

    Joined:
    Jun 30, 2020
    Posts:
    20
    I think what I needed to do is this:
    Time.fixedDeltaTime = 1.0f / ImuFrameRate;
    Time.captureDeltaTime = 1.0f / VideoFrameRate;

    this seems to work, and in non-realtime. It seems to be working nicely!
     
    andyb-unity likes this.