Home

Awesome

BakeShader

Bake

Setup:

Bake Modes :

#pragma multi_compile _ _BAKESHADER

// in vertex function :
#ifdef _BAKESHADER
    float2 remappedUV = IN.uv.xy * 2 - 1;
    float4 outputPos = float4(remappedUV.x, remappedUV.y, 0, 1);
    OUT.vertex = outputPos; // Built-in RP
    OUT.positionCS = outputPos; // URP
#else
    OUT.vertex = UnityObjectToClipPos(IN.vertex); // Built-in RP
    OUT.positionCS = TransformObjectToHClip(IN.vertex); // URP
#endif
// (where "vertex" / "positionCS" is the common naming convention for the parameter using SV_POSITION semantic)