Transparent background

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…

Any help is greatly appreciated!

I think there are a couple things missing there:

  1. You do need alpha: true on the scene, as you mention.
  2. Don’t change setClearColor.
  3. 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.

/cc javascript - Setting a transparent background with three.js - Stack Overflow