0

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

4
  • BTW, which browsers are restricting you to CSS only? Commented Jan 28, 2014 at 13:41
  • Well, it's because I'm projecting some divs onto a sphere and it's easier using CSS3DRenderer (I think), also because WebGL is not fully supported on mobile devices Commented Jan 28, 2014 at 13:51
  • Why not use CanvasRenderer and CSS3DRenderer both? Commented Jan 28, 2014 at 14:10
  • Well I need to add hexagons to a sphere and to be honest I think is easier with divs rather than canvas and points Commented Jan 28, 2014 at 15:12

1 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

2 Comments

Many Thanks. Any examples of how to do this?
No examples of that, sorry. It just means you can make divs that face the light lighter. If orientations are changing, however, then you have to do it on the fly.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.