我给画布一个透明的背景,下面的代码让它看起来像鸟儿飞过一个风景。但是当我这样做时,鸟儿的翅膀不再襟翼。我究竟做错了什么?
renderer = new THREE.CanvasRenderer();
renderer.setClearColor(0x000000, 0);
renderer.setPixelRatio(window.devicePixelRatio);
renderer = new THREE.WebGLRenderer({alpha: true, canvas: birdscanvas});
如果我发表评论
renderer = new THREE.WebGLRenderer({alpha: true, canvas: birdscanvas});
鸟翼襟翼。
答案 0 :(得分:2)
按如下方式更改
renderer = new THREE.CanvasRenderer({
alpha: true,
canvas: birdscanvas
});
renderer.setClearColor(0x000000, 0);
renderer.setPixelRatio(window.devicePixelRatio);
// renderer = new THREE.WebGLRenderer({ alpha: true, canvas: birdscanvas });
对于基于WebGLRenderer的,请按以下步骤操作;
renderer = new THREE.WebGLRenderer({
alpha: true,
canvas: birdscanvas
});
renderer.setClearColor(0x000000, 0);
renderer.setPixelRatio(window.devicePixelRatio);
在render
方法中,在for循环的末尾添加以下行;
bird.geometry.verticesNeedUpdate = true;