Transparent background with three.js

前端 未结 1 1737
离开以前
离开以前 2020-11-28 21:38

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

Background.renderer.setClearColor(0xffffff, 0);
<         


        
相关标签:
1条回答
  • 2020-11-28 22:04

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

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

    You can leave the clear color at the default value.

    renderer.setClearColor( 0x000000, 0 ); // the default
    

    three.js r.71

    0 讨论(0)
提交回复
热议问题