From e3a3db246ef47ac0eedf997f7bee74dbff4874d1 Mon Sep 17 00:00:00 2001 From: Schmarni Date: Thu, 18 Sep 2025 09:40:40 +0200 Subject: [PATCH] fix(lines): working OIT for lines! Signed-off-by: Schmarni --- src/nodes/drawable/line.wgsl | 8 ++++++++ src/nodes/drawable/lines.rs | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/nodes/drawable/line.wgsl b/src/nodes/drawable/line.wgsl index e227143..4094e5c 100644 --- a/src/nodes/drawable/line.wgsl +++ b/src/nodes/drawable/line.wgsl @@ -14,6 +14,9 @@ pbr_functions::{apply_pbr_lighting, main_pass_post_lighting_processing}, } #endif +#ifdef OIT_ENABLED +#import bevy_core_pipeline::oit::oit_draw +#endif struct LineMaterial { unused: u32, @@ -51,5 +54,10 @@ fn fragment( out.color = main_pass_post_lighting_processing(pbr_input, out.color); #endif +#ifdef OIT_ENABLED + oit_draw(in.position, out.color, false); + discard; +#else return out; +#endif } diff --git a/src/nodes/drawable/lines.rs b/src/nodes/drawable/lines.rs index 7a1555a..6bc4bfe 100644 --- a/src/nodes/drawable/lines.rs +++ b/src/nodes/drawable/lines.rs @@ -49,7 +49,7 @@ impl MaterialExtension for LineExtension { } fn alpha_mode() -> Option { - Some(AlphaMode::Opaque) + Some(AlphaMode::Blend) } }