From Shader Forge Wiki
Jump to: navigation, search

Unity 5.x

A shader supports Enlighten lightmapping (and light probes) when the checkbox "Lightmap & light probes" is enabled in the Lighting section, on the left side within Shader Forge. It's that simple.

Unity 4.x

Lightmapping custom shaders in Unity has many strict rules you need to follow in order to make it work properly with Unity's Beast lightmapper.

Unity's lightmapper doesn't care about how you set up your node tree. It's, in a sense, blind, to whatever your shader is doing, with some specific exceptions.

If you have nodes, with exactly these internal names, Beast will read them. For example, name your diffuse texture node MainTex, the internal name will be _MainTex, and Beast will read it as the diffuse color.

Properties Beast recognizes

  • _MainTex (Texture, diffuse color in the RGB channels, transparency in the A channel)
  • _Color (Color, diffuse color tint. This is multiplied by _MainTex)
  • _SpecMap (Texture, specular map)
  • _SpecColor (Color, specular color tint)
  • _Shininess (Value or Slider, controls glossiness)
  • _BumpMap (Texture, normal map)
  • _TransparencyLM (Texture, rgb channels define colored transparency)
  • _Illum Texture, for emissive materials. This will be a mask of _MainTex * _Color)

In addition to using these property names, you also need to name your shaders properly, because Beast will read the shader path to determine what shader "type" it is.

For example, if you're using the _Illum property, you will need to have the word Self-Illumin in your shader path. "Self-Illumin/MyShader" instead of "Shader Forge/MyShader".

There are more keywords like this, such as: ‘Specular’, ‘Transparent’, ‘Self-Illumin’, etc.