Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Does texturing with Heightmap is available on Unity ?

Discussion in 'General Graphics' started by ArthyShow, Oct 12, 2021.

  1. ArthyShow

    ArthyShow

    Joined:
    Aug 6, 2016
    Posts:
    23
    Hi everyone, I'm trying to generate a procedural Voxel map and I want to apply PBR textures on it.

    My goal is to reproduce something like TimberBorn, where we can see that edge of their cube are not strait but have deformation following the texture (texture heightmap?):

    upload_2021-10-12_10-4-26.png

    So I bought some PBR Texture (like this one) pack containing for every texture:
    - base color
    - normal
    - heightmap
    - ambient Occlusion
    - roughness

    So I opened the pack and this is the difference between what I bought (left - the previous on the store) and what I have as Material in Unity (right), as you can understand I'm not happy with the result ^-^
    (When I opened the package on Unity all materials was pink, so I did Edit > Render Pipeline > Universal Render Pipeline > Update Project Materials to UniversalRP Materials, it may come from here ?)
    upload_2021-10-12_10-8-26.png

    - First question (maybe dumb but I'm really not good for graphics ^^), Do both of those render are done with the same mesh ? Or the first is using another mesh to render rocks on a sphere ?

    - Second question, I tried to implement those texture by creating a new Shader Graph (v10.0 using Unity 2020.3) but I PBR Master Node isn't here anymore, I understand that was replaced by Vertex/Fragment, but they only give option to setup Base Color + Normal (How to I add Heightmap ??). I also tried using a unity material shader but didn't found any with all options (URP/Autodesk Interactive/autodesk Interactive have everything BUT not heightmap..)

    - Third question (only if it's not possible to create those deformation using texture heightmap): Can I reproduce those mesh update using a Shader ? (and not have to be generated by my voxel mesh generator?)
     
    Last edited: Oct 12, 2021
  2. Omniglitch

    Omniglitch

    Joined:
    May 29, 2017
    Posts:
    37
    The image on the left was probably created with a simple sphere model which was then modified on the GPU to have extra geometry protruding using a technique called Tessellation (which calculates the protrusions based on a height map). This was introduced with DirectX 11. As far as I know, this is only supported in Unity with HDRP, but not in URP or the built-in pipeline.
     
  3. lilacsky824

    lilacsky824

    Joined:
    May 19, 2018
    Posts:
    164
    Second image is use tessellation shader. First image may use parallax shader? not sure.

    And it is not relate to render pipeline. So it is possible to do it in Built-in, HDRP, or URP.
    You buy one in asset store if you not familiar with writing shader. :p
     
  4. ArthyShow

    ArthyShow

    Joined:
    Aug 6, 2016
    Posts:
    23
    Okay.. As usual the "It's works but not in this Unity version/RP" answer as been posted (it's should be the headline for Unity, with "It's work but not with ___")


    lilacsky824 thank you for the your answer, I decide to bought this asset to test tessellation shader: https://assetstore.unity.com/packag...dvanced-tessellation-shader-82066#description
    But I cannot make it works..

    Do you have any resources (video, article, asset store, ...) about Unity + Tessellation shader for Unity 2020 and actual version of shader (I found some links but they are all from 2017-2018 and did not works anymore)
    Thanks
     
  5. ValentinHm

    ValentinHm

    Unity Technologies

    Joined:
    Dec 10, 2020
    Posts:
    13
    Hello ArthyShow, about your questions :
    1. The image on the left looks like it is using a shader combining Tessellation (or simply using a high density sphere mesh) and Displacement. To get a similar result with your sphere mesh you should either subdivide it yourself, or use Tessellation, and then use your heightmap to drive the Displacement of the sphere vertices.
    2. If you are using Shadergraph, you will find Tessellation is currently only available in the Graph Editor for HDRP since 2021.2, or by using the LitTessellation shader (this one should be available in versions prior to 2021.2). But if you are comfortable writing shaders yourself, tessellation should indeed be supported.
    3. It is unlikely that in the example you gave they are using Tessellation + a heightmap.
      It seems like the mesh has been made to look that way (you can see in the corners that it's always exactly the same mesh, just repeated)
    I hope this will help !
     
    Torbach78 likes this.
  6. ArthyShow

    ArthyShow

    Joined:
    Aug 6, 2016
    Posts:
    23
    Hi Valentin, Thank for your answer and explanations.
    I know how to use ShaderGraph and write (very) simple Shader but didn't know about all those tech.
    I knew that Shader can update vertices positions but just learning about Tessellation, Displacement, high density sphere, .. Very interesting

    I tried to open my URP project on 2021.2 but cannot found any LitTessellation node, so try to create an empty project, install HDRP and Shader graph, but didn't found either Tessellation node.

    But in all case look like it's too much effort (even more on cubes because Displacement on edge of the cube create artifacts crack who need additional works to fix) and isn't worth it.
    You say that in a game (like TimberBorn where the first screen is taken), where you'll have to run map of hundred x hundred cube, it's better to add directly some vertices in the mesh generator better than handling it by shader ?
    Interesting. I'll make some test on my project.

    Thank you again
     
    Torbach78 likes this.
  7. ValentinHm

    ValentinHm

    Unity Technologies

    Joined:
    Dec 10, 2020
    Posts:
    13
    This is bit confusing so I will try to be more precise.

    The LitTesselation is not a node in Shadergraph but an already made shader that you can assign to a material, also, it can only be found in HDRP. You can find more infos on it here.

    At this time, if you want tessellation in core Unity or URP you will have to write the shader or find a solution online.
    If you want to give it a look, you can check this link (Built-in Unity only)

    Tessellation is available for your custom shadergraphs, in HDRP, since 2021.2. You will find it in the Graph Inspector by expanding "Surface Options"
    Tessellation.jpg

    For your last question, what I'm saying is I don't think that a tessellation + displacement shader is used in that particular case.
    Also, tessellation will usually do a worse job at subdividing in an optimized way than adding geometry yourself only where it is needed. Now, I guess this could vary based on different cases :)
     
    Torbach78 likes this.