Download

Anime Inspired Shading Model

After struggling to find a shader that will fit my projects, I decided to make my own anime-inspired shading model. It was a very fun experience and I’m planning to expand this project and add more shading models in the future! In the meantime, I hope you like this shading model. It is designed to give you as much control as possible over your material’s color. The material’s base color is completely separated from the highlight color and shadow color. You can even make a black material with white shadows! The shader supports multiple light sources and it has cool features such as a stylized specular and rim light.

Michiru (BNA)
Model + Rig Created by Christoph Schoch
Download the rig here!
ArtStation: https://www.artstation.com/artwork/d836rX
If you made something cool with the shader, send it to me and I’ll add it to the post!

I made a short video that shows the material’s features, I recommend watching it!

I also made this installation guide that explains how to download and use the materials:

Github Repository: https://github.com/SirCodalot/UnrealEngine
My Twitter: https://twitter.com/Sir_Codalot
Example Project: GitHub - SirCodalot/ShadersExample

Recommended Project Settings:

  • Project Settings > Rendering > Static Lighting = Enabled
  • Project Settings > Rendering > Auto Exposure = Disabled
  • Project Settings > Rendering > Auto Exposure Bias = 1.0
  • Main Light Source > Light > Intensity = 1.0 lux

When you create a new material and set the shading model to “Toon”, use these material properties to control your material:

  • Base Color: Defines the overall color of the material.

  • Shadow Color: The color of the unlit areas of the material.

  • Highlight Color: The color of the material’s specular and rim light.

  • Offset:

    • Red: The shadow’s offset.
    • Green: The specular’s offset (size).
    • Blue: The rim light’s offset (size).
  • Range:

    • Red: The shadow’s softness.
    • Green: The specular’s softness.
    • Blue: The rim light’s softness.

Known Issues:

  • The shading model probably doesn’t work with Forward Rendering.
  • Using more than one directional light might look weird, but you can use as many SpotLights and PointLights as you want.
  • Only works with moveable light sources (but you still have to enable static lighting in your project’s settings).

I want to thank the creators of a few other shading models. It is very hard to find information on this subject and without them, I would’ve failed. Please check out their shading models, they might fit your project more than mine!

Other cool shading models:

Other helpful links:

2 Likes

Looks cool. Thanks for sharing.

Is it possible to use cast shadows as a mask to lerp between multiple textures like in your first link? Been hoping to see someone implement it with the deferred renderer, but I’ve never known whether it was even possible.

Nice work regardless

Yes, it works in the Deferred Renderer and it still supports multiple light sources. You just need to connect your first texture to the Base Color and your second texture to the Shadow Color. The result looks like this:

https://i.ibb.co/XSL0zPW/Dragon-Ball-800.gif

neat! I love seeing more of these pop up :>

How does this look when you have multiple light sources? The reason I don’t support deferred in my shading model is because when I put the lighting together I take the results from all lights and break things down into either a lit pixel, or an unlit pixel so that I’m eliminating any partial shadows that come up when there’s multiple lights whereas deferred just adds the lighting results together. I’ve searched through the source code a few times and I was never able to find where the deferred pipeline actually puts together the result of GetDynamicLightingSplit function like forward rendering does in ForwardLightingCommon.ush so I could achieve the same result through that pipeline.

I made it so the shadow can only be controlled by the directional lights, while the point/spotlights can only add more of the base color on top of it.

Oh man, that’s awesome :slight_smile:

I uploaded an example project to GitHub! GitHub - SirCodalot/ShadersExample
It contains a useful M_ToonBase material that you can copy to your own projects.

this shading model support ILM textures?

Yes, but you’ll need to separate the RGB channels and modify the values in the material graph. I might add an ILM material to the example project, so if you couldn’t get it to work, the example might help.

ok thank you!

I’m wondering if you have any plans on getting this shader up and running in the UE5 preview?

I suspect that something is either wrong with how I got the shaders up, or it might be because I had to comment some code out from the RectLight and CapsuleLight integrate shader files, as it was causing some compilation issues due to the GBuffer not being passed as an argument in those functions that were modified anymore.

EDIT: Interestingly enough, after enabling Mesh Distance Fields, this is what happened.

I definetly want to upgrade to UE5 in the future, but I’ll probably wait for a more stable version. If that’s the only part you commented, the shader should still work but point and spot lights will look weird.

Hey, awesome model, was working really well but yesterday I got this message, do you know how to fix it? Thank you!

image