DLSS / MainPassResolutionOverride: point and spot lights are cut off in screen-aligned rectangles (cluster lookup uses the full viewport size)

Aperta
#26,668 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
58/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust

Direzione di ricerca

Read bevy_pbr/src/render/clustered_forward.wesl at view_fragment_cluster_index and bevy_pbr/src/render/light.rs in prepare_lights. Compare the viewport used for fragment cluster lookup with the viewport used to calculate cluster_factors, then check how MainPassResolutionOverride supplies main_pass_viewport. Done means clustered lights align at reduced main pass resolution and the reported cutoff is gone; verify at both overridden and full resolution.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

C-Bug S-Needs-Triage

Bevy version and features

  • 0.20.1
  • Features: default + dlss (bevy_anti_alias::dlss). The camera has Dlss::<DlssSuperResolutionFeature> with DlssPerfQualityMode::Quality.

[Optional] Relevant system information

  • cargo 1.99.1 (5f94df478 2026-08-27)
  • Windows 11
AdapterInfo { name: "NVIDIA GeForce RTX 5080", vendor: 4318, device: 11266, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "616.92", backend: Vulkan }

What you did

A night scene with a SpotLight (range 45 m, outer angle 0.5 rad, no shadows) attached to
the camera like a flashlight, pointed at the ground. DLSS Super Resolution in Quality mode, so
the main pass renders at a lower resolution than the output (MainPassResolutionOverride).
GPU clustering is on (the default).

What went wrong

  • Expected: one continuous light spot on the ground.
  • Actual: parts of the lit area are missing in screen-aligned rectangles, with stair-step
    edges along the cluster tile grid. It happens mostly at the far end of the light's range.
    With DLSS DLAA (render resolution = output resolution) or without DLSS, everything is fine.

Additional information

bevy_pbr/src/render/clustered_forward.wesl, view_fragment_cluster_index:

let xy = vec2<u32>(floor((frag_coord - bindings::view.viewport.xy) * bindings::lights.cluster_factors.xy));

cluster_factors.xy is set in prepare_lights (bevy_pbr/src/render/light.rs) from the full
viewport:

cluster_factors: Vec4::new(
    clusters.dimensions.x as f32 / extracted_view.viewport.z as f32,
    clusters.dimensions.y as f32 / extracted_view.viewport.w as f32,
    ...

With MainPassResolutionOverride, frag_coord is in the reduced main pass resolution
(view.main_pass_viewport), while cluster_factors.xy is "clusters per output pixel". So every
fragment looks up the cluster at (render scale × its real position), i.e. a cluster up and to
the left of its own. Close to the camera the light covers almost every cluster, so nothing is
visible. At the far end of the light's range the neighbouring clusters don't contain the light,
and the light is cut off along the tile edges.

Workaround / proposed fix (one line), which makes the rectangles disappear:

let xy = vec2<u32>(floor((frag_coord - bindings::view.main_pass_viewport.xy)
    / bindings::view.main_pass_viewport.zw * vec2<f32>(bindings::lights.cluster_dimensions.xy)));

Without a resolution override main_pass_viewport equals viewport, so nothing changes there.
Another option is to compute cluster_factors.xy from the main pass size in prepare_lights.
Any other user of MainPassResolutionOverride is probably affected the same way.

Tested on one machine. Screenshots (same frame, DLSS Quality): before, after, and a zoomed
crop of the cut-off area.

dlss_clusters_before dlss_clusters_after dlss_clusters_zoom
Lingua principale
Rust
Stelle
50k
Fork
5.1k
Merge medio
2g 20h
PR unite (30g)
129

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bevyengine/bevy

Tutte le issue di bevyengine/bevy

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.