Feature: Integrate distance fog sky color source into runtime host

This commit is contained in:
2026-04-30 02:16:34 +02:00
parent e28e3cc2b7
commit 4225fe3a1b
2 changed files with 28 additions and 4 deletions

View File

@@ -89,7 +89,11 @@ import {
resolveBoxVolumeRenderPaths,
type ResolvedBoxVolumeRenderPaths
} from "../rendering/advanced-rendering";
import { applyAdvancedRenderingPerspectiveCameraFar } from "../rendering/distance-fog-pass";
import {
applyAdvancedRenderingPerspectiveCameraFar,
createDistanceFogSkyColorSource,
syncDistanceFogSkyColorSource
} from "../rendering/distance-fog-pass";
import {
createScreenSpaceGodRaysLightSource,
resolveDominantScreenSpaceGodRaysLightInput,
@@ -106,6 +110,7 @@ import {
import {
resolveWorldCelestialBodiesState,
resolveWorldCelestialHorizonVisibility,
resolveWorldBackgroundSkyColorState,
resolveWorldEnvironmentState,
WorldBackgroundRenderer
} from "../rendering/world-background-renderer";
@@ -672,6 +677,8 @@ export class RuntimeHost {
private readonly sunLight = new DirectionalLight();
private readonly moonLight = new DirectionalLight();
private readonly godRaysLightSource = createScreenSpaceGodRaysLightSource();
private readonly distanceFogSkyColorSource =
createDistanceFogSkyColorSource();
private readonly localLightGroup = new Group();
private readonly lightVolumeGroup = new Group();
private readonly brushGroup = new Group();
@@ -2943,6 +2950,10 @@ export class RuntimeHost {
celestialBodiesState,
shaderSkyState
);
syncDistanceFogSkyColorSource(
this.distanceFogSkyColorSource,
resolveWorldBackgroundSkyColorState(resolvedWorld.background, shaderSkyState)
);
const godRaysLightInput =
shaderSkyState !== null
? resolveDominantScreenSpaceGodRaysLightInput(
@@ -3121,7 +3132,8 @@ export class RuntimeHost {
this.camera,
settings,
this.worldBackgroundRenderer.scene,
this.godRaysLightSource
this.godRaysLightSource,
this.distanceFogSkyColorSource
);
this.currentAdvancedRenderingSettings =
cloneAdvancedRenderingSettings(settings);

View File

@@ -215,7 +215,11 @@ import {
createAdvancedRenderingComposer,
resolveBoxVolumeRenderPaths
} from "../rendering/advanced-rendering";
import { applyAdvancedRenderingPerspectiveCameraFar } from "../rendering/distance-fog-pass";
import {
applyAdvancedRenderingPerspectiveCameraFar,
createDistanceFogSkyColorSource,
syncDistanceFogSkyColorSource
} from "../rendering/distance-fog-pass";
import {
createScreenSpaceGodRaysLightSource,
resolveDominantScreenSpaceGodRaysLightInput,
@@ -236,6 +240,7 @@ import {
import {
resolveWorldCelestialBodiesState,
resolveWorldCelestialHorizonVisibility,
resolveWorldBackgroundSkyColorState,
resolveWorldEnvironmentState,
WorldBackgroundRenderer
} from "../rendering/world-background-renderer";
@@ -749,6 +754,8 @@ export class ViewportHost {
private readonly sunLight = new DirectionalLight();
private readonly moonLight = new DirectionalLight();
private readonly godRaysLightSource = createScreenSpaceGodRaysLightSource();
private readonly distanceFogSkyColorSource =
createDistanceFogSkyColorSource();
private readonly localLightGroup = new Group();
private readonly lightVolumeGroup = new Group();
private readonly brushGroup = new Group();
@@ -2240,6 +2247,10 @@ export class ViewportHost {
celestialBodiesState,
shaderSkyState
);
syncDistanceFogSkyColorSource(
this.distanceFogSkyColorSource,
resolveWorldBackgroundSkyColorState(displayedBackground, shaderSkyState)
);
const godRaysLightInput =
shaderSkyState !== null
? resolveDominantScreenSpaceGodRaysLightInput(
@@ -2360,7 +2371,8 @@ export class ViewportHost {
this.perspectiveCamera,
settings,
this.worldBackgroundRenderer.scene,
this.godRaysLightSource
this.godRaysLightSource,
this.distanceFogSkyColorSource
);
this.currentAdvancedRenderingSettings =
cloneAdvancedRenderingSettings(settings);