Search Unity

Objects with same material with normals don't render properly

Discussion in 'Universal Render Pipeline' started by Cornel3, Oct 30, 2019.

  1. Cornel3

    Cornel3

    Joined:
    Sep 3, 2014
    Posts:
    7
    I couldn't find the answer on the internet / this forum / by myself so I hope there are some great people to help me

    I'm trying to make 2D game in Unity with realtime lighting and hand-painted normal maps using newest LWRP (tried URP too). It's all working great if I have only one object with the same material in the view. Doesn't matter if it's scene or game view. It just has to be one object with that material being rendered. I can rotate it and normals rotate too.
    The problem appears if I add second object with the same material and rotate it. It looks like Unity is batching it and uses one material for both objects despite they are illuminated differently.

    Am I missing some crucial elements of those renderer pipelines or is it just bug?

    Any ideas how to solve it?
     

    Attached Files:

  2. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,684
    SRP batcher enabled?
     
  3. Cornel3

    Cornel3

    Joined:
    Sep 3, 2014
    Posts:
    7
    Tried enabling and disabling SRP batcher and Dynamic batching in Universal Renderer Pipeline Asset - no difference.
     
  4. Cornel3

    Cornel3

    Joined:
    Sep 3, 2014
    Posts:
    7
    Ok, I found the simple solution. I just added "DisableBatching" = "True" to Sprite-Lit-Default shader...

    However, adding this to ShaderGraph was a little trickier but managed to do this too.

    Thanks eizenhorn for this hint!
     
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,750
    Sounds like a bug though, theoretically disabling all other forms of batching in the pipeline asset should have disabled batching.