Search code examples
three.js

ThreeJS CSS3DRenderer Lights


I'm trying to add some lights to the scene but because of browser restrictions I can use CSS3DRenderer only.

Can I use lights with this type of renderer?

I've been trying to add this code but it doesn't seem to work

var ambiLight = new THREE.AmbientLight(0x111111);
scene.add(ambiLight);
var spotLight = new THREE.DirectionalLight(0xffffff);
spotLight.position.set(-20, 30, 40);
spotLight.intensity = 1.5;
scene.add(spotLight);

Thanks


Solution

  • No, CSS3DRenderer does not support lights.

    You can fake lighting, of course, by judicious choice of your div colors. (In other words, bake the lighting in.)

    three.js r.65