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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Bumped Specular Legacy Shader weird reflection artifacts when using normal map

Discussion in 'Shaders' started by Gooren, Apr 22, 2016.

  1. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    324
    Hello guys,

    I have a problem with the Bumbed Specular Legacy Shader. Problem can be observed from following screenshots (top image - with normal map; bottom image - without normal map) and also here with normal map again.

    Unity versions I tried are: Unity 5.4.0b13 and Unity 5.4.0b15

    This weird "chess board" glitch is visible only in the place where reflection happens and only when I am using my normal map.

    Do You have any idea why this happens?

    Thanks,
    Steven
     
    Last edited: Apr 22, 2016
  2. cblarsen

    cblarsen

    Joined:
    Mar 10, 2007
    Posts:
    266
    Looks like a precision problem.
    When you are using a bumpmap, some vectors are transformed into tangent space, and that is probably done a little inexactly for the sake of performance.

    It looks like Unity is using half3 vectors to represent both viewDir and lightDir through all lighting calculations.
    I think maybe using float3 vectors would solve it, but it would take me several hours to rewrite the lighting framework to be higher precision. And the result would be a very ugly shader.

    What you might do is add a little noise to the smooth parts of your cubemap to hide the artifacts.
     
  3. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    324
    ETC1 texture compression on my normal map was the cause here! Thank You for Your effort anyway :) Entirely my fault in the end.