Add tests for god rays source mask calculation

This commit is contained in:
2026-04-28 06:03:19 +02:00
parent 179e12111a
commit fa1ef318c5

View File

@@ -157,9 +157,11 @@ import {
resolveDistanceFogParameters resolveDistanceFogParameters
} from "../../src/rendering/distance-fog-pass"; } from "../../src/rendering/distance-fog-pass";
import { import {
GOD_RAYS_SOURCE_MASK_RADII,
createScreenSpaceGodRaysLightSource, createScreenSpaceGodRaysLightSource,
projectScreenSpaceGodRaysLight, projectScreenSpaceGodRaysLight,
resolveGodRaysParameters, resolveGodRaysParameters,
resolveGodRaysSourceMask,
syncScreenSpaceGodRaysLightSource syncScreenSpaceGodRaysLightSource
} from "../../src/rendering/screen-space-god-rays"; } from "../../src/rendering/screen-space-god-rays";
import { resolveDynamicGlobalIlluminationParameters } from "../../src/rendering/screen-space-global-illumination"; import { resolveDynamicGlobalIlluminationParameters } from "../../src/rendering/screen-space-global-illumination";
@@ -434,6 +436,17 @@ describe("god rays parameters", () => {
}) })
).toBeNull(); ).toBeNull();
}); });
it("keeps the source mask compact around the celestial disc", () => {
expect(resolveGodRaysSourceMask(0)).toBe(1);
expect(
resolveGodRaysSourceMask(GOD_RAYS_SOURCE_MASK_RADII.coreOuter)
).toBeGreaterThan(0.5);
expect(resolveGodRaysSourceMask(0.035)).toBeLessThan(0.5);
expect(
resolveGodRaysSourceMask(GOD_RAYS_SOURCE_MASK_RADII.haloOuter)
).toBe(0);
});
}); });
describe("createAdvancedRenderingComposer", () => { describe("createAdvancedRenderingComposer", () => {