use bevy::{ core_pipeline::{ fxaa::{Fxaa, Sensitivity}, prepass::{DepthPrepass, NormalPrepass}, }, prelude::*, }; use bevy_mod_edge_detection::{EdgeDetectionConfig, EdgeDetectionPlugin}; fn main() { App::new() // MSAA currently doesn't work correctly with the plugin .insert_resource(Msaa::Off) .add_plugins(DefaultPlugins) .add_plugin(EdgeDetectionPlugin) .init_resource::() .add_startup_system(setup) .run(); } /// set up a simple 3D scene fn setup( mut commands: Commands, mut meshes: ResMut>, mut materials: ResMut>, ) { // set up the camera commands.spawn(( Camera3dBundle { transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y), ..default() }, // The edge detection effect requires the depth and normal prepass DepthPrepass, NormalPrepass, // Add some anti-aliasing because the lines can be really harsh otherwise // This isn't required, but some form of AA is recommended Fxaa { enabled: true, edge_threshold: Sensitivity::Extreme, edge_threshold_min: Sensitivity::Extreme, }, )); // set up basic scene // plane commands.spawn(PbrBundle { mesh: meshes.add(shape::Plane::from_size(5.0).into()), material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()), ..default() }); // cube commands.spawn(PbrBundle { mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })), material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()), transform: Transform::from_xyz(0.0, 0.5, 0.0), ..default() }); // light commands.spawn(PointLightBundle { point_light: PointLight { intensity: 1500.0, shadows_enabled: true, ..default() }, transform: Transform::from_xyz(4.0, 8.0, 4.0), ..default() }); }