pouët.net

Go to bottom

How to calculate caustics with Spheretracing?

category: code [glöplog]
 
I need some enlightenment here. I have no idea how to calculate it.
added on the 2013-02-03 21:51:11 by Danguafer Danguafer
You calculate it like any other caustics. Sphere tracing is just a way of finding a surface. This should be good enough for any realtime use: http://research.cs.tamu.edu/keyser/Papers/CausticsCGI09.pdf
added on the 2013-02-04 01:30:25 by xernobyl xernobyl
Isn't this technique only for calculating water caustics? I am looking for a way to calculate the caustics produced by distorted spherical objects or any other kind of object.
added on the 2013-02-04 04:44:54 by Danguafer Danguafer
Doesn't matter water or not: intersect, refract, repeat. Throw in fresnell equation and get nice pink spiky ball with caustics as las did.
added on the 2013-02-04 07:10:18 by a13X_B a13X_B
Doesn't matter water or not: intersect, refract, repeat. Throw in fresnell equation and get nice pink spiky ball with caustics as las did.
added on the 2013-02-04 07:10:19 by a13X_B a13X_B
And I officially suck at posting *<|:D
added on the 2013-02-04 07:11:26 by a13X_B a13X_B
Straight forward way - if you have a simple "caustics receiver" (i.e. a ground plane) where you expect your caustics to appear.
abductee and I came up with this quite simple approach, don't know whether there is a paper on this using a similar approach.

1. Trace/Render "photons" from the "lightsource" into an MRT FBO. Store the position and color of the "photon" when it hits the receiver plane. A little "jittering" (stratified sampling) of the photon start positions helps to improve the overall visual result - otherwise you will clearly be able to see some sampling patterns.
-> photonPositions/photonColors
You should have a look at how standard raytracers do photon mapping.

This pass is basically a photon mapping step but instead of using some 3D acceleration structures to store the photon data, we simply store the photon information into two textures because we know where we want to see caustics and can optimize for that special case.

2. Take a simple grid with a lot of quads (point sprites) and sample the textures from the first pass (nearest neighbor please!). Place the quads along photonPositions and apply photonColors to the point sprites (you might want to use additive blending and a nice fall of function for your point sprites).
Render this into a nice texture which you will apply (in 3.) to your ground plane where you expect your caustics to appear.

3. Raytrace the thing as you usually do - when you calculate the colors for positions on the ground plane, take the texture you rendered in step 2. into account.

DONE. \o/

Well - it sounds quite simple and it actually is, BUT you have to take care to choose the proper parameters to get something that's not looking totally unconvincing. And I wont tell you how to do that. :P
added on the 2013-02-04 09:29:18 by las las

login

Go to top