Integrate screen space god rays lighting

This commit is contained in:
2026-04-28 04:34:18 +02:00
parent bb6f5ae8b8
commit d6d2c5b4a2

View File

@@ -86,6 +86,10 @@ import {
type ResolvedBoxVolumeRenderPaths
} from "../rendering/advanced-rendering";
import { applyAdvancedRenderingPerspectiveCameraFar } from "../rendering/distance-fog-pass";
import {
createScreenSpaceGodRaysLightSource,
syncScreenSpaceGodRaysLightSource
} from "../rendering/screen-space-god-rays";
import {
fitCelestialDirectionalShadow,
resolveDominantCelestialShadowCaster
@@ -641,6 +645,7 @@ export class RuntimeHost {
private readonly ambientLight = new AmbientLight();
private readonly sunLight = new DirectionalLight();
private readonly moonLight = new DirectionalLight();
private readonly godRaysLightSource = createScreenSpaceGodRaysLightSource();
private readonly localLightGroup = new Group();
private readonly lightVolumeGroup = new Group();
private readonly brushGroup = new Group();
@@ -2910,11 +2915,15 @@ export class RuntimeHost {
this.ambientLight.color.set(resolvedWorld.ambientLight.colorHex);
this.ambientLight.intensity = resolvedWorld.ambientLight.intensity;
this.currentCelestialShadowCaster =
resolveDominantCelestialShadowCaster(
resolvedWorld.sunLight,
resolvedWorld.moonLight
)?.key ?? null;
const dominantCelestialLight = resolveDominantCelestialShadowCaster(
resolvedWorld.sunLight,
resolvedWorld.moonLight
);
this.currentCelestialShadowCaster = dominantCelestialLight?.key ?? null;
syncScreenSpaceGodRaysLightSource(
this.godRaysLightSource,
dominantCelestialLight?.light ?? null
);
this.sunLight.color.set(resolvedWorld.sunLight.colorHex);
this.sunLight.intensity = resolvedWorld.sunLight.intensity;
this.sunLight.visible = resolvedWorld.sunLight.intensity > 1e-4;
@@ -3021,7 +3030,8 @@ export class RuntimeHost {
this.scene,
this.camera,
settings,
this.worldBackgroundRenderer.scene
this.worldBackgroundRenderer.scene,
this.godRaysLightSource
);
this.currentAdvancedRenderingSettings =
cloneAdvancedRenderingSettings(settings);