UnityObjectToClipPos()

What does function UnityObjectToClipPos() ???

1 Like

CGIncludes\UnityCG.cginc line #153 from the 5.4 beta built in shader source

// Tranforms position from object to homogenous space
inline float4 UnityObjectToClipPos( in float3 pos )
{
#if defined(UNITY_SINGLE_PASS_STEREO) || defined(UNITY_USE_CONCATENATED_MATRICES)
    // More efficient than computing M*VP matrix product
    return mul(UNITY_MATRIX_VP, mul(unity_ObjectToWorld, float4(pos, 1.0)));
#else
    return mul(UNITY_MATRIX_MVP, float4(pos, 1.0));
#endif
}
12 Likes

this is not helping much

1 Like

Basically it converts a coordinate vector from object space to clip space.

Clip Space is kinda like Screen Space, but can be different if you have a different viewport set up. Anything outside -1 ~ +1 is clipped.