Sign in to follow this  

Path Tracing: Direct Lighting + Indirect Lighting for Caustics

This topic is 1969 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have written a path tracer in OpenCL. It works great, but it's slow to converge, particularly for small lights. From some research, I understand that this can be rectified by explicit light sampling ("Direct lighting method") by sampling light sources. Evidently, the energy at a point is the direct lighting plus the indirect lighting.

Consider a completely transparent object with refractive index identical to air (i.e., effectively invisible). For example, imagine the Cornell box with a small sphere made of this material in the middle. Intuitively, rays passing through the sphere are not refracted or attenuated; the sphere poses no obstacle whatsoever to rays bouncing around the box, so it should look as if it is not even there.

However, with the model of illumination being the direct lighting plus the indirect lighting, there's a problem. For a point on the floor under the sphere, there is no direct illumination, because a shadow ray is blocked by the sphere. Consequently, there is not enough light: the invisible sphere casts a shadow!

I don't know how the direct + indirect lighting model is supposed to work around this?

Thanks,
-G

Share this post


Link to post
Share on other sites
It depends on what your light sources are. Are they physical, e.g. have an area, or are they omni point lights? If they are point lights, I see only one solution so far: once you've cast your direct sampling ray to the light source, you walk along it and see if the ray gets deflected somewhere (either it hits something, or gets refracted away, etc...). Doing this you will trace your ray through the sphere and correctly identify that the sphere poses no obstacle to the ray, so the direct sampling path still counts. Of course, this sucks in terms of speed and possibly floating-point accuracy. So basically, a more elaborate version of a shadow ray.

However, if you have area lights, and I also suspect you do since you mention "small lights", then you might be using the wrong model, because it would seem that any semitransparent media (e.g. glass, water) would fail horribly. However, if they don't, and you are able to generate caustics nicely, then you can simply view the "transparent object with refractive index identical to air" as producing a degenerate caustic exactly the size of the hypothetical "shadow", but which does not show any change in brightness (so effectively, no difference). An unfortunate "special case", in other words. If that makes sense.

Of course, the obvious solution is to preprocess your scene and delete invisible objects... I mean, why have them there if they are going to be invisible?

Share this post


Link to post
Share on other sites
[quote name='Bacterius']However, if you have area lights, and I also suspect you do since you mention "small lights", then you might be using the wrong model, because it would seem that any semitransparent media (e.g. glass, water) would fail horribly.[/quote]Direct light sampling does work with caustics somehow. The adaptation of the SmallPT code [url="http://www.kevinbeason.com/smallpt/explicit.cpp"]http://www.kevinbeason.com/smallpt/explicit.cpp[/url] does so. I'm just not sure what they're doing exactly; their RNG is all mixed up with ray generation.[quote name='Bacterius']However, if they don't, and you are able to generate caustics nicely, then you can simply view the "transparent object with refractive index identical to air" as producing a degenerate caustic exactly the size of the hypothetical "shadow", but which does not show any change in brightness (so effectively, no difference). An unfortunate "special case", in other words. If that makes sense.[/quote]Precisely. I've done this with rasterization using shadowmaps and causticmaps.[quote name='Bacterius']Of course, the obvious solution is to preprocess your scene and delete invisible objects... I mean, why have them there if they are going to be invisible?[/quote]Naturally. I'm running this example as a test.
Thanks,

Share this post


Link to post
Share on other sites

This topic is 1969 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this