Mapdev:specular

From Spring
Revision as of 07:41, 30 December 2012 by Enetheru (talk | contribs) (→Specular: addded example images.)
Jump to navigationJump to search

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 Alpha defines how "polished" the surface looks, and and the RGB color is the amount of light that gets reflected for each color channel

Caution
requires clients to have GLSL-spec hardware
Example Specular Texture Ingame Result

Specification

  • 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
  • The RGB channels will control the red, green, and blue contribution per highlight
  • The alpha channel (multiplied by 16) becomes the specular exponent.
  • There is no size requirement on the specular texture, it will be stretched/shrunk to fit the map.
  • You have to set the RGB values to zero if you want no specular contribution

mapinfo.lua

The relevant sections of the mapinfo.lua

local mapinfo = {
   resources = {
      ...
      specularTex = "",
      ...
   },
   ...
   lighting = {
      ...
      groundSpecularColor = {0.1, 0.1, 0.1},
      ...
   },
   ...
}

Image File

  • Image Location: ./maps/
  • 8 bpp RGBA, any resolution (it will be stretched over the whole terrain).

Forum Discussion