playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
26 lines (19 loc) • 591 B
JavaScript
var sharedGLSL = /* glsl */ `
// convert clip space position into texture coordinates to sample scene grab textures
vec2 getGrabScreenPos(vec4 clipPos) {
vec2 uv = (clipPos.xy / clipPos.w) * 0.5 + 0.5;
uv.y = 1.0 - uv.y;
return uv;
}
// convert uv coordinates to sample image effect texture (render target texture rendered without
// forward renderer which does the flip in the projection matrix)
vec2 getImageEffectUV(vec2 uv) {
uv.y = 1.0 - uv.y;
return uv;
}
`;
export { sharedGLSL as default };