Skip to content
프로젝트

소개

Toon Shader for the bevy game engine

게임 및 에뮬레이션

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
-1
in 7 days
0
in 15 days
-1
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

Bevy Toon Shader

Crates.io MIT/Apache 2.0

A toon shader for the Bevy game engine.

bevy_toon_shader

Features

  • "Sun" color & direction
  • Specular highlight
  • Light banding
  • Shadow casting
  • Albedo map (base color texture)

Not supported (yet)

  • Dynamic color banding amount
  • Shadow receiving
  • Rim lighting

Installation

cargo add bevy_toon_shader
use bevy::prelude::*;
use bevy_toon_shader::{ToonShaderMainCamera, ToonShaderMaterial, ToonShaderPlugin, ToonShaderSun};

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugin(ToonShaderPlugin)
        .add_systems(Startup, setup)
        .run();
}

fn setup(
    mut commands: Commands,
    mut meshes: ResMut<Assets<Mesh>>,
    mut toon_materials: ResMut<Assets<ToonShaderMaterial>>,
) {
    // Camera
    commands.spawn((
        Camera3dBundle { /* ... */ },
        ToonShaderMainCamera,
    ));

    // Sun
    commands.spawn((
        DirectionalLightBundle { /* ... */ },
        ToonShaderSun,
    ));

    // Ambient light
    commands.insert_resource(AmbientLight {
        color: Color::GRAY * 0.2,
        ..default()
    });

    let material = toon_materials.add(ToonShaderMaterial::default());

    // 3D object
    commands.spawn(MaterialMeshBundle {
        mesh: meshes.add(Mesh::try_from(shape::Torus::default()).unwrap()),
        transform: Transform::from_xyz(0., 2., 0.),
        material: toon_material,
        ..default()
    });
}

Running the example

git clone https://github.com/tbillington/bevy_toon_shader.git
cd bevy_toon_shader
cargo run --example scene

Bevy Support Table

bevy bevy_toon_shader
0.12 0.3
0.11 0.2
0.10 0.1

Credit

Code initially adapted from this excellent Unity tutorial by Roystan.

License

Except where noted, all code in this repository is dual-licensed under either:

at your option. This means you can select the license you prefer! This dual-licensing approach is the de-facto standard in the Rust ecosystem and there are very good reasons to include both.

Your contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

관련 프로젝트 살펴보기

불러오는 중…