Fix sun quad square artifact with hard radial discard cutoff

Add hard discard at radius 0.35 so no fragment beyond that point
reaches the additive blend stage. Tighten disc, glow, and edge
fade to fit within the cutoff boundary.
This commit is contained in:
Kelsi 2026-02-23 08:43:50 -08:00
parent 0a1e240831
commit 5072c536b5
2 changed files with 9 additions and 6 deletions

View file

@ -27,17 +27,20 @@ void main() {
vec2 uv = TexCoord - 0.5; vec2 uv = TexCoord - 0.5;
float dist = length(uv); float dist = length(uv);
// Hard disc with smooth edge // Hard circular cutoff — nothing beyond radius 0.35
float disc = smoothstep(0.42, 0.35, dist); if (dist > 0.35) discard;
// Soft glow that fades to zero well within quad bounds // Hard disc with smooth edge
float glow = exp(-dist * dist * 32.0) * 0.5; float disc = smoothstep(0.35, 0.28, dist);
// Soft glow confined within cutoff radius
float glow = exp(-dist * dist * 40.0) * 0.5;
// Combine disc and glow // Combine disc and glow
float alpha = max(disc, glow) * push.intensity; float alpha = max(disc, glow) * push.intensity;
// Fade to zero well before quad edges // Smooth fade to zero at cutoff boundary
float edgeFade = 1.0 - smoothstep(0.30, 0.38, dist); float edgeFade = 1.0 - smoothstep(0.25, 0.35, dist);
alpha *= edgeFade; alpha *= edgeFade;
vec3 color = push.celestialColor.rgb; vec3 color = push.celestialColor.rgb;

Binary file not shown.