twlomega

Unity 5; Lightprobe Gamma Hack (For Mobile)

Aug 26th, 2015
683
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.Rendering;
  3. using System.Collections;
  4.  
  5. public class LightProbeGammaHack : MonoBehaviour
  6. {
  7.     //adjust this, in all of our levels this seems to be a good sane value on Android
  8.     public float scaleValue = 0.078125f;
  9.     void Start()
  10.     {
  11.         //used to just scale all probes down once; we don't do this in editor. (because otherwise you have to reload the scene to get the unmodified probes back)
  12.         //for editor testing, I scale them with the toolbar once after a full light bake.
  13. #if !UNITY_EDITOR
  14.         SphericalHarmonicsL2[] bakedProbes = LightmapSettings.lightProbes.bakedProbes;
  15.         for (int i = 0; i < bakedProbes.Length; i++)
  16.             bakedProbes[i] *= scaleValue;
  17.            
  18.         LightmapSettings.lightProbes.bakedProbes = bakedProbes;
  19. #endif
  20.     }
  21. }
Add Comment
Please, Sign In to add comment