Files
horizon-airdef/crates/horizon-shader-api/packs/golden_hour/common.wgsl
T
Ludovic Marie 49f62d02cb Horizon shader packs: horizon-shader new/check/pack, templates, an example pack and the guide
The SDK's tool, in horizon-shader-api: `horizon-shader new <dir> --template
post|sky|material` makes a pack that passes the check, `check <pack>...
[--json]` runs the check the game, the launcher and the registry run and
prints each stage's cost and the pack's SHA-256 or every problem at its
file:line:column, and `pack <dir>` checks then writes the reproducible
.hshader. Golden Hour, the example pack, warms the sky around a low sun and
adds a soft glow and a colour grade, with five options. docs/shaders.md is the
authors' guide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 15:38:23 +01:00

14 lines
446 B
WebGPU Shading Language

fn luminance(c: vec3<f32>) -> f32 {
return dot(c, vec3<f32>(0.2126, 0.7152, 0.0722));
}
// 1 while the sun is up in the Overworld, fading out around the horizon.
fn daylight() -> f32 {
return select(0.0, smoothstep(-0.1, 0.1, frame.sun_direction.y), frame.dimension == 0);
}
// 1 when the sun is on the horizon, 0 from a quarter of the way up.
fn sun_low() -> f32 {
return 1.0 - smoothstep(0.0, 0.35, abs(frame.sun_direction.y));
}