Path Tracer

About Path Tracer:

Path tracer is an algorithm used to render realistic 3D scenes with global illumination. In path tracer, huge number of rays are traced and random paths from the point of intersection towards the light source are computed. Hence, it requires computation of large number of rays, so computationally very expensive. However, it is assumed that each ray path is independent, hence, embarrassingly parallel. So, it makes sense to implement path tracer in CUDA.

Stream compaction:
As per path tracer algorithm, any ray which does not intersect an object will have zero contribution to the final image. Hence, does not require to be traced again. Hence, I used stream compaction in order to reduce the traversal of such  rays with each iterations. Thus, reducing the computation time considerably.

In this post, I am explaining the method used to implement refraction and reflection in the path tracer and some results.

Added the refraction.

I calculated the refraction using the snell's law. Snell's law is the formula that describes the relationship between angle of incidence and refraction, when a ray of light passes from one material to another. The actual science behind it is explained in below image:

Better image, without noise:

I also added Reflection today.


The ray is reflected from the reflective surface at an angle equal to the angle between the incident ray and the normal to the surface. The reflected direction can be calculated using the formula:

Reflected direction = incident - 2.0 * dot(normal, incident) * normal ;

Fresnel: When ray intersects with materials with different transmission coefficient, it either refracts or reflects from the surface. I used russian roullete technique to determine whether the ray should reflect or refract based on the fresnel transmission coefficient.

Fresnel equation is solved using the wikipedia link.

1 comment:

  1. Hi there, I wish for to subscribe for this web site to get hottest updates, therefore where can i do it please assist. craigslist st louis