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.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Low Performance on Mobile VR Device

Discussion in 'Unity Render Streaming' started by HenryBech, Jul 1, 2021.

  1. HenryBech

    HenryBech

    Joined:
    Oct 7, 2020
    Posts:
    4
    I am trying to stream from a mobile VR device (Pico Neo 2) and it works, but when i start receiving the stream in a browser my framerate inside the mobile VR device drops from 72 fps to around 35 fps. The streams framerate seems to be fine. Now i am trying to get to a higher framerate.

    I tried:
    - turning on the hardware encoder on the RenderStreaming component
    - lower the Streaming Size on the Camera Streamer component
    - lower the framerate on the streaming camera with the CameraStreamer component ->
    Code (CSharp):
    1.    
    2.     public int fps = 20;
    3.     float elapsed;
    4.     Camera cam;
    5.  
    6.  
    7.     void Start()
    8.     {
    9.         cam = GetComponent<Camera>();
    10.         cam.enabled = false;
    11.     }
    12.  
    13.     void Update()
    14.     {
    15.         elapsed += Time.deltaTime;
    16.         if (elapsed > 1 / fps)
    17.         {
    18.             elapsed = 0;
    19.             cam.Render();
    20.         }
    21.  
    22.     }
    To manually start rendering did not seem to work. I think because the last rendered frame will be send over and over again. Are there any other options i can try to get better performance or is there a way i can edit the scripts in the package? if i try to edit them they will just reset.
     
  2. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    544
    Have you tried to analyze the performance with the profiler?
     
  3. HenryBech

    HenryBech

    Joined:
    Oct 7, 2020
    Posts:
    4
    Yes, rendering seems to be the problem. The only thing that helped so far was lowering the resolution of the stream.

    I attached screenshots of the profiler before and after i started the stream.
    Before stream:
    beforeStream.JPG
    After stream:
    afterStream.JPG
    My idea now would be to only use the main camera and to copy every other frame and send that instead, but since disabling the rendering of the camera that streams did not gave me better performance i do not think that the second camera is the problem.
     
  4. HenryBech

    HenryBech

    Joined:
    Oct 7, 2020
    Posts:
    4
    Edit: GPU usage does not seem to change.
    gpu.JPG
     
    dhruv_unity154 likes this.
  5. dhruv_unity154

    dhruv_unity154

    Joined:
    Feb 11, 2022
    Posts:
    14
  6. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    544
    Great. This profiling result is so useful for us to make our plans. It shows that there are some issues about CPU load optimization on mobile platforms (iOS, Android). We need to raise the priority of our tasks for that.
     
    dhruv_unity154 likes this.
  7. dhruv_unity154

    dhruv_unity154

    Joined:
    Feb 11, 2022
    Posts:
    14
    Yes. Please prioritise this to make stable fps. This is require and most useful feature for use in mobile platforms Android iOS. Also on VR Device like Oculus and etc.