# Is there a way to do sphere caustics analytically?

I have a Shadertoy which renders the image below using ray tracing.

I'd like to add caustics, but am aware that in general they are a hard solution, especially without bidirectional ray tracing or photon mapping.

Does anyone know if there is a way to analytically calculate caustics, or at least some of the caustics (or plausible caustic effects) in a situation like this?

There is refraction going on here, not just transparency, in case that makes a difference.

• Just thinking out loud, it may be possible to use some equations for spherical lenses and treat it like calculating defocus blur. The caustic brightness would go like $1/r^2$ of the circle of confusion, or something like that. – Nathan Reed Jan 12 '17 at 22:04
• That sounds really promising. I like how that seems like it could be exact for spheres, whereas the answer about using surface normal and refractive index would be decent approximations for general shapes. – Alan Wolfe Jan 12 '17 at 22:40

## 1 Answer

You might find this paper useful—its authors describe a way to make reasonably plausible caustic effects just by modulating their shadows with the surface normal and refractive index. It won’t get you the more complex/interesting hot-spot shapes that you’d get with photon mapping, but it could work well depending on your scene.

To extend stochastic shadow maps to mimic caustics, we decrease shadowing where light strikes a transmissive surface at normal incidence. We increase shadowing where the refractor is at a glancing angle and thus has a low Fresnel transmission factor. Specifically, during shadow map rendering, we increase ρ(λ) where the magnitude of the dot product of the surface normal nˆ and the vector to the light ωˆi is close to 1, and decrease ρ(λ) where the dot product is close to zero. We also increase this effect with the relative refractive index η.