Ray Tracing Part III

In this part, I will implement firstly transformations. Then, I will implement instancing, multisampling and distribution ray tracing.
Let's start with transformations.
In this part, after I read the transformations ,there is two different option.First one is transforming vertices of objects. Second option is transforming rays. For second option we should use inverse matrix of transform matrix. I used second option. I created transormation matrix. I started with unit matrix and I multiplied each transform matrix in order.
To test this transform I used simple transform scene. I created three different gif. They shows rotation scaling and translations.





Transform examples


Now, I will show instancing and motion blur. Instancing helps us to reduce memory usage. When the same object exist with different transformations and materials in a scene, we don't need to store points again. We can use its data jointly.
Motion blur shows us dynamic objects in one frame. Objects which have motion blur, look like they are moving in motion direction.
cornellbox_boxes_dynamic example contains motion blur intancing and transformations.




In previous parts, we had mirrors. They were perfect mirrors. In this part, we have imperfect mirrors. To do that effect we have roughness variable in mirrors. This variable shows that how much this mirror has imperfection. For this example we have cornellbox_brushed_metal example.





This an another example for transformation roughness and mesh instance.
metal_glass_plates

Last topic is depth of field. In this topic,We will apply lens logic in this regard. When we focus on fixed position in real life, we clearly see these positions, but other points are blurred. To show depth of field we have spheres_dof example.






Last example is smooth shading. Without smooth shading it looks like :
Flat shading


It is flat shading. In flat shading we use triangles normals. Therefore it doesn't look smooth. To give smoothness we should use vertex normal. Then we can interpolate them and we can have smooth shapes
Smooth shading

In this part, I showed wrong results.










Yorumlar