Search Unity

Question Emissive texture Realtime GI update

Discussion in 'Global Illumination' started by beatdesign, Jun 5, 2020.

  1. beatdesign

    beatdesign

    Joined:
    Apr 3, 2015
    Posts:
    137
    I am able to change the material Emissive texture in realtime, but I can't update realtime GI accordingly.
    This is the original mat emissive value (without texture), the game view and the lit clustering view: matWOEmissiveTexture2.jpg matWOEmissiveTexture.jpg

    If I change the emissive texture in Editor mode, game view and lit clustering are changed in the right way: matWithEmissiveTextureChangedEditor.jpg

    But if I start from the material without emissive texture, and in realtime I try to change the emissive texture, I obtain this: matWithEmissiveTextureChangedRealtime.jpg

    as you can see, lit clustering is wrong. To update emissive texture I did this (i'm using the standard shader):

    Code (CSharp):
    1. MeshRenderer.sharedMaterial.SetTexture("_EmissionMap", NewEmissionMap);
    2. MeshRenderer.sharedMaterial.SetColor("_EmissionColor", White);
    3. DynamicGI.SetEmissive(MeshRenderer, White);
    4. RendererExtensions.UpdateGIMaterials(MRenderer);
    5.  
    Am I missing something?
     
  2. beatdesign

    beatdesign

    Joined:
    Apr 3, 2015
    Posts:
    137
    Anyone?
     
  3. beatdesign

    beatdesign

    Joined:
    Apr 3, 2015
    Posts:
    137
  4. beatdesign

    beatdesign

    Joined:
    Apr 3, 2015
    Posts:
    137
    Sorry guys. I really can find anything on this argument. Is it possible that I am the only one that is asking something on this topic? O_O
     
  5. Reshima

    Reshima

    Joined:
    Dec 10, 2012
    Posts:
    51
    I'm not expert in this area but realtime GI is actually precomputed realtime GI, meaning it saves data when you bake to be used in realtime later. So if you change materials with emissive textures in realtime it won't be correct when you play because it wasn't baked like that in the first place. Not sure what you're trying to achieve but maybe you should take a different approach.
     
  6. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    AFAIK the real-time GI only works for lights, not emissive textures. Which makes sense, since it's done on the CPU and sampling textures would be very expensive, so it pre-calculates surface information instead.
     
  7. intrepidolivia

    intrepidolivia

    Joined:
    Aug 22, 2018
    Posts:
    3
    Emissive textures work for realtime GI too, you just have to set its Emissive Intensity value above 0.
     
    beatdesign likes this.
  8. beatdesign

    beatdesign

    Joined:
    Apr 3, 2015
    Posts:
    137
    You're right. But... have you figured it out how can I update at runtime the precomputed realtimeGI for an emissive texture that is changing?