HW #2

Hello everyone.

In this phase, I have implemented bounding volume hierarchy, multisampling and dielectrics with no caustics. My ray tracer, azimuth, now also supports multithreading.

While importing the scene from XML file, azimuth constructs a BVH for each mesh. Then, using these BVHs and other objects such as spheres, it creates another BVH for the scene which is the main BVH used during sampling (i.e. image generation) step.

For the multisampling part, azimuth uses quasi-random sampling and Gaussian filtering (Note that images below are generated with a Gaussian filter with a radius of 1.4 units). In order to make it easier to add new sampling and filtering techniques, I completely separated these two steps. I am not totally sure if that is a good decision in terms of performance. It made it possible to implement multithreaded version without using mutexes but I have to compare both versions to make a final statement.

Lastly, there is a problem with transparent objects. As you can see in images below, METU Tree of Science looks a lot brighter compared to the reference image. However, cornellbox_glass scene does not have such an artifact. It is probably something related to diffuse and specular components of the dielectric material but I could not spot it yet.

Here are the results with their total execution time. Note that the program is compiled in release mode with same flags in HW #1 and culling was disabled:



Single-thread
Multithread(# of threads = 4)
Chinese Dragon
6.628040s
    4.855523s              
Cornellbox Glass
172.932617s
86.783539s
Tree of Science
542.907349s (~9m)
1104.228638s (~18.4 m)

Chinese Dragon(800x800)

Cornellbox Glass(800x800)

METU Tree of Science(1440x720)

 METU Tree of Science, Reference

Thanks for reading.

UPDATE: I have switched off ambient light for cases where a ray hits a dielectric and the ray's origin is inside that dielectric. The result is as follows: 


It definitely looks better now but there is probably another bug which I am not currently aware of and it is not about lighting.

Comments

  1. For METU Science Tree, I had the same problem. I think that you should not calculate/include the contribution of the lights for the rays hitting a point which is inside of the object.

    ReplyDelete
    Replies
    1. Hello Bilal.

      You are right and that is what I changed first. But it seems like there is another problem which I could not figure out yet.

      I have tried switching lights on/off based on its position relative to the dielectric material (i.e. if it is inside or outside) and the material which the ray hits. However, none of those images is exactly the same with the reference image. I updated the post and uploaded the closest one.

      I have even fixed a few other tiny bugs. I am pretty confused right now and really wonder what I am missing. Hopefully, it will show up again during HW #3 and I will fix it then.

      Thanks for your comment.

      Delete
    2. Hi Furkan,

      Are you sure you are disabling all lights (not just the ambient light) for the inside points of a glass object?

      Delete
    3. Hello Mr. Akyuz,

      Diffuse and specular lights are not disabled for the image in the post. However, switching off all the lights does not solve the problem either:

      https://drive.google.com/file/d/1AvBlUTQeoH8W9LLDyWTftloqTH-GEoCh/view?usp=sharing

      (Left: Reference image, Middle: Generated image, Right: Difference between those two)

      When I looked for what is happening in faulty regions, I realized that some lights have to be taken into account in some cases. In order to remove the difference on
      the right, for example, specular lights should be enabled. Similarly, to create the pattern on the root of the tree, we have to add the contribution of ambient light.

      I have review the code line by line but could not notice any error related with this. I have checked epsilon values but they do not change anything significantly. I
      am probably missing something.

      Delete

Post a Comment