Gius
April 20, 2022, 1:54pm
1
Hi,
we load a background image simply with this code:
private createBackground(backgroundURL) {
const textureLoader = new TextureLoader();
this.bgTexture = textureLoader.load(backgroundURL);
this.scene.background = this.bgTexture;
};
We aim to emphasize a loaded 3D object so we would like to blurry the background.
It’s possilbe to blurry the texture on the fly without loading another already blurried image?
We searched the web but didn’t find a solution yet.
Thanks!
It is currently not possible to configure Scene.background
with a blur. However, there is the intention to introduce support for it. In the first step, it will only be possible to blur environment maps. The below PR tries to implement this feature:
mrdoob:dev
← Mugen87:dev63
opened 04:00PM - 12 Mar 22 UTC
Related issue: -
**Description**
We have tried to integrate background blu… rriness in the past (e.g. #20463), however the approach at that time wasn't right. This one uses `textureCubeLodEXT()`/`textureLod()` to retrieved blurred samples of the configured environment map.
The PR introduces `WebGLRenderer.setBackgroundBlurriness()` which accepts values in the `[0,1]` range. Because `textureCubeLodEXT()`/`textureLod()` relies on mipmapping, the environment map has to set `generateMipmaps` to `true` and also use `LinearMipmapLinearFilter`.
Important: The configuration of the environment map has to be done on app level and can't be changed in `WebGLBackground`. That's because equirectangular textures are internally converted to cube map render targets and it is not possible to change render target texture parameters after their creation right now, see #14375.
In the next step, we could figure out how to implement the blur for normal textured backgrounds.