bevy_wind_waker_shader

Crates.iobevy_wind_waker_shader
lib.rsbevy_wind_waker_shader
version0.2.0
sourcesrc
created_at2024-02-19 01:56:35.058294
updated_at2024-07-04 17:36:32.861081
descriptionA toon shader that looks like the one used for characters in The Legend of Zelda: The Wind Waker
homepage
repositoryhttps://github.com/janhohenheim/bevy_wind_waker_shader
max_upload_size
id1144603
size7,483,419
Jan Hohenheim (janhohenheim)

documentation

README

Wind Waker Shader

crates.io docs.rs

A toon shader that looks like the one used for characters in The Legend of Zelda: The Wind Waker. The main code is taken from the ideas presented in this video.

Showcase

Sphere:

Sphere

Scene throughout day:

https://github.com/janhohenheim/bevy_wind_waker_shader/assets/9047632/80aa9851-f425-4439-88f1-558918caa9f1

Scene in daylight:

Scene in daylight

Scene at night:

Scene at night

Functionality

The shader has the following properties:

  • It is a toon shader with only two colors: the highlight and the shadow.
  • The edge between the two colors is not entirely hard but has an ever-so-slight gradient.
  • The color palette used is based on the time of day and the weather.
  • The model has a rim highlight on the edge to make it pop.

All colors and the texture mask are taken from The Legend of Zelda: The Wind Waker.

Differences to The Wind Waker:

  • This shader supports multiple light sources, like in Breath of the Wild. The original Wind Waker only supports a single light source.
  • The rim highlight also comes from Breath of the Wild.
  • The Wind Waker uses even more weather conditions, but I find most of them too specific to include in this shader.

Keep in mind this shader only replicates what is seen on the characters in The Wind Waker, not the environment!

Example

use bevy::prelude::*;
use bevy_wind_waker_shader::prelude::*;

fn main() {
    App::new()
        .add_plugins((DefaultPlugins, WindWakerShaderPlugin::default()))
        .add_systems(Startup, spawn_character)
        .run();
}

fn spawn_character(mut commands: Commands, asset_server: Res<AssetServer>) {
    commands.spawn((
        SceneBundle {
            scene: asset_server.load("models/Fox.glb"),
            ..default()
        },
        WindWakerShaderBuilder::default()
            .time_of_day(TimeOfDay::Afternoon)
            .weather(Weather::Sunny)
            .build(),
    ));
}

Compatibility

bevy bevy_wind_waker_shader
0.14 0.2
0.13 0.1
Commit count: 48

cargo fmt