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
     
    Master_J_Coz likes this.
  2. ntjahero

    ntjahero

    Joined:
    Jun 18, 2018
    Posts:
    9
    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. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,705
    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. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,705
    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:
    7
    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
     
    CrateraGames and CiscoCruz like this.
  8. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,705
    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. RoughSpaghetti3211

    RoughSpaghetti3211

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

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,705
  12. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,705
    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. RoughSpaghetti3211

    RoughSpaghetti3211

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

    RoughSpaghetti3211

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

    mangax

    Joined:
    Jul 17, 2013
    Posts:
    336
    still have the issue
     
  16. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,705
    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:
    12,342
    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. RoughSpaghetti3211

    RoughSpaghetti3211

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

    NatureManufacture

    Joined:
    May 20, 2014
    Posts:
    2,026
    Error still exist in hd rp
     
  20. Staus

    Staus

    Joined:
    Jul 7, 2014
    Posts:
    13
    Also still a problem in Shadergraph 7.1.7 in URP
     
  21. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
  22. andreicfsteaua

    andreicfsteaua

    Joined:
    Nov 18, 2019
    Posts:
    36
    Same issue in 7.1.8 in URP, tried to set the map as Default unchecked sRGB then Normal map but they don't work. Adjusting the strength does literally nothing. As you can see in the image below the preview is just a blue square whereas my other textures are clearly tiled.
     

    Attached Files: