Mapdev:normal

From Spring
Jump to navigationJump to search

Normal Texture

Gives the terrain a normal map. This can be used to suggest small surface details while keeping terrain flat. The RGB channels determine the XYZ of the new surface normal (in tangent space), while the alpha channel determines how much of the original surface normal is kept.

This GIMP plugin provides various ways to convert heightmaps into normal maps.

Icon-caution.png Caution
Requires clients to have GLSL-spec hardware
Example
FIXME: needs image file FIXME: needs image file
Without Normal Map With Normal Map

Important Info

  • The normal map effect will *not* be shown unless you have a specular map defined. It can be as simple as a full-black with full-black alpha image, TGA 32-bit format is recommended.
  • If you want to merge two normal maps, for instance, one for the terrain and one for the resources (metal, geo vents), it's not as simple as it might sound if you want to do it properly. You can read about it in detail here. The "Whiteout" technique is recommended, there is a Photoshop action available for it here

Specification

mapinfo.lua

The relevant sections of the mapinfo.lua

local mapinfo = {
   ...
   resources = {
      ...
      detailNormalTex = "normal.png",
      ...
   },
   ...
}

Image File

File Location ./maps/
File Format PNG, TGA
Colour Depth 8bpp
Channels RGBA
Resolution Any, recommended powers of two, will be stretched over the terrain.
Modifies the shading normal as follows

shadingNormal.xyz = NORMALIZE(terrainNormal.xyz * (1 - detailNormalTex.a) 
                               + detailNormalTex.rgb)