Skip to content

Procedural Caustics

Procedural Caustics!

Procedural caustics is an ongoing topic within the CG community. There have been many more and less sucessfull aproaches. Recently I stubled upon an interesting idea posted by Oneleven on the shadertoy site: 'Sample vector map in the neighborhood of each pixel, then pretend that you move these neighboring pixels according to vector map, then calculate how many of them lands in the current pixel, then normalize that value'.

To verify same result, I have also re-implemented simplex noise and his hacky derivative calculation. Results are amazing and fast and seamless! We can use other noise types as well!

Current implementation is using sampleBuffer (as I was matching to the reference), therefore it will be resolution dependent, but swapping it into a imageBuffer or textureBuffer should be very simple and resolution independent.

For better explanation, you can also check out sop caustics implementation