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

Open
#26,668 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
rust

Research direction

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.

Written by the indexing model from the issue text.

Description

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
Dominant language
Rust
Stars
50k
Forks
5.1k
Avg merge
2d 20h
Merged PRs (30d)
129

Getting set up

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 bevyengine/bevy

All issues in bevyengine/bevy

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.