Search Unity

Determine light type via define?

Discussion in 'Shaders' started by xVergilx, Oct 16, 2019.

  1. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Is there a way to determine which type of light is currently being processed by the shader variant (Realtime / Baked)?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    See the first #if in AutoLight.cginc
    https://github.com/TwoTailsGames/Unity-Built-in-Shaders/blob/master/CGIncludes/AutoLight.cginc
    Code (csharp):
    1. #if !defined(POINT) && !defined(SPOT) && !defined(DIRECTIONAL) && !defined(POINT_COOKIE) && !defined(DIRECTIONAL_COOKIE)
    And Lighting.cginc
    https://github.com/TwoTailsGames/Unity-Built-in-Shaders/blob/master/CGIncludes/Lighting.cginc
    Code (csharp):
    1. #if defined(UNITY_SHOULD_SAMPLE_SH) || defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
    There's also a
    DIRLIGHTMAP_COMBINED
    , but
    LIGHTMAP_ON
    will also be true when that is.
     
    xVergilx likes this.