threejs gotchas

Lighting a large scene:

DirectionalLight is the best simulation of daylight. But in a big world, you probably don't want to light it all at once. You'll need to update the light position and also it's target position, what it uses to calculate it's angle.

The gotcha is: you have to run scene.add( light.target ) , even though it is already being used by the Light, otherwise the target position will revert silently. Joy of joys.

Tip: Update this on a slow interval as opposed to the animate loop to save a few thousand unnecessary frame calcs.

oko
friend