C.S
C.S

Reputation: 21

THREE.EffectComposer is not a constructor

first time here :) Hello everyone !

I was trying to follow some code to create a volumetric light scattering shader using THREE, trying to reproduce this: https://codepen.io/abberg/pen/pbWkjg

But when I do it, I get a console error saying: 'THREE.EffectComposer is not a constructor'

The issue is that I'm trying to reproduce this in ES6 environnement, using gulp. In order to prevent too much compiling time, I removed THREE from the gulp watch compilation for the duration of the dev, and imported it directly in index.html as follow:

<script type="text/javascript" src="node_modules/three/build/three.min.js"></script>

I use THREE 0.88.0

Did I miss a plugin ? Search on google didn't lead me to any recent answer about this issue.

Thanks in advance for your answer !

Upvotes: 2

Views: 5063

Answers (1)

Ryder Brooks
Ryder Brooks

Reputation: 2119

EffectComposer is not included in the three.js bundle you are referencing in your script tag. You will need to add the following:

<script type="text/javascript" src="node_modules/three/examples/js/postprocessing/EffectComposer.js"></script>

Same idea for adding OrbitControls and other unofficial three.js modules.

Upvotes: 1

Related Questions