OpenSceneGraph – Trees and Grass

glsl_260_treesgrassIn this demo I made a test of creating trees, grass and shadows. 

The trees use a bill-boarding technique where I rotate a quad with an image of a tree, so it always faces the camera. I let the GPU handle instancing, which allow me to have many trees (over 1000000) with little impact on performance.

The grass uses a variant of the technique I used on the trees, but basically the same idea. The grass also has a slight wave animation to them. It is not the texture that is animated, but I do a slight skewing of the vertices on GPU.

The shadow is just simple projected shadow. The only problem I have is the projection onto the grass, because the grass is also a billboard which means I should adjust the projection to make (which I haven’t done in this demo).

Here is a video of my result: