Home page: http://www.cse.ucsd.edu/~cliang/cse168/finalprj.html
For this project, I ray-trace ocean surface with ripples and waves.
Note the triangle is placed above the surface on purpose.
This is accomplished with BSP accelerated structure. The sky is rendered in 2D with random noise.The ocean surface is composed of 190*190*2 triangles over a large square. With displacement mapping, each vertex of a triangle is displaced from the surface to simulate bump. The function Turbulence is used to calculate the height at every point. In fact, somehow Turbulence doesn't work well, so the height function is 1- Turbulence after trying many different ones. It works pretty well since it resembles random constructive and destructive sine waves. In addition, it has important features, such as C1 continuous, unlike real noise. To smooth out the edges, I take the average normal of all adjacent triangles. The normal is interpolated within each triangle with the edges the same as the adjacent triangle. Hence, it hides sharp edges even if the triangles are not small.
The Fresnel equation is used to calculate the fraction of light reflected and refracted at the surface of water. It adds more realism since the light intensity attenuates every time it hits a surface. On the left picture, the refracted ray into the ocean will not hit anything. On the contrary, the ocean floor is added such that it appears more blue on the right picture.
Note two triangles are placed above and below the surface .
The picture on the left is rendered with 4x4 subpixel jittering to reduce aliasing and with 2 random diffuse rays at hit point. The right picture is rendered with 5x5 subpixels jittering and 5 random diffuse rays. Each random ray generated must be within the unit sphere and get normalized, or it will be rejected to.