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!
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:
My Twitter:
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:


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:

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!


Are you planning to upload version 4.27 ?

Probably not. I’m waiting for UE5 to come out.

I will try to port 4.27 myself.
and I would be very grateful if you could give a tip about Android toon shading model.

I don’t know much about the mobile rendering system so I don’t think I’ll be able to help you.
Send me a message when your fork is ready, I’d love to try it out!

I managed to get this shader ported to Unreal Engine 4.27 for the time being (Although the issue with my fork is that I also updated to Steamworks v1.53). The only big downside currently being that raytracing shadows results in weird dark shadow artifacts on materials. It seems to work good enough with raytraced reflections and screen space global illumination. I’m personally pairing this with an invert hull mesh. This is probably one of the better toon shading solutions that I’ve seen in Unreal Engine that still works with deferred rendering (No forward rendering trickery needed).

A few things I’d definitely suggest adding for this to be a great universal solution:

  • Having the option for multiple shading and specular steps would be nice
  • Some sort of 2D subsurface scattering (Basically a small line between the lit and unlit area) for toon shaded skin would be a nice addition to have.
  • Some sort of way to affect how sharp shadows can be when casted onto the material (currently, shadows when casted onto the material look sharp no matter the shading softness set in the material)

Thanks for the work done on the shader! Just needs a little more polishing and I’d recommend to submit a pull request to get an NPR shader implemented in the engine (as binary builds have desperately been needing a proper toon shading solution for a while).

1 Like

This is great!
I tried but without success. What are the changes to make compared to 4.26? Is there a fork?