Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/janhohenheim/pixelate_mesh
Apply a pixelation effect to any Bevy mesh or scene without post-processing.
https://github.com/janhohenheim/pixelate_mesh
3d bevy game-development pixel-art
Last synced: 5 days ago
JSON representation
Apply a pixelation effect to any Bevy mesh or scene without post-processing.
- Host: GitHub
- URL: https://github.com/janhohenheim/pixelate_mesh
- Owner: janhohenheim
- License: apache-2.0
- Created: 2023-03-05T01:10:57.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-04T17:23:58.000Z (6 months ago)
- Last Synced: 2024-12-28T07:12:55.193Z (12 days ago)
- Topics: 3d, bevy, game-development, pixel-art
- Language: Rust
- Homepage:
- Size: 279 KB
- Stars: 79
- Watchers: 3
- Forks: 5
- Open Issues: 6
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
- License: license-apache.txt
Awesome Lists containing this project
README
# Pixelate Mesh
[![crates.io](https://img.shields.io/crates/v/pixelate_mesh)](https://crates.io/crates/pixelate_mesh)
[![docs.rs](https://docs.rs/pixelate_mesh/badge.svg)](https://docs.rs/pixelate_mesh)Apply a pixelation effect to any Bevy mesh or scene without post-processing.
![Pixelated foxes](./docs/foxes.jpg?raw=true "Pixelated Foxes")
## Usage
- Add the `PixelateMeshPlugin`, where you specify a component that tracks the main camera.
- Add this tracking component to your camera.
- Add the `Pixelate` component to any entity that you want to pixelate.The tracking component is needed because the plugin draws the textures on 2D canvases that need to rotate to always face
the main camera.## Compatibility
| bevy | pixelate_mesh |
|-------------|---------------|
| 0.14 | 0.4 |
| 0.13 | 0.3 |
| 0.12 | 0.2 |
| 0.10 | 0.1 |## Examples
The following is an annotated minimal example.
More can be found in the [examples folder](./examples).```rust
use bevy::prelude::*;
use pixelate_mesh::prelude::*;fn main() {
App::new()
.add_plugins(DefaultPlugins)
// Add the plugin
.add_plugin(PixelateMeshPlugin::::default())
.add_systems(Startupsetup)
.run();
}// Create a component for the main camera
#[derive(Component)]
struct MainCamera;fn setup(
mut commands: Commands,
mut meshes: ResMut>,
mut materials: ResMut>,
) {
commands.spawn((
// This cube will render at 64x64 pixels
Pixelate::splat(64),
PbrBundle {
mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })),
material: materials.add(Color::WHITE.into()),
..default()
},
));commands.spawn((
// Add the tracking component to the camera
MainCamera,
Camera3dBundle {
transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
..default()
},
));
}
```## Inspiration
The plugin tries to emulate the effect as seen in Prodeus:
[Source](https://www.youtube.com/watch?v=Vb-hPYOIwMw)
## Shortcomings
- The current setup does not work with multiple main cameras. Feel free to
comment [on the issue](https://github.com/janhohenheim/pixelate_mesh/issues/1) if you have an idea for how to fix
this!
- The plugin deactivates MSAA globally.