Mapdev:normal: Difference between revisions

From Spring
Jump to navigationJump to search
Flozi (talk | contribs)
m →Normal Texture: use Caution
Maddox (talk | contribs)
Added 'important info' section about specular map requirement for normal effect
Line 12: Line 12:
! Without Normal Map !! With Normal Map
! Without Normal Map !! With Normal Map
|}</center>
|}</center>
= 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.<br />


= Specification =
= Specification =

Revision as of 14:46, 18 August 2018

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.

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.

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)