Mapdev:parallax

From Spring
Revision as of 07:32, 31 December 2012 by Enetheru (talk | contribs) (created page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Parallax Texture

modifies the diffuse, normal, and specular TEXTURE COORDINATES before sampling is done

FIXME: description as to why you want to use Parallax textures.

Example
FIXME: needs image file FIXME: needs image file
Without Parallax Map With Parallax Map

Specification

mapinfo.lua

The relevant sections of the mapinfo.lua

local mapinfo = {
   ...
   resources = {
      ...
      parallaxHeightTex = "parallax.png",
      ...
   },
   ...
}

Image File

  • Location: ./maps/
  • 8bpp RGBA, any resolution(will be stretched over the terrain).
  • Should be the same size as the specular tex

FIXME: needs cleaning.

height, scale, and bias parameters are packed
as follows to produce a texel offset-factor f

h = (parallaxHeightTex.r * 65280 + parallaxHeightTex.g * 256) / 65536
s = (parallaxHeightTex.b)
b = (parallaxHeightTex.a - 0.5)
f = h * s + b

Forum Discussions