Three.js smoke animation with transparent background

I'm completely new to three.js, I'd like the smoke canvas to on top of the image to have a transparent background. the canvas sits behind the image at the moment, that's why I have this css below.

    position: absolute;
    z-index: 2;
    left: 0;

I don't understand how to remove or to make the black background of the canvas transparent. Please have a look at my demo below



answered 6 months ago Fasani #1

If you need a transparent background you can pass in the alpha parameter to the WebGLRenderer constructor.

var renderer = new THREE.WebGLRenderer({ alpha: true });

answered 6 months ago Mugen87 #2

You can use scene.background for this. There is no need to work with an additional HTML element. Just do:

scene.background = texture;

comments powered by Disqus