Search Unity

Bug Applying lightmap at runtime causes incorrect smoothness values

Discussion in 'Universal Render Pipeline' started by b4gn0, Jan 2, 2021.

  1. b4gn0

    b4gn0

    Joined:
    Jul 26, 2019
    Posts:
    119
    Problem started since switching to URP 10 from URP 8.
    Manually applying a lightmap texture (by changing
    renderer.lightmap_index
    ) causes the renderer to completely ignore the MetallicGlossMap, and render it as if Smoothness is set to 1.

    upload_2021-1-2_12-23-13.png

    The material is correctly set to "Metallic Alpha":
    upload_2021-1-2_12-26-36.png
    Printing some debug info showed the associated metallic texture has the correct alpha values in its pixels.

    We are at a loss at what might be causing this, it happens only if:
    - Change the lightmapIndex at runtime
    - Renderer uses a material with MetallicGlossMap

    What can we do to pinpoint where the problem is?
    Unfortunately the code behind the lightmapIndex setter calls an extern function.

    Thank you