3 unstable releases

0.2.0 Mar 19, 2024
0.1.3 Jan 7, 2024
0.1.2 Jan 7, 2024
0.1.1 Jan 7, 2024
0.1.0 Jan 6, 2024

#579 in Game dev

Download history 4/week @ 2024-01-06 5/week @ 2024-02-17 150/week @ 2024-03-16 9/week @ 2024-03-23 51/week @ 2024-03-30 6/week @ 2024-04-06

74 downloads per month

MIT/Apache

34KB
601 lines

Auto Exposure for Bevy HDR

crates.io docs.rs

A Bevy plugin for auto exposure. Features:

  • Setting min/max exposure values for the camera;
  • Metering mask to give more weight to certain parts of the image;
  • Smooth exposure transition, with speparate settings for brightening and darkening;
  • Exposure compensation curves, for example to make dark scenes look actually dark.

Usage

Setting up auto exposure is easy:

use bevy::prelude::*;
use bevy_mod_auto_exposure::{AutoExposurePlugin, AutoExposure};

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        // Add the plugin.
        .add_plugins(AutoExposurePlugin)
        .add_systems(Startup, setup)
        .run();
}

fn setup(mut commands: Commands) {
    commands.spawn((
        Camera3dBundle {
            camera: Camera {
                // make sure you set your camera to hdr
                hdr: true,
                ..default()
            },
            ..default()
        },
        // Add the auto exposure component. You can also use the default option,
        // it's good enough for most cases.
        AutoExposure {
            // Set the exposure range to a bit bigger if your scene has a very
            // high dynamic range.
            min: -16.0,
            max: 16.0,
            // Set the compensation curve to make dark parts look dark on
            // screen.
            compensation_curve: vec![vec2(-16.0, -4.0), vec2(0.0, 0.0)],
            ..default()
        },
    ));
}

Bevy Version Support

I intend to track the latest releases of Bevy.

bevy bevy_mod_auto_exposure
0.13 0.2
0.12.1 0.1

Examples

cargo run --example auto_exposure

Licensing

This project is dual-licensed under either

  • MIT License: Available online
  • Apache License, Version 2.0: Available online

at your option.

Dependencies

~18–46MB
~735K SLoC