diff --git a/src/outline.wgsl b/src/outline.wgsl index 0993fc6..f82e5d3 100644 --- a/src/outline.wgsl +++ b/src/outline.wgsl @@ -63,7 +63,7 @@ fn vertex(vertex: VertexInput) -> @builtin(position) vec4 { #ifdef FLAT_DEPTH let out_zw = vec2(model_origin_z(vstage.origin, view.view_proj) * clip_pos.w, clip_pos.w); #else - let out_zw = clip_pos.wz; + let out_zw = clip_pos.zw; #endif #ifdef OFFSET_ZERO let out_xy = clip_pos.xy; diff --git a/src/pipeline.rs b/src/pipeline.rs index 1224c08..a368b50 100644 --- a/src/pipeline.rs +++ b/src/pipeline.rs @@ -304,7 +304,9 @@ impl SpecializedMeshPipeline for OutlinePipeline { depth_compare: CompareFunction::Greater, stencil: StencilState::default(), bias: DepthBiasState { - constant: if key.pass_type() == PassType::Stencil { + constant: if key.depth_mode() == DepthMode::Flat + && key.pass_type() == PassType::Stencil + { 2 // 1 is empirically not enough to prevent Z-fighting. } else { 0