Mapdev:specular: Difference between revisions

From Spring
Jump to navigationJump to search
m →Image File: used image template styling
Gajop (talk | contribs)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= Specular =
= 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
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
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.
{{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 16: Line 15:
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
* 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>
<pre>
local mapinfo = {
local mapinfo = {
   resources = {
   resources = {
Line 31: Line 30:
   ...
   ...
}
}
</pre></code>
</pre>


== Image File ==
== Image File ==
Line 51: Line 50:
|}
|}
* The RGB channels will control the red, green, and blue contribution per highlight
* 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.
* 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)
* 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.
|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.}}
{{Caution|If you set the alpha value of the specular texture to zero, or you will get the below result. Use almost zero instead.}}
<center>
<center>
{| class="wikitable"
{| class="wikitable"
Line 63: Line 62:
* [http://springrts.com/phpbb/viewtopic.php?f=13&t=21951 Make Your Maps Shiny(er) With SSMF]
* [http://springrts.com/phpbb/viewtopic.php?f=13&t=21951 Make Your Maps Shiny(er) With SSMF]


[[Category:Mapdev]]
[[Category:Map Dev]]
[[Category:Development]]

Latest revision as of 16:38, 18 December 2018

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
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
  • 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
If you set the alpha value of the specular texture to zero, or you will get the below result. Use almost zero instead.

Forum Discussion