WebGLBackground: Rendering issue with Reflector
See original GitHub issueDescription of the problem
While investigating an issue in the forum, I’ve encountered a rendering problem with scene.background
.
This fiddle shows how it should look like. Proper reflections of the torus knot and the skybox: https://codepen.io/anon/pen/XqeyBM
But if you set transparent
to true on the reflectors material, it looks like this:
https://codepen.io/anon/pen/XqeyxR
For some reasons, the (white) clear color of the renderer is visible in the reflector’s render target at certain parts. I have found two ways to solve this problem:
- Don’t use
scene.background
but manually create the skybox like in this example: https://codepen.io/anon/pen/jxGQQb - It does also work if you set
depthWrite
to true of the shader material inWebGLBackground
.
I don’t know so far why these approaches fix the issue but I suppose it has to do something with the way WebGLBackground
renders the background.
Note: The reflector is rendered after the background in all these examples.
Three.js version
- Dev
- r92
- …
Browser
- All of them
- Chrome
- Firefox
- Internet Explorer
OS
- All of them
- Windows
- macOS
- Linux
- Android
- iOS
Hardware Requirements (graphics card, VR Device, …)
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to fix rendering from a reflector? - Questions - three.js forum
I'm now working with Reflectors, they work ok but when using a skybox the render goes glitchy in the mirror. Any idea of...
Read more >WebGL Player settings - Unity - Manual
Rendering. Use these settings to customize how Unity renders your game for the WebGL platform. Choose which color space should be used for...
Read more >WebGL drawArrays generates white background
The problem is that it sometimes renders a triangle on a white background although clear color is set to non-transparent black. (in latest...
Read more >Getting started with the WebGL renderer | Three.js Cookbook
When you want to create an initial Three.js project that uses WebGL for rendering, you always have to set up the same couple...
Read more >Creating the Effect of Transparent Glass and Plastic in Three.js
three is an open-source javascript library for rendering 3D ... I think that's transparent, we can see the background colour through it.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think #15662 fixed that issue.
Yes, it does!!! Yay! 🎉 🙌