feat: daybreak finale turns the contact arrival into a sunrise with a dawn chord

This commit is contained in:
2026-10-11 05:32:08 +03:00
parent c9e6ac0f29
commit b6e22a1299
37 changed files with 756 additions and 44 deletions

View File

@@ -1,5 +1,6 @@
import * as THREE from 'three';
import { BEAM_PARS, beamUniforms } from './headlights';
import { DAWN_PARS, dawnLightUniforms } from './dawn-light';
import type { EnvironmentChapter } from '@/journey/types';
import type { RenderQualitySettings } from '@/scene/render-quality';
import type { SceneResourceBag } from '@/scene/resources';
@@ -236,7 +237,7 @@ export function createTerrain(
const groundMaterial = resources.own(
'material',
new THREE.ShaderMaterial({
uniforms: { ...uniforms, ...beamUniforms },
uniforms: { ...uniforms, ...beamUniforms, ...dawnLightUniforms },
vertexShader: material.vertexShader.replace(
'displaced.y += height + 0.028;',
'displaced.y += height - 0.12;',
@@ -251,6 +252,7 @@ export function createTerrain(
varying vec3 vTerrainPosition;
varying vec3 vGridColor;
${BEAM_PARS}
${DAWN_PARS}
void main() {
vec3 normal = normalize(cross(dFdx(vTerrainPosition), dFdy(vTerrainPosition)));
float light = abs(dot(normal, normalize(vec3(-0.5, 0.8, -0.3))));
@@ -259,6 +261,8 @@ export function createTerrain(
// HIGH BEAM: the ridges beside the road catch the headlights.
float beam = headlightBeam(vTerrainPosition);
color += vec3(1.0, 0.84, 0.66) * beam * (0.3 + 0.7 * abs(dot(normal, normalize(uBeamOrigin - vTerrainPosition)))) * 0.28;
// END OF SHIFT: the ridges catch first light from the low sun ahead.
color += dawnRim(normal, normalize(cameraPosition - vTerrainPosition));
color = mix(uFogColor * 0.55, color, vDepthFade);
gl_FragColor = vec4(color, 1.0);
#include <tonemapping_fragment>