Fix Z-fighting in the flying_objects example.

This commit is contained in:
Robin KAY 2023-10-27 21:44:09 +01:00
parent 10304a6164
commit 0351b05978

View File

@ -355,15 +355,16 @@ impl SpecializedMeshPipeline for OutlinePipeline {
depth_write_enabled: true,
depth_compare: CompareFunction::Greater,
stencil: StencilState::default(),
bias: DepthBiasState {
constant: if key.depth_mode() == DepthMode::Flat
&& key.pass_type() == PassType::Stencil
bias: if key.depth_mode() == DepthMode::Flat && key.pass_type() == PassType::Stencil
{
2 // 1 is empirically not enough to prevent Z-fighting.
} else {
0
},
DepthBiasState {
// Values determined empirically
constant: 3,
slope_scale: 1.0,
..default()
}
} else {
default()
},
}),
multisample: MultisampleState {