andacode

Code. Design. Code.

Raytracer

ray-tracer test with diffuse and directional lighting

ray-tracer test with diffuse and directional lighting

For my computer graphics class I got to build a ray-tracer from scratch. It is all written in c++, only using the standard libraries. This was one of my favorite projects. It was one of those projects that really solidified my understanding of linear algebra. The simplicity of the math behind the scene makes the beauty of ray-tracers so amazing. Obviously my ray-tracer only allows for simple scenes. It is able to trace multiple light sources, reflection, shadows, and diffuse shaders. In the scene above you can see how the light source is coming from the right and shadows are dropped on objects in the line. Below is an example of the scene input file that the image above used to generate the image.

diffusefile

ray-tracer reflection integrity test

ray-tracer reflection integrity test

The image above is a test to verify the reflection integrity. There are 2 triangle mirrors facing eachother and a blue, red, and yellow ball. All the other visible balls are the result of multiple reflections.

ray-tracer test of reflective curved surface

ray-tracer test of reflective curved surface

The final image is of a test to verify that the reflection works properly on a curved surface.

Next Post

Previous Post

Leave a Reply

© 2021 andacode