Directional lights sort shadow-casting and volumetric lights last, contrary to the comment, so they're the ones dropped past MAX_DIRECTIONAL_LIGHTS
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 70/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- rust, wasm
- Ambito
- computer-graphics
Direzione di ricerca
L'ordinamento si trova in prepare_lights in crates/bevy_pbr/src/render/light.rs, dove directional_light_entities.sort_by_cached_key ordina per (light.volumetric, light.shadow_maps_enabled, *entity) e il risultato viene troncato con .take(MAX_DIRECTIONAL_LIGHTS). Leggi questo blocco insieme al commento sopra, poi conferma che false viene ordinato per primo. Il lavoro è completo quando le luci che proiettano ombre e quelle volumetriche restano davanti a quelle senza ombra, e lo spareggio per entità è lasciato al suo posto. Verifica a mano il ragionamento sull'ordine, dato che l'issue non fornisce alcun test da eseguire.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Bevy version and features
- 0.20.1. The same code is on
main(crates/bevy_pbr/src/render/light.rs,prepare_lights). - Seen on WebGL2 (
webgl2, wasm32), whereMAX_DIRECTIONAL_LIGHTSis 1.
[Optional] Relevant system information
- Rust 1.97.1, Chromium 156 on Linux.
AdapterInfo { name: "ANGLE (AMD, AMD Radeon RX 6650 XT (radeonsi navi23 ACO), OpenGL ES 3.2)", vendor: 4098, device: 0, device_type: Other, driver_info: "WebGL 2.0 (OpenGL ES 3.0 Chromium)", backend: Gl, .. }
What you did
Lit a scene with two DirectionalLights on the same layers: a bright sun and a dim fill light from the opposite side with shadow_maps_enabled: false. Built it for WebGL2, which warns The amount of directional lights of 2 is exceeding the supported limit of 1.
What went wrong
The comment above the sort says lights with volumetrics, then shadows, come first:
// Sort lights by
// - those with volumetric (and shadows) enabled first, ...
// - then those with shadows enabled second, ...
// - then by entity as a stable key ...
directional_light_entities.sort_by_cached_key(|entity| {
let light = directional_lights.get(*entity).unwrap().2;
(light.volumetric, light.shadow_maps_enabled, *entity)
});
But false sorts before true, so lights without volumetrics or shadows come first. Each view then keeps .take(MAX_DIRECTIONAL_LIGHTS), so past the limit it's the shadow-casting (or volumetric) light that gets dropped.
What we saw: on WebGL2, our scene was lit only by the dim fill light. With the sun's shadows on, the fill wins outright. With both lights shadowless, the entity tie-break decides, and which light won flipped between two builds of our app when we added an unrelated plugin.
Expected: the order the comment describes, Reverse on the first two keys or !light.volumetric, !light.shadow_maps_enabled. Then a shadowed sun is kept over a shadowless fill.
Additional information
- Natively this only matters past 10 directional lights (or the volumetric/shadow counts derived from
.take(MAX_DIRECTIONAL_LIGHTS)), since per-view shadow maps are capped by a running cascade count, not by index. - Workaround: we don't spawn the fill light on WebGL2.
- Lingua principale
- Rust
- Stelle
- 49.8k
- Fork
- 5.1k
- Merge medio
- 3g 4h
- PR unite (30g)
- 136
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di bevyengine/bevy
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
bevyengine/bevy#26641 ·
I maintainer di solito rispondono entro 2 giorni
-
A-Animation AI-Assisted C-Bug D-Trivial S-Needs-Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
bevyengine/bevy#26637 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
bevyengine/bevy#26635 ·
I maintainer di solito rispondono entro 2 giorni
-
Feathers checkbox outline should have flex_shrink: 0Forse già presa @Tatsuya0330 l’ha presa oggi. ApertaC-Bug S-Needs-Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
bevyengine/bevy#26630 ·
I maintainer di solito rispondono entro 2 giorni
-
Remove full_ui testbedApertaA-UI C-Examples C-Refinement D-Straightforward S-Needs-Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
bevyengine/bevy#26584 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di bevyengine/bevy
Issue simili
-
go good first issue test
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 2 giorni
-
bug triaged tui ux wontfix
Difficoltà 2/5 Mezza giornata Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno