Change Three.js Background to Transparent or Another Color in HTML



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: 2023-11-23T14:22:48+05:30

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements