Interactive grass

Characters can move grass now. This was fun to figure out. Basically I have an invisible circle with x,y,z direction embedded into RGB colors under every moving character, and I can use this to bend the grass in the right direction near characters. It’s like 6 lines of code added to Unity’s built-in grass shader. The grass shader already has code for moving grass blade vertices - for wind - so I just had to add the render texture for grass camera (which only sees those hidden circles with character direction) and parse the colors into direction and add that to the grass vertex displacement function. It sounds pretty complicated when written out, but it’s pretty simple actually.

I have to tweak some settings to make them look more convincing, but at least the functionality is there. Also, right now the terrain is rendering each grass blade separately, but I really should make a new grass texture with multiple grass blades to save some GPU power. Might not see each grass blade moving independently with many blades per texture, but grass blades aren’t the most important thing in this game.

How did Metal Gear Solid 3 do individually moving grass blades? I remember being impressed when I played that game for the first time. And all that stuff was running on PS2 hardware. How?! Man, my accomplishments in this game pale in comparison to those retro games and their black magic. MGS3 also had those flowers moving independently during the boss battle with The Boss. How did they do all that stuff? How does ThatGameCompany’s Flower render all those grass blades and flowers on PS3 hardware? Maybe there’s a better way to render and move these grass blades… Hmm.