diff --git a/src/main.rs b/src/main.rs index aeb22ab..4a52c1e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,6 +17,7 @@ use bevy::app::{App, ScheduleRunnerPlugin, TerminalCtrlCHandlerPlugin}; use bevy::asset::{AssetMetaCheck, UnapprovedPathMode}; use bevy::audio::AudioPlugin; use bevy::core_pipeline::CorePipelinePlugin; +use bevy::core_pipeline::oit::OrderIndependentTransparencySettings; use bevy::diagnostic::DiagnosticsPlugin; use bevy::ecs::schedule::{ExecutorKind, ScheduleLabel}; use bevy::gizmos::GizmoPlugin; @@ -388,7 +389,7 @@ fn bevy_loop( app.add_systems(PostStartup, move || { ready_notifier.notify_waiters(); }); - app.add_systems(Update, update_cameras); + app.add_systems(Update, (add_oit, update_cameras)); app.add_systems( XrFirst, xr_step @@ -416,6 +417,27 @@ fn update_cameras(mut camera: Query<&mut Projection, (With,)>) { } } +fn add_oit( + mut commands: Commands, + cameras: Query< + Entity, + ( + With, + Without, + ), + >, +) { + for entity in &cameras { + commands + .entity(entity) + .insert(OrderIndependentTransparencySettings { + layer_count: 4, + alpha_threshold: 0.00, + }) + .insert(Msaa::Off); + } +} + fn xr_step(world: &mut World) { // camera::update(token); #[cfg(feature = "wayland")]