feat(@typegpu/radiance-cascades): Partial solves and filtered sectors in `holographic`

Abierto
#3,450 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
43/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
typescript

Línea de trabajo

Start by reading the holographic executor implementation and its run() and integrate pipelines; the issue does not name their file paths, so locate them in the repository. Compare the current sector solve and filtering flow with the proposed options, then identify which API and pipeline changes are needed. Done means partial sector masks, optional filtered sectors and output, and the stated behavior and compatibility are implemented and covered.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Problem

holographic exposes the four directional sectors (executor.sectors), which lets a consumer go
beyond the angular mean. Examples are directional irradiance for normal-mapped or non-flat
receivers, lifting the 2D solve onto 3D surfaces, and weighting light by facing. Three things
still make the sectors expensive or noisy to use that way:

  1. Every run() solves all four quadrants. An app that can tolerate a frame or two of
    lighting latency can't spread the solve over frames. For example, it might solve +X/−X on even
    frames and +Y/−Y on odd ones, halving the per-frame cost.
  2. The sectors are unfiltered. The transmission-aware five-tap filter in integrate runs
    only on the summed output, so anyone sampling the sectors sees the ray-pattern artifacts it
    removes.
  3. output is always computed. A consumer that samples only the sectors still pays for the
    integrate pass and the output texture.
const gi = hrc.create({ root, size, medium });
gi.run({ pass }); // always all four quadrants, plus the integrate pass
// gi.sectors holds the unfiltered per-direction radiance
Proposal
const gi = hrc.create({
  root,
  size,
  medium,
  sectors: { filtered: true }, // default false: sectors as today
  output: false, // default true: skip `integrate` and the output texture
  masks: [0b0101, 0b1010], // optional: the masks run() will be given, so only those compile
});

gi.run({ pass, sectors: 0b0101 }); // solve quadrants 0 and 2; 1 and 3 keep their last result
gi.run({ pass, sectors: 0b1010 }); // next frame
gi.run({ pass }); // default: all four, as today
  • run({ sectors }) is a bitmask of quadrants (bit q is quadrant q). Unsolved layers of
    sectors keep their previous contents, so the texture always holds the latest solve of every
    direction. With output on, integrate combines whatever the layers currently hold.
  • sectors.filtered applies the existing transmission-aware five-tap filter to each sector
    layer, using the same arithmetic as integrate. It writes in place, or into a second array
    when output also needs the raw sum.
  • output: false drops integrate, output and its pipeline.
  • masks compiles only the pipelines those masks need, which keeps start-up compiles down on
    mobile. Without it, every quadrant is available, as today.

Two internal changes, with no API change, would fit alongside:

  • A merged schedule.

    • The traced levels run in one dispatch.
    • The top interval level is recomputed by the last downpass instead of stored.
    • An even and an odd quadrant are solved together, each on its own scratch.

    Four sectors take 34–38 dispatches instead of about 88, with at most five storage buffers per
    dispatch.

  • A quadrature table. The downpass weights (atan(slope1) − atan(slope0)) / 2π depend only
    on level and ray. They can be computed once on the CPU in double precision, into a read-only
    buffer, which saves two atan per sample and one pipeline. The results are not bit-identical
    to GPU atan: about 0.03% of sector values move by one half-float step.

Alternatives considered
  • Filter the sectors outside the package. The filter needs the medium's per-pixel opacity,
    which the executor already evaluates, so a separate pass would evaluate medium again.
  • A separate executor per sector pair for partial solves. That doubles the scratch buffers
    and the pipelines.
Cost when not used

None. Without the new options the executor builds the same pipelines, records the same passes and
produces the same output and sectors. The merged schedule and the quadrature table are
internal and can land separately.

Lenguaje dominante
TypeScript
Estrellas
3.4k
Forks
151
Merge medio
3 d 8 h
PR fusionados (30 d)
55

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de software-mansion/TypeGPU

Todos los issues de software-mansion/TypeGPU

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.