top of page

Assignment 3 -

Indoor Candle Scene

​

This assignment involves rendering a realistic image of an object or scene of our own choosing. 

 

The main point for the final project is to be creative, and so we did some exploring online for models to use. We decided to render this Indoor candle scene because it offers us freedom of applying different materials to different objects, and we also like the design of the scene a lot. 

​

Overview

Our ray tracer implements the following techniques:

  • HDR environment mapping

  • Depth of field

  • Procedural textures/Perline noise

  • Bounding Volume Hierarchy

  • Monte Carlo Path Tracing

  • Multiple rays

  • Distributed Ray Tracing

  • Area lights (soft shadows)

  • Glossy reflection/refraction

  • Tone-mapping (Bloom algorithm)

  • Texture mapping​

​

​

Depth of Field

Since we do not have much time for the final project, for the second advanced rendering algorithm we decide to implement Depth of field. However, even if we had more time on the final project, having depth of field implemented is still our first priorities because it could significantly improve the immersive experience and in real world not everything is supposed to perfect.

​

​

Unfortunately, not all of these are used in the final image because we do not have enough time to render with all of them turned on.  However, we kept some images when we were testing each part separately. 

​

​

Modeling

We encountered an issue when we first tried to render all the candles and other models in the scene. Our object loader was not working properly.

​

The problem with our object loader is it requires all the faces to be triangles, and the models we found online are mostly quad faces. Then we found an online object loader which generates triangles from these quad faces, and also organizes the triangles into groups that we can set materials for.

​

Basically, instead of one TriangleMesh with all the triangles, in this scene we basically have 103 TriangleMeshes, each of which can be given a different material.

​

In order to test which index refers to which object in the scene, we have rendered a rainbow image. In this image, the first couple of TriangleMeshes (1~50) are red-yellow-green in color, while the last few TriangleMeshes are blue-purple-red in color (50~103). Then we tested each index one at a time to figure out which one is corresponding to which.

​

Monte Carlo path tracing

​

​

​​

​

​

In normal raytracing, we usually think in a way that all light is focused through a small point on a pixel and onto the image plane. To add depth of field effects, we simply think as replacing the point camera with a lens. In this project, we don't hactually use a real lens and calculate the focal length from the properties of the glass. Instead, we choose our focal length and make the "lens" adjust to us.

​

Our first approach was to pick a random point on the aperture by randomly choose a point in the pixel, and offset the ray’s origin by aperture offset. Then we use the idea of the Monte Carlo method, instead of picking a random point in a square, we generate a random point within a circle uniformly.  By picking a uniformly random angle in the interval 0 to 2π, and narrow down our aperture radius R, we would end up with more points towards the center.

​

Glossy reflections and refractions

Many real materials are imperfect reflectors, where the reflections are blurred to various degrees due to surface roughness that scatters the incident radiance.  In this project, we implemented glossy reflections by randomizing the direction of the outgoing ray according to the Phong model. Instead of reflecting only light from the reflected ray direction, the Phong model takes the average over multiple ray directions biased in the direction of the reflected ray. The result is a blurred, imperfect reflection.

​

​

Procedural textures and Perline Noise

Procedural textures are subset of textures. The advantage of using procedural texture is that we can represent a lot more details without using a lot of storage since the image is not fully described. Actually some formulas allow for infinite level of details, something that an hand drawing artist even full-time cannot achieve.

​

In this project we implemented basic implementation of turbulent texture

The basic idea of this texture is that we can easily add details to the basic noise, by combining several versions of it at different resolutions.

​

The image on the right show a simple version of turbulent texture with adding some perline noises.  We also created stained glass effect (the part inside the frame) using the simialr approach. 

​

We also tried different focal depth and aperture values in order to test different effects. The image above shows a result of setting a focal depth that is very close to the eye.

Thanks for viewing the website and hope you enjoyed looking at the images we generated.

Area lights (Soft shadows)

Ray tracing with point light sources produces perfect shadows with sharp edges, but in the real world we do not have infinitesimally small light sources. Instead, we see shadows with soft edges because physical light sources emit light from an area. Instead of lighting every point in the scene as binary lit or obscured, we need to model scene points that are partially obscured from the light sources. This requires an integration of the visibility and irradiance over the area of the light source. With Monte Carlo path tracing, this can be achieved by averaging over multiple direct light samples that connect the hit point to a random point on the light source. In the candle scene, the fires on the candles are treated as area lights.

Texture Mapping

In order to render a picture inside the picture frame, we needed to handle texture mapping, which required loading an image file (.png) into code and mapping the pixel values of the image to the corresponding texture coordinates given in the model of the scene (.obj file). Since our renderer is based on triangle meshes, the texture coordinates have to be interpolated from barycentric coordinates (similar to the way the normal vectors are interpolated using barycentric smoothing). With this computation, all that's left is to scale these texture coordinates to the size of the image to identify which pixel to render in the scene point.

With plain ray tracing (left), surfaces are perfectly reflective and a lot of indirect lighting is omitted. With path tracing (right), we get more realistic surface materials because we are able to model glossy reflection and indirect lighting.

© 2023 by Name of Site. Proudly created with Wix.com

  • Facebook Social Icon
  • Twitter Social Icon
  • Google+ Social Icon
bottom of page