Choosing a package
When the trace core is enough, and when you want the path tracer.
@pmndrs/raytracer: you write the shading
Use it when you have a renderer and need rays, such as for reflections, shadows, ambient occlusion, GI probes or baking. It gives you:
- Inline WGSL.
rtModuleWgslreturns functions to paste into your compute shader:rtVisible(anything in the way?),rtClosest(first hit),rtSurface(position, normals, uvs and material of a hit). Only what you ask for is decoded. - Batch tracing.
RtBatchTracertraces a GPU buffer of rays into a buffer of hits, direct or indirect, with no CPU work per frame. - The scene copy. Materials, textures and lights on the GPU, with light sampling (
rtSampleLightLi) and a one-bounce OpenPBR shade (rtShade) for hit lighting. - Interval queries. Closest hit and visibility inside a
(t0, t1]range, for radiance cascades and probe tracing. - Loading.
loadGltfandbuildGpuScene.
@pmndrs/pathtracer: images out
Use it when you want a rendered image: a converged reference, a preview, or real-time frames for a denoiser.
- Two schedulers.
PtMegakernel(one kernel per sample) andPtWavefront(queues and indirect dispatch). They give the same image per pixel.ptwfAutoPolicypicks one for a film size and path length. - Materials. OpenPBR: metal, glass (thick or thin-walled), coats, sheen, thin film, anisotropy and absorbing media, with textures and alpha cutouts.
- Modes.
reference(default),previewandrealtime. Real time writes the planes a denoiser and an upscaler read: diffuse and specular radiance with their demodulation factors, emission, normals, depth and motion.
Experimental in @pmndrs/pathtracer
These are built, checked against references, and off by default. Their options can still change:
Pages for them carry Experimental in the title.