The goal for this week was to set up a working scene graph so that the framework would be ready for the main global illumination pipeline.
I decided to implement the scene graph building in the shader itself. However, I soon ran into problems. The first problem was that GLSL ES does not support pointers, and therefore, I would not be able to build a real scene graph on the shader. So I decided that I would leave the scene graph for later and work with individual objects with their own individual transformations (with respect to the world.) This would require matrix math to create translation, rotation, and scale matrices along with several other matrix operations in order to apply and undo transformations. I was planning to use GLM for the math library. However, I found out that GLSL ES does not support the #include directive. I tried looking around for options, but could not find anything useful. So I then decided I would work with very basic sphere and cube structs that have position and radius values.
Once I have the basic structs, I keep them in an array of shapes. I then proceeded to write the intersection code for the structs, as well as the intersection code for the world, iterating over the array of shapes and finding an intersection.
Once I had intersection code, I started writing the recursive ray tracing function that will utilize the intersection checks I just added. After I wrote the ray tracing code, complete with reflection and refraction, I encountered an unknown compilation error. And after a long time of looking over my code and Googling for answers, I realized that GLSL ES does not allow for recursive function calls. (I found the reference for GLSL ES which is useful.) So I had to revert my code back to the original non-recursive ray tracing.
A lot of time this week was spent troubleshooting and figuring out the limitations of GLSL ES, the hard way. At the moment, I don't have ray tracing working perfectly with my new intersection code. The spheres have a fuzzy grainy texture, which I assume is attributed to floating point precision error.
Over the next few days, I hope to have complete and debug the intersection code for both spheres and cubes. The reason that I focused on having just the basic ray tracing working with my new code is because photon casting will be using the same code.
I do have some concerns for recursion support. I'm not sure if photon scattering will work without recursion. I will have to look into that.