This commit is contained in:
Gabrieal Jimmy
2026-10-02 12:42:00 -05:00
commit 2c99305fb0
145 changed files with 6525 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
uniform vec4 uDof; // focus distance, focus range, transition, max radius (half-res px)
uniform float uTiltShift;
// Signed CoC in [-1, 1]. Distance-based blur plus an optional screen-space
// tilt-shift band that exaggerates the miniature/diorama look.
float cocFromDepth(float linDepth, vec2 uv) {
float s = linDepth - uDof.x;
float a = smoothstep(uDof.y, uDof.y + uDof.z, abs(s));
float tilt = uTiltShift * smoothstep(0.18, 0.5, abs(uv.y - 0.5));
float sgn = abs(s) > 0.25 ? sign(s) : sign(uv.y - 0.5);
return max(a, tilt) * sgn;
}