Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shadow rays through light bending objects

Tags:

raytracing

For raytracing, how should I handle shadow rays (or alternatively, explicit light paths) which pass through a material which bends light? I understand transparent and semi-transparent barriers which don't bend light: I just need to attenuate the light. But if the barrier actually bends the light, the ray in general won't end up at the light source at all.

More generally, an explicit path from the light source to the point will have to follow a different path to account for the bending: a path which will generally change the properties of the incident light (angle, distance traveled, etc.). So do I need to find that path, and if so, how?

One thing I was considering is to force the explicit path to continue to the point where it intersects the light bender, then bend and extend the path with a new explicit ray to the light source (and keep going if it intersects another light-bending boundary). But I can't take an explicit path from a light-bending surface to the light source, because it won't take the bending into account.

I think if there was one refracting surface, I could probably solve a system based on the way it bends light, and find a ray from the light to the surface, and another from the point to the surface, where each ray would bend into the other. But if there are arbitrarily many refracting surfaces, I don't really know which ones it will pass through until I know how it bends through all the others.

like image 403
brianmearns Avatar asked Dec 11 '25 07:12

brianmearns


2 Answers

If you're just doing unidirectional recursive ray tracing starting from the camera, there is no known method for simulating the type of light paths you want to simulate (from light to specular reflection or refraction to a "regular" surface (read "regular" as diffuse or glossy) to the camera).

You'll need to use a technique that includes tracing paths starting from the light source, such as the bi-directional approaches of Bi-directional path tracing or Photon Mapping

Below is an image with caustics generated through photon mapping. If you look closely, you can see that the pool separators cast shadows in the caustics at the bottom of the pool. (I'll generate a better demonstration image and edit it in, but this is the best one I could find with a quick search) Shadows in caustics

like image 106
MikeMx7f Avatar answered Dec 15 '25 05:12

MikeMx7f


In addition to what @MikeMx7f said, what you will actually need to do depends on your particular ray tracing "technique". Note that all following points are grossly over-simplified.

  • When doing straight forward unidirectional whitted-style ray tracing the usual method is to just assume the ray shadowed when it hits an shadow-casting object in between your point of intersection and the light source.

  • When doing (unidirectional) path tracing1 you generally just sample a lot of directions inside the hemisphere from your point of intersection and trace those secondary rays until a certain criteria is met (maximum depth, hit "light source" - that is an emitting material).

  • When doing photon mapping you get the caustics caused by the refractive object through the photons stored all over your scene geometry. That is you collect a certain number of photons in the vicinity in order to approximate the incoming light in the point of intersection. There must be taken special care for specularly reflective surfaces however.

Path Tracing

like image 37
Marcus Borkenhagen Avatar answered Dec 15 '25 04:12

Marcus Borkenhagen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!