Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

How to get scale in lightmap?

Discussion in 'Shaders' started by SticklandPWorm, Jan 10, 2022.

  1. SticklandPWorm

    SticklandPWorm

    Joined:
    Apr 20, 2017
    Posts:
    17
    Hello

    Can anyone tell me how I would find the scaling unity applies to different object UV's in a lightmap from inside a shader please?

    Many thanks
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,061
    v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw;
     
  3. SticklandPWorm

    SticklandPWorm

    Joined:
    Apr 20, 2017
    Posts:
    17
    Thanks AcidArrow.

    Unfortunately I left out the word graph. How would I get the scale value from inside a Shader Graph?
     
    AcidArrow likes this.
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,061
    Right, sorry, no idea then, I haven't really used shader graph for anything non-trivial, hopefully someone else will chime in.