Integrate distance fog support into advanced rendering composer and world background rendering

This commit is contained in:
2026-04-30 02:16:00 +02:00
parent ca53f86ccb
commit e28e3cc2b7
2 changed files with 31 additions and 3 deletions

View File

@@ -54,7 +54,8 @@ import {
import {
DistanceFogPass,
resolveDistanceFogParameters,
shouldApplyDistanceFog
shouldApplyDistanceFog,
type DistanceFogSkyColorSource
} from "./distance-fog-pass";
import {
ScreenSpaceGlobalIlluminationPass,
@@ -314,7 +315,8 @@ export function createAdvancedRenderingComposer(
camera: PerspectiveCamera,
settings: AdvancedRenderingSettings,
backgroundScene: Scene | null = null,
godRaysLightSource: ScreenSpaceGodRaysLightSource | null = null
godRaysLightSource: ScreenSpaceGodRaysLightSource | null = null,
distanceFogSkyColorSource: DistanceFogSkyColorSource | null = null
): EffectComposer {
// The scene is always rendered into the composer's offscreen targets first,
// so those targets need depth for correct visibility even when no effect samples it.
@@ -429,7 +431,13 @@ export function createAdvancedRenderingComposer(
}
if (distanceFogEnabled) {
composer.addPass(new DistanceFogPass(camera, distanceFogParameters));
composer.addPass(
new DistanceFogPass(
camera,
distanceFogParameters,
distanceFogSkyColorSource
)
);
}
if (godRaysEnabled && godRaysLightSource !== null) {