fix(landing): merge the final scene's two suns into one
The closing sky drew two suns: the 3D sun mesh (corona + GodRays) at a fixed world point, and a disc/halo painted by the sky shader aimed at a fixed direction. As the camera flew forward, parallax split them apart — the mesh rode high while the painted halo stayed low. Aim the sky shader's uSunDir at the real camera→sun direction each frame so the halo locks onto the mesh (one sun), and lower SUN_POS.y 34→13 so that single sun sits at the lower, near-horizon spot. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,7 @@ import { rainVertexShader, rainFragmentShader, skyVertexShader, skyFragmentShade
|
||||
// <WeatherClock/> (mounted first) and read by every other piece of the scene.
|
||||
const weather = makeWeatherSample();
|
||||
|
||||
const SUN_POS = new THREE.Vector3(0, 34, -205);
|
||||
const SUN_POS = new THREE.Vector3(0, 13, -205);
|
||||
const SKY_RADIUS = 400;
|
||||
|
||||
function WeatherClock() {
|
||||
@@ -49,6 +49,10 @@ function GradientSky() {
|
||||
m.uniforms.uSunColor.value.copy(weather.sunColor);
|
||||
m.uniforms.uSunReveal.value = weather.sunReveal;
|
||||
m.uniforms.uCameraPos.value.copy(state.camera.position);
|
||||
// Aim the painted sky-sun along the real camera→sun direction so its halo
|
||||
// stays locked onto the 3D sun mesh. Using a fixed direction made it drift
|
||||
// into a second, lower disc as the camera flew forward (parallax).
|
||||
m.uniforms.uSunDir.value.subVectors(SUN_POS, state.camera.position);
|
||||
if (meshRef.current) {
|
||||
meshRef.current.position.x = state.camera.position.x;
|
||||
meshRef.current.position.z = state.camera.position.z;
|
||||
|
||||
Reference in New Issue
Block a user