unity3d Emission


Example

Emission is when a surface (or rather a material) emits light. In the inspector panel for a material on a static object using the Standard Shader there is an emission property:

Emission parameter in inspector

If you change this property to a value higher than the default of 0, you can set the emission color, or assign an emission map to the material. Any texture assigned to this slot will enable the emission to use its own colors.

There is also a Global Illumination option which allows you to set whether the emission is baked onto nearby static objects or not:

  • Baked - The emission will be baked into the scene
  • Realtime - The emission will affect dynamic objects
  • None - The emission will not affect nearby objects

If the object is not set to static, the effect will still make the object appear to "glow" but no light is emitted. The cube here is static, the cylinder is not: The cube is set to static, the cylider is not. Emission is set to 10.

You can set the emission color in code like this:

Renderer renderer = GetComponent<Renderer>();
Material mat = renderer.material;
mat.SetColor("_EmissionColor", Color.yellow);

Light emitted will fall off at a quadratic rate and will only show against static materials in the scene.