Question by
scottharber · Mar 08, 2016 at 05:39 PM ·
shaderlightmap
Lightmap emission with custom shaders?
I have a custom emissive shader in Unity (the shader is not deferred). When I bake lightmaps, the emissive shader does not light the surrounding environment with its emission. But when I bake using the Standard shader, it does.
How do I make the emission of a custom shader behave the same way as the Standard shader when lightmapping? I couldn't find any documentation for how to do this.
Comment
Answer by scottharber · Mar 09, 2016 at 12:44 PM
Found it. Sharing the love in case someone else has this question and finds this thread:
// ------------------------------------------------------------------
// Extracts information for lightmapping, GI (emission, albedo, ...)
// This pass is not used during regular rendering.
Pass
{
Name "META"
Tags { "LightMode"="Meta" }
Cull Off
CGPROGRAM
#pragma vertex vert_meta
#pragma fragment frag_meta
#pragma shader_feature _EMISSION
#pragma shader_feature _METALLICGLOSSMAP
#include "UnityStandardMeta.cginc"
ENDCG
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612071055im_/https://answers.unity.com/themes/thub/images/avi.jpg)