Search Unity

Do terrain normals add much detail to terrain heightmaps?

Discussion in 'World Building' started by ghtx1138, Jan 17, 2019.

  1. ghtx1138

    ghtx1138

    Joined:
    Dec 11, 2017
    Posts:
    114
    I came across this website http://poniesandlight.co.uk/notes/creating_normal_maps_from_nasa_depth_data/ offering terrain normals for the earth. As I understand that person has processed the NASA height maps and calculated normals.

    Does this help us making more detailed real world terrains? I can understand that height maps make a smooth elevation from point to point but I can't understand if a normal map would make any difference. And cant seem to find any info online.

    Thanks
     
  2. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    424
    Hey! Yes, it would! It doesn't necessarily add more detail to the heightmap though. Those normals will be used when performing lighting calculations which will usually lead to a more detailed rendered terrain surface.

    In the context of Unity Terrain, we do this already for you in some capacity. If you have instancing enabled in your Terrain's Settings, a normal map is generated from the Terrain heightmap.
     
  3. ghtx1138

    ghtx1138

    Joined:
    Dec 11, 2017
    Posts:
    114
    Hi @wyatttt thanks for your reply.

    I don't think I understand - where do I enable terrain instancing? I am using 2018.3. I'm assuming you don't mean instancing with a prefab?

    If I understand correctly - the heightmap is a relatively "smoothed" representation. Light will bounce of this like a curved surface.

    The normal map is a per vertex (or per triangle?) vector calculated at 90 degrees perpendicular to the surface?

    So while the heightmap is not affected by the normalmap - the normal map adds "apparent" detail by adding additional calculations to the surface on a per vertex (or per surface) basis?

    So the "resolution" of the heightmap in a sense determines the resolution of the normal map because it determines the vertices (or triangles) that the interpolated normal map can use.

    So would I'd be better off with a more detailed heightmap (and a smaller terrain tile size) because that gives Unity more vertices (or triangles) to play with when interpolating normals?

    And I can't "overlay more detail" on a terrain with a normalmap greater than what the terrain base-level vertices (or triangles) allow me? (no free lunch)

    Thanks - I am not an expert and have probably got a lot of this all muddled - please let me know if I can clarify my ideas. Cheers.
     
  4. ghtx1138

    ghtx1138

    Joined:
    Dec 11, 2017
    Posts:
    114
    I am so blind :eek:

    DrawInstanced.png
     
  5. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    424
    Ideally this would be enabled by default. Possibly something we do in the future
     
  6. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    424
    Yes, more or less. With instancing, the normal map will add detail per pixel/texel that is drawn. Without instancing, normals are per vertex/face and are generated based on the output geometry instead of the heightmap. I believe there is a 1 to 1 mapping in resolution from heightmap to normal map. I'll have to double check

    This is why with instancing enabled, you might get the same geometry output as non-instanced Terrain but the amount of "surface" detail is preserved because of the use of the normal map in lighting calcs
     
  7. ghtx1138

    ghtx1138

    Joined:
    Dec 11, 2017
    Posts:
    114
    Thanks @wyatttt for your detailed reply. Cheers
     
  8. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    424
    No problem!