Adjust celestial body intensity and god rays input based on horizon visibility

This commit is contained in:
2026-04-28 14:24:16 +02:00
parent 8ee2238afc
commit f7f2827196

View File

@@ -101,6 +101,7 @@ import {
} from "../rendering/world-shader-sky"; } from "../rendering/world-shader-sky";
import { import {
resolveWorldCelestialBodiesState, resolveWorldCelestialBodiesState,
resolveWorldCelestialHorizonVisibility,
resolveWorldEnvironmentState, resolveWorldEnvironmentState,
WorldBackgroundRenderer WorldBackgroundRenderer
} from "../rendering/world-background-renderer"; } from "../rendering/world-background-renderer";
@@ -2908,21 +2909,47 @@ export class RuntimeHost {
shaderSkyState.celestial.sunVisible shaderSkyState.celestial.sunVisible
? { ? {
colorHex: shaderSkyState.celestial.sunColorHex, colorHex: shaderSkyState.celestial.sunColorHex,
intensity: shaderSkyState.celestial.sunIntensity, intensity:
shaderSkyState.celestial.sunIntensity *
resolveWorldCelestialHorizonVisibility(
shaderSkyState.celestial.sunDirection.y,
shaderSkyState.sky.horizonHeight
),
direction: shaderSkyState.celestial.sunDirection direction: shaderSkyState.celestial.sunDirection
} }
: null, : null,
shaderSkyState.celestial.moonVisible shaderSkyState.celestial.moonVisible
? { ? {
colorHex: shaderSkyState.celestial.moonColorHex, colorHex: shaderSkyState.celestial.moonColorHex,
intensity: shaderSkyState.celestial.moonIntensity, intensity:
shaderSkyState.celestial.moonIntensity *
resolveWorldCelestialHorizonVisibility(
shaderSkyState.celestial.moonDirection.y,
shaderSkyState.sky.horizonHeight
),
direction: shaderSkyState.celestial.moonDirection direction: shaderSkyState.celestial.moonDirection
} }
: null : null
) )
: resolveDominantScreenSpaceGodRaysLightInput( : resolveDominantScreenSpaceGodRaysLightInput(
celestialBodiesState.sun, celestialBodiesState.sun === null
celestialBodiesState.moon ? null
: {
colorHex: celestialBodiesState.sun.colorHex,
direction: celestialBodiesState.sun.direction,
intensity:
celestialBodiesState.sun.intensity *
celestialBodiesState.sun.horizonVisibility
},
celestialBodiesState.moon === null
? null
: {
colorHex: celestialBodiesState.moon.colorHex,
direction: celestialBodiesState.moon.direction,
intensity:
celestialBodiesState.moon.intensity *
celestialBodiesState.moon.horizonVisibility
}
); );
syncScreenSpaceGodRaysLightSource( syncScreenSpaceGodRaysLightSource(
this.godRaysLightSource, this.godRaysLightSource,