Changing three.js background to transparent or another color in HTML

HTMLWeb DevelopmentFront End Technology

If you want a transparent background in three.js, you need a pass in the alpha parameter to the WebGLRenderer constructors in the below-given code −

var renderer = new THREE.WebGLRenderer( {alpha: true } );
// You can leave the clear color at the defaultvalue.
renderer.setClearColor( 0x000000, 0 ); //default

However, to set the background color,

renderer.setClearColor(0xb0f442 );
Updated on 04-Mar-2020 05:32:05