Download

Celshading

Hello everyone
I’ve been working on a celshade/toon shade( is there a difference? ), and just wanted to share it with you.
I’m not really a shader programmer, I just compiled together what I found on the internet, customized some bits, etc.

So, if you like it, take it :slight_smile:
I’m sure it could be more optimal, if you know any better method, or ways to improve, please do tell!

With small gradient on edges
BwvSlkY.jpg

With hard edges
mUVZF2B.jpg

Outline test
Ldo3pDE.jpg

Usage:
There is a MaterialInstance, where you can set these values:
LightingPower: Scales the light calculated from the scene. Useful on darker levels, because lighting difference would be so small, that the whole character would be on the same light level. Default is 1
Min-MaxDistanceAlpha: Fades out the outline based on min-max distance
Min-MaxDistanceSize: Modifies the size of the outline based on the mix-max distance, between OutlineSize and 1
OutlineSize: Width of the outline. Set it carefully, sadly if set to a too high value, it gets distorted. 5 was the max I could get, 1 is the minimum.

And you need a texture, I used a 1x256 sized one, decides what light level the current pixel should have. 128,128,128 is the base value, anything brighter color will brighten up your scene.

Only works on models with RenderCustomBuffer

If you download the zip, put the Shaders folder inside your content folder, restart the editor, and it should appear.
Download it here

thanks for sharing this, i also liked the outline effect, it looks like painted with a brush

Hello,Honya15, I’m trying to write an outline-black shader.Do you know how to set the RenderCustomBuffer ?Or is there an demo on github.com about how to use this shader files?

Just tick it on on the mesh properties.

I replace the material of the boxes using , and tick Render Custom Depth on, but it didn’t work.It just like a transparent shader but an outline-black shader (toon)