Change background of three.js to transparent or other color in HTML

PHPz
Release: 2023-08-31 21:25:06
forward
1371 people have browsed it

Change background of three.js to transparent or other color in HTML

If you want to use transparent background in Three.js, you need to pass alpha parameter to WebGLRenderer constructor in the code given below -

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

However, to set the background color,

renderer.setClearColor(0xb0f442 );
Copy after login

The above is the detailed content of Change background of three.js to transparent or other color in HTML. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!