-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EXR Envmap not working on iOS #19053
Comments
Any errors in the console? |
[Warning] THREE.WebGLRenderer: EXT_frag_depth extension not supported. (three.module.js, line 16023) |
It seems to be the case for Android too, just tested on Chrome on Galaxy S10 |
I'm able to replicate this. At a quick glance, this looked related with This doesn't look related with EXR per-se, as changing https://threejs.org/examples/webgl_materials_envmaps_hdr.html to |
Can reproduce with a Pixel 1. |
I believe the problem stems from the fact that a
What I'm not sure is how we'd go about fixing this. Nothing comes to mind. |
Any ideas @elalish? |
The PMREMGenerator is designed to work with RGBE for exactly this reason (since RGBA8 framebuffers are supported everywhere). I think the best solution would be to read in the EXR as an RGBE texture and pass that to PMREMGenerator. Unless there's a reason that would be a problem elsewhere? |
It is possible to output an |
I think PMREM should support the standard HDR formats. That would include We also want to avoid having to decode RGBE in the shader, so support for floating point data textures is important. |
@WestLangley I tried that way originally, but switched to RGBE because while floating point textures are widely available for decode, the same is not true for writing to framebuffers. Samsung devices can't write halffloat buffers and iphones can't write float buffers, so I ended up decoding RGBE in the shaders because that was the only way I could find to make a broadly cross-device solution. Perhaps we should throw a warning about device compatibility when using non-8-bit formats with PMREM? |
Don't know if its of any help but the same file worked with my old implementation on mobile devices: var cubemapGenerator = new THREE.EquirectangularToCubeGenerator( texture, { resolution: 1024, type: THREE.HalfFloatType } );
var cubeMapTexture = cubemapGenerator.update( renderer );
var pmremGenerator = new THREE.PMREMGenerator( cubeMapTexture );
pmremGenerator.update( renderer );
var pmremCubeUVPacker = new THREE.PMREMCubeUVPacker( pmremGenerator.cubeLods );
pmremCubeUVPacker.update( renderer );
hdr = pmremCubeUVPacker.CubeUVRenderTarget; |
@krfft Yes, and the reason for that was that the old PMREMGenerator internally converted everything to RGBM (another 8-bit format). It's a little quicker to decode than RGBE, but comes at the cost of having significant interpolation artifacts at high dynamic range. |
I've pushed #19070 as a temporary fix for the situation. Even if we decide to pursue other solutions in the future, there's no harm in allowing That way, at least, we have a viable option for people looking to use EXR envmaps with mobile support. |
If I am not mistaken, That is one reason why I wonder if it would make sense to add |
I discussed privately with @WestLangley and perhaps allowing the user the ability to set the intermediary and final render target parameters ( Format, Type, Encoding ) might allow us to use regular floating point textures as an input for As far as I'm aware, most mobiles can read from floating point textures, the problem is usually rendering to them. Thoughts @elalish ? Do you think that would be something we can adapt ? |
@sciecode Yes, that fits with my understanding. That sounds like a reasonable path forward; I don't have a strong opinion on the shape of three's API. If we're planning to overhaul PMREMGenerator it might also be a good time to enable different sizes (right now it's fixed to outputting a 256x256 cubemap regardless of input size). It seems like with the right choice of defaults we might even be able to make this change non-breaking, which would be nice. |
I would allow the users to set only the data type, as I suggested above. |
Following the example on: https://threejs.org/examples/webgl_materials_envmaps_exr.html
and loading a EXR file as environment map with:
This works perfectly on all desktop browsers but on iOS the HDR is completely black and no lighting is applied to the model. This also applies to the example link on iOS: https://threejs.org/examples/webgl_materials_envmaps_exr.html
Three.js version
Browser
OS
Hardware Requirements (graphics card, VR Device, ...)
The text was updated successfully, but these errors were encountered: