Search Unity

Resolved Change Spherical Harmonics in Realtime

Discussion in 'General Graphics' started by FOXAcemond, Dec 12, 2020.

  1. FOXAcemond

    FOXAcemond

    Joined:
    Jan 23, 2015
    Posts:
    99
    Hello,

    I'm trying to get the Lightprobes from my scene and change some spherical harmonics values.
    But no matter what I try, I cannot manage to see a difference in the scene. How exactly are we supposed to change them?

    The documentation says they can be changed at runtime: https://docs.unity3d.com/2020.2/Documentation/ScriptReference/LightProbes.html

    I tried this (among many other things):

    Code (CSharp):
    1. var probes = LightmapSettings.lightProbes;
    2. for (var i = 0; i < probes.count; i++) {
    3.     probes.bakedProbes[i].Clear();
    4. }
    5.  
    6. LightmapSettings.lightProbes = probes;
    Or this
    Code (CSharp):
    1. var probes = LightmapSettings.lightProbes;
    2. for (var i = 0; i < LightmapSettings.lightProbes.count; i++) {
    3.     LightmapSettings.lightProbes.bakedProbes[i].Clear();
    4. }
    I know I could use LightmapSettings.lightProbes = null if I wanted to wipe them out, but Clear should set the SH to 0, shouldn't it? Or some update method must be called afterwards? I already tried Tetrahedralize.
     
  2. FOXAcemond

    FOXAcemond

    Joined:
    Jan 23, 2015
    Posts:
    99
    RenanRL and fuzzy3d like this.