When using an arc rotate camera, the object stays stationary and the camera moves. But what I’d like to do is keep the lights in the same position relative to the camera as it rotates. In this example, the green area light would always face the front of the object. I have some vague idea on how to do this, but is there an easy way already implemented?
Get their offset from the camera, and
camera.onViewMatrixChangedObservable.add(function(e){
// reset their position to the camera from the offsets
})
or parent them to the camera?
you want to create a similar effect to PG with area light?
It feels similar, but I think there might be a problem with handling the intensity based on location. (I think it would be best to handle it by placing it at an absolute distance and increasing the value accordingly.)
This is close, but the lights are moving away with camera zoom and pan. All I really care about is that their orbital angle matches the camera. The way the arc rotate camera works is that the camera moves instead of the objects in the scene. I want to create the illusion that it’s the model that is moving and so the lights appear stationary to the camera, which should make the lighting on the model appear to change. Sorry for the crude diagram, but something like this.
This is slightly closer, but I can’t get the lights to appear to be standing still. Something off with my math here.
cc @srzerbetto
To demonstrate the problem even further, in this example, I’m using a really dark skybox that has black on the bottom. I want to rotate as if to look at the bottom, and it should move into the light. Even affecting the rotationY value doesn’t quite do it.
@Alex2 , do you think this matches the behavior you are trying to achieve?
I think a few changes got lost, but I updated it and I think this is really close!
I set let newCameraPositon = camera.position.clone();
And, I’m not sure what var newRootPosition = newCameraPositon.subtract(relativePositon);
is doing because the value isn’t used.
Is this what you want? I didn’t use the same light and your create light function but it might give you some idea
https://playground.babylonjs.com/#T7FXR8#62
Unfortunately, no. The ask is to use area lights instead of directional lights. The goal is to use a combination of IBL lighting and area lights that can be moved to specific locations to add highlights.