ssr_resolve.computeShader
- README.md2.1 KB
- bindings.yaml644 B
- shader.wgsl7.7 KB
This package holds more than this page lists. See all of its files in its world.
README.md
ssr_resolve
Gathers each pixel's reflection lobe from the rays the trace drew, accumulates
it over frames, and writes the result into @scene.reflection.
A pixel's lobe is the GGX distribution its roughness describes. The pixel's own
ray and the rays of up to taps neighbours on a disk (turned by pixel and
frame, radius up to 6 px, growing with roughness) are weighed against that lobe:
D · Vis · cos / pdf, where pdf is the density the neighbour's ray was drawn
with. A neighbour counts only where it shows the same surface: its normal within
0.9 (cosine) of the pixel's and its depth within 5 percent of the pixel's.
Each ray carries the place it hit, not the light. The resolve reads the light
from @scene.colorHistory where the hit stood in the previous frame, and takes
a sky hit's direction from the camera ray through the sky pixel.
The output states two things per pixel: .rgb, the light of the rays that found
something on screen, and .a, the share of the lobe those rays cover. A ray that
found nothing counts toward the lobe and carries no light, so a lobe the screen
answers half of is a = 0.5, and the material fills the other half from the
probes and the sky. .a also carries intensity and the hand-over above
roughnessCutoff.
The accumulated value is stored premultiplied in the feature's history target. The history colour is held to the mean plus or minus 1.25 standard deviations of the gathered rays, in a space where bright values do not own the average. A surface above roughness 0.25 keeps up to 0.9 of the previous frame; a surface below 0.1 keeps nothing, takes no neighbours and reads its one ray.
Includes
ssr_commongbuffer_materialdisplay
Bindings
| name | kind |
|---|---|
ssr_rays | texture2d |
scene_color | texture2d |
scene_depth | texture_depth |
scene_normal | texture2d |
scene_material | texture2d (sample: uint) |
history_prev | texture2d |
frame_cam | buffer |
ssr_params | buffer |
history_state | buffer |
history_out | storage2d (rgba16f) |
ssr_out | storage2d (rgba16f) |