Flat colour shading for foliage

I’m trying to create a foliage shader where the grass blends into the landscape and can only be seen on colour transitions/shadows. The best example is T3ssel8r’s Pixel art shader for Unity.

This is the best I could achieve on my own with and without my cel shader.


This is my current code for the grass. The virtual texture provides the landscapes colour, which is a consistent colour.

I know the cel shader needs for adjusting for sharper bands, but I’m not sure what adjustments to the foliage I need to make to get the desired results. Any pointers are appreciated.

Some keywords you are looking for are “color banding” “color stepping” “palette reducer” which are ways to snap colors to a set / range / nearest value. That way colors lit or shaded would snap to the nearest darker or lighter variant. I think it can only be done in post processing with UE though.

https://forum.unity.com/threads/shader-for-stepping-banding-gradient.700496/

List of software palettes - Wikipedia

I don’t have a ready example in shader code but it’s both commonly done in python for 2D images.

1 Like

I’ve applied my curve atlas that I had for my shadows to my colours in the cel shader. It works but in a hacky way.

I’ll still keep an eye out as I think something can still be done to the foliage normal, to stop the small unwanted patches of light/dark grass.

what if you fake it entirely with an emissive material?

I think that’s what I ended up doing, I managed to fix most the the spotty colour issue mostly by editing the landscape itself. Once I make the band edges sharper then it’ll be good enough for me.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.