pmndrs / pmndrs/react-postprocessing

[Bug] - N8AO works incorrectly with adaptiveDpr

Offen
#280 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
TypeScript
Sterne
1.4k
Forks
134
Ø Merge
4 Min.
Gemergte PRs (30 T.)
4

Beschreibung

Hey everyone! I seems found a bug in N8AO related to AdaptiveDpr

We found a strange effect in our application after adding N8AO to EffectComposer - sometimes it started to add weird 'reflections' to the materials, and we couldn't understand where it's coming from

image

This is how it looks like: On the surface of the model you can see "reflection" from grid, which should't be present (but it's not only about grid but any objects can appear as reflection).

After debugging for a while I've noticed that this happens on my machine when DPR value is changed. If we (or system) change dpr from 2 to 1, N8AO started to add this 'reflections'. As I can see class has size values which are half of the initial renderer size (if I understand correctly)

Снимок экрана 2024-04-23 в 10 16 47

If I manually call setSize(width, height) method on N8AOPostPass instance and upscale this values back to dpr=2 values this bug disappears. So it's either should always keep initial values or there is some error in calculation after updating render size

Steps to reproduce
Lest say screen size is 1000x500 with dpr=2. initial values of renderer is 2000x1000px, dpr=2, we set dpr to 1, values are updated to 1000x500, bug appears. If I set values manually by calling setSize() on N8AOPostPass instance to setSize(2x1000, 2x500) it starts working correctly again

versions

"@react-three/drei": "^9.97.5",
"@react-three/fiber": "^8.15.16",
"@react-three/postprocessing": "^2.16.2",
"postprocessing": "^6.35.3",
"three": "^0.161.0",

Can anyone help with this? I can help with fix if you can explain a bit more of how it works. Thanks in advance

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit dem im Issue beschriebenen Verhalten von N8AOPostPass und reproduziere den Fall, indem du die Renderer-DPR in den aufgeführten react-postprocessing- und three-Setups von 2 auf 1 änderst. Verfolge, wie sich seine Größenwerte aktualisieren; abgeschlossen ist die Aufgabe, wenn adaptiveDpr nach dem DPR-Übergang keine unbeabsichtigten Reflexionen mehr erzeugt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
react, three.js, typescript
Bereich
frontend, performance, web-dev
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.