-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
Using a texture as scene.background
is blurrier than it should
#27501
Comments
When applying this texture to So we comparing two different env map techniques here and it's not surprising to see slightly different results. |
Well, the end result is that the background is blurrier than it should be given the provided texture – we had a number of people complain about that so I'd certainly like to understand better how to fix it. "Just don't use .background, make a sphere" doesn't sound very usable. Converting an equirect texture to a cubemap does not inherently make it blurrier (e.g. it doesn't in Unity). |
Do you get better results if you increase the resolution of the internal cube render target here? three.js/src/renderers/webgl/WebGLCubeMaps.js Lines 43 to 44 in 8286a47
|
When I remember correctly, in earlier days examples often used a fixed size to convert equirectangular env maps to the cube map format. E.g. scene.background = new THREE.WebGLCubeRenderTarget( 512 ).fromEquirectangularTexture( renderer, texture ); #19911 introduced the |
Yes, indeed, then the results look much better – I believe Unity always uses the full Pixel counts:
|
An interesting alternative might be doing regular or rotated-grid supersampling in the |
Just updating the size of the cube map would at least be an easy fix^^. Still unsure about the performance implications though. I don't know how the supersampling approach works out but I wonder if you would be happy with a "slightly" better result compared to using a cube render target with higher size that provides an optimal result. |
True that! I'm not sure if the shader-based solution can achieve similar quality, it's just something I've used in the past for crisper text rendering and such cases... |
Some memory allocation data for comparison: RGBA8:
FP16 (HDR):
The additional required memory for 1024 x 1024 is quite a bit. However, the improvement in quality is noticeable. @elalish What would you recommend from |
After a bit of thinking I believe fixing this would be good:
I agree there is a risk that someone was using 4k backgrounds before to offset the extra blur that a 2k background introduced (I certainly did that in a number of projects), and memory requirements are now 4x. But the fix is easy, just not use 4k in that case, reaching the desired 2k quality. |
@hybridherbst is a significant It would be nice if we had a standard cubemap image format so we didn't need to worry about all these conversions. Is KTX2 a possibility? |
KTX2Loader cannot load float16 or float32 cubemaps at this point, see #26642 (comment). It does support LDR cubemaps (with Basis Universal compression), so it'd work for |
Thanks for the info! I hear Binomial is doing some work on HDR compression, so maybe this'll get improved soon. |
Description
This is something that has bothered me for a while: when using a texture for scene.background, it ends up being blurrier than the same texture just used on a regular sphere.
I accidentally found a good way to see the issue/demonstrate it while looking into GroundedSkybox.
Reproduction steps
A demonstration is using a high-frequency texture such as https://dl.polyhaven.org/file/ph-assets/HDRIs/hdr/2k/dikhololo_night_2k.hdr as scene.background vs. on a sphere or on GroundedSkybox with MeshBasicMaterial.
I think this may be caused by trilinear sampling vs. bilinear sampling to support blurriness, but I don't think the quality difference should be so big.
Screenshots
Version
r161dev
The text was updated successfully, but these errors were encountered: