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. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

HD Render Materials Set Up Questions

Discussion in '2018.1 Beta' started by EddieChristian, Feb 10, 2018.

  1. EddieChristian

    EddieChristian

    Joined:
    Oct 9, 2012
    Posts:
    725
    So I am trying to figure out how to use a Meagascans model in the New HD Rendering Pipline. Where do you put things like Roughness maps in this material?

    Is their a Doc that Breaks down all the new Materials and Shaders?
     
  2. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    Hey, documentation is in progress, we have a very minimal documentation that is old and a bit obsolete that I paste here. But it will still help you.

    Shader

    There is currently 5 shader associated with HDRP



    Lit shader is the equivalent of the “standard shader” from vanilla Unity. It is a ubershader with a lot of features due to the fact that it is really painful to share code within a .shader (due to shader labs). The LitTessellation is the same but with tessellation enabled (Again due to a technical limitation of Unity, we don’t have other choice than duplicate the file…).


    Unlit is a shader for any emissive only object (That can produce light with GI system) or regular object that doesn’t receive lights.


    LayeredLit is horizontal layering system based on Lit shader. Up to 4 layer are supported and one layer is a regular Lit shader except that ClearCoat, Anisotropy and SpecularColor mode are not supported.


    Lit starter

    Mask map packing



    R: Metallic, G: Ambient occlusion, B: Detail mask (for the detail texture), A: Smoothness

    When a value is displayed at the same time as the texture, it mean that texture will be multiply by the value (So be aware to setup value to white when setting a texture).


    Heightmap is only used when Displacement is enabled



    Vertex displacement will move vertex position based on the heightmap value in the direction of the vertex normal. Imply that the mesh is be pre-tessellated.
    Pixel displacement used parallax occlusion mapping algorithm to give the illusion of displacement (this is expensive) - Mean you don’t have silhouette displacement. It is meant to be used with a plane. Anything that is not a plane will not work correctly.


    For heightmap settings:



    Heightmap are value between 0 and 1, it need to be remapped to the desired value.

    The height is provide in centimeter with min and max values represented in the heightmap.

    The base value define what is the center of the heightmap. 0.5 mean the center of the heightmap is 0.5. So from 0.5 to 1, the value will be remap to 0 to 1cm and from 0 to 0.5, the value is remap to -1cm to 0.


    If you setup Base to 1, it mean you are always inward and it is the recommended value for Pixel displacement (which doesn’t support outward displacement)

    If you setup base to 0, it mean you are always outward (even if you setup negative value).


    These settings match Knald and Xnormal provided value.


    When using a Subsurface type, you can select the SSS profile from the list matching the SSS settings of HDRenderPipelineAsset:




    Subsurface radius map allow to control the local strength of the SSS. By settings 0 there is no more SSS. With 1 you have SSS from the SSS profile. Main usage is to disable SSS on some part of the object, in this case it match Standard mode with metallic at 0


    Subsurface Thickness map is for transmission only and will affect the intensity of the transmission. Thickness map is 0 for full transmission to 1 for no transmission. The thickness is remapped to real world unit with the value provide in the SSS Profile (in millimeter). Thickness map can be produce with a baker (https://support.allegorithmic.com/documentation/display/SD5/Thickness+Map+from+Mesh), take care of the convention.


    Detail map:



    R: Details albedo, G: normal Y, B: Detail smoothness, A = normal X.
    (Note this is DXT5nm encoding for normal which provides more bit depth in the G and Alpha channels).

    There is a tutorial on how to create a detail map here : https://gamedev.amazon.com/forums/articles/63070/how-to-create-detail-maps-in-lumberyard.html


    Neutral value for albedo and smoothness is 128, 128, 128. Both use Photoshop overlay mode (mean value below 128 will darken and above 128 will brighten).

    Our DetailAlbedoScale and SmoothnessScale should be set to 1 and Texture should be modify instead. But for quick test you can move them, a value of 0 mean no effect.


    Lit shader also support Rough refraction and Distortion.

    https://docs.google.com/a/unity3d.c...-T_FhpvbJiNscGAlbS3nZ5WdwfyY/edit?usp=sharing


    Note: Rough refraction is the correct way to do transparency in the physical sense. It use thickness, index of refraction, absorption of the medium, follow Beer’s Law unlike regular blend mode that can’t emulate it. However it is more costly than regular blend mode.

    Distortion is just an artistic effect, video game style.


    And Unlit support Distortion.


    Few notes:

    • Parallax occlusion mapping doesn’t work with Layering

    • Clear coat will change to a cheaper version and different control

    • With Tessellation, per pixel and per vertex displacement will be disable

    • Planar and Triplanar mapping are currently not handled by the meta pass (i.e wrong GI)

    Blend mode

    There is 4 blend mode in HDRP: Alpha blend, add, multiply and alpha blend premultiply.

    Alpha blend premultiply require work from the artists on their texture and is mainly targeting VFX rather than regular environment.


    With Lit shader these blend mode will not affect specular (as physically speaking blend mode should only affect transmission), but you can uncheck “preserve specular lighting” to come back to incorrect previous behavior.


    Unlit shader only do regular blend mode
     
  3. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    Keep in mind that following overview is not up to date, menu have change in more recent version etc..., but concept remain:

    Subsurface Scattering Settings

    A default Subsurface scattering settings is available in the Github project but we recommend to create a new one outside the ScriptableRenderPipeline folder to not lose the settings when merging.


    To make Subsurface scattering work in HDRP you need to create Subsurface scattering settings.



    Assign these settings to the appropriate property of HDRenderPipelineAsset.


    There is a maximum of 16 different SSS profile for the whole game. A SSS Profile allow to define how light is scattered in a surface. The subsurface solution of HDRP is generalist and apply to everything, from skin, marble, apple, to candle etc…



    Note: We use Normalized Burley diffuse for Subsurface scattering. For technical detail about what is done under the hood, check: https://graphics.pixar.com/library/ApproxBSSRDF/paper.pdf .


    SSS profile also include Transmission settings. The transmission will use the same profile than the Subsurface scattering.




    On the image above, the 2D image show how the light is diffused under the surface and on which distance. The 1D image show a depth slice view, and highlight how light will react for transmission with depth penetrating into the surface.


    Caution: When moving a Profile up or down, be careful, the corresponding SSS profile index on the material is not update, you need to update it by hand.
     
    OfficialHermie and id0 like this.
  4. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    Regarding your question about Roughness of megascan, it is like in Builtin Unity, Smoothness is 1 - roughness, so you need to invert your map in a texture application. (Note: we aim to add a way to invert smoothness map in the slot, so you will not be required to do it).
     
    id0, Korindian and EddieChristian like this.
  5. EddieChristian

    EddieChristian

    Joined:
    Oct 9, 2012
    Posts:
    725
    Thanks for the quick response. I am hoping that a version of the shaders that Don't require Texture Packing is in the works. Until then, This will get me started.
     
  6. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    This is call shader graph :)
     
  7. EddieChristian

    EddieChristian

    Joined:
    Oct 9, 2012
    Posts:
    725
    I was hoping for that, But it seems the New Shader Editor currently only does the LightWeight Pipe. If there is something that I can do a Shader Graph for HD now, I would love a link to it.
     
  8. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,589
    Are you going to unify naming? HDRenderPipeline, LightweightPipeline and MobileRenderloop is quite inconsistent in its naming.
     
  9. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    not for now, support of HD will come in a near future
     
    EddieChristian likes this.
  10. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    There is the Unity UX team working on this.
     
    Peter77 likes this.
  11. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,589
    Thanks a lot for being so active and helpful in the forum!
     
  12. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Yeah we must buy Seb some beers or say cheers for the help :)
     
  13. mephistonight

    mephistonight

    Joined:
    Dec 14, 2016
    Posts:
    75
    Hi,

    I'd like to ask some questions about the Layered/Lit shader. I'm interested in investigating this shader to look at how I can author large architectural assets with a decent texel density that isn't driven entirely by the UV's.

    Is the setup described here still up to date?
    https://drive.google.com/file/d/1xXOc8vz3h9wbklyDGnhtNQG8lizoUeGa/view - it's the Photogrammetry guide

    So, I can drive the visibility of the different materials either via a layer mask where each material is split via the RGBA channels, or I can use vertex colours (and or a heightmap) to drive visibility?

    I would also need to author my materials differently, right? So I'd need the Metal map in the Red channel, the AO in the Green, Detail map in the Blue, then use the Alpha for Smooth / Roughness? This needs to be done for all of the materials, including the main layer, right?

    Do you recommend this is done in Photoshop or can one create a node in Substance Designer to output these channels as needed from existing Substances?

    I'd also like to know whether or not you think I'd be crazy to try and bring this shader in to 2017.3? What is the main difference between this shader's use in 2018 (just the layering, not the SSS and other features)? Is it just the lighting? Am I wasting my time trying to do this, or is it possible do you think?

    This is an awesome shader btw - kudos and many thanks for providing it.

    Cheers,
    M
     
  14. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    789
    Yea, that's still the way to do it. You can also check out this blog post about the Fontainebleau Forest Photogrammetry demo - https://blogs.unity3d.com/2018/03/1...aking-real-world-objects-into-digital-assets/
    which also includes the scene and assets.
     
  15. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Currently Substance Painter has an export format prepared for Unity metal/rough workflow. From what I understand, Unity 2018.x is moving to a channel packed texture format. Please correct me if I'm wrong, but this means that the current Unity export options in Painter will not cooperate with the HDRP texture requirements?
     
  16. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    789
    It won't but you can easily setup a custom export which packs the channels. You will also have Shader Graph so you can build custom shaders with your own channel packing or none.
     
  17. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Right, and thank you for the response, however, it does imply that those textures will need to be re-exported. That being said, the HDRP is still in preview and meant for learning purposes, so that's understandable.
     
  18. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    789
    Yea they will need to be re-exported or manually repacked. Some teams might make a texture packer for their textures if they want to use the standard Lit shader and have a lot of materials to convert. There is already one made by @andydbc on GitHub (along with some cool Shader Graph stuff) but haven't messed around with it myself, it could be useful for a lot of people though.

    Also here is the setup for HDRP packed texture export
    upload_2018-4-22_9-18-27.png
     
    Last edited: Apr 22, 2018
  19. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Oh wow, this is a huge help, thank you so much! I imagine this will benefit others as well, good post +1

    EDIT: 2018.1.0b13 is a hot mess
     
    Last edited: Apr 12, 2018
    FROS7, Grimreaper358 and Thr3dee like this.
  20. Thr3dee

    Thr3dee

    Joined:
    Aug 29, 2017
    Posts:
    5
    Massive help @Grimreaper358 for the texture packer!

    @buttmatrix - I decided to stay in 2018.1.0b10 and so far so good! Same build as is recommended for the Fontainebleau Demo.

    And I've got to say Unity team @SebLagarde ... apart from using Substance and Quixel I haven't left Unity yet to build or export out of Max now that we have Probuilder! This mixed with the Probuilders Smoothing Groups and HDSRP's "Keep Shape" Tessellation options + Triplanar mapping is... JUST. FREAKING. AMAZING.

    Keep up the good work.
     
    Grimreaper358 and buttmatrix like this.
  21. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    This is incorrect. You can't use Gloss squared, only gloss.

    EDIT:
    The above image has now been fixed!
     
    Last edited: Apr 23, 2018
    buttmatrix likes this.
  22. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    789
    Ah, yea that was my mistake didn't notice when I was making it. It's fixed now thanks for pointing that out.
     
  23. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Yeah it sent us into a bunch of investigation and we had to reach out to allegorithmic for a clear answer :D
     
    buttmatrix likes this.