CSE 168
Rendering the sun at early morning

In my final project, I want to render a sun rising from the mountain. The reason I want to render the mountain is because no one in UCSD rendering competition has dealt with it before. Therefore, I want to try something new and unique. Although my final image is different from my image proposal, they are of the same type that I had thought about.

Here is the picture that I want to render:

Techniques implemented:

+ Atmosphere scattering
+ Bump mapping
+ Procedural texture
+ Lens Flare
+ Environment mapping

Modeling mountain:

I used Bryce for rendering the mountain. The model rendered by software is pretty good and I have a lot of control on the shape of my mountain. The only thing that I�m not satisfied is when exported to the object file, it can only export to 60,000 triangles without reducing the shape of the mountain. What I expected for my model is from 500,000 to 1 million triangles.

Sky dome

Two sky domes rendered by changing only one parameter.

I model the sky dome using atmosphere scattering & ray marching instead of using texture although a simple 2D texture could provide a good model. The weakness of the latter is that it can only produce one sky texture and user does not have a control on the color of the sky. Using the former method, I could create sky dome at different time in a day just by choosing the direction of the light of choosing the property of particles in the atmosphere. The second reason is that atmosphere scattering can also be used for creating fog or cloud.
I follow the �Display Method of the Sky Color Taking into Account Multiple Scattering� by Tomoyuki Nishita published in 1993 to create my sky dome. I divided the sky dome into my regions and pre-calculated light at those regions. I then interpolated the value from these regions to get my sky dome color.

Here are the colors of my sky dome by just varying one parameter from the property of air particles.

Glow from the sun

The sun scatters in the atmosphere and provides light for the sky. I model the glow by exponential function. It�s simply the power of the distance of a pixel to the center of the sun.

Brightness = powf(distance from pixel to the sun�s center, 100);

Lens Flare

To mimic lens flare, I created 100 random rays shot from the center of the sun. The thickness of these rays is 5 pixels. Pixels near the boundary of the rays receive less energy than pixels in the middle. Brightness from pixels is then interpolated to create smooth region.

Combined together:
Bump mapping

Bump mapping was at first used create the roughness of the mountain surface. I later on discovered that it�s also useful for making the terrain. I don�t want to go into details of bump mapping. If you�re interested in learning about bump mapping, here�s a good tutorial to start

If the normal vector changes too much from its original vector, I set the terrain to be land. Otherwise it�s set to be snow. The choice of surface also depends on its surface.

The texture for bump mapping is randomly generated using Perlin noise.

What I could probably missed

* Photon mapping: I don�t want to use the photon mapping because it�s not really useful and efficient for my image. The space for landscape is very enormous and therefore, photon mapping doesn�t help too much in this situation.

So how can I do the indirect illumination? I estimate the shadow region based on many factors and gives assume that it receives a fraction of light power (about 0.5-0.8).

* Fog: I have tried to add fog into my picture (may be my fog is not good enough) but I�m not satisfied with the new image. The fog is useful and obvious if the viewer stands at a distance pretty far away from the objects while my camera is set to be very close to the mountain. I have looked at some images rendered by Terragen and the fog is used only when the mountain is far away.

Code from others

I code the whole project by myself except:

+ Miro base code
+ 3D loader code for loading objects from 3ds files by Andrea Ingegneri. This code is for loading objects only.


These are the gentlemen without them I could not complete this project ;-)

Professor Henrik

TA Wojciech

Thank you for reading this.