Sunday, December 15, 2013

Spectral Rendering Part II - UV Lighting and Fluorescence

My latest feature for FancyRay was the introduction of Fluorescent materials.  Fluorescent materials work by first absorbing the incoming frequencies of light at varying degrees based on its unique wavelength absorption function, and then modulates the absorbed frequencies by a predetermined mapping function from absorbed -> emitted. This mapping function, shifts the wavelengths towards higher values and modulates their intensities.


Scene rendered using normal daylight spectrum (CIE Standard Illuminant D65)


And here is the scene again rendered using a Black Light spectral power distribution


Thursday, December 12, 2013

Aperture Shape and Bokeh

Up until now the default aperture shape has been a simple disk, however now the aperture shape can be directly changed by the user. Some examples of possible shapes include triangle, diamond, pentagon and other higher order polynomials.

The main effect of this is that out of focus highlights in the scene will take on the shape of the aperture. This effect is known as "bokeh."

Here are some images demonstrating the effect.

Here is a heavily out of focus image with a triangular aperture. Notice the highlights on the bubble and the ball in the background appear triangular.


And here is the same scene with a diamond shaped aperture




Sunday, December 1, 2013

Filtering

This is a simple extension to FancyRay which allows the user to add in different filter types to the final image rendering. Here are some filters applied to a Cornell Box with two bubbles.

Original


     GrayScale

Sepia

Negative

Wednesday, November 27, 2013

Spectral Rendering and Iridescence Through Thin Film Interference

I really wanted to include iridescence as a feature for FancyRay and so in order to do that I had to include spectral rendering, which is where instead of using the conventional RGB model, light is treated as a combination of electromagnetic radiation at various wavelengths and intensities. Each wavelength of light interacts with the iridescent surface and depending on the thickness of the surface and the angle of view, the outgoing wavelength differs due to interference with other wavelengths.  The outgoing wavelengths are then converted to their XYZ tri-stimulus values using the CIE color matching functions and then finally the XYZ tri-stimulus values are converted using a matrix transformation into their RGB values in order to be displayed on the screen. The result is a nice rainbow effect. However, to avoid banding, Perlin Noise is used to get varying widths for the surface.

Below is a completed example of my iridescent bubble shader.



The image below is a semi-finished prototype. You can see the iridescence in place but the Fresnel term and specular highlight and refraction have not yet been added.





Thursday, October 31, 2013

Backgammon


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.




Gecko


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.


Thursday, July 18, 2013

FancyRay


These are some screenshots from the rendering engine I am building that I've decided to call FancyRay. Although currently incomplete, I've made some decent progress thus far.



FancyRay Part 1-Basic Direct Illumination with Point Lights
For this first prototype image, you can see specular and glossy reflections as well as transparency with Fresnel effects on the glass ball. All objects were rendered using a Cook-Torrance BRDF model. The speckling is due to a minor bug in my code for glossy reflection. Rays were cast using a two-dimensional Halton Sequence algorithm for low-discrepancy pixel samples.


FancyRay Part 2 - FishEye
FancyRay is built with a realistic camera lens simulation that allows for different lens effects. Here we see the same scene as above but rendered with a fisheye lens.



FancyRay Part 3 - Telephoto
In addition to the fisheye lens setup, FancyRay comes equipped with a telephoto lens option that allows you to zoom in really close on the objects in your scene.

FancyRay Part 4 - Soft Shadows and Area Lighting
Here we see soft shadows created by the use of a circular area light on the ceiling. This image was rendered with 32 samples per pixel by 32 samples per light.

FancyRay Part 5 - Photon Mapping
Although currently incomplete, FancyRay will be able to simulate global illumination using photon mapping. In this image here you can see the photons in the photon map rendered directly which gives a sense of what the final indirect illumination will look like.

To be continued...


Wednesday, July 17, 2013

Bioluminescence

For a class project, my partner, Forrest Browning, and I extended the PBRT rendering software program to include volumetric photon mapping in order to simulate the effects of bioluminescence. The fish model was also created by us using Maya.