Nishant Dania
Coder / Designer / Arduino Enthusiast
GSOC 2014 - Week 6: Procedurally Generating a Pool and Adding an Underwater Shader
  • 30 Jun 2014
  • Procedurally Generating the Pool

    This was the easy part. I used the same grid that I had created and added texture coords to every vertex. I added UV map coordinates to every vertex. I made the walls of the pool using this technique. Similarly I added a water plane to the pool. This is how it looked so far:

    The wireframe render of the procedurally generated pool. The front two faces can't be seen due to backface culling.

    So far, so good.

    Adding the Underwater Shader

    I also wrote an exponential fog shader. This was required to simulate the decrease in visibility in underwater scenes. A few lines of fragment shader gave me the required effect. The other way to simulate underwater effect was to generate particles which can't be rendered at a decent FPS. So I had to stick to this fake fog shader.

    Pool rendered with the underwater fog effect. The texture on the pool's walls is feebly visible through water. This visibility increases as we move closer to the pool. The upper lighter part is a separate water shader.

    Going deep down underwater:

    The texture on the walls gets clearer as we move closer. The underwater shader at effect.

    Can't leave the Panda alone:

    The Panda Bath. A blue tint is added to the models that are underwater.

    Another reason why I chose not to use particles for an underwater scene was the fact that it would have messed up the selecting objects feature. Since selecting the objects depends upon the rays sent from the camera to the object, the particles in between would have hindered the path. Without those particles, everything is as smooth as required.

    Selecting the Panda

    There are still a lot of things that I will add to this underwater scene in later days including a reflection shader and an environment map. For now, I am happy to see this beta version of the scene come up in time.

    What's next:
    Animating the water texture.
    Adding some controls for the pool to the GUI.

    comments powered by Disqus