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.

Bug One of my reflection probes cause huge fps drop

Discussion in 'High Definition Render Pipeline' started by JanMarm, Apr 9, 2021.

  1. JanMarm

    JanMarm

    Joined:
    May 10, 2020
    Posts:
    2
    Hi, I created a room for VR visualisation in Unity 2020.3.3f1 with HDRP 10.4.0. I added two reflection probes (non-planar) to it with type set to "Realtime" and realtime mode set to "On Demand". I don't know why but first probe cause framerate drop from 45fps to 7fps (when I disable it fps instantly grows), the second one is absolutely ok.

    I'm using this code to bake the probes on Awake() and when I click a button in the inspector:

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Rendering.HighDefinition;
    3.  
    4. public class LightingSettings : MonoBehaviour
    5. {
    6.  
    7.     public HDProbe[] Probes;
    8.  
    9.     private void Awake()
    10.     {
    11.         BakeProbes();
    12.     }
    13.  
    14.     public void UpdateLighting()
    15.     {
    16.         BakeProbes();
    17.     }
    18.  
    19.     private void BakeProbes()
    20.     {
    21.    
    22.         foreach (HDProbe probe in Probes)
    23.         {
    24.             probe.RequestRenderNextUpdate();
    25.         }
    26.        
    27.     }
    28.    
    29. }
    Code (CSharp):
    1. using UnityEditor;
    2. using UnityEngine;
    3.  
    4. [CustomEditor(typeof(LightingSettings))]
    5.  
    6. public class LightingSettingsEditor : Editor
    7. {
    8.  
    9.     public override void OnInspectorGUI()
    10.     {  
    11.         base.OnInspectorGUI();
    12.  
    13.         LightingSettings lightingSettings = (LightingSettings)target;
    14.  
    15.         if (GUILayout.Button("Update lighting"))
    16.         {
    17.             lightingSettings.UpdateLighting();
    18.         }
    19.        
    20.     }
    21.  
    22. }
    Probe enabled:
    fps1.png
    Probe disabled:
    fps2.png
    PS: In advance sorry for my english.