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

Đang mở
#3,450 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
43/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
computer-graphics

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
3.4k
Fork
151
Merge trung bình
3 ngày 8 giờ
Pull request đã merge (30 ngày)
55

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của software-mansion/TypeGPU

Tất cả issue của software-mansion/TypeGPU

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.