植物补光

This commit is contained in:
2026-03-26 10:38:27 +08:00
parent a8308174df
commit df6d78236d
2 changed files with 46 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ export class OceanScene {
this.pmremGenerator = null;
this.renderTarget = null;
this.sunLight = null;
this.vegetationFillLight = null;
this.composer = null;
this.bloomPass = null;
this.cloudGroup = null;
@@ -122,6 +123,10 @@ export class OceanScene {
this.sunLight.shadow.camera.top = 100;
this.sunLight.shadow.camera.bottom = -100;
this.scene.add(this.sunLight);
this.vegetationFillLight = new THREE.DirectionalLight(0xffb06a, 0.95);
this.vegetationFillLight.castShadow = false;
this.scene.add(this.vegetationFillLight);
}
initPostProcessing() {
@@ -338,6 +343,16 @@ export class OceanScene {
this.sun.z * sunDistance
);
}
if (this.vegetationFillLight) {
const fillDistance = 90;
this.vegetationFillLight.position.set(
-this.sun.x * fillDistance * 0.45 + 35,
Math.max(18, this.sun.y * fillDistance * 0.28 + 24),
-this.sun.z * fillDistance * 0.35 + 28
);
this.vegetationFillLight.intensity = THREE.MathUtils.lerp(0.7, 1.15, THREE.MathUtils.clamp((this.sun.y + 0.2) / 0.9, 0, 1));
}
if (this.renderTarget) {
this.renderTarget.dispose();