• Advertisement
Sign in to follow this  

Question about terrain normal mapping?

This topic is 1664 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok so this is what i understand can be done with terrain normal mapping, please correct me if i'm wrong.

 

First you would have the terrain vertex normals. You can also generate a higher resolution terrain and from which generate a high resolution normal map (in world space so you won't need tangents/bitangents) and use this map instead of the vertex normals.

 

There are also normals maps that can be generated from the colour textures in tangent space. And the detail normal maps, also in tangent space. These need tangents/bitangents.

 

Does this sound about right? If so, do you usually use both the terrain normal map AND the diffuse normal map? Or pick one? Which looks better?

 

 

Share this post


Link to post
Share on other sites
Advertisement

The main use of normal maps is to add small amount of detail to a object or to pass normal data from a high poly object to a low poly object.

 

For a terrain you need at least a Diffuse map for color if you have a pre-made mesh.

It is advised you use a Height map(Displace map) to create a terrain not a normal map.

 

The common textures are:

 

The Height map to create mountains and valleys, by positioning the vertices at the height defined by the color of the map, also known as a Displace map.

The Normal map would be used to make small stones or small cracks in the surface and other small detail, only needed if you are attempting to make a high end game.

The Diffuse map is used to give the terrain color and value, this is the most important texture.

The Specular map  and all its related textures is used to show reflective surfaces, Specular maps have three forms Intensity,Size,Color.

The Ambient map used for realistic lighting, this can be mixed into the diffuse map.

The Detail map this is the same as a diffuse but tiled at a smaller scale to add detail.

The Light map is used to bake shadows and lights of static objects so that thy can be removed from the light and shadow pass, this helps with performance.

 

These are just guide lines, you don't need them all.

Depending on the engine your using and the shaders you could need more or even less textures for the terrain.

 

Edit:

 

There are many kinds of normal maps, the tangent and radiosity are the common ones.

If you bake normals from a object then two things matter the detail of the object and if the size texture you are using can store that detail.

Edited by Scouting Ninja

Share this post


Link to post
Share on other sites

Well thanks for your answer but i already knew those things. My question was about the Normal map itself and what's the best way to go about implementing it.

Share this post


Link to post
Share on other sites

I'm not entirely sure what the question you are asking is so please bear with me. How are you composting compositing your terrain surface? If you're splatting a set of materials to your terrain then world space normals for these materials doesn't make sense (if you're using a virtual texture then that's a different story). If you're using low frequency material textures with high frequency detail textures then you would have normal maps for the latter.

Edit: silly auto correct!

Share this post


Link to post
Share on other sites

Yes sorry i just reread my post and it wasn't very clear. Basically i want to know if it's better to use a normal map generated from a more detailed version of the terrain OR from the diffuse textures themselves. I also wanted to know if you should use the base diffuse texture or the detail map (this one you answered).

Share this post


Link to post
Share on other sites
What technique are you using to texture your terrain? Is it texture splatting or something else? If its texture splatting then you would generate normal maps for each of your materials.

Share this post


Link to post
Share on other sites


i want to know if it's better to use a normal map generated from a more detailed version of the terrain OR from the diffuse textures

 

It is better to bake the normal map from the higher model than to turn the diffuse textures into normal maps.

Here is a image showing why:

ZDn1wnV.png

 

This was made using Blender and it's Suzanne model.

Here you can see the Normal map made from the diffuse texture is less detailed and blocky.

Share this post


Link to post
Share on other sites
The problem with that approach for terrains and texture splatting is:

a) The terrain mesh itself would be of insufficient resolution to produce a high quality normal map

b) The final composited surface texture would need to be taken into account to produce an accurate normal map for the splatted textures (which, of course, would require normal maps for the textures anyway). Simply generating a normal map from the terrain mesh won't work as it won't correlate with the splatted materials

c) The resulting normal texture would be very large (i.e. >VRAM) for terrains of any meanginful size and detail, requiring a more advanced texturing technique such as virtualisation (defeating the purpose of texture splatting)

Share this post


Link to post
Share on other sites

The problem with that approach for terrains and texture splatting is:

 

Now I am interested in what approach would work with texture splatting?

Edited by Scouting Ninja

Share this post


Link to post
Share on other sites

This whole thing feels quite confused.

 

First you would have the terrain vertex normals. You can also generate a higher resolution terrain and from which generate a high resolution normal map (in world space so you won't need tangents/bitangents) and use this map instead of the vertex normals.

Not really. Terrains are often represented using scalar grids - that's the monochrome height map image - even in the pro GIS applications.

Pulling the weight height out of the normal is quite more complicated than the other way around. The heightmap really encodes both informations, albeit it might not do so with sufficient accuracy for normals. In practice, I don't think I ever observed this problem.

Extracting a normal (and by extension the whole TBN frame) is still not as straightforward as one might think. You could play a bit with The GIMP normalmap plugin. It has a lot of settings. Generating terrain normals is not a very different from other assets.

 

There are also normals maps that can be generated from the colour textures in tangent space. And the detail normal maps, also in tangent space. These need tangents/bitangents.

Yes, a whole TBN frame is always required to perform the computation. Note that this does not imply it must also be stored, it could be computed on the fly.

Normal maps generated from the colour textures... often viable, often good enough, but I'm still not buying this as correct practice. I guess your wording here is a bit off, I have no idea what the "colour textures in tangent space" are supposed to be... I guess you really meant to be referring to the generated normal maps.

 

Does this sound about right? If so, do you usually use both the terrain normal map AND the diffuse normal map? Or pick one? Which looks better?

I haven't played with terrain for a while (not necessary for what I'm doing) but my last system used both. You cannot really go along without one of them.

Note however the terrain normal map is very well suited to be replaced by vertex operations. By definition, it's 1 sample per terrain sample, which ends up being 1 vertex. Therefore it's usually way better to just pack the normal in the vertex value itself or even reconstruct normal by Vertex Texture Fetching in the VS.

 

edit: wrong word

Edited by Krohm

Share this post


Link to post
Share on other sites

Hmm yes that makes sense. What i'm doing so far is using VTF in the PS (not VS) to obtain normals. I think i might move this to VS or simply send in normals with vertex lke you said. Then i use an alphamap with 3 values (2 texture IDs and 1 weight) for the splatting, as apposed to the usual 4 splat weights channel. This gives me more textures to work with but limits me to 2 textures per vertex, which isn't a problem really. I also use detail maps.

 

Anyway, for the tangents and bitangents, is it better to send them in with the vertex or generate on the GPU? By better i mean performance wise.

 

@Scouting Ninja, thanks for the visual aid :)

Share this post


Link to post
Share on other sites

Calculating TBN for a heightfield is less "involved" than for an arbitrary mesh as the UV coordinates are basically the vertex positioning equally spaced along the X/Z plane. You could calculate the normal from the heightfield using a cross filter a la Frostbite and from this derive your Tangent and BiNormal vectors for your TBN matrix. Will this be faster? Well, that depends on your hardware and requirements but it would be a lot less geometry to be sending to the GPU as the terrain vector field would consist of just two UV components. Just to clarify in case there's any confusion: normal maps do not replace normals, they are used in conjunction with one and other (except in a few simplistic cases).

Share this post


Link to post
Share on other sites


Extracting a normal (and by extension the whole TBN frame) is still not as straightforward as one might think.

You can cheat your way out of needing a TBN frame if you perform your lighting in object space.

 

In object space, your terrain is always a regular grid, and the (approximate) tangents and bitangents lie along the grid axes.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement