Cel shading with real lighting data, without post process materials or engine modifications


I discovered how to use real lighting data alongside cel shading in Unreal Engine 5, without needing a post process material or engine modifications.

The gist of the solution is to make your normal PBR material, then use a translucent overlay material to get the lighting data (by dividing scene color by base color scene texture). This gives the "raw" lighting data, which can then be used with if nodes, smoothstep, curves, etc.

This gives more artistic freedom than a post process material, as it can be applied per-mesh instead of to the entire scene. Experiment with custom shadow colors per mesh!

You can find an example overlay material here:

4 Likes

That looks super cool, and what a sick Goku model.

insanely cool!

will add the caveats:

  • unreal 5.1 or greater
  • overlay materials result in an extra draw call for the mesh, so just something to be aware of
  • dynamic exposure will affect scene color

also going to share these images that @WistfulHopes had shared on discord because i think it really helps drive the technique home:

base material

base + overlay material

Hello, Im trying it, but I got stuck with the CurveAtlasRowparameter. which is asking me for a curve and atlas Material expression. how to go about that?

1 Like

Also getting that error, I added a default curve & atlas but wasn't able to replicate the cell effect

Actually, I think I ended up getting it working by adding some constant keys to the curve from near black to white. Interested to see if WistfulHope has a more ideal curve setup?

In any case, the results are great - thank you for sharing!

I seem to be having trouble getting this to work. When I had made the translucent material, and applied it to my character as an overlay material, they appear completely blackened out.

Any possible fixes?

Just to check: you made a basic linear color curve float and applied it to your material?


Also, here's how I currently apply light coloring to the cel shader.

The Point Light node is added to the texture, then the Light node is done with an Overlay blend.

Yea. I have my gradient set up like this

I have my translucent overlay material setup with the blueprint code provided in the link of the original post, and then I assigned my curve to the Curve Atlas Parameter Node. Not sure if I did the right approach, but if I have the material blueprints just like it is in the link in the OP, and use it as the overlay material, my character gets blacked out.

And with those named reroutes nodes for applying the lights to the cel shader, I'm not entirely sure how to apply them. Are those just part of the overlay material and I plug them into one of the outputs, or am I supposed to make a material function to carry these reroutes to my base cel shader?

I might be overcomplicating things lmao