Hi. this is my first time working with threejs and it’s awesome so far! I found a codepen I really like but I’m having trouble setting a transparent bg. I’ve taken a look at all the topics on here, and all the questions on stackoverdlow but I can’t get it working. I’ve tried adding , { alpha: true}, changing my scene and other things.
Here’s the codepen I’m trying to work with… https://codepen.io/ramsaylanier/pen/raybzy
Any help is greatly appreciated!
I think there are a couple things missing there:
- You do need
alpha: true
on the scene, as you mention.
- Don’t change
setClearColor
.
- If you’re using EffectComposer, there is some extra work required to make it allow a transparent background, see these comments. three.js - How do I stop EffectComposer from destroying my transparent background? - Stack Overflow
I’d recommend starting with renderer.render( scene, camera )
instead of composer.render()
just to make sure you have the first two parts working.