A collection of tricks, thoughts, ideas and solutions from a graphics programmer. This blog contains my experiences, tips and tricks, everyday problems and their solutions. This blog serves not only as my reference but also for the whole world at large.
I was looking to implement Half angle slicing but due to some problems I was unable to get the results. see the image below. The problems included how to update the OpenGL blending order front to back and back to front for the light and eye buffers. Once this was sorted, I was still not getting the same output as was shown in the paper by Joe Kniss. So just today I noticed I was not clearing the eye and light buffers doing so removed the bugs. Finally, I managed to get it working. Compare the above images to this one.
Half angle slicing is a really wonderful technique invented by Joe Kniss. The details are given in GPUGems1-Chapter 39. I implemented it and the results are amazing. I will post videos after the whole thing is finished. Till then, enjoy some snapshots.
I saw an interesting demo from NVIDIA in the OpenGL sdk using render to 3D texture functionality to run a realtime water simulation. I thought I would replicate the same thing in 2D atleast to get started. So here it is.
The reference for this was this wonderful article. The snapshot from the application is on the top. Here is how I implemented this on OpenGL. I created 3 textures and attached them to the three color attachments using the FBO. The first color attachement was for the 3D scene (the teapot and the plane). The second and third color attachments were for the water simulation. Basically I have simply converted the main code given in the article. See it for details in this regard. In the display function, first the scene is rendered and then the water simulation is rendered by ping pongging btw color attachment 1 and 2. The complete fragment shader for water is given below
After this, we have three rendered outputs the first one containing the rendering result, the second and third contain the water buffer. These textures are then used in another fragment shader to show the final output. The fragment shader is given below.