Search Unity

New Shader graph normal mapping

Discussion in 'Shaders' started by Immortalis94, Jun 17, 2018.

  1. Immortalis94

    Immortalis94

    Joined:
    Feb 22, 2017
    Posts:
    11
    I am getting weird normal mapping effects with new Shader Graph using Lightweight SRP.
    Without normal map everything is alright. These r the screenshots and screenshots from the game. I hope someone can help :)
    RenderTEST.jpg S-Graph.PNG
     
  2. ntjahero

    ntjahero

    Joined:
    Jun 18, 2018
    Posts:
    6
    It's just a wild guess, since I'm not that familiar with the render pipelines yet, but you normal map preview looks like it's color managed. If the default pipeline doesn't color manage textures and the lightweight does - you should check if your normal map have some color space conversion - this breaks normal map stuff and shout be removed and the map should be set to be raw data, rather than converted to sRGB. I believe there is a button in the texture Inspector for that.
     
  3. Immortalis94

    Immortalis94

    Joined:
    Feb 22, 2017
    Posts:
    11
    @ntjahero Tried that :) Dunno what's happening here. I tried to use Sampler with default texture type and set the normal map as Default too with enabled and disabled Convert to sRGB and it just became more weird. Something is not right here or i dont knwo how to use normal maps through Shader Graph. When u set normal map type as Normal Map u dotn have the Convert to sRGB checkbox so i suppose its not converting it, as for the preview i always had previews like that for the normal maps even within the editor. Like i told u everything is working fine with the same normal map using in Lightweight Standard (actually forgot to mention this) shader and every other shader except this 1 which is made in Shader Graph :( I can't be the only one with this problem, i hope so :)
     
  4. Immortalis94

    Immortalis94

    Joined:
    Feb 22, 2017
    Posts:
    11
    Installed Unity HUB and made a fresh LWRP Project still the same issue. Unity 2018.1.5f
    screen_1920x1080_2018-06-19_14-41-10.png

    2 Spheres with same Metalic/Smoothenss values and same normal map. LightweightPipeline Standard PBR shader on the left and custom lwrp shader made with shader graph on the right. Even used normal map preset settings from the example project. Still can't see where is the problem here? :( :( :(
    ShaderGraph.PNG
    Also there is some weird offset like u can see sphere on the right has some little x offset on the normal map (Offset in the settings is x: 0 y: 0).
    U can clearly see it here i added normal strength to the custom shader and both have 1.5 strength, and for some reason specular highlight goes in different direction from the one in LW PBR Shader when increasing strength of the normal map...
    screen_1920x1080_2018-06-19_16-32-55.png
     
    Last edited: Jun 19, 2018
  5. francois85

    francois85

    Joined:
    Aug 11, 2015
    Posts:
    646
    Im not able to get my normal map to work, here is a terrain with the normal map on albedo (to visualize) and then also going into the normal channel.
     

    Attached Files:

  6. francois85

    francois85

    Joined:
    Aug 11, 2015
    Posts:
    646
    I also attempted a simple sphere, at first it didn’t seem to work but when I scaled my sphere down to a unit sphere it looked more correct but something is not working with the normal maps on shadergraph or more likely I don’t know how to use it.

    Below is a unit sphere and then a scaled up sphere.
     

    Attached Files:

  7. ARideout

    ARideout

    Joined:
    Sep 7, 2017
    Posts:
    3
    wrong_normals.JPG correct_normal.JPG

    Having similar issues. I found that if I set the texture type of my imported texture to "Default" and then in my SampleTexture2D node in the shader graph to "Normal", I get correct normals (bottom image). But if I set both to "Normal", then I get the top image. I get something similar to the top image again if I set the texture type to "Normal" and the SampleTexture2D node to "Default". Kinda annoying since Unity bitches when you don't have your normal maps set to "normal" when you import them.

    I was able to hack a fix though that produces the result of the second image when the input texture is set to "Normal" and you add some dumb swizzle math stuff in the Shader Graph. Basically a custom "Unpack Normals" operation that converts Unity's DXT5nm format for normal textures. Technically there is some more math you can do for the B/Z channel, but I found just setting it to 1 in the Vector3 produces very similar results.

    dumb_math.JPG
     
  8. francois85

    francois85

    Joined:
    Aug 11, 2015
    Posts:
    646
    I’ve opened up an issue with Unity , they asked me for a small demo scene that I provided. I can let people know what they say.
     
  9. Immortalis94

    Immortalis94

    Joined:
    Feb 22, 2017
    Posts:
    11
    @francois85 Sure, I am still having the same problem with new 2018.2
     
  10. francois85

    francois85

    Joined:
    Aug 11, 2015
    Posts:
    646
    Yea I tried it as well, no luck. Still waiting on a reply from QA.
     
  11. francois85

    francois85

    Joined:
    Aug 11, 2015
    Posts:
    646
  12. francois85

    francois85

    Joined:
    Aug 11, 2015
    Posts:
    646
    Mmm Unity closed my ticket saying fixed in 2018.2 ... but it’s not , is there a new patch out for 2018.2 ?

    Reproduced with:
    2018.1.0f1, 2018.1.8f1, 2018.2.0f2, 2018.3.0a5
     
  13. francois85

    francois85

    Joined:
    Aug 11, 2015
    Posts:
    646
    I have not tested the fix yet but my ticket for this has been update to “fixed in Package “
     
  14. francois85

    francois85

    Joined:
    Aug 11, 2015
    Posts:
    646
    Ran a test this is still broken
     
  15. mangax

    mangax

    Joined:
    Jul 17, 2013
    Posts:
    281
    still have the issue
     
  16. francois85

    francois85

    Joined:
    Aug 11, 2015
    Posts:
    646
    QA got back to me saying

    It should be fixed in the 2.0.8 and 3.3.0 package versions.

    Latest package I can see in unity is 3.0.0
     
  17. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    7,160
    Yeah, this should be fixed in the LW 2.0.8 preview version that was released, but they released LW 3.0.0 a few days after 2.0.8 and it's broken in that version. You can revert to LW 2.0.8 for now if it's a problem for you. As I understand it, LW 3.0.0 was really intended for use with Unity 2018.3 anyway, though it works with 2018.2. Future LW 3.#.# versions may actually require new APIs in 2018.3 which may be why it hasn't been released yet.
     
  18. francois85

    francois85

    Joined:
    Aug 11, 2015
    Posts:
    646
    Ahh ok ill revert thanks for the info
     
  19. NatureManufacture

    NatureManufacture

    Joined:
    May 20, 2014
    Posts:
    1,613
    Error still exist in hd rp