Mapdev:specular: Difference between revisions
From Spring
Jump to navigationJump to search
m →Specular: addded example images. |
m re-arranged and added info |
||
| Line 13: | Line 13: | ||
= Specification = | = Specification = | ||
== mapinfo.lua == | == mapinfo.lua == | ||
The relevant sections of the [[Mapdev:mapinfo.lua|mapinfo.lua]] | The relevant sections of the [[Mapdev:mapinfo.lua|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 | |||
<code><pre> | <code><pre> | ||
local mapinfo = { | local mapinfo = { | ||
| Line 41: | Line 36: | ||
* Image Location: ./maps/ | * Image Location: ./maps/ | ||
* 8 bpp RGBA, any resolution (it will be stretched over the whole terrain). | * 8 bpp RGBA, any resolution (it will be stretched over the whole 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. | |||
* 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 | |||
{{infobox|title=Caution|icon=icon-caution.png|color=rgba(255,0,0,0.1) | |||
|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> | |||
{| class="wikitable" | |||
| [[File:Mapdev-spec_alpha_issue.jpg]] | |||
|}</center> | |||
= Forum Discussion = | = Forum Discussion = | ||
Revision as of 07:58, 30 December 2012
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
- Image Location: ./maps/
- 8 bpp RGBA, any resolution (it will be stretched over the whole 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.
- 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
| 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. |
|

