Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Changing the Normal Map value does nothing 5.6.0b6

Discussion in '5.6 Beta' started by Griffo, Feb 3, 2017.

  1. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    HI,

    Now when I change the Normal Map value it does not change the look (bumpiness) of the model .. 5.6.0b6
     
  2. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
  3. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    @kemalakay Hi,

    I've tried both, Progressive Lightmapper and Enlighten.

    When I change the Normal Map value in the standard shader on any model it does nothing.

    So I opened a new project, put a plane and a sphere in the scene, made 2 materials, one for the floor and one for the sphere, added a albedo and a Normal Map, all looks fine, the tried changing the Normal Map value on both, no change.

    So I decided to export the package for you to have a look at, then I opened another new project and imported the package I'd just exported for you and guess what, yes now when I change the Normal Map values on both objects it works the bumpiness alters on the objects.

    So now I go back the the project I setup and still the same, no effect by changing the Normal Map values.

    So to me it looks like a bug, I can't send you my main project its just to big, I can't even think of exporting it then opening it in a new project to see if that will work because again its so big I think it would take ages.

    Could you please try what I have just done and see if you can reproduce it, thanks.
     
    Last edited: Feb 4, 2017
  4. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Hi @Griffo,

    Thank you for exporting the package but apparently, it's not attached to your post. Can you please upload it? I can gladly have a look at it.

    Thanks!
     
  5. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Hi @kemalakay

    Sorry, if you read my post again you will see that once I exported the project it worked, I could adjust the Normal Map value and see the difference.

    It was when I built the new project that the Normal Map value would not do anything so sending you the project would be useless.

    Can yo do as I did above and open a new project and put a plane and a sphere in the scene and see if it happens to you please.

    Like I said as my original project is so big I can't export it out then re-import it back in as with the results I got above that should then have the Normal Map values working again!!

    Thanks.
     
  6. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    I've still got this problem can not changing the normal map value does nothing .. 5.6.0b8
     
  7. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Hi @Griffo

    Please report this issue with your project as a bug or alternatively, send me your project through PM/here so I can have a look. We don't experience this issue with normal maps.

    Thanks
     
  8. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Hi @kemalakay

    OK, here is the file.

    Please create a new project, then import my custom package, open my Test_Scene_00.

    Now please go Materials, Floor_00, you will notice you can alter the Normal Map value and see it altering in the scene, all is ok.

    Now please go Build Settings and change platform to iOS, now try changing the Normal Map value, nothing happens.

    Switching the build back to PC the Normal Map value works again.

    I appreciate you help.

    My system is 5K iMac, macOS Sierra.

    Thanks.
     

    Attached Files:

  9. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    2,054
    As far as i'm aware this has always been the case, the Standard shader normalmap value is not supported on mobile platforms in order to reduce the performance cost. Instead you'll need to modify the source normalmap texture to your desired result.
     
  10. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Thats strange, because I don't remember the normalmap value not working before 5.6.0b6

    Also that seem a pointless exercise to remove it, as the user should have the decision to use it or not, and I'm sure most new mobiles will cope easily with normal maps ..
     
  11. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    2,054
    Well I know it was true as of 5.2 - 5.4 as I ran into the exact same problem. Not sure if it has been changed since, though I don't see why, since the decision due to performance issues is sound. However I do agree it would have been nice if Unity had provided developers an option to enable normalmap scaling or not in the shader on mobile.

    Edit: Checking the Unity Standard Shader source ( 5.6) I see that it has a check for shader level >= 30. So perhaps this only affects gles 2.0 level hardware which was my minimum spec. That might also explain why you didn't notice it before as the behavior of the shader can change depending on api support of the device you test on?
     
  12. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Hi @Noisecrime

    It's a bug .. Just got this from a bug report I sent in ..

    Hi,

    Thank you for submitting a bug to Unity.

    We have identified this issue as a duplicate of an existing known bug and we will be closing the issue. The information you have supplied will help us further in the resolution.
    You can track this bug in our issue tracker: https://issuetracker.unity3d.com/issues/editor-normal-map-gives-artefacts-on-mobile-platforms

    If you have further questions, feel free to contact us.

    Regards,
    Aurimas
    QA Team
     
  13. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    2,054
    Hmm, it might be, it might not. Getting a reproducible/duplicate report does not mean that Unity has confirmed its a bug, just that the behavior has been confirmed. Its quite likely that it might be passed onto a developer who will then say its by design, specifically in this case as a performance optimization for mobile. Alternatively they might decide that its no longer a performance issue with current hardware and fix it. Basically I'm just cautioning over expecting this to be addressed in the near future as it might not.

    However looking at the shader code again I noticed something I missed last time.

    Code (CSharp):
    1. half3 UnpackScaleNormal(half4 packednormal, half bumpScale)
    2. {
    3.     #if defined(UNITY_NO_DXT5nm)
    4.         return packednormal.xyz * 2 - 1;
    5.     #else
    6.         half3 normal;
    7.         normal.xy = (packednormal.wy * 2 - 1);
    8.         #if (SHADER_TARGET >= 30)
    9.             // SM2.0: instruction count limitation
    10.             // SM2.0: normal scaler is not supported
    11.             normal.xy *= bumpScale;
    12.         #endif
    13.         normal.z = sqrt(1.0 - saturate(dot(normal.xy, normal.xy)));
    14.         return normal;
    15.     #endif
    16. }        
    As far as I'm aware, no mobile platform ( Android/iOS) supports DXT compression, meaning that the unpacked normal will NEVER have the normalmap strength value applied to it, regardless of the supported shader level api!

    This could be considered a bug, as the first condition is preventing any other code from executing on mobile devices, where as in reality if a mobile device supports shader level 3.0 or more one 'might' consider the hardware performant enough that it can handle scaling the normalmap.

    So the code can be 'fixed' relatively easily, however it will require considerably more processing power than not scaling the normal, as not only do you have to unpack then scale, but also renormalize. Which is why i'm hesitatent in thinking Unity will fix this at this point in time. If they do I hope they will include it as a user define, as its important to avoid this type of performance drain if you are not using bumpscale.

    If you want to fix this yourself I guess the following should work in UnityStandardUtils.cginc ( untested )

    Code (CSharp):
    1. half3 UnpackScaleNormal(half4 packednormal, half bumpScale)
    2. {
    3. #if defined(UNITY_NO_DXT5nm)
    4.  
    5. #if (SHADER_TARGET >= 30)
    6.     // SM2.0: instruction count limitation
    7.     // SM2.0: normal scaler is not supported
    8.     half3 normal;
    9.     normal = (packednormal.xyz * 2 - 1);
    10.     normal.xy *= bumpScale;
    11.     normal.z = sqrt(1.0 - saturate(dot(normal.xy, normal.xy)));
    12.     return normal;
    13. #else
    14.     return packednormal.xyz * 2 - 1;
    15. #endif
    16.    
    17. #else
    18.     half3 normal;
    19.     normal.xy = (packednormal.wy * 2 - 1);
    20. #if (SHADER_TARGET >= 30)
    21.     // SM2.0: instruction count limitation
    22.     // SM2.0: normal scaler is not supported
    23.     normal.xy *= bumpScale;
    24. #endif
    25.     normal.z = sqrt(1.0 - saturate(dot(normal.xy, normal.xy)));
    26.     return normal;
    27. #endif
    28. }
     
    Griffo likes this.