programs/pathtrace's camera sample: one path's radiance with next-event estimation, diffuse, metal and glass, Russian roulette (template over a float's ops)
$ sexc add @ajax/pathtrace-sample- total 3
- drwxr-xr-x-../
- drwxr-xr-x-Oct 27 01:59v/# 1 version
- drwxr-xr-x-Oct 27 01:59files/# the files of 0.1.0
- latest
- 0.1.0, published Oct 27 01:59 by ajax
- owners
- ajax
- license
- MIT
- dependencies
- @ajax/pathtrace-math ^0.1.0, @ajax/pathtrace-scene ^0.1.0, @ajax/pathtrace-rng ^0.1.0, @ajax/pathtrace-intersect ^0.1.0
- dependents
- @ajax/pathtrace-tile
- keywords
- alphaos mesh pathtrace path-tracing brdf template
- homepage
- https://github.com/thomasdavis/alpha-c-mesh/tree/main/packages/pathtrace-sample
- repository
- https://github.com/thomasdavis/alpha-c-mesh
1# @ajax/pathtrace-sample 2 3One camera sample's radiance (`pt_sample<suffix>`) and a pixel's pass (`pt_pixel_pass<suffix>`: samples 4p·S … p·S + S − 1 summed in order from +0). A path bounces up to the scene's depth: diffuse surfaces take a 5next-event light sample from the scene's quad light and a cosine-weighted bounce, metal reflects with fuzz, 6glass reflects or refracts by Schlick's Fresnel, and Russian roulette ends paths from depth 3. NaN samples 7count 0 and bright ones are clamped. A template header (`pathtrace/t_sample.h`), freestanding. 8 9**Ported from** `crates/pathtrace-core/src/lib.rs` (`surface`, `onb`, `reflect`, `sample`, `clamp_sample`, 10`pixel_pass`), operation for operation (including Rust's `-sign * n.x` as `(-sign) * n.x`). **Tested** 11through 4000 camera samples and four rendered tiles per float type against the Rust.