Concept Summary

Since we are fans of the popular game "Plants vs. Zombies", we want to create a 3D scenario of this game. We introduce a peashooter model, a zombie model and a grass model as our main parts. These three parts have more than 65000 triangles and take us about 5 hours to render a high resolution image on AMD 2600.
Moreover, the bullet represented by a sphere is motion blurred. We add a pond-like material to the ground so that the final image is more realistic. Additionally, we add pervasive fog because we want to express a dangerous atmosphere. 

Scene Building

We use Blender as our modeling tool. The peashooter, zombie and grass .obj files are downloaded from 3rd party websites. The bullet is modeled as a sphere that is directly added. An infinite plane is added as our ground. One perspective camera and spot light are used.
We split peashooter and zombie models into different subparts with different materials. In the final image we use following materials and textures:
- Several basic lambertian materials
- Combine material (Lambertian + Phong)
- Bump map ground with mirror material and water image texture.

By the way, since Blender coordinate system is not the same as our ray tracer coordinate system, we override the construct function of cameras and light sources so that we are able to directly set viewpoints and illumination directions in our code.

Motion Blur

Motion blur is used in the bullet flying effect. We add a member function motionChanges() to the class Primitive. In this way, every solid can have its own moving trajectory. In case of our scenario, a simple translation matrix is added as a parameter to the bullet sphere object.
P.S. In renderer.cpp we created two functions, one render_all_motion() is based on the ray moving so that the whole scenario is blurred, while the other function render_motion() takes care of each solid individually.

Bump Mapper

We want to creat a pond-like ground. This means we need one smooth water image texture as the perturbation. With the help of mirror material, it looks like water wave surface. We have implemented a triangle-based bump map solid in the practical assignment, while in this competition a infinite plane based bump map is finished by us.

Heterogenous Fog

In order to create a horrific atmosphere, we use volume rendering to build a pervasive heterogenous fog. This heterogenous feature is done by adding perlin noise to the attenuation factor and using ray marching along the primary and shadow rays. The code is implemented in fogtrace.cpp and this effect is really time consuming.

Additional Features

- Super sampling creates soft shadows and anti-aliasing (20 samples per pixel)
- BVH accelerates rendering procedure

References

- [1] Peashooter Model
- [2] Zombie model
- [3] Grass model
- [4] Water image texture
- [5] Webpage template