A little while ago I posted about a very basic grass shader I worked on (with unity) on my Real-Time Rendering and Animation of Small Soft-Stemmed Plants. Having said that, I had not worked with shaders in a very very long time…think days of 8-instruction-limit fragment shaders. What I’m presenting here is far from a perfect grass shader but is meant to be a basis for how you can go about writing a simple shader if you are just starting out with it.

The Algorithm

What I was looking to create was luscious grass, swaying in the wind, for my game which uses an overhead view camera. This is actually an important point when it comes to writing a shader because something that looks good from above may look terrible from gazing angles and vice-versa. The first step was clear: search for it. I quickly came across this paper: