Sunday, September 30, 2012

Am I Done??? Not Yet ...

Final Images
 Scene with reflections, refraction, anti-aliasing, transparent shadows

Simple Scene showing specular reflection

Progress so far:
  • The transmittance and reflectivity seen above are calculated using Fresnel's equations.
  • Have implemented supersampled antialiasing, but it is done sequentially. It is done using 4 jittered samples in addition to the normal ray. The normal ray is given more weightage over the jittered points. The image below shows the

  • Also implemented light going through transparent objects, so that the shadows aren't black but get the get of the transparent object. Below you can see this on the image up front, the shadow has a yellow tinge to it.

Next Steps (Will try to implement this when I tranform this to the Path Tracer):
  • Still have to do area lights. There's smething wrong with the way I am transferring data; have to look more into this.
  • Obj File loader
  • Area Lights

Friday, September 28, 2012

Reflection and Refraction

Progress so far:
  • Was able to achieve reflection as well as refraction in the scene.
  • Refraction is based on Snell's law and have also written code for internal reflection if the incident angle is greater than the critical angle while calculating refraction.
  • I am calling kernel function based on the number of rays in the next iteration. So number of threads keep on decreasing (unless there are too many reflecting surfaces) after each trace level. But I am going to the CPU to compact the rays. My goal, maybe later, will be to implement stream compaction so that the data can be reduced in the GPU itself without moving to the CPU.
Refection and Refraction.
Refractive Index = 2.2

Refection and Refraction.
Refractive Index = 1.3
I haven't yet handled shadows for transparent objects. As ssen in the above image, the shadows for transparant objects are same as those of solid objects. Will handle that soon.

Next Steps:
  • Try out anti-aliasing to smoothen out the image
  • Area lights
  • Depth of field
  • Obj Loader, if time permits
  • Stream Compaction (before changing it to a Path Tracer)

Thursday, September 27, 2012

Diffuse and Specular Shading

Progress so far:

Diffuse as well as specular shading is now visible with the ray tracer. Below are images showing the same.

Diffuse Shading

Diffuse and specular shading

Next steps:
  • Reflection
  • Refraction
  • Ray bundles to be sent out to GPU

Flat Shading

Progress so far:
  • Have grouped rays together and calling into cuda kernels for the rays array instead of by pixels. Have written code to handle both reflections as well as refractions. So each ray may generate 2 rays if it a transparent reflecting object. Currently I am organizing the threads by going to the CPU and going back to the GPU.
  • Have written code for light feelers which gives out flat shading for the objects in the scene. Below is the image for the same scene as previously shown, with flat shading enabled.

Next Steps:
  • Diffuse shading
  • Specular shading
  • Reflection
  • Refraction
  • Handle just pure reflection or pure refraction directly on the GPU without going back to the CPU.

Tuesday, September 25, 2012

Ray Casting

I started with ray casting of the scene from the camera. Ray casting is a process of shooting rays into the scene to find the first intersection of the rays. The rays are created from the camera and the direction is determined by the pixel the ray is passing through. The rays are then checked for intersection with the scene objects. The material attached to the object is considered as the pixel color. Below is an image (800x800) for 3 spheres in a Cornell box. As you can see from the image, it looks very flat as there were no rays sent out for shadow feelers (to determine light reaching a point) nor were recursive rays sent out within the scene for reflection or transmission.
The ray casting is parallely performed for each pixel of the image and so it is pretty fast.

Next Steps:
  • Figure out how recursion will work on the GPU
  • Call kernel functions for reflected and refracted rays

Friday, September 21, 2012


I am working on a Ray Tracer using CUDA as part of my GPU course at UPenn. This page will be used to show my progress. The goal is to render scenes using a simple ray tracer on the GPU.

I am primarily using the GeForce GT 650M card with 384 Cuda cores. Specifications can be found here.

In this project, base code has been given for:
  • Loading, reading, and storing the TAKUA (a renderer created by the TA for the course) scene description format
  • Example functions that can run on both the CPU and GPU for generating random numbers, spherical intersection testing, and surface point sampling on cubes
  • A class for handling image operations and saving images
  • Working code for CUDA-GL interop

The following features have to be implemented:
  • Raycasting from a camera into a scene through a pixel grid
  • Phong lighting for one point light source
  • Diffuse lambertian surfaces
  • Raytraced shadows
  • Cube intersection testing
  • Sphere surface point sampling

At least 2 of the following features also need to be implemented:
  • Specular reflection
  • Soft shadows and area lights
  • Texture mapping
  • Bump mapping
  • Depth of field
  • Supersampled antialiasing
  • Refraction, i.e. glass
  • OBJ Mesh loading and rendering
  • Interactive camera