Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Access lightmap index in shader

Discussion in 'Shaders' started by Zenix, Jun 11, 2017.

  1. Zenix

    Zenix

    Joined:
    Nov 9, 2009
    Posts:
    207
    Is there a way to access the lightmapindex in a cg shader? Using "unity_Lightmap" gives me the lightmap texture itself, but I need the index so I can use it to lookup a value in an array.
     
  2. simoose

    simoose

    Joined:
    Mar 22, 2013
    Posts:
    2
    Did you ever find a solution to this? A shader property set between batches would be really useful.
     
  3. Balikk

    Balikk

    Joined:
    Oct 23, 2014
    Posts:
    49
    Hi,
    You can get it in C# script and pass the value to the shader?
     
  4. Zenix

    Zenix

    Joined:
    Nov 9, 2009
    Posts:
    207
    I don't think I ever found a built in way.
     
unityunity