Mapdev:normal: Difference between revisions

From Spring
Jump to navigationJump to search
Line 1: Line 1:
= Normal Texture =
= Normal Texture =
{{FIXME}} description as to why you want to use normal textures.
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.
 
[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)
{{infobox|title=Caution|icon=icon-caution.png|color=rgba(255,0,0,0.1)
|body=Requires clients to have GLSL-spec hardware}}
|body=Requires clients to have GLSL-spec hardware}}
Line 10: Line 13:
! Without Normal Map !! With Normal Map
! Without Normal Map !! With Normal Map
|}</center>
|}</center>
= Specification =
= Specification =
== mapinfo.lua ==
== mapinfo.lua ==

Revision as of 00:50, 25 February 2013

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)