I can output emission value to baked lightmap with a surface shader. But how can i do it in vert/fragment shader.
I try to add a meta pass like this. Suppose to get red emission on the light map but nothing. Or did i miss something. Thanks.![]()
// ------------------------------------------------------------------
// Extracts information for lightmapping, GI (emission, albedo, ...)
// This pass it not used during regular rendering.
Pass
{
Name "META"
Tags {"LightMode"="Meta"}
Cull Off
CGPROGRAM
#include"UnityStandardMeta.cginc"
float4 frag_meta2 (v2f_meta i): SV_Target
{
// we're interested in diffuse & specular colors,
// and surface roughness to produce final albedo.
FragmentCommonData data = UNITY_SETUP_BRDF_INPUT (i.uv);
UnityMetaInput o;
UNITY_INITIALIZE_OUTPUT(UnityMetaInput, o);
o.Albedo = fixed3(1,0,0);
o.Emission = fixed3(1,0,0);
return UnityMetaFragment(o);
}
#pragma vertex vert_meta
#pragma fragment frag_meta2
#pragma shader_feature _EMISSION
#pragma shader_feature _METALLICGLOSSMAP
#pragma shader_feature ___ _DETAIL_MULX2
ENDCG
}