Expand description
§bevy_smooth_pixel_camera
A bevy plugin that adds a simple smooth pixel camera.
The smoothing is based on this video from aarthificial which explains how it works pretty nicely: https://youtu.be/jguyR4yJb1M
This method allows for smooth camera movement while retaining the pixel perfection of low resolution rendering.
§Usage
-
Add the
bevy_smooth_pixel_cameracrate to your project.cargo add bevy_smooth_pixel_camera -
Add the
PixelCameraPluginand set theImagePlugintodefault_nearest.use bevy::prelude::*; use bevy_smooth_pixel_camera::prelude::*; App::new().add_plugins(( DefaultPlugins.set(ImagePlugin::default_nearest()), PixelCameraPlugin )).run(); -
Add a pixel pefect camera to your scene.
use bevy::prelude::*; use bevy_smooth_pixel_camera::prelude::*; fn setup(mut commands: Commands) { commands.spawn(( Camera2dBundle::default(), PixelCamera::from_size(ViewportSize::PixelFixed(4)) )); } -
That should be it! Make sure you move your camera via the
PixelCamera.subpixel_posproperty instead of theTransformcomponent.
§Bevy Compatibility
Modules§
- components
- The components of
bevy_smooth_pixel_camera. - prelude
use bevy_smooth_pixel_camera::prelude::*;to import thePixelCameraandPixelCameraPlugin.- viewport
- Viewport Scaling and Stretching.
Structs§
- Pixel
Camera Plugin - The
PixelCameraPluginhandles initialization and updates of thePixelCamera.
Enums§
- Camera
Systems - A
SystemSetforPixelCameraPlugin’s systems.