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.

canvas{ 
    position: absolute;
    z-index: 2;
    top:0px;
    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

https://codepen.io/davide77/pen/GxZgZB?editors=1010

javascriptthree.js

Answers

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 });

https://threejs.org/docs/#api/renderers/WebGLRenderer

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;

https://codepen.io/anon/pen/OvNVmy

comments powered by Disqus