Skip to content
Advertisement

Transparent background with three.js

The code work, but I’m having a problem setting transparent background to the canvas with three.js. I use:

JavaScript

But then the background gets black. How do I change it to be transparent?


The code:

JavaScript

Advertisement

Answer

If you want a transparent background in three.js, you need pass in the alpha parameter to the WebGLRenderer constructor.

JavaScript

You can leave the clear color at the default value.

JavaScript

three.js r.71

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement