Mapdev:specular: Difference between revisions

From Spring
Jump to navigationJump to search
Flozi (talk | contribs)
m 1cat
Flozi (talk | contribs)
m use Caution
Line 2: Line 2:
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
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
Alpha defines how "polished" the surface looks, and and the RGB color is the amount of light that gets reflected for each color channel
{{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"
Line 53: Line 52:
* 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.
* 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
* You have to set the RGB values to zero if you want no specular contribution
{{infobox|title=Caution|icon=icon-caution.png|color=rgba(255,0,0,0.1)
{{Caution|Do not set the alpha value of the specular texture to zero, or you will get the below graphical artefacts. Use almost zero instead.}}
|body= Do not set the alpha value of the specular texture to zero, or you will get the below graphical artefacts. Use almost zero instead.}}
<center>
<center>
{| class="wikitable"
{| class="wikitable"

Revision as of 14:26, 16 February 2014

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

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
Caution
Do not set the alpha value of the specular texture to zero, or you will get the below graphical artefacts. Use almost zero instead.

Forum Discussion