Move 'neural' multiple scattering onto the shared pmndrs neural tooling

Open
#3 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript

Research direction

Start with the MLP and weight loading in packages/vdb/src/core/frame/ and packages/vdb/src/tools/frame/neural.ts, then review the sibling @pmndrs/denoiser runtime interface and WGSL package. Check the CPU twin tests in packages/vdb/test/tools/frame-neural-train.test.ts and the frame comparisons in e2e/k6-frames.spec.ts; done means the neural path uses shared tooling, meets the stated CPU and image checks, and preserves the reported bias bound.

Written by the indexing model from the issue text.

Description

Summary

multipleScattering: 'neural' estimates multiple-scattered light in a cloud with a small MLP. It should run on the shared pmndrs neural tooling instead of our own one-off MLP code and trainer: pmndrs/denoiser, whose @pmndrs/denoiser-core defines a runtime-agnostic network interface on the host's GPUDevice, with hand-written WGSL (@pmndrs/denoiser-wgsl) and WebNN (@pmndrs/denoiser-webnn) runtimes.

What it is today

  • Network: 20 inputs → 32 → 32 → 1, exp output, about 1.7k multiply-adds.
    • Inputs: log(1 + σ·h·2^k) at the point and at ±h·2^k toward the light for 6 box-mip levels, plus the direct optical depth and an albedo term.
    • No anisotropy input: it is trained for Henyey-Greenstein g = 0.8.
  • Where it runs: on the GPU, once per cell of the shadow grid (64³ by default), only when that grid is rebuilt. That happens when a light, a volume or the shadow region moves; static frames skip it. It does not run per pixel.
  • Code:
    • The generic MLP the core evaluates: renderer.mlp, built with vdbFrameMlpFromNeural (packages/vdb/src/core/frame/, packages/vdb/src/tools/frame/neural.ts).
    • The weights, as data: packages/vdb/src/tools/frame/neural-weights.ts. These are our own weights, trained on procedural media only (K6.N).
    • The trainer: scripts/k6/neural/, ported from mjurczyk/openvdb's scripts/neural-indirect/ (MIT). Its target is the scattered fluence by delta tracking with ratio-tracking next-event estimation.
    • The CPU twin and tests: packages/vdb/test/tools/frame-neural-train.test.ts, plus the k6-core gather / transmittance probes.
  • Status: the default multiple-scattering mode (multipleScattering: 'neural', D36), now with our weights. Against the K6.R path-traced reference, the mean |bias| over 16 held-out scene groups is 10.0% for 'neural' and 18.8% for two-sided (handoff docs/archive/handoffs/K6-N.md). Its runtime cost is not measured yet (K6.T).

Goal

  • Run inference through the sibling neural tooling: its WGSL layers, weight format and loading.
  • Train with the sibling tooling where it fits, and keep the dataset and target generation here (procedural media only, so the weights carry no data licence).
  • Keep the core engine-free (D20) and the one-storage-buffer-per-kernel / host-encoder rules (D10). The network stays pluggable: weights as data, null falls back to 1D diffusion.

Acceptance

  • The 'neural' kernels match their CPU twin within the existing bound, with a fail-before mutation.
  • Every frame that doesn't use 'neural' is byte-identical in e2e/k6-frames.spec.ts.
  • scripts/k6/reference-report.mjs: 'neural' bias on the 16 groups is no worse than K6.N's.
  • Open follow-ups to fold in if the tooling makes them easy (K6.Na):
    • an anisotropy input, so one network serves every g;
    • a lower-noise training target;
    • a timing against two-sided on hardware (K6.T).

Refs: DECISIONS D34, D35 (2), D36; DIVERGES V157–V158; TASKS K6.Na.

Dominant language
TypeScript
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pmndrs/vdb

All issues in pmndrs/vdb

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.