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

Lightmapped Bumped 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.

Bumped 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.

Like a Diffuse shader, this computes a simple (Lambertian) lighting model. The lighting on the surface decreases as the angle between it and the light decreases. The lighting depends only on the this angle, and does not change as the camera moves or rotates around.

Bumpmapping simulates small surface details using a texture, instead of spending more polygons to actually carve out details. It does not actually change the shape of the object, but uses a special texture called a Bumpmap (also called a Normal Map) to achieve this effect. In the Bumpmap, each pixel's color value represents the angle of the surface normal. Then by using this value instead of the one from geometry, lighting is computed. The Bumpmap effectively overrides the mesh's geometry when performing lighting of the object.

Creating Bumpmaps

You can import a regular grayscale image and convert it to a Normal Map from within Unity. To learn how to do this, please read the Bumpmap FAQ page.

Technical Details

The Normal Map is a tangent space type of Normal Map. Tangent space is the space that "follows the surface" of the model geometry. In this space, Z always points away from the surface. Tangent space Normal Maps are a bit more expensive than the other "object space" type Normal Maps, but have some advantages:

  1. It's possible to use them on deforming models - the bumps will remain on the deforming surface and will just work.
  2. It's possible to reuse parts of the Bumpmap on different areas of a model; or use them on different models.

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 on the more expensive rendering side. For more details, please view the Shader Peformance page.