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/game.rs b/crates/horizon-client/src/game.rs index c97d57eb3..0a4b53ee8 100644 --- a/crates/horizon-client/src/game.rs +++ b/crates/horizon-client/src/game.rs @@ -8084,7 +8084,12 @@ impl Game<'_> { .then(|| self.gui.atlas.sprites.get("misc/shadow").copied()) .flatten(); if let Some(sprite) = shadow_sprite { - let ambient = if self.dim == Dim::Nether { 0.1 } else { 0.0 }; + // DimensionType.ambientLight: the_nether 0.1, the_end 0.25. + let ambient = match self.dim { + Dim::Nether => 0.1, + Dim::End => 0.25, + Dim::Overworld => 0.0, + }; let darken = self.sky_darken(); let a = alpha; let lerp = |p: Vec3, q: Vec3| { diff --git a/crates/horizon-client/src/gfx.rs b/crates/horizon-client/src/gfx.rs index 68ae9206f..7f14c77a6 100644 --- a/crates/horizon-client/src/gfx.rs +++ b/crates/horizon-client/src/gfx.rs @@ -1969,7 +1969,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, @@ -1981,6 +1981,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