Mapdev:normal: Difference between revisions

From Spring
Jump to navigationJump to search
Flozi (talk | contribs)
m 1cat
Flozi (talk | contribs)
m →Normal Texture: use Caution
Line 4: Line 4:
[https://code.google.com/p/gimp-normalmap/ This GIMP plugin] provides various ways to convert heightmaps into normal maps.
[https://code.google.com/p/gimp-normalmap/ This GIMP plugin] provides various ways to convert heightmaps into normal maps.


{{infobox|title=Caution|icon=icon-caution.png|color=rgba(255,0,0,0.1)
{{Caution|Requires clients to have GLSL-spec hardware}}
|body=Requires clients to have GLSL-spec hardware}}
<center>
<center>
{| class="wikitable"
{| class="wikitable"

Revision as of 14:27, 16 February 2014

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

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)