Search Unity

Moving emissive texture and GI (hdrp)

Discussion in 'Global Illumination' started by S4UC1SS0N, Jul 7, 2019.

  1. S4UC1SS0N

    S4UC1SS0N

    Joined:
    May 29, 2014
    Posts:
    49
    Hello,

    I'm trying to get a moving emissive texture to emit light on a baked floor (static). I choose "Emission > Global Illumitation > realtime" in the Material using my HDRP unlit shader (i didn't quite figure out when baked is for).

    upload_2019-7-7_10-39-30.png


    When i tweak the offset in the inspector, i see the emitted light moving on the ground, but when the animation is shader based, it doesn't :



    Here i use a simple time sin node of the x offset of the uv.

    I looks like Unity is updated someting on the GI in editor when there is a inspector change and is not doing it continuously at runtime.

    How can one, achieve this kind of moving light from a texture ? Thank you !
     
    Last edited: Jul 7, 2019
  2. S4UC1SS0N

    S4UC1SS0N

    Joined:
    May 29, 2014
    Posts:
    49
    For people looking for a solution, Nomcycle mentioned this on Discord :

    https://docs.unity3d.com/ScriptReference/RendererExtensions.UpdateGIMaterials.html

    I guess it can be dangerously expensive but i did that :

    Code (CSharp):
    1. using System.Collections.Generic;
    2. using UnityEngine;
    3.  
    4. [ExecuteInEditMode]
    5. public class EmissiveUpdater : MonoBehaviour
    6. {
    7.     public List<Renderer> renderers = new List<Renderer>();
    8.  
    9.     private void Update()
    10.     {
    11.         foreach (var renderer in renderers) {
    12.             renderer.UpdateGIMaterials();
    13.         }
    14.     }
    15. }
     
    Last edited: Jul 7, 2019
    thefranke likes this.