Lightmapped Specular
Reference Manual > Built-in Shader Guide > Lightmapped Shader Family > Lightmapped Specular

Lightmapped Specular

Lightmapped Properties

This shader is a complex version of a Self-Illuminated shader. It uses a secondary Lightmap texture that defines light "emitted" from the object onto itself (and nothing else). The Lightmap's RGB values define the color of light, and its alpha channel can be used to control glow. The Lightmap texture also uses the secondary UV map of the mesh for controlling the placement of light, which can differ from the primary UV map. This shader allows you to use baked colored light, radiosity with color bleeding and other funky effects.

This shader is handy when your Base texture and/or Bumpmap are tiled across your object multiple times and its Self-Illumination can't be tiled along with them. Most 3D modeling applications have tools to "bake" lighting into a texture and/or automatically compute a suitable lighting UV map. However, not all 3D modeling applications can export a secondary UV map properly.

Any scene lights will add illumination on top of the object's illumination. So if you have a Lightmapped level with baked lighting, and a rocket with point light flying, it will just add lighting - i.e. it just works.

Specular Properties

This shader is a Pixel-Lit shader, which is more expensive than Vertex-Lit. Pixel lighting is expensive mostly because each object has to be drawn multiple times for each pixel light that shines on it. Vertex lights don't affect the shader in this way. Pixel lights support cookies, bumpmapping, and shadows while vertex lights do not. Pixel lights are also much less sensitive to tesselation of the models - if you have a cube using this shader, you can put point light very close to its surface and it will have nice round highlight. This effect cannot be achieved with Vertex lighting.

Specular computes the same simple (Lambertian) lighting as Diffuse, plus a viewer dependent specular highlight. This is called the Blinn-Phong lighting model. It has a specular highlight that is dependent on surface angle, light angle, and viewing angle. The highlight is actually just a realtime-suitable way to simulate blurred reflection of the light source. The level of blur for the highlight is controlled with the Shininess slider in the Inspector.

Additionally, the alpha channel of the main texture acts as a Specular Map (sometimes called "gloss map"), defining which areas of the object are more reflective than others. Black areas of the alpha will be zero specular reflection, while white areas will be full specular reflection. This is very useful when you want different areas of your object to reflect different levels of specularity. For example, something like rusty metal would use low specularity, while polished metal would use high specularity. Lipstick has higher specularity than skin, and skin has higher specularity than cotton clothes. A well-made Specular Map can make a huge difference in impressing the player.

Performance

Generally, this shader is moderately expensive to render. For more details, please view the Shader Peformance page.