aframevr / aframe

:a: Web framework for building virtual reality experiences.
https://aframe.io/
MIT License
16.61k stars 3.94k forks source link

1.3.0 Hellow WebVR screenshot looks washed out #5014

Closed diarmidmackenzie closed 1 year ago

diarmidmackenzie commented 2 years ago

Description:

This is what a screenshot of the Hello Web VR app (Ctrl-Alt-S) used to look like screenshot--1645741701810

This is what it looks like in 1.3.0 - to my eye this looks far too washed out. screenshot--1645741354272

This glitch uses a small JS script to run a version of 1.3.0 with the fix for PR4822 reverted, and gives the same screenshot output as 1.2.0 did.

I understand that PR4822 was added because screenshots were coming out too dark in some circumstances, but it seems that the way it's been fixed has just traded one problem for another.

I don't have any expertise around the various WebGLRenderTarget settings, so no idea what the "correct" fix is - but it looks like we still have issues here in getting the screenshot colors right in all cicumstances.

diarmidmackenzie commented 2 years ago

Wild guess, from reading 4915 and 4917, is it a question of whether colorManagement is enabled?

The Hello WebVR example doesn't use colorManagement, whereas maybe the cases being looked at in 4915 and 4917 did?

diarmidmackenzie commented 2 years ago

Here's a glitch with a totally unmodified "Hello WebVR" except for the addition of the "screenshot" attribute on the scene. https://fire-vine-family.glitch.me/

Ctrl-Alt-S on this will reproduce the washed out screenshot.

kfarr commented 2 years ago

Thanks for raising @diarmidmackenzie . I just took a look at the commit (it's been a while). I agree with your analysis.

dmarcos commented 2 years ago

Yeah we should match color management on screen and screenshot component. Thanks

zackdove commented 2 years ago

Is there an easy fix for this in the meantime?

innovaciones commented 2 years ago

Is there an easy fix for this in the meantime?

I tried the code from @diarmidmackenzie and that fixed the problem for me:

<script>      
  AFRAME.components.screenshot.Component.prototype.getRenderTarget = function (width, height) {
      return new THREE.WebGLRenderTarget(width, height, {
        minFilter: THREE.LinearFilter,
        magFilter: THREE.LinearFilter,
        wrapS: THREE.ClampToEdgeWrapping,
        wrapT: THREE.ClampToEdgeWrapping,
        format: THREE.RGBAFormat,
        type: THREE.UnsignedByteType
      });
    }
</script>

I was using the chromakey component and screenshots looked be very washed out, now screenshots looks fine.

dmarcos commented 1 year ago

Any PRs to fix this super welcome

diarmidmackenzie commented 1 year ago

I'll have a go.

dmarcos commented 1 year ago

fixed by https://github.com/aframevr/aframe/pull/5157