Sunday, March 25, 2012

Modules of Basic Ray Tracing

Modules 1: Mesh Import. This part is done by CPU
Modules 2: Construct KD-Tree.This module is finished in CPU.
Modules 3: Main part. GPU is responsible for this module. 
Basically each thread is responsible for one ray. 
Step1, Generate rays. 
Step2, find intersections. Kernel functions: 1. KD-Tree search. 2. KD-Restart 3. KD-BackTrack
Step3, calculate colors and reflected refracted rays
Then go to step 2. 

One of the biggest problem is still how to reduce the recursion of module 3. Maybe create a big buffer for every iteration and then add them together. However, this is really memory-consuming. 

Tuesday, March 20, 2012

Computational Finance Presentation

Ray tracing

The ray tracing can be divided into two main sections:
1. Intersection algorithm
2. Trace

Section1:
This section is based on the paper "Real Time KD-Tree Construction on Graphics Hardware".
Input of this section is a triangle list.
When constructing a KD-tree, we should recursively split current node into two parts. The coordinate part is down in CPU and is the BFS of a tree.
The parallelism is exploited as such:
1. compute AABB for triangles in parallel.
2. Split nodes at the same level of a tree in parallel.
3.For larger nodes,  Calculate the bounding box of each node in parallel. Divide triangles in each node into chunks, then all chunks in all nodes are processed parallel.  Finishing the chunk bounding boxes, use the same method to get the bounding box for each node. This process uses the reduction algorithm.
4. For smaller nodes, it is really clever to use bit masks. I such manner, reduction algorithm find its place again.

Section 2:
Apparently, each pixel can be processed parallel. However, a big problem is the recursion in ray tracing. Now, I haven't started to work on this problem.

Problem to be solved:

1.How to import meshes into my program first. Maybe I can import meshed from Maya. 
2. Figure out more details about the KD tree. Like SAH cost, spatial median splitting, empty space maximizing, how to incorporate reduction.

Sunday, March 18, 2012

Whole Picture for Rendering

The work is much more than what I thought. I found some resources for my project.  
1. "Real-Time KD-Tree Construction on Graphics" 
2. "An Efficient GPU-based Approach for Interactive Global Illumination"
3. "Fast GPU Ray Tracing of Dynamic Meshes using Geometry Images"

This project can be divided into two parts: GPU Ray Tracing and GPU Photon Mapping.  I am not confident that I can finish this project finally. But at least I should complete the Ray tracing part. 

1. GPU Ray Tracing
It is responsible for direct illumination of the scene.
Actually, I did a CPU ray tracer last semester. But the effect is not good. There are some artifacts. I am not sure about whether improving my old work or modifying a open source ray tracer. To develop the ray tracing, I plan to combine the 1st paper and the 3rd paper. 

2.GPU Photon Mapping
It is for the global illumination. First, construct the photon map. This part is not difficult. It is similar to the ray tracing and based on "Real-Time KD Tree Construction". The most consuming may be the final gathering process. Because computing the outgoing radiance needs a lot of estimating samples. One paper tries to reduce the number of photons and the effect is good. Unfortunately, I fail to understand the details of this method. So I decide to give up it. 
 
In the following week. I will mainly focus on the Ray tracing part. Hope that I can make a great step.  

Tuesday, March 13, 2012

Proposal for final project


        Ocean Simulation and Render Proposal                   

Yuanhui Chen, Tao Lei

For the CIS565 final project, we are going to take ocean simulation and rendering. Yuanhui Chen, 1st year master student in CGGT,  will mainly work on rendering part. Tao Lei, 1st year master student in EE, will focus on simulation. Fluid animation if popular in games, special effects. However, it is hard to get desired effects due to its computing complexity. So exploring the computing power of GPU becomes an effective solution.

We are going to use Smoothed Particles Hydrodynamics(SPH) method to do the ocean simulation. SPH's drawback over grid-based method is that it requires large number of particles to produce simulation of equivalent resolution. But, since we are using GPU, which is good at dealing with computation intensive tasks, such drawback should be no longer exist. Since SPH method is inherently parallelism, less data dependent, which is perfect to be implement on GPU. Although physically based fluids animation has historically been the domain of high-quality offline rendering due to great computational cost(GPU Gem Chap 30.1 pg633), we are going to simulate it in real-time.

For the rendering part, we will try several methods then determine which one to implement at last. First option is to use marching method to generate isosurface from density field and then use volume rendering to visualize isosurface. The marching method is based on a paper "Using the CPU programmable Geometry Pipeline". It combines the marching cubes and tetrahedra. The second option is photon mapping. Photon mapping is a good choice for add refractions, reflection and global illumination, however it is expensive, especially when we need to change the view frequently.

We also plan to add interactions:interaction between ocean and coast, interaction between water and floating objects. We refer "Animating the Interplay Between Rigid Bodies and Fluid". It developments the SPH model by adding rigid body forces and enforcing rigid body motion. We will also take the wind effects into consideration.


Although this project is ocean simulation and rendering, we are not going to confine our work in ocean. We may also cover cloud and terrain simulation and rendering in our work to make our picture rich and full.

Video: