Monday, July 16, 2012

Ray Tracing Update 2

Except sphere and plane, triangle is supported now. After rely on OpenCL doing transformations like MVP and VP so long, I did it myself this time. When wrote the obj loader, I met strange problem with ftell/fseek, fgetpos/fsetpos pairs, still don't know why it failed to restore last file indicator position. The obj loader should be more flexible.
Ambient Occlusion pass.
512 rays were used but still noise. I also tried to load the model into Maya and did rendering using mental ray. The result is much much better. OK, my ray tracer is still in its baby age.
Refraction.
RI is 1.33 ( 20 °C Water ).
Refraction.
RI is 1.50( 20 °C Benzene ).
To be frankly,the result is not pleasing. There is no absorbing, no subsurface scattering and refraction rays should result a lighten shadow, etc. The good thing is I know where I need improvement once more. 

Wednesday, July 11, 2012

Ray Tracing Update

  Specular reflection is added and the ray tracing depth is 2. 
The above image after diffuse reflection was removed. To see the other effects clear, I have adjust the image using OpenCV APIs. All the pixels is of 32 bit float format when rendering and transformed to be a RGB image with 8 bit per channel.
 Shadow rays is added. Two light sources.
 Diffuse reflection is removed.
 Soft shadow is supported. 16x16 shadow rays were emitted when rendering the soft shadow.
Diffuse reflection is removed.

I also implemented pixel multisampling. All the original images are rendering in 1080P but after I downsampled them to be half HD, the zigzag border became not obvious.

Tuesday, July 3, 2012

Ray Tracing Step One


Finally, I made the first move. Before this I have read many lecture notes, SIGGRAPH course papers. It is just my way, "Theory before Practice". I used GLM for mathematics and OpenCV to store pixel values and manage the window.
The first image is without shading, just return the color of the spheres. In the second image, diffuse pass is added. One ray for one pixel.