I am writing a raytracer which is meant to support shadows. Previously, I have naively implemented hard shadows by casting a shadow ray towards the light (+ offset) and seeing if it hits anything along the way. This worked great, but now I am challenging myself by adding support for dielectrics and transparency in general.
Intuitively, I wanted to make my shadow rays refract if they hit an object on the way to the light. However, it turns out this is pretty difficult to do. I then found this post which explains that I can just ignore refraction for a good enough approximation. Therefore:
- How does the final result change depending on if you refract the shadow ray or not? I am having a hard time trying to visualize it, are there maybe any side by side comparisons?
- The answer also mentions photon mapping. Alternatively, is it not possible to solve for the angle you need to shoot in order to end up at the light after refracting many times? Should this not end up being a linear system of equations? Or do we not do this because it is computationally too intense?
- Are there any heuristics or rules of thumbs for when you should start actually modelling it in a physically realistic way (i.e. refract shadow rays)? Does the number of dielectrics in the scene affect this?
Now, assuming that I do cast a straight shadow ray and beteen a point and the light there is a semi-transparent (50% opaque) purple surface.
- So, half the light should go through. Does that mean I multiply the surface's colour by half the intensity of the light and then shade the area under the surface like I would shade any surface normally? Or do I just set the surface colour to be half the intensity of the light multiplied by purple?
- What happens if I have many surfaces stacked on top of eachother? Say I have 3 purple surfaces all stacked perfectly on top of each other, with a vertical distance between them. The light shines straight down. I'm guessing that the intensity of the light with initial intensity $i$ would be as follows: after the first surface, it is $\frac{i}{2}$, then $\frac{i}{4}$ and lastly the point sees $\frac{i}{8}$ of the original intensity?