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
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

HDRP Lit Shader detail map issue

Discussion in 'Graphics Experimental Previews' started by Koach, Jul 14, 2018.

  1. Koach

    Koach

    Joined:
    Feb 14, 2018
    Posts:
    3
    I've been trying to figure out how the detail map inputs work on the new lit shader, and so far I'm extremely confused. I followed the documentation here:

    https://github.com/Unity-Technologies/ScriptableRenderPipeline/wiki/lit-shader

    And created a test image, creating black and white values directly on the red, green and blue channels, and erasing half the image as well to test the effects of extremes in all the different channels, and the results are...extremely confusing. Is there a more detailed guide on how to make detail maps for the new lit shader?
    detail map test.png
    issue with detail map.jpg
     
    florianalexandru05 likes this.
  2. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    707
    There is no guide currently, but I will try to compare it to how the Built-In standard detail maps works :
    Basically, detail maps contain surface informations (albedo, normal, smoothness) that are added to the base surface information, in ordre to be used with a high tilling value.
    In the Built-In standard shader, the detail maps are Albedo and Normal. In HDRP, we wanted to optimize the number of texture samplers in a material, and that's why there is only one map used for detail, where :
    • The red channel contains the albedo variation. It is applied to the underlying material in an "Overlay" blend mode, similar to photoshop. You can create this channel by simply desaturating the built-in detail albedo.
    • The green channel contains the normal Y value. Simply use the green channel of the built-in detail normal.
    • The blue channel contains the smoothness variation. One again, it is applied with an "Overlay" blending, and this can either be done by using the smoothness map of your detail material if you have one, or creating is from the albedo, or leaving it to a mid-gray value to keep the underlying smoothness unchanged.
    • The alpha channel contains the normal X. Like for the blue channel, you can simply use the red channel of the built-in detail normal.
    I hope this was clear enough and that it helped you.
     
    KUDr likes this.
  3. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    @Remy_Unity I understand what a detail normal map is, it's an overlay for fine details.
    But what is an "albedo variation"?
     
  4. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    707
    Imagine that your base albedo is ... let say red.
    The albedo variation in the detail map will keep the red information, but lighten or darken it. If the detail is mid gray, the final albedo is unchanged. It it is white, the final albedo will be white. And if it is black, the final albedo will be dark.
    The behavior is similar for the smoothness.
     
    OfficialHermie likes this.
  5. Vaz21011

    Vaz21011

    Joined:
    Jan 12, 2017
    Posts:
    5
    Was anything changed in 2018.3 version? I created a test cube and applied a material which contained only detail map (no base albedo or normal texture), I created that detail map according to your instruction (well, i thought so), but the result was very strange. On the picture there is my cube rotated from 0 to 180... upload_2019-4-3_20-43-33.png
    Changing green and alpha didn't help (I thought I placed the wrong normal channel there). It looks as if... vertex normals look inside the cube or "normal" blue channel (which is calculated) is darker than 127...please help me!
     
  6. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    707
    Have you by any chance set the normal map space to "Object Space" ? I encounter the issue you're mentioning only with this setting, with "Tangent Space" it's rendering correctly.
    But I'll report a bug for this, as it should be handled.
     
  7. Vaz21011

    Vaz21011

    Joined:
    Jan 12, 2017
    Posts:
    5
    I've just checked it ones again more closely... upload_2019-4-4_22-16-40.png
    And I don't know how to describe the result, maybe I should change object and tangent space somewere else...
     
  8. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    707
    All that is pretty strange. Do you mind sharing your scene ?
     
  9. Vaz21011

    Vaz21011

    Joined:
    Jan 12, 2017
    Posts:
    5
  10. VCDESIGN

    VCDESIGN

    Joined:
    Jul 18, 2017
    Posts:
    43
    Hello guys, I've made a tool that converts your texture maps automatically into the Detail Map from Lit Shader.
    No more manual work in Photoshop.
    Check it out: https://gum.co/Nbdfn
     
  11. Vaz21011

    Vaz21011

    Joined:
    Jan 12, 2017
    Posts:
    5
    I know the reason....it is that thing...Never even thought to look here, hate it...
    upload_2019-4-28_11-17-35.png
     
    asemenov likes this.
  12. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    585
    @Remy_Unity Could you please explain the difference between the base surface and the detail map?
    I still can't make it out from your sentence below. I don't understand what is meant by "variation".
    Thank you again for clarification!

     
  13. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    707
    By variation, I mean that the detail texture will make "vary" the base surface.

    Albedo for example :
    - For a base color, let say red, if detail albedo is mid grey, the result is unchanged.
    - For darker detail, the resulting albedo will be dark red, until full black for full black detail.
    - For lighter detail, the resulting albedo will be pinkish, until white for full black detail.

    For smoothness, the blending is similar, and for normal, we apply the reoriented normal mapping technique to overlay it to the base normal.
     
  14. MajorParts

    MajorParts

    Joined:
    Sep 27, 2014
    Posts:
    88
    @Remy_Unity

    Sorry to bring up an old topic.

    Pre-HDRP, we had detail albedo for giving models different coloured markings. From what I've read here, this will no longer work and only lighten or darken the base albedo? Our model was pretty much grey all over with the detail albedo making parts of it blue, red etc. How would we achieve this now?
     
    krakentanz likes this.
  15. karstenv

    karstenv

    Joined:
    Jan 12, 2014
    Posts:
    81
    Just wanted to add something to this old post that might help future readers.

    As far as I understand it, and have tested, the detail map (with its 4 channels as described above) ONLY works - if and when - there is a #detail mask# in the Mask Maps blue channel. So its not just to make a detail map you also have to add a mask to the blue channel of the Mask Map. If you set it to mid-grey then it will blend the detail map 50% into it. This last part is a guess on my part as I have only tested it with mid-grey and its kinda hard to tell how much they blend :)
     
  16. Wawruch2

    Wawruch2

    Joined:
    Oct 6, 2016
    Posts:
    68
    I'm trying to recreate normal detail blending in shader graph from HDRP Lit shader but nothing works. I managed to recreate it in Unreal Engine but unfortunately nothing works in Unity. I tried OpenGL normals, blending nodes, adding it manually, pretty much everything but always detail normals seems to look inverted. Did anyone has similiar problem?




    I also checked the shaders above but it doesn't work there aswell.