Home Technical Talk

Can someone please explain to me how polygons and height maps work together?

logan4179
polycounter lvl 2
Offline / Send Message
logan4179 polycounter lvl 2

I've been prototyping a game/level idea in Unity, and have been using square planes with only a single polygon (or two triangles I guess) along with various materials I'm creating in substance designer. I think I'm getting it to look fairly decent. Here's an example for one of the little hallway experiments:


However I've noticed that the height maps don't really look right on some materials, compared to the preview in substance designer, and it made me realize that the preview I'm using in substance is a hi-res plane as opposed to the single poly I'm using in Unity. I decided to compare a low res and hi-res preview plane in substance on an early material I'm working on and got extreme distortion on the low-res one on the left.  

I'm not sure I totally understand what's going on here. Here's a low-res vs hi-res comparison in Unity, there's not nearly as much difference:


First of all, I think I'd like a proper explanation of what height maps do, as I've heard a lot of conflicting information and what sounds like people opining on what they think they do.  Some people say that height maps "create geometry", some people say that height maps "displace geometry" (which I assume means that they move the vertices around, but don't create new ones), some people say it only simulates detail like a normal map. The Unity manual says: "This effect, while it can produce a very convincing representation of 3D geometry, is still limited to the surface of the flat polygons of an object’s mesh [....] the “silhouette” of the model will never be modified, because ultimately the effect is drawn onto the surface of the model and does not modify the actual geometry."...but clearly the silhouette appears affected inside of substance designer based on the height map settings, which suggests added or displaced polygons inside substance... 

I imagine the low resolution geometry is probably the issue, but if so, I have no idea how high-res to make my geometry, and I don't fully understand how this works in order to logically make a decision. For example, considering a lot of the detail I'm simulating with height are very small details, would just subdividing the planes a few times make any difference considering the resulting polys would still be far larger than the details on the map? The alternative (making the wall/floor planes so high-poly that they could simulate the height detail geometrically) would obviously not be doable in a game for performance reasons. Is there some "sweet spot" in terms of poly count, or are you supposed to strategically place edge loops where they're needed, or am I just missing the point? 

Replies

  • gnoop
    Offline / Send Message
    gnoop sublime tool
    I never worked with Unity  beyond some little testing  but from  this small citation they refer to so called  parallax mapping  which  makes  kind of several layers/slices , totally in 2d    and each slice getting certain UV shift   based on texels height values.    It creates  a kind of depth illusion.   It doesn't depend on polycount at all. 
      The idea has  a few issues:  to work nicely  it needs  lots of such layers/slices  and it's getting calculative expensive, more of so than with regular  geometry  while still making no influence on silhouettes.  it also creates often undesirable  sinking down illusion .   In a word  visually it makes little help  until it's really heavy  and fps hungry.

    The other approach is actual geometry displacement .   In our game we displace only existing ground vertexes . Not so helpful either visually . 
       Many modern games use so called adaptive tessellation when your engine (U4 for example)  creates extra tessellation  and  vertexes on the fly before displacing them  based on how close a surface point to your camera.   Usually on the ground  too.    It's a kind of replacement for LODs .
        But the truce is  this method is also expensive  and fps hungry . LODs are still more efficient .

    Anyway don't expect  the adaptive tessellation would make any good for an object like in your screen.  it works best on evenly tessellated surfaces.  Much like any displacement in any 3d package. . U4 has its own magic  making it work on long triangles  better  than in Arnold for example  but  don't expect miracles.

  • sprunghunt
    Offline / Send Message
    sprunghunt polycounter
    Tesselation and displacement are bad for hard surface mechanical objects. They just can't hold edges as efficiently as proper modeling. For this kind of thing just adding extra polygons gives a better and more efficient result.

    Tesselation is better for things like rocks or bumpy ground textures. 
  • PolyHertz
    Offline / Send Message
    PolyHertz polycount lvl 666
    A 'height map' is just a name given to a black and white map which is being used to convey height information. For hard surface they're normally only used with parallax shaders, and for organics they're used with either parallax or to offset vertices together with tessellation.
  • logan4179
    Offline / Send Message
    logan4179 polycounter lvl 2
    Tesselation and displacement are bad for hard surface mechanical objects. They just can't hold edges as efficiently as proper modeling. For this kind of thing just adding extra polygons gives a better and more efficient result.

    Tesselation is better for things like rocks or bumpy ground textures. 
    Thanks, I appreciate the direct advice.
  • logan4179
    Offline / Send Message
    logan4179 polycounter lvl 2
    gnoop said:
    Anyway don't expect  the adaptive tessellation would make any good for an object like in your screen.  it works best on evenly tessellated surfaces.  Much like any displacement in any 3d package. . U4 has its own magic  making it work on long triangles  better  than in Arnold for example  but  don't expect miracles.

    Thanks for your explanation. When you say an evenly tessellated surface, would that be a surface that I've manually subdivided? I'm a little new to all this.
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    Thanks for your explanation. When you say an evenly tessellated surface, would that be a surface that I've manually subdivided? I'm a little new to all this.
    Yes,  for any kind of displacement   you need to  make   regularly tessellated mesh  sometimes adding extra loops manually where  they are not absolutely necessary shape wise .      Not  just two big  triangles for a sides of your tunnel or that vent shield .  But anyway you would see those zigzags  until it's really lots of geo  so it's better to just model close LOD for the thing .   The displacement, while possible theoretically,  never works right for  a hard surface.     Use it on the ground.


Sign In or Register to comment.