调校场景
This commit is contained in:
@@ -5,6 +5,7 @@ import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
||||
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
|
||||
import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
|
||||
import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js';
|
||||
import { OutputPass } from 'three/addons/postprocessing/OutputPass.js';
|
||||
import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js';
|
||||
import Stats from 'three/addons/libs/stats.module.js';
|
||||
import { TerrainGenerator } from './TerrainGenerator.js';
|
||||
@@ -219,6 +220,8 @@ export class OceanScene {
|
||||
this.snowPass.material.uniforms.intensity.value = this.params.snowIntensity;
|
||||
this.snowPass.material.uniforms.snowSpeed.value = this.params.snowSpeed;
|
||||
this.composer.addPass(this.snowPass);
|
||||
|
||||
this.composer.addPass(new OutputPass());
|
||||
}
|
||||
|
||||
initAudio() {
|
||||
@@ -1654,16 +1657,20 @@ export class OceanScene {
|
||||
const sunMix = THREE.MathUtils.clamp((this.params.elevation + 10) / 100, 0, 1);
|
||||
const fogColor = new THREE.Color(this.getFogColor());
|
||||
const nightMix = THREE.MathUtils.clamp((-this.params.elevation + 1.0) / 12.0, 0, 1);
|
||||
const clarityMix =
|
||||
THREE.MathUtils.smoothstep(this.params.elevation, 52, 82) *
|
||||
(1.0 - THREE.MathUtils.smoothstep(this.params.turbidity, 3.2, 8.0));
|
||||
const warmHorizon = new THREE.Color(0xf0c7a3);
|
||||
const coolHorizon = new THREE.Color(0xcfe0ee);
|
||||
const coolHorizon = new THREE.Color(0xcfe0ee).lerp(new THREE.Color(0x8fd2ff), clarityMix);
|
||||
const nightHorizon = new THREE.Color(0x27415f);
|
||||
const horizonColor = warmHorizon.clone().lerp(coolHorizon, sunMix).lerp(nightHorizon, nightMix);
|
||||
const warmSkyBase = new THREE.Color(0xf6d7b8);
|
||||
const coolSkyBase = new THREE.Color(0xbfd8eb);
|
||||
const coolSkyBase = new THREE.Color(0xbfd8eb).lerp(new THREE.Color(0x6fc4ff), clarityMix);
|
||||
const nightSkyBase = new THREE.Color(0x08111f);
|
||||
const nightSkyBlend = new THREE.Color(0x182940);
|
||||
const skyBaseColor = warmSkyBase.clone().lerp(coolSkyBase, sunMix * 0.92).lerp(nightSkyBase, nightMix);
|
||||
const skyBlendColor = skyBaseColor.clone().lerp(fogColor, 0.42).lerp(nightSkyBlend, nightMix * 0.78);
|
||||
const fogBlend = THREE.MathUtils.lerp(0.42, 0.16, clarityMix);
|
||||
const skyBlendColor = skyBaseColor.clone().lerp(fogColor, fogBlend).lerp(nightSkyBlend, nightMix * 0.78);
|
||||
|
||||
return { sunMix, fogColor, horizonColor, skyBaseColor, skyBlendColor };
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ function setupControls(oceanScene) {
|
||||
bindController(snowFolder.add(params, 'snowIntensity', 0, 1.5, 0.01).name('雪量'), (value) => oceanScene.setSnowIntensity(value));
|
||||
bindController(snowFolder.add(params, 'snowSpeed', 0.2, 2.2, 0.01).name('速度'), (value) => oceanScene.setSnowSpeed(value));
|
||||
|
||||
gui.close();
|
||||
[skyFolder, bloomFolder, waterFolder, cloudFolder, rainFolder, fogFolder, snowFolder].forEach((folder) => folder.close());
|
||||
updateStarControllerState();
|
||||
}
|
||||
|
||||
|
||||
@@ -69,18 +69,18 @@ export const WEATHER_PRESETS = {
|
||||
...DEFAULT_SCENE_PARAMS,
|
||||
elevation: 72,
|
||||
azimuth: 180,
|
||||
exposure: 0.27,
|
||||
turbidity: 8.2,
|
||||
rayleigh: 2.1,
|
||||
bloomStrength: 0.14,
|
||||
bloomRadius: 0.06,
|
||||
waterColor: '#2b78a4',
|
||||
cloudCoverage: 0.18,
|
||||
cloudDensity: 0.28,
|
||||
cloudElevation: 0.7,
|
||||
fogDensity: 0.1,
|
||||
fogHeight: 0.2,
|
||||
fogRange: 0.24,
|
||||
exposure: 0.45,
|
||||
turbidity: 2.2,
|
||||
rayleigh: 0.18,
|
||||
bloomStrength: 0.2,
|
||||
bloomRadius: 0.03,
|
||||
waterColor: '#25b7d9',
|
||||
cloudCoverage: 0.06,
|
||||
cloudDensity: 0.12,
|
||||
cloudElevation: 0.82,
|
||||
fogDensity: 0.015,
|
||||
fogHeight: 0.12,
|
||||
fogRange: 0.08,
|
||||
starIntensity: 0.0,
|
||||
lightningEnabled: false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user