Hello! I’ve been toying around with shaders and I’m trying to understand these two functions:
vec4 GetScreenPos(vec4 clipPos)
{
return vec4(
clipPos.x * cGBufferOffsets.z + cGBufferOffsets.x * clipPos.w,
clipPos.y * cGBufferOffsets.w + cGBufferOffsets.y * clipPos.w,
0.0,
clipPos.w);
}
vec2 GetScreenPosPreDiv(vec4 clipPos)
{
return vec2(
clipPos.x / clipPos.w * cGBufferOffsets.z + cGBufferOffsets.x,
clipPos.y / clipPos.w * cGBufferOffsets.w + cGBufferOffsets.y);
}
Can somebody tell me what does cGBufferOffsets
stands for? Also, any help on this “wierd” looking multiplactions and divisions by its components in both of the upper functions would be more than welcome