3个不稳定版本

0.2.0 2024年3月19日
0.1.3 2024年1月7日
0.1.2 2024年1月7日
0.1.1 2024年1月7日
0.1.0 2024年1月6日

游戏开发类别中排名第848

MIT/Apache

34KB
601

Bevy HDR自动曝光

crates.io docs.rs

Bevy自动曝光插件。特性:

  • 设置摄像机的最小/最大曝光值;
  • 测光蒙版,以赋予图像某些部分更多权重;
  • 平滑曝光过渡,具有分别针对亮化和暗化的设置;
  • 曝光补偿曲线,例如使暗场景看起来真正黑暗。

使用方法

设置自动曝光非常简单

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版本支持

我打算跟踪Bevy的最新版本。

bevy bevy_mod_auto_exposure
0.13 0.2
0.12.1 0.1

示例

cargo run --example auto_exposure

许可

本项目可根据您的选择使用以下任一许可:

  • MIT许可:可在此处找到
  • Apache License,版本2.0:可在此处找到

选择。

依赖项

~18–46MB
~717K SLoC