How do I achieve simple flat/cel shading on mobile?

I’ve been able to replicate a couple versions of cel shading by copying what others have posted in this thread:

But they use the SceneTexture node in post processing and when I check the “mobile debugging” it gives me a warning that the SceneTexture node is “not supported in feature level ES2”.
This is for a mobile game and, ideally, I’d be able to target as many mobile devices as possible. The art style is very simple and low poly.

I don’t really have any experience with writing shaders but I’d like to know if there’s any other way to do this?

One idea that I thought of that might be simpler would be to use flat shading but in my tests so far it doesn’t give a pleasant result. I had to add a decent amount of geometry to get my character to deform properly and there’s a ton of triangles with a lot of different shades; but I’m thinking I could build my characters with separated parts, like the biceps and forearms and hands all separated so there’s no deformation. Hmm… strokes beard

Otherwise, I may have to resort to no shading. Just unlit, emissive materials with some “baked” shading. This wouldn’t be so bad, it could work for the art style and goals of this game; but I just want to know if there’s a better way.


So, I was trying to figure out how to do flat shading and I have 2 problems.

1: All quads get triangulated and leave a noticeable diagonal line through the middle. I don’t like it but it’s not a deal breaker; I don’t know if there’s a solution for that.
2: The only method I’ve found to do flat shading, once again, uses nodes that aren’t supported on ES2!! :mad:

I find it hard to believe that (what I would think is) such a simple shading style wouldn’t be supported on mobile! It’s just 1 color per poly; shouldn’t that be much simpler than Phong/etc shading?

Blergh. Frustrating that the best looking result I’ve been able to get thus far is when I completely disable shading (unlit, emissive).

What about using vertex colors instead of a texture? I’ll have to look into that tomorrow.

Unlit + Vertex colour is where you probably want to start. Then do a dot product of a fake light vector and the surface normal to create some soft lighting.

Here’s an idea, since my lighting needs are pretty simple: How can I make a shader that will just darken a poly by X amount if the angle is within a certain threshold of down?

I don’t really need lighting, per se, I just want a kind of global shading on the under side of certain dynamic characters.

Basically, I’m only going to have 2-3 characters on screen at a time that I want to have some shading. The background and props can all just be unlit.

I don’t know anything about shaders so I guess I’m just thinking out loud; I’ll have to start doing some reading.

You may want to look into using the Dot Product between the pixel normal(or most likely better vertex normal for mobile performance) and a direction vector - probably (0,0,1) for starters :slight_smile: