WebGLBakground.setClearColor: Do not set alpha to 1 by default
See original GitHub issueI had a problem with making a transparent render target correctly. Called setClearAlpha(0) and setClearColor(0x000000) on the active rendertarget, but alpha was then returned to 1 because of the method below (in WebGLBackground). Could it be a better idea to use the value that setClearAlpha saved instead of 1? It might break code where users used a wrong setClearAlpha and the overwrote it with setClearColor by mistake (but with the wanted visual result), making some render targets transparent again when updating three.js.
setClearColor: function ( color, alpha ) {
clearColor.set( color );
clearAlpha = alpha !== undefined ? alpha : 1;
setClear( clearColor, clearAlpha );
}
https://github.com/mrdoob/three.js/blob/dev/src/renderers/webgl/WebGLBackground.js#L210
Three.js version
- [x ] Dev
- r120
- …
Browser
- All of them
- Chrome
- Firefox
- Internet Explorer
OS
- All of them
- Windows
- macOS
- Linux
- Android
- iOS
Issue Analytics
- State:
- Created 3 years ago
- Comments:18 (9 by maintainers)
Top Results From Across the Web
WebGLRenderer#setClearColor – three.js docs
When set to true , the value is 0 . Otherwise it's 1 . Default is false . premultipliedAlpha - whether the renderer...
Read more >Changing three.js background to transparent or other color
I came across this when I started using three.js as well. It's actually a javascript issue. You currently have: renderer.setClearColorHex( 0x000000, 1 );....
Read more >WebGLRenderer - Nonfunctional clearColor Parameter #4150
Using the latest version in master (r63), the clearColor parameter does not set the background color as expected.
Read more >WebGL and Alpha
The default is true. ... A really good way to find if you have any alpha problems is to set the canvas's background...
Read more >EaselJS v1.0.0 API Documentation : StageGL - CreateJS
If true , the canvas is NOT auto-cleared by WebGL (the spec discourages setting ... If true , this assumes the shader must...
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
Sure! Can put some thoughts into a PR, at least as a discussion starter.
You mean doing this, right?