| Crates.io | bevy_psx |
| lib.rs | bevy_psx |
| version | 0.1.2 |
| created_at | 2025-10-14 15:41:43.590592+00 |
| updated_at | 2025-10-17 11:25:06.346034+00 |
| description | A Bevy plugin that provides authentic PlayStation 1 (PSX) style rendering capabilities, including low-resolution rendering, vertex snapping, and palette quantization |
| homepage | https://github.com/tajo48/bevy_psx |
| repository | https://github.com/tajo48/bevy_psx |
| max_upload_size | |
| id | 1882576 |
| size | 298,850 |
A Bevy plugin that provides authentic PlayStation 1 (PSX) style rendering capabilities, including low-resolution rendering, vertex snapping, and palette quantization.
Add the plugin to your Bevy app:
use bevy::prelude::*;
use bevy_psx::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(PsxCameraPlugin) // Add the PSX plugin
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
// Spawn a camera with PSX rendering
commands.spawn((
Camera3d::default(),
Transform::from_xyz(4.0, 2.5, 4.0).looking_at(Vec3::ZERO, Vec3::Y),
PsxCamera, // This component enables PSX rendering!
));
// Your 3D objects will automatically get PSX vertex snapping
// Palette quantization is available but disabled by default
}
That's it! Your camera will now render at PSX resolution with automatic vertex snapping applied to all 3D models. Palette quantization is available but disabled by default.
Control the PSX rendering behavior with PsxRenderSettings:
fn configure_psx(mut settings: ResMut<PsxRenderSettings>) {
// Set resolution
settings.render_resolution = UVec2::new(320, 240); // Classic PSX
settings.base_resolution = UVec2::new(320, 240);
// Enable/disable features
settings.pixelated = true; // Nearest-neighbor filtering
settings.aspect_ratio_matching = true; // Adjust to window aspect ratio
}
Control vertex snapping with PsxSettings:
fn configure_vertex_snapping(mut settings: ResMut<PsxSettings>) {
settings.snap_enabled = true;
settings.snap_amount = 64.0; // Lower = more jittery, Higher = smoother
// Jitter levels guide:
// 8.0-16.0: Extreme jitter (very wobbly, experimental)
// 16.0-32.0: Maximum jitter (authentic PSX look)
// 64.0-96.0: Moderate jitter (recommended for most games)
// 128.0-256.0: Minimal jitter (smoother movement)
// 512.0+: Almost no jitter (modern look with slight retro feel)
}
The snap_amount value controls how "wobbly" your 3D geometry appears, recreating the characteristic PSX vertex jitter:
How it works: Vertices are snapped to a grid in screen space. Lower values create fewer grid points, causing dramatic jumps between positions as objects move or rotate.
Visual impact:
Performance: All snap amounts have similar performance impact since the calculation is done on the GPU.
Recommendation: Start with 64.0 for an authentic PSX experience, then adjust based on your artistic vision.
Color palettes are now handled through the unified shader system with PsxSettings:
fn configure_unified_shader(mut settings: ResMut<PsxSettings>) {
settings.use_palette = true; // Turn on palette quantization
settings.quantize_steps = 32; // Color reduction steps
}
The plugin includes built-in keyboard controls (can be seen in the examples):
Rendering Controls:
Common Controls (most examples):
Variable Controls (example-specific):
⚠️ Important: Each example may use slightly different key mappings! When you run an example, check the console output for the specific controls available. The most comprehensive controls are in the lights.rs example.
The plugin automatically loads color palettes but keeps them off by default. Each demo can choose whether to turn on palette quantization. Supported formats:
Example palette file:
# My Custom Palette
000000
ffffff
ff0000
00ff00
0000ff
Built-in palettes include:
Run any of these examples to see the PSX plugin in action:
cargo run --example simple_psx
A basic demonstration of PSX rendering with interactive controls for all features.
cargo run --example rotating_scene
Multiple animated objects showcasing vertex snapping and palette effects.
cargo run --example lights
The most comprehensive example - demonstrates complex lighting scenarios with PSX rendering:
Features:
Controls:
1/2 - Adjust camera aperture (f-stops)3/4 - Adjust shutter speed5/6 - Adjust ISO sensitivityR - Reset exposure settingsSpace - Toggle ambient light on/offArrow Keys - Move objects around the sceneZ - Toggle red point light on/offX - Toggle green spot light on/offC - Toggle blue point light on/offG - Toggle directional light on/offP - Toggle palette quantization (compare lighting effects!)N/M - Switch between color palettesV/B - Adjust vertex snapping intensityT - Toggle vertex snapping on/offQ/E - Adjust color quantization stepscargo run --example object_spawner
Extreme performance testing with automatic object spawning up to 1000 objects per frame.
The plugin automatically converts standard Bevy StandardMaterials to PSX-enhanced materials with:
When enabled, the plugin automatically adjusts the render resolution based on your window's aspect ratio:
This prevents stretching while maintaining the low-resolution aesthetic.
The PSX rendering adds minimal overhead:
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit issues and pull requests.
Inspired by the distinctive visual style of original PlayStation games and the technical limitations that created their unique aesthetic.