Thursday, September 27, 2012

CUDA GPU Ray Tracer

This is a course project for CIS 565.
  •  Ray Tracing

Basic Algorithm: For each pixel, shoot a ray into the scene. Check intersections for the ray. If  intersection happens, cast a shadow ray to light source to see if the light source is visible and shade the current puxel accordingly. If the surface is diffuse, the ray will stop there. If it is reflective, shoot a new ray reflected across the normal from teh incident ray. And repeat over until reached the tracing depth or the ray hits a light or diffuse surface.

Folowing is a picture demonstrates how ray tracing algorithm works.(grab from wikipedia)

 Since CUDA does not support recursion, we need to use Iterative Ray-tracing.
Useful link: http://en.wikipedia.org/wiki/Ray_tracing_%28graphics%29
  • Box-ray intersection
I use slab method to check box-ray intersection.
Useful link: http://www.siggraph.org/education/materials/HyperGraph/raytrace/rtinter3.htm
  • Sphere surface point sampling
I used spherical coordinates for sphere surface point sampling.
Useful link: Wolfrat Math World: http://mathworld.wolfram.com/SpherePointPicking.html

No comments:

Post a Comment