I want a threejs canvas with a transparent background. I'm creating a renderer like this:
# coffeescript
r = new THREE.WebGLRenderer alpha: true
When I call r.render()
, it works as expected, with the objects appearing over a transparent background. However, when I attempt to add post-processing with EffectComposer like so:
cmp = new THREE.EffectComposer r
cmp.addPass new THREE.RenderPass scene, camera
effect = new THREE.FilmPass 0.9, 2, 2048, true
effect.renderToScreen = true
cmp.addPass effect
cmp.render 3
the new result is that the scene renders as expected (objects have the Film effect correctly applied), EXCEPT the background is no longer transparent as desired...instead it's black and opaque. Why? How can I prevent post-processing from tampering with my transparent background?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…