Thursday, October 31, 2013


This photo is a macro shot of my backgammon board, with some post processing in Photoshop in order to make the colors more bold. 

Red Face

This is a portrait I took of a girl in front of a black background. Afterward I cranked up the gamma value to distort the color of her face. I then used the spot healing tool to eliminate the bright highlights in order to achieve a very "flat" look.


This photo was taken in the cactus garden on Stanford campus. I took the photo using a sepia filter while in macro mode. The end result is a nicely balanced image with a gecko stealthily camouflaging itself on the right and a moderate bokeh effect on the left. 

Alien Tree

This is a photo of a dead tree located at the Stanford Foothills. In photoshop I decided to heavily manipulate the colors so that the end result looks like an eerie desolate wasteland.

Glimmering Pool

This is a photo I took of a fountain on the Stanford campus. By making the rest of the photo black and white, the rainbow effect in the pool really stands out. In the original color photo, this would have been overlooked by most observers.

More Flowers

I decided to take a macro shot of some flowers on the Stanford campus. In the background there is a nice bokeh effect noticeable mostly on the street lamps. Afterwards, I made most of the image black and white in photoshop in order to really bring out the flowers in the foreground.

Black Flower

For this photo, I lit the scene using just a red LED light in an otherwise dark room. As a result, the other wise white flowers and green leaves turn red and black respectively, giving an eerie other-worldly feel to the image. No post-processing effects were included.

Wednesday, October 30, 2013

Matrix Transformations

I've implemented a matrix stack to my program that allows me a much higher degree of freedom to render cool scenes than I did before. For example, before the camera was fixed at the origin looking down the z-axis, but now the camera can be located anywhere in the scene and oriented in any direction.

In the two renderings below, the camera has been translated upward and rotated down to give a sort of bird's eye view of the scene. Several of FancyRay's other features can be scene in this rendering as well including global illumination & caustics, depth of field, soft shadows with a shadow photon optimization, texture mapping and textures using Perlin Noise.

Stay tuned for more effects with matrices...

Monday, October 28, 2013

Depth of Field and Autofocusing

Here are some images of the cool depth of field effects FancyRay can achieve by means of its realistic camera set up. FancyRay is also capable of autofocusing its camera with user provided autofocus zones so that the parts of the scene you want in focus will automatically be in focus.

In this first rendering, the globe in the foreground is in focus.

In this second rendering, the mirror ball in the mid-ground is in focus.

In this third rendering, the film is at the hyperfocal distance and is therefore focused on infinity. Thus, all objects beyond a given point (starting from the marble ball) appear in sharp focus.

Sunday, October 13, 2013

Motion Blur

I just finished adding motion blur to my renderer. As you can see in this example image, the 15 billiard ball can be seen blurred as it falls towards the floor. So far FancyRay can only handle motion blur of objects moving in a linear path but hopefully I'll get around to also including the ability to make objects move in more unusual directions.

This scene was also rendered with full global illumination, a frosted mirror ceiling and a wooden floor.

Thursday, October 10, 2013

Putting it all together

Here's an example rendering that combines my newly implemented perlin noise with global illumination, caustics, soft shadows/area lighting and texture mapping.

And just for fun here's the same image rendered using my fisheye lens settings. As mentioned in an earlier posting, FancyRay is capable of fisheye, wide angle, telephoto and DGauss lens settings.

Perlin Noise

I'm currently in the midst of writing a 3D PerlinNoise generator class in order to add cool procedurally based textures like marble or wood to my objects. What is cool about 3D Perlin Noise is that it can be applied arbitrarily to any mesh of any size without having to worry about UV coordinates and warping.

Here's an example image of what I am talking about. I calculated a marble noise texture to every object in my scene.

Monday, October 7, 2013

Shadow Photon Optimization

Originally, I was doing my shadow calculations the "traditional" way by sending shadow rays from the intersection point to the light source to see if they were obstructed. However, sending shadow rays can be an expensive process and so one alternative technique to use is shadow photons.

In the first step of this algorithm, shadow and illumination photons are traced through the scene. Illumination photons are stored at a photons first interaction with a surface and shadow photons are found by continuously tracing the photon in the same direction and storing it at its interactions with subsequent surfaces. 

In the second step of the algorithm, at each intersection point, both shadow photons and illumination photons are gathered in the same way "regular" photons are for global illumination calculations. Once they are gathered, there are 3 outcomes:

1) Shadow photons but no illumination photons. Area is completely in shadow so skip direct lighting calculation. No shadow rays necessary

2) Illumination photons but no shadow photons. Area is completely illuminated so calculate radiance. No shadow rays necessary. 

3) Both shadow and illumination photons present. Hit point is at a shadow boundary/in the penumbra. Send a shadow ray to determine if it is lit or not.

Below is an example rendering with my new shadow algorithm with 64 samples per pixel. The quality of the shadows is on par with my previous shadows with only using half as many samples (before I had 16 pixel samples * 8 light samples).

Texture Mapping

My next feature was implementing diffuse texture mapping. In this image, in addition to the mirror and glass spheres, we see a diffuse billiard ball (although it should be partially specular) and a diffuse earth. The texture mapping fits in mostly well with the global illumination except for a weird artifact where the right side of the ceiling has a large square section that is a separate color then the rest of the ceiling. I am currently looking into why this might be an issue.

Stay tuned for my shadow photon optimization coming next...

Sunday, October 6, 2013

Global Illumination & Caustics

I've finished my photon mapping algorithm to include diffuse inter-reflection (i.e. color bleed) and caustics (bright spots caused by the focusing of light by dielectric materials - in this case glass).

350,000 photons were emitted for both the global and caustic photon maps with each having a search radius of 1.0 and 0.1 respectively. 16 samples per pixel were used with 8 light samples used per intersection to calculate soft shadows.

Rendering time for this image was approximately 50 minutes. This can definitely be improved by further optimizing my code. Currently the image appears slightly grainy because I am not using enough samples. However, once I further optimize my code, I'll be able to up the sample count without drastically increasing the render time.

Lastly there is still some speckling on the ceiling and glass sphere that I need to take care of.