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!
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?
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.
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?
Well, I am a dingus and didn't understand the setup at the time LMAO. Now I got it to work and it looking amazing.
I do have one question though: how do I approach decals that have different materials?
FighterZ models like this one have decals on the face that appears to be on a different material slot. I tried applying the decal texture by using the texture coordinate node but that doesn't work. How could I fix this?
Also, if you have multiple materials that all need to be cel shaded, you can do the following:
Duplicate all cel shaded parts of your model, and assign it to one material slot before all other materials. This will be your "pure white" PBR material.
Instead of setting an overlay material, set the individual material slots to be cel shaded.
This has the same effect as the overlay material system, but is more flexible.