Log inGet started
Package

ssr_resolve.computeShader

Newest version

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_common
  • gbuffer_material
  • display

Bindings

namekind
ssr_raystexture2d
scene_colortexture2d
scene_depthtexture_depth
scene_normaltexture2d
scene_materialtexture2d (sample: uint)
history_prevtexture2d
frame_cambuffer
ssr_paramsbuffer
history_statebuffer
history_outstorage2d (rgba16f)
ssr_outstorage2d (rgba16f)