Thursday, December 20, 2012

OpenGL Shadow Mapping

I don't have particular interest for Shadow Mapping. Just take it as a chance to learn rendering into framebuffer and multi-pass OpenGL rendering. You can notice in the video there is still shadow acne on the teapot.
1024x1024 depth texture that will be rendered in the first render pass.

Depth buffer of the static buffers(in gDEBugger).

The ground plane is rendered in the second render pass.

Teapot is rendered in the second render pass.

Sunday, November 18, 2012

OpenGL 4 Tessellation for Bézier Patch

gl_TessLevelOuter[] = 1, gl_TessLevelInner[] = 1.
gl_TessLevelOuter[] = 6, gl_TessLevelInner[] = 6.

gl_TessLevelOuter[] = 12, gl_TessLevelInner[] = 12.

gl_TessLevelOuter[] = 36, gl_TessLevelInner[] = 36.

In my last post about OpenGL 4 tessellation I didn't use vertex points as patch control points so there was no change in the geometry. This time I produced a Bézier patch of 16 control points using 2D Gaussian distribution. The result is much funny this time. I checked OpenGL 4 reference page and haven't found anything about tessellation level limitation.

For produce surface from control points, lecture 8 of http://graphics.ucsd.edu/courses/cse167_w06/ will be
a good reference. I also used this course as reference when I was a Computer Graphics TA for senior students.

Monday, October 8, 2012

Bullet Physics Balls Demo



Long time no update. My path tracer become too big for me to finish in short time, especially when I want to add advanced rendering effects. During past one week holiday, I rewrote the ray tracer and integrated it with Bullet physics engine. Here is my first demo with only diffuse pass and hard shadow enabled. 

Thursday, August 9, 2012

OpenGL4.2 Triangle Tessellation

Original triangle mesh.
 Tessellation with gl_TessLevelOuter[0-2]=2, gl_TessLevelInner[0] = 1.
 Render result with one point light source and diffuse pass only. The above two meshes will give same results. A tessellated polygon will produce more polygons and the normal will not change.



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