Search Unity

Access lightmap index in shader

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

  1. Zenix

    Zenix

    Joined:
    Nov 9, 2009
    Posts:
    213
    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:
    213
    I don't think I ever found a built in way.
     
  5. FariAnderson

    FariAnderson

    Joined:
    Jan 20, 2020
    Posts:
    37
    any solution ?
     
  6. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
  7. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734