Merge pull request #2615 from sifi11/shadow-depth-bias
🤖 Agent: verified by Ludovic's AI agent (contrib gate 20): the shadow depth bias: shadows look the same as before on Metal and no rim flicker showed before or after (0 flipped pixels over 7 sub-pixel yaw steps). It passed in this wave's union with main on the Mac mini: the selected parity harnesses (332/332, then 122/122 on the final union), clippy -D warnings and the tests, and lan_e2e with the host on its server thread and in-frame (18/18 each). Thanks @sifi11!
This commit is contained in:
@@ -1818,19 +1818,21 @@ impl Renderer {
|
||||
false,
|
||||
);
|
||||
// RenderPipelines.ENTITY_SHADOW: translucent, depth test without
|
||||
// writes. The quads lie on the block tops like vanilla's, but the
|
||||
// terrain under them snaps to the subpixel grid at other vertices, so
|
||||
// at a slant their depths differ by up to 1/256 of a pixel's depth
|
||||
// slope and whole shadows failed the test. The bias covers that and
|
||||
// the rounding, and stays below the 0.001 a model's feet sit higher
|
||||
// (1/27 of a pixel's slope at the 16-block shadow range in 720p).
|
||||
// writes. The quads lie exactly on the block tops like vanilla's, but
|
||||
// terrain and shadows are separate draw paths, so their fp32 depth
|
||||
// interpolations disagree by a few dozen ulps of the fragment depth
|
||||
// and the shadow's rim z-fights with the block top (speckle that
|
||||
// re-rolls as the camera drifts a subpixel). A constant bias of 128
|
||||
// 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(
|
||||
"Entity shadows",
|
||||
None,
|
||||
false,
|
||||
wgpu::CompareFunction::GreaterEqual,
|
||||
wgpu::DepthBiasState {
|
||||
constant: 16,
|
||||
constant: 128,
|
||||
slope_scale: 0.015,
|
||||
clamp: 0.0,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user