Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Honest Standard Shader questions (Height Map)

Discussion in 'Shaders' started by RyFridge, Mar 22, 2016.

  1. RyFridge

    RyFridge

    Joined:
    Apr 7, 2014
    Posts:
    47
    Hey people,

    I am currently trying to create good materials for the Asset Store, but I'm heaving huge issues with the Height Map slot :( Any help is greatly appreciated!

    1. Sharp Height Maps for structures / manmade materials just don't work. I thought they would maybe stretch pixels that are next to the steep cliffs, but it just glitches wierdly. It works 'OK' on natural, more smooth materials like rocks, but it's not amazing either (side angle view creates glitches). Please see editor view and Height Map texture (part) below:

    ineditor.jpg heightmap.jpg

    2. Why is the Occlusion Map not warped according to the Height Map? I understand silhouettes are difficult, but inside the triangle? That should be not problem, since Albedo etc. are warping according to the Height Map (kinda) in the right way? I don't want to miss out on occlusion if I want displacement.


    Am I doing something wrong? :)
     
  2. Farfarer

    Farfarer

    Joined:
    Aug 17, 2010
    Posts:
    2,249
    The issue is that it offsets the UV coordinate depending on the height value and the viewing angle. Sharp transitions in the height map will cause issues like you can see there. You'll generally want to blur it just a little bit in order to have nicer looking results.

    As far as I can tell, the occlusion map is sampled from the same offset UVs, it works as expected.

    You'll also probably want to disable sRGB sampling on your heightmap in order to keep it in linear space - it shouldn't be in sRGB space.
     
  3. RyFridge

    RyFridge

    Joined:
    Apr 7, 2014
    Posts:
    47
    Hey, thanks for your answer.

    I understand that smooth transitions make this problem less noticeable (but it is still there). But that is not a solution for anything that has to have sharp edges. If you look at several other shader packages, parallax displacement seems to work just perfectly fine if done right. It would just need to stretch the nearest pixels instead of glitching like this, which is just unusable as a result. I'm wondering why anybody would implement it to work like this. :(
    I've yet to see a good looking Height Map on the Standard Shader, except from those street or rock textures that just use smoothed cliffs.

    The Occlusion Map is most definitely not warping with the Height Map, at least not with my materials. Do you have some working example of this?

    How do I disable sRGB? Using the 'gray' mode in Photoshop should be alright, yes? That's what I'm doing.

    Best, Ry
     
  4. Farfarer

    Farfarer

    Joined:
    Aug 17, 2010
    Posts:
    2,249
    No, set your texture to "Advanced" and in the options, enable "Bypass sRGB Sampling".
     
  5. Farfarer

    Farfarer

    Joined:
    Aug 17, 2010
    Posts:
    2,249
    And my bad, the occlusion isn't being offset by the heightmap. That seems like a silly bug.
     
  6. RyFridge

    RyFridge

    Joined:
    Apr 7, 2014
    Posts:
    47
    The bypass really makes some difference (the 2nd picture), but it's not much better :p (It seems to make the 'natural' height maps slightly better though, so thanks!

    sampling_allowed.jpg sampling_disabled.jpg

    And I really don't understand how the occlusion problem can be in this official shader, and after such a long time? Cannot find ANY answers or official Unity stuff about Standard Shader Height Maps...
     
    Last edited: Mar 22, 2016
  7. RyFridge

    RyFridge

    Joined:
    Apr 7, 2014
    Posts:
    47
    Sorry for the bump, but is there no official topic on Height Maps for the Standard Shader?

    There is no spot on the Roadmap to fix the Occlusion UV-Mapping regarding the height either. So, should we just ignore the Height Map for our assets in the Asset Store all together or is there a way to do this right?

    I would honestly like to hear an honest answer from the Unity Team, since I can't find more information :(
     
  8. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    9,286
    Submit a bug report for it, you're unlikely to get an official response on the forums.
     
unityunity