diarmidmackenzie / aframe-multi-camera

A-Frame components implementing multiple cameras
MIT License
24 stars 6 forks source link

Mirrors are looking dark in A-Frame 1.5.0 with color management enabled. #8

Open diarmidmackenzie opened 10 months ago

diarmidmackenzie commented 10 months ago

A-Frame 1.5.0 has enabled color management by default

See: https://github.com/aframevr/aframe/issues/5383 and https://github.com/aframevr/aframe/pull/5210

On upgrading the mirror example to 1.5.0 I noticed everything got very dark.

Setting renderer=colorManagement: false got us back to the original display.

However, ideally mirrors should work with colorManagement enabled, especially as this is the default from 1.5.0.

I have created a test page with a mirror, and colorManagement enabled. With 1.4.2 the reflections are noticeably darker, but not too bad. WIth 1.5.0, they are much darker still. Back in 1.2.0 the reflections weren't darkened at all.

Some pics (all with color management enabled):

1.5.0 image

1.4.2 image

1.3.0 (looks the same as 1.4.2 to me) image

1.2.0 image

diarmidmackenzie commented 10 months ago

Obvious first thing to try was moving to the latest THREE.js code from Reflector.js

Done that in a branch here: https://github.com/diarmidmackenzie/aframe-multi-camera/tree/update-mirror-to-three-r158

With that change, reflections with 1.5.0 and color management enabled do seem a little less dark. image

But more significantly there's a massive perf degradation - the mirror example was running at < 3fps on the latest code, vs. about 15fps with the previous code.

Possible match on this issue: https://github.com/mrdoob/three.js/issues/19248

Is so, there's presumably an encoding mismatch somewhere, leading to the perf degradation... I don't have time to dig into this at the moment.

diarmidmackenzie commented 10 months ago

Based on comment here I discovered that if I remove the color attribute from my mirrors, the performance degradation disappears.

The 'color' attribute had been intended to color the back side of the mirror, so some work needed to color the back correctly without affecting performance of the mirror front.