COMPUTER GRAPHICS/OPENGL PROGRAMMING
For this project, I took my previous ray tracer and used it as the starting point for a basic photon mapper into order to achieve caustics and diffuse inter-reflection. The general pipeline for simulating photon maps is as follows:
1.Fire Photons from each light source at the scene and store them in the photon map.
2. Organize the photon map into a KD-Tree.
3. Perform raytracing. Replace the ambient estimate with a radiance estimate using k-nearest neighbors from the photonmap.
The above image effect is achieved by emitting 0.1 billion photons into scene. I also experiment to add support for more advanced sufaces, more advanced rendering technique, such as, Progressive Photon Mapping. PPM is a technique that gets around some of the problems of photonmapping, namely the need to store all photons.
KD Trees for Faster Ray Tracing
During this project, I implement a basic ray tracer that can handle ambient and diffuse lighting, soft shadows, reflection and refraction. While the basic ray tracing algorithm produces very crisp images that look quite unnatural. In order to fix this consider making my ray tracer distributed, I add the glossy reflection and environment map.
Data Structure for optimization: KD tree is an axis-aligned BSP tree. Space is partitioned by splitting it in two halves, and the two halves are processed recursively until there are more than 50% mesh triangles of each half-space is same or no half-space contains more than a preset number of primitives. KD tree may look like octrees at first, they actually are quite different: A octree always splits space in eight equal blocks, while the kd-tree splits space in two halves at a time and the splitting plane is not fixed and depends on the longest axis of the current bounding box.
After the addition of the KD tree and multithreading (8 threads, for my ray tracr), the Stanford dragon, at ~100,000 faces could be rendered in several minutes with 64 sample numbers.
Geometry Subdivision And Shader Programming
In this project, I implement a very simple reflection shader by using GLSL. I am given a scene with a geometry and an environment map. This reflection shader will reflect a ray from the camera off of a point on the object to a point on the environment map. Then shader will then sample the environment map at that point, in order to determine the reflected light color.
I also implement the Loop subdivision algorithm for this project. It is a two-pass algorithm: the first pass creates all the new points and triangles, and the second refines all the old points that were not created during the first pass. It is an approximating algorithm, which means that the existing vertices are modified during subdivision. Boundary and interior edges are handled differently in order to preserve the features of the boundary.
I also use Halfedge data structure and hashmap to increase the subdivision speed and fulfill the 6th iteration of complex model (around 4 million polygons) in under 2 seconds.
1. Object Creation:
1.1 create the pool object by using the .obj data. I tried to use the GLBegin/End and Vertex Array method to create the model. And I am still working on the VBO method and it requires different light model.
1.2 Manully calculate the water surface on the X-Z plane and translate it to the specific position by using gltranslatef/glrotatef/glscalf. Using push and pop matrix to integrate pool and water surface together.
2. Normal Calculation:
2.1 implement the per vertex normal to make sure lighting model works correctly.
3.lighting and material
3.1 use the basic lighting model and material to give the object some realistic look
3.2 I also noticed that the light will change position with camera, I repositioned the light source every source every frame to make it relative static to eye system coodinate system.
4.Computing the heightmap
4.1.base on the water suface x and z coordinates, compute the y coordinate amd draw the animate water surface.