top of page

Tasty Town Foliage Animation Shader



JamCity / SGN (2016)


The Tasty Town land mass is populated by tree's and foliage. Some are mere decorative objects while others such as the clearable trees are more significant to gameplay.

Because there are so many trees surrounding the town and peppered around the playable area, having them all static made the town feel too sterile and non-organic. I made a custom unlit shader using Shader Forge that rendered the meshes with a low cost toon shading technique while looking at the red color channel of each vertex to determine how much to offset or sway. This made any foliage or tree using this shader slowly and gently sway back and forth to an imaginary wind gust.

The until toon shader used a 2 color ramp texture to fake some self shadows. This allowed the trees to be rotated to any angle and still have it rendered with the correct light direction. The mesh vertices are then painted with different opacities of red. Typically, top parts of the foliage are painted with a more solid value of red while fading down to black as we traverse down the mesh. This allowed the base of the mesh to stay anchored while the top part swayed the most. A simple cosine multiplied to a controllable value over time drove the back and forth swaying motion.

bottom of page