Master’s Thesis: Real-Time Grass Rendering

Grass is the most prevalent form of vegetation on the Earth’s surface. Thus, it is an essential element in rendering realistic outdoor scenes. But due to the geometric complexity of grass, rendering it realistically in real-time can be difficult and computationally expensive. Furthermore, to produce life-like representations of grass requires faithful physical simulations of movement provided by wind currents.
Ticking away are the moments that make up my final months in graduate school. And as my academic career winds to a conclusion, I’ve been working hard and coding away at my master’s thesis project. My master’s thesis is all about discovering and implementing an algorithm to render luscious grass in real-time. My ultimate goal is to have hyper-realistic fields grass all over the place and all up in yo’ face!
Above is a screenshot I took of the current state of my project. It looks quite groovy so far, but my journey has just begun.
Navier-Stokes Fluid Dynamics
Above is a video of a particle system driven by fluid dynamics that I developed in conjunction with my dear-old Dominican friend Manny Fernandez. The physics of this application is simulated using Navier-Stokes equations.
The Navier-Stokes equations are really quite groovy because they describe the physical properties behind fluid substances, from water and air currents to the motion of stars swirling inside a galaxy. Navier-Stokes is also used as the basis for weather forecasts. If you are interested in this learning more about this physics trickery, Jos Stam gave a great GDC talk about it.
The particle system application is coded in C++ and uses OpenGL/GLUT to render 40,000 particles. Given the vast amount of particles, we decided to take a multi-threaded approach to fork the work into several threads, with each thread handling a block of particles.
The source code is available for those who are interested. It’s public domain goodness.
[ Source Code ]
ArmorGames.com Sponsors Wasabi!
Wasabi was recently picked up and sponsored by the fantabulous Flash-portal site, ArmorGames. Thanks to all of you who play-tested my game and provided me with such great in-depth feedback on the gameplay. Without your love and funkitude, this game wouldn’t have been what it is today.
And if I ever see you internet folks in real-life, remind me to give you a high-five! You are all wonderful people.
Fembot
Above is a video of the Fembot 3ds-Max model which is being rendered by my 3D-engine. I coded a custom plugin for Autodesk’s 3dsMax that exports 3D models out to my own custom format (XML based). My 3D-engine then reads my custom format and correctly imports it into my engine to be rendered in all its glory.
The model uses simple phong lighting and specular highlights to achieve the glossy look. The yellow-blueish tone is achieved by using the coefficient from the phong lighting (n-dot-L) and interpolating between two colors (yellow and blue); this technique is also known as Gooch shading. According to the Gooch model, colors range from cool tones to warm tones rather than dark to light, thus giving it an appearance of ambient lighting.
[ Large Rendered Image ] 1920×1080 PNG
Sumo Pixels

I was fooling around in my pixel program last night and came up with a small mockup of two sumos wrestling. Maybe I’ll make a game out of it! Maybe I won’t! Who knows!
Carmack’s Fast Inverse Square Root
You don’t need to be an graphics expert to appreciate why square roots are so useful. It’s used in calculating distance, normalizing vectors, physics simulations, and all other Euclidean and Newtonian tomfoolery.
The number of CPU cycles required to calculate a square root is dozens of times more expensive than that is required to execute a simple math operation. A basic 3D engine can have tens-of-thousands of square root operations per update, so any opportunity to approximate the square root will save you a good number of frame rates.
The code below approximates 1/sqrt(x) using only multiplication and bit-shift operations. This code was heavily used in the Quake II engine:
float InvSqrt(float x) { float xhalf = 0.5f * x; int i = *(int*)&x; i = 0x5f3759d5 - (i >>; 1); x = *(float*)&i; x = x*(1.5f - xhalf*x*x); return x; }
For those who are mathematically curious: The code above approximates the inverse square root by using Newton’s method.
[ Reference ]
Stop Motion Pixel Art
A man by the name of Alex Varanese once wondered what 8-bit video games might look “in the form of a stop motion animation”. And while most people would just stop at wondering, this dude actually implements it. It’s awesome. Please watch it.




