diff --git a/crates/horizon-client/src/entity.wgsl b/crates/horizon-client/src/entity.wgsl index 919c5edbb..b674b0941 100644 --- a/crates/horizon-client/src/entity.wgsl +++ b/crates/horizon-client/src/entity.wgsl @@ -263,6 +263,16 @@ fn crumbling_uv(uv: vec2, packed_origin: vec2, sprite_size: vec2, // rendertype_outline.fsh: the vertex colour (the team colour; outline vertices carry no // normal, so no cardinal light) wherever the texture is not fully clear. +// rendertype_entity_shadow.fsh: the shadow texture times the vertex colour, +// then fog, with no alpha cutout, so a faint shadow in dim light still draws. +@fragment fn fs_entity_shadow(in: Out) -> @location(0) vec4 { + var color = textureSample(atlas, atlas_sampler, in.uv) * in.color; + color *= in.light_color; + let f = max(linear_fog(in.spherical, globals.fog.x, globals.fog.y), + linear_fog(in.cylindrical, globals.fog.z, globals.fog.w)); + return vec4(mix(color.rgb, globals.fog_color.rgb, f * globals.fog_color.a), color.a); +} + @fragment fn fs_outline(in: Out) -> @location(0) vec4 { if textureSample(atlas, atlas_sampler, in.uv).a == 0.0 { discard; } return vec4(in.color.rgb, 1.0); diff --git a/crates/horizon-client/src/gfx.rs b/crates/horizon-client/src/gfx.rs index beb8b9060..367172eec 100644 --- a/crates/horizon-client/src/gfx.rs +++ b/crates/horizon-client/src/gfx.rs @@ -1966,7 +1966,7 @@ impl Renderer { // ulps covers that spread at any resolution while staying far below // the 0.001 a model's feet sit higher, so shadows never bleed onto // the feet. - let shadow_blob_pipeline = entity_pipeline( + let shadow_blob_pipeline = entity_pipeline_with( "Entity shadows", None, false, @@ -1978,6 +1978,8 @@ impl Renderer { }, alpha_blend, false, + "fs_entity_shadow", + wgpu::ColorWrites::ALL, ); // RenderPipelines.ITEM_TRANSLUCENT: blended, depth tested. Drawn before // translucent terrain, it cannot write depth: the water behind a