Tuesday, January 6, 2015

Raytracing Part 1

This post shows the progress for an assignment I'm currently creating for a university course. It's about creating a raytracer starting from scratch. I chose to implement it using SharpDX. I first started by creating a standard renderer, which draws triangles on the GPU using DirectX. After I could load in simple objects and draw them on the screen, I created a basic raytracer.

First I had to convert the loaded models in SharpDX to triangles I could actually use to trace. After some work I finally got some results and started taking screenshots. Hence the result so far in graphical representation:

The model drawn with the basic effect

Silhouette by raytracing the boundary. The gray area is the bounding sphere (which is a little off scale).

Material loading, getting the 'correct' colors for the car. The light color interfered here, thats why the colors are still a little off.

I forgot to order the triangles by depth! What a mess..

After ordering the triangles

Blinn-phong shading.

More lights! Shadows!

Soft shading, taking the average of three normals for each point on a triangle.

Our car is back! However some normals are still incorrect, you can see headlights missing.

Soft Shadows! Sending 20 rays from every point to the lightsource to see if we have shadow. The correct normals have been put in.

Blinn-Phong shading back in the picture. The car looks really metallic now:

There are still some strange 'light artifacts' on the floor and the car window. More updates will be in the next post.

No comments:

Post a Comment