Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Determine light type via define?

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

  1. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    2,061
    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:
    7,642
    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.