Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Mapdev:specular

From Fightorder
Revision as of 07:38, 18 December 2018 by interwiki>Gajop (mapinfo.lua)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Specular

Gives you per-pixel control over the color and intensity of specular highlights anywhere on the map. You could eg. make all highlights red, or have them depend on the type of material that a pixel represents, or something more exotic. The alpha channel defines how "polished" the surface looks (glossiness), and the RGB color is the amount of light that gets reflected for each color channel.

Caution
File:Mapdev-specular.jpg File:Mapdev-spec with.jpg
Example Specular Texture Ingame Result

Specification

mapinfo.lua

The relevant sections of the mapinfo.lua

  • If specularTex points to a file that does not exist, you will get full unmoderated specularity based on whatever your map's lighting settings are
local mapinfo = {
   resources = {
      ...
      specularTex = "",
      ...
   },
   ...
   lighting = {
      ...
      groundSpecularColor = {0.1, 0.1, 0.1},
      ...
   },
   ...
}

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.
  • The RGB channels will control the red, green, and blue contribution per highlight
  • The Alpha channel (multiplied by 16) becomes the specular exponent. Or on other words controls the sharpness of the specular highlights, the higher the value the sharper the highlights.
  • You have to set the RGB values to zero if you want no specular contribution
  • If you omit the alpha channel, or have a fully opaque image, the specular exponent is at its max and the results are a very sharp specular highlights.
Caution
File:Mapdev-spec alpha issue.jpg

Forum Discussion