feat(render3d): anti-aliasing that exists, and a lens for the viewfinder

The shipping default had NO anti-aliasing at all: the temporal resolve was removed, the
setting's first option went on saying "Temporal", and MSAA defaults to one sample, so
every machine without DLSS drew grass and needle cards with nothing smoothing an edge.

FXAA in the sharpen pass, which already reads the neighbourhood and runs last on the LDR
image. No history, so it cannot drag or smear a reflection. 25.5% less single-pixel
staircase on edge pixels.

The trap, recorded because it inverted the result: the unsharp delta must be computed
from the RAW image and only then applied to the anti-aliased colour. Centre from FXAA and
neighbours from the raw texture measures half smoothing and half signal, so the mask
sharpens precisely what FXAA softened - 29% WORSE than no anti-aliasing at all.

Depth of field for the photo mode: a disc whose radius is the circle of confusion,
normalised by focus distance so a landscape shot is not a macro, with taps rejected
unless they are at least as out of focus as the pixel they blur into - which is what
stops a sharp foreground haloing into a blurred background. Between the scene and the
bloom, so a blurred highlight still blooms. Skipped whole when the aperture is shut.

400 frames in ordinary play: GL 7.1 s, VK 7.2 s - the lens does not draw there.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-19 17:38:25 +03:00
parent 182cbf3cc3
commit ae52e9c4da
10 changed files with 222 additions and 6 deletions

Binary file not shown.

Binary file not shown.

View file

@ -326,7 +326,7 @@ T 638623c2 u_sky 6
T 638623c2 u_tershadow 7
T 638623c2 u_ts_height 8
P 4cf96468 fullscreen.vert sharpen.frag
B 4cf96468 frag 1 840
B 4cf96468 frag 1 844
U 4cf96468 frag u_cascade_vp 0 mat4 5 64
U 4cf96468 frag u_cascade_split 320 float 5 16
U 4cf96468 frag u_cascade_range 400 float 5 16
@ -364,6 +364,7 @@ U 4cf96468 frag u_fog_desat 816 float 1 0
U 4cf96468 frag u_texel 824 vec2 1 0
U 4cf96468 frag u_amount 832 float 1 0
U 4cf96468 frag u_grain 836 float 1 0
U 4cf96468 frag u_fxaa 840 float 1 0
T 4cf96468 u_brdf 2
T 4cf96468 u_irradiance 3
T 4cf96468 u_prefilter 4
@ -3168,3 +3169,52 @@ T 74258189 u_prefilter 5
T 74258189 u_shadow 6
T 74258189 u_tershadow 7
T 74258189 u_ts_height 8
P 5161e6ba fullscreen.vert dof.frag
B 5161e6ba frag 1 916
U 5161e6ba frag u_cascade_vp 0 mat4 5 64
U 5161e6ba frag u_cascade_split 320 float 5 16
U 5161e6ba frag u_cascade_range 400 float 5 16
U 5161e6ba frag u_cascade_texel 480 float 5 16
U 5161e6ba frag u_sun_dir 560 vec3 1 0
U 5161e6ba frag u_sun_color 576 vec3 1 0
U 5161e6ba frag u_cam_pos 592 vec3 1 0
U 5161e6ba frag u_prefilter_levels 604 float 1 0
U 5161e6ba frag u_fog_density 608 float 1 0
U 5161e6ba frag u_fog_height_falloff 612 float 1 0
U 5161e6ba frag u_fog_base 616 float 1 0
U 5161e6ba frag u_clip_y 620 float 1 0
U 5161e6ba frag u_spec_scale 624 float 1 0
U 5161e6ba frag u_sky_rot 632 vec2 1 0
U 5161e6ba frag u_ground_alb 640 vec3 1 0
U 5161e6ba frag u_ground_alb_hi 656 vec3 1 0
U 5161e6ba frag u_ground_hi_y 668 float 1 0
U 5161e6ba frag u_ground_hi_w 672 float 1 0
U 5161e6ba frag u_ibl_scale 688 vec3 1 0
U 5161e6ba frag u_daylight 700 float 1 0
U 5161e6ba frag u_fire_pos 704 vec3 1 0
U 5161e6ba frag u_fire_color 720 vec3 1 0
U 5161e6ba frag u_hand_pos 736 vec3 1 0
U 5161e6ba frag u_hand_color 752 vec3 1 0
U 5161e6ba frag u_hand_dir 768 vec3 1 0
U 5161e6ba frag u_hand_cone 780 float 1 0
U 5161e6ba frag u_ts_origin 784 vec2 1 0
U 5161e6ba frag u_ts_half 792 float 1 0
U 5161e6ba frag u_ts_on 796 float 1 0
U 5161e6ba frag u_force_cascade 800 int 1 0
U 5161e6ba frag u_cloud_shadow 804 float 1 0
U 5161e6ba frag u_time 808 float 1 0
U 5161e6ba frag u_fog_inscatter 812 float 1 0
U 5161e6ba frag u_fog_desat 816 float 1 0
U 5161e6ba frag u_inv_proj 832 mat4 1 0
U 5161e6ba frag u_texel 896 vec2 1 0
U 5161e6ba frag u_focus 904 float 1 0
U 5161e6ba frag u_aperture 908 float 1 0
U 5161e6ba frag u_max_coc 912 float 1 0
T 5161e6ba u_brdf 2
T 5161e6ba u_depth 3
T 5161e6ba u_irradiance 4
T 5161e6ba u_prefilter 5
T 5161e6ba u_shadow 6
T 5161e6ba u_src 7
T 5161e6ba u_tershadow 8
T 5161e6ba u_ts_height 9