Feature 10 Post Mortem

Drawing billboards in my scene wasn’t terribly hard. The hardest part was finding an image I wanted to use and loading it in properly. I needed transparency for my grass images, so I had to export the image from Gimp as a C file. I also had to shrink down the image’s size so Visual Studio was able to read it in. This made my images look a little squished, but when there are a lot of tufts of grass near each other it’s not very noticeable.

To draw my billboards, I decided to use geometry shaders. I found it more intuitive than the non-geometry shaders route, and I also didn’t want to have to mess around with defining faces and everything in my renderer. My shaders weren’t too extraordinary-they simply take in points and redraw them as squares. I also pass in the up and right vectors as uniforms so the billboards rotate with the camera’s movement.

As I said above, finding an image to represent my grass was harder than it would seem. If I used a picture that had a wide base, the squarish bottom of the image was visible in places where the terrain changed heights quickly. Thus I had to find an image with a narrow base. I also needed to choose an image that was sufficiently green-because I was compressing the image so much it the grass was too light it would look yellow and dead. I rejected the following images:

And eventually settled on this one:

After this it was smooth sailing, as getting the grass to draw was no problem. I did notice an issue where if I turned my fog on (my walkabout starts with it off), the grass would disappear. I realized that my fog was using GL_BLEND and I was drawing my grass after this.  I simply changed my onDraw() to draw the fog after the grass and this fixed the problem.

My video is below:

http://www.youtube.com/watch?v=Bg1ke0N_eag&feature=youtu.be

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *