Search Unity

Emmisive

Discussion in 'Shaders' started by echologin, Sep 3, 2017.

  1. echologin

    echologin

    Joined:
    Apr 11, 2010
    Posts:
    1,078
    I have this unlit vert/frag shader I would like to add "emissive" so it can give off light like the standard shader does ( baked and realtime to work with standard shader )

    Is this even possible ? been trying for last 6 hours with no luck
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    Yes. The thing is the color used by the baked lighting doesn't come from the usual vertex/fragment passes people are familiar with. Those come from a special "Meta" pass. See the Illumin-VertexLit.shader from the built in shader source for a basic example. However for realtime emission there's one more step that needs to be done. There's a flag that needs to be set on the material from script. Usually this is done with a custom material editor. It can be manually set via material.globalIlluminationFlags or automatically set with MaterialEditor.FixupEmissiveFlag().
     
    echologin likes this.
  3. echologin

    echologin

    Joined:
    Apr 11, 2010
    Posts:
    1,078
    Got it working THANKS !