Stylized Flat Shading and Shadowing

I’ve ran into some complications with implementation of stylized low poly shading.
Well, actually the shading part has no issues at all, it is the shadowing I am having problems with.

This is the desired apperance:

https://image.prntscr.com/image/74003cc5af6945c5916610c74c8042e7.png

Namely, it is faced shadows I am after. With baked light, it isn’t an issue at all, I just sample light/shadow maps with a coordinate, that was not interpolated.

However, the same behavior needs to be replicated for all dynamic shadows.

This appearance with dynamic shadows is unwanted:

https://image.prntscr.com/image/d02146eac8f34d49af8e12f6e878a54e.png

I’m searching for an elegant solution and would be glad for any assistance/ideas.

Gonna bump this, as I created the thread on a weekend and it might have went unnoticed.
I’m still in search of a decent way to make CSM look faceted, following geometry of shadow receivers.

I am fairly certain you would need to use forward rendering and change the code for how shadowing is applied.

A more hacky but doable way is to mosaic the scene texture using a post process material. Its possible to point sample the regular terrain grid easily, but not the random other polygons. Maybe you could use shading model or custom depth to mask the effect to only work on the terrain.

This works, but has a slight bit of shimmer when moving the camera. Not sure why, but maybe this helps:

edit looks to be tempAA doing the shimmer at least mostly. But also looks like this will pixelate silhouettes unless you mask it to only affect terrain. probably not useful.

Trying to avoid it as far as practicable. Before positing this thread this was the only solution that would fit all needs, that I could think of at least.
Can’t think of any post-process solution, that would fit the needs either.
Thanks for response though.

The things I’ve tried or considered so far:

  • Various shadow filtering tricks, including offsetting shadow sampling using some sort of noise/mosaic texture.
  • Just disable shadow filtering and roughly match shadowmap resolution to average face size in the scene.(surprisingly good results, but not good enough and lack of scene-to-scene consistency).
  • Expand g-buffer and materials to contain non-interpolated vertex position, and refine shadowmap sampling using it.(Haven’t tried it yet due to the scope of work, but I suspect It might acceptable for what I need).
  • Fake forward shadows with a scene capture, implemented per-material. (Improper interaction with other shadows and baked data is probably the only thing that stops me from using this approach).