Saturday, August 4, 2012

Procedural Textures - Noise


First, some of my results.
Sky shader using Perlin noise.
 I haven't got a name for the pattern yet. This time, Gauss noise is used instead of Perlin Noise.
Same pattern as above image but different color. I just want to know which color of teapot I'd like to buy if there are real ones. Hope you like it too.

Seamless noise texture is still a problem for me. I have tried simplex noise of GLM lib but still met edges on texture boundries.

Wednesday, August 1, 2012

Spherical Harmonics for Diffuse Objects Lighting

I found my ray tracer code is in a mess and redesigned it. I want to write an unbiased path tracer this time and it is not finished yet. 

For a relax, I turn to play with OpenGL and GLSL again. Anyway, it is a much easier way to implement graphics techniques with help of them.

Spherical harmonics approximation is similar with approximating a function in terms of Fourier series but the function is defined over sphere now. When reading about its history, you will meet great mathematicians such as  Pierre Simon de Laplace and Adrien-Marie Legendre again. It also reminds me of discrete cosine transform for image compression. Both the techniques only pick low frequency ( most significant ) parts of data. 

Here are some of my results,

Diffuse teapot lighting by Uffizi Gallery Probe.

 Diffuse*0.8+Mirror Reflectance*0.2 lighting by Uffizi Gallery Probe.

 Diffuse teapot lighting by Grace Cathedral Probe.

  Another diffuse teapot lighting by Grace Cathedral Probe.

References


An Efficient Representation for Irradiance Environment Maps,Siggraph 01, pages 497-500, 
project site:

http://www.cs.berkeley.edu/~ravir/papers/envmap/

A good reading about Spherical Harmonics is at Appendix B of
http://zurich.disneyresearch.com/~wjarosz/publications/dissertation/

and The Orange Book.

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.

Monday, June 25, 2012

Real-time Image-Based Lighting

(Recently I cleared the background to black and uploaded a video. Dec, 2012)
I visited Paul Debevec's website many times and read many of his papers. However, not until recently I started from scratch to implement IBL myself.

OpenGL/GLSL 4.2 and OpenEXR 1.7 is used. Uffizi light probe is downloaded and then transformed to cube-face environment maps using exrenvmap, which is one of the tools inside OpenEXR release.

References