Home

Awesome

Unmaintained

Through means beyond my comprehension I (hatfullr) have somehow become the owner of this repository. I did not create this repository and I have no relation to this repository. I am unable to locate or contact the original contributor, "James Roll". As such, download this code at your own risk. I hold no liabilities related to or consisting of code, ideas, artwork, or any other property in this project or derivatives of this project. I will not delete the repository so that others can still use it.

hatfullr does not own any content of the file below this sentence.

<h1 align="center"> <img src=".Images/PixelLit.png" alt="Lit Example" width="300"> <br> Anime-Style Cel Shader (Unity) </h1> <p align="center"> <a href="https://opensource.org/licenses/MIT"> <img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License (MIT)"> </a> <a href="https://github.com/Jameslroll/UnityURP-AnimeStyleCelShader/releases"> <img src="https://img.shields.io/github/v/release/Jameslroll/UnityURP-AnimeStyleCelShader?label=Release&display_name=tag&include_prereleases" alt="Release"> </a> <a href="https://discord.gg/ssMzQPXjwq"> <img src="https://img.shields.io/discord/318871569323524096?label=Discord&logo=discord&logoColor=white" alt="Discord"> </a> <a href="https://paypal.me/jameslroll"> <img src="https://img.shields.io/badge/Donate-PayPal-green.svg?logo=paypal" alt="Donate (PayPal)"> </a> <a href="https://www.buymeacoffee.com/jameslroll"> <img src="https://img.shields.io/badge/Donate-Buy_Me_a_Coffee-green.svg?logo=buymeacoffee" alt="Donate (Buy Me a Coffee)"> </a> </p>

Details

This project allows for anime-style cel-shading in Unity. It includes lighting, shadows, edges, and is highly configurable. Adjusting the material settings might be necessary depending on the model, scene, or desired art-style.

Edges are blended with a custom render feature and pass using the camera's depth, normals, and color which contribute to the weight of the edge. Each contribution can be fine-tuned or disabled completely in the render feature's settings.

Sidenote

Physically based rendering of anime-style models is an inaccurate representation of how anime is drawn or rendered. While unlit shaders are more of an accurate representation, they often lack the artistic beauty that scene lighting provides. This shader simulates lighting and shadows more akin to the artistic style of anime while providing the options to allow for further freedom to the artist. Edges provide a subtle distinction between flat surfaces and can vary depending on the artistic style.

Usage

Materials

Edges

Compatibility

Requires Unity's Universal Render Pipeline (URP) with Unity version 2022.1.0b10 or greater for full compatibility.

Requires Unity version 2022.1.0b10 or higher for full functionality.

FeatureSupported
Post Processing
Deferred Rendering
Accurate G-Buffer Normals
Forward Rendering
Orthographic Cameras
Perspective Cameras
Pixel Lights
Vertex Lights
Decals
Virtual Reality
MSAA

MSAA is not supported (this can be disabled in the render pipeline settings), however other camera aliasing should work fine.

Lighting

Each material has configurable settings to modify how lighting behaves on the model.

PropertyRecommendedDescription
Shade Min-0.5 to -1.0Light areas are more aggressive with higher values.
Shade Max0.0 to 0.5Dark areas are more aggressive with higher values.
Shade Falloff0.0 to 0.5Higher values result in more aggressive directional lighting which looks bad. While lower values have the opposite effect and make them look better.
Vertex Light Falloff0.25 to 0.5Same as the shade falloff setting, but for vertex lights (if enabled).
Shadow ColorGreyishA light's indirect light which is applied to shadowed areas.
Receive ShadowsOnEnable shadows applied to the model.
Shadow Falloff1.0 to 2.0Higher values result in harder shadows.
Alternate ShadowsOffUses an inverse lighting falloff, which softens shadows.

Examples of the differences of: Vertex Lighting and Pixel Lighting.

A project's settings or a scene's lighting can greatly effect the result of the shader in positive and negative ways.

Edges

The Edge Detaction post-processing effect can be added to your Volume Profile and are rendered by the Anime Stack renderer feature.

SettingRecommendedDescription
Visualize-Render just the edges. Each contribution method is split into their own channel. Disable post-processing for an accurate representation.
Color-Color that the edge blends with. Alpha channel is used for opacity.
Blend Mode-How the outline blends with the image.
QualityLow or MediumHow many samples are take to determine the edge.
Size1.0 to 2.0How many pixels the edge is.
Depth0.02 to 0.1How much differences in depth contributes to the edge intensity, in meters.
Coplanar Falloff0.5Scales depth falloff to avoid contributing coplanar pixels with high deltas. Typically reproducible by looking parallel at a face.
Normal Falloff1.0Scales normals contribution. Higher values for higher angles. Zero to disable.
Depth Falloff0.5Scales depth contribution using the depth setting. Higher values will scale depth factor up. Zero to disable.
Color Falloff1.5Scales color contribution. Higher values for more aggressive color thresholds.

The visualizer shows each channel combined.

<a href=".Images/EdgesRGB.png"> <img src=".Images/EdgesRGB.png" alt="RGB" width="200" align="left"> </a>
ChannelContributor
RedDepth
GreenNormals
BlueColor
<br>

Videos

None.

Images

As of version 0.1.0.

Inside Image

Outside Image

3-Point Setup Image

Lit Group Image

Comparisons

URP's Unlit Image

URP's Lit Image

Credits

License

This project is licensed under the MIT License. Credit is appreciated.