Search Unity

Emissive modes is broken in Standard shader

Discussion in 'Global Illumination' started by homerender, Sep 4, 2018.

  1. homerender

    homerender

    Joined:
    Sep 14, 2012
    Posts:
    182
    Hi. I'm working on scene lightmapping and found a big problem. I need some objects with emission and bloom effect, but I do not need to affect it to the baked lighting. In this case I'm always used Realtime emission mode. But now even if it's enabled, emission from material anyway baking into lightmap like in Baked mode... Also this lighting looks terrible, many leaks and bugs.

    Unity 2018.2.5f1

    Screenshot_3.jpg

    And another test in a simple scene:

    Enlighten + emissive Baked:

    enlighten_em_baked.jpg

    Enlighten + emissive Realtime (after full rebake of course):

    enlighten_em_realtime.jpg

    Progressive + emissive Baked:

    progressive_em_baked.jpg

    Progressive + emissive Realtime:

    progressive_em_realtime.jpg

    As you can see, this bug happens only in Enlighten. Realtime emission mode work the same like a baked. Progressive render works fine with emission modes. (And for some reason we can't use Progressive in our game project). I hope guys from Unity will fix that very soon...
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    11,043
    This isn't a bug, this is explicitly what the Realtime setting under the emissive property enables. If you don't want it to affect the global illumination, set that option to None.

    https://docs.unity3d.com/Manual/StandardShaderMaterialParameterEmission.html

    The setting only matters if it's used on a static game object. It's possible in the past you weren't baking with real time precomputed GI enabled in the scene's lighting setting, or were applying the material to non-static objects, both of which disable this feature.
     
  3. homerender

    homerender

    Joined:
    Sep 14, 2012
    Posts:
    182
    I'd really like you to be right, but there's no option None, it was missed many time ago...

    Без имени-1.jpg

    And anyway emissive mode should work equally between enlighten and progressive, but it doesn't.
     
    Last edited: Sep 5, 2018
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    11,043
    Well, they removed that option and didn't update the documentation. Lovely. As I said before, setting that to Realtime enables the use of Precomputed Realtime GI for that object. If you don't want it to affect the lighting around it, you'll need to set the object to not be static (or, more explicitly, not be Lightmap Static). That will disable it from affecting the lightmap, in either realtime or baked mode. You could also set it to be baked with a black emissive color, then enable the emissive via script at runtime. It's unfortunate that None was removed as it would have handled this as you wanted without any other modifications.

    Realtime Precompute GI is essentially the singular unique feature of Enlighten that no other lightmapping solution has an equivalent for. Technically you can have both the progressive lightmapper and realtime precomputed GI enabled, this just means both the progressive lightmapper and Enlighten are enabled at the same time.

    It should be noted that the reason for the light leaking is that the realtime lightmap is significantly lower resolution than the baked lightmap.
     
    hopeful likes this.
  5. homerender

    homerender

    Joined:
    Sep 14, 2012
    Posts:
    182
    I need to bake this objects witch has emissive materials without affecting to lightmap like it was in None mode. I'm not using Realtime GI, it's disabled. And I has too many objects and materials in a whole project in a different folders, I can't anytime turn it off before lightmapping, it's a stupid. I want None mode back or fixed Realtime mode...
     
    Last edited: Sep 5, 2018
    AlanOToole likes this.
  6. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    11,043
    Well, you can still do this, by working around Unity's custom inspector.

    Select your material. Right click on the inspector tab and select "Debug". You'll now see a list of properties, including one called "Lightmap Flags" or "m_LighmapFlags". Set that value to 0. Right click on the inspector tab (now showing "Debug") and set it back to "Normal". In the material inspector it'll now show nothing for the Global Illumination option. If you click on that again, it'll set it to realtime or baked, but it is now in None mode.
     
    dnnkeeper and hopeful like this.
  7. homerender

    homerender

    Joined:
    Sep 14, 2012
    Posts:
    182
    Thanks, will try it tomorrow. Sounds much better then wait for a few years while Unity devs will fix that...
     
  8. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,320
    Hi! The reason the progressive lightmapper is behaving differently with materials set to realtime emissive is bug 1056171 that I fixed this week. I am working on getting the docs updated so the None option is not confusing people. Please note that the None option is still available in the scripting API https://docs.unity3d.com/ScriptReference/MaterialGlobalIlluminationFlags.html. @bgolus suggestions for working around are good and I would recommend you try setting the material to https://docs.unity3d.com/ScriptReference/MaterialGlobalIlluminationFlags.EmissiveIsBlack.html in a script.
     
  9. homerender

    homerender

    Joined:
    Sep 14, 2012
    Posts:
    182
    Glad to hear it, when we can download patch?
     
  10. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,320
    The fix will appear in 2019.1 alpha1 and will be backported to 2018.2/2018.3 soon.
     
unityunity