Globe light position #5240
Replies: 4 comments
-
Globe lighting is the light on "null island". |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
In order to see the atmosphere |
Beta Was this translation helpful? Give feedback.
-
Hi, I've successfully got the proper lighting position by using following, a rotation correcting, function: function lightPosition(lat: number, lng: number) {
const sin = (d: number) => Math.sin(d * Math.PI / 180);
const cos = (d: number) => Math.cos(d * Math.PI / 180);
const acos = (v: number) => Math.acos(v) * 180 / Math.PI;
const b = acos(cos(lat) * cos(lng));
const a = acos(sin(lat) / sin(b));
return [-1, a, b] as [number, number, number];
} with subsolar point of the Sun: {
light: {
anchor: 'map',
position: lightPosition(subsolar.lat, subsolar.lng)
}
} I've also created a plugin to overlay a night shadow even on a 2D map, just FYI: Thanks. |
Beta Was this translation helpful? Give feedback.
-
maplibre-gl-js version: v5.0.0-pre.9
browser: Chrome 131.0.6778.140 (arm64)
Steps to Trigger Behavior
[1.15, 0, 0]
position.Link to Demonstration
See simple example with globe view and city view next to each other with same position.
Expected Behavior
Light position should be same for both views.
Actual Behavior
Looks like light is not correctly positioned for the globe view.
Beta Was this translation helpful? Give feedback.
All reactions