Here we can see a green glass ball absorbing the pixels behind it, and before the rays hit our eyes( camera ) the color is absorbed based on how long/far it travels trough the sphere.
This effect is mostly a post process effect, where I use two depth maps to find out how thick the object is. This is done by first rendering the sphere’s backfaces into one depth buffer, and then rendering the spheres frontbuffer into another buffer; taking the difference of these two textures will give me the thickness of the object.
If you take a look at the spikeball, it contains some artifacts. This is because of the way I find the depth of the object. There are many ways of getting these look better and I will get back to this later! 😉
Then, I use Beer-Lambert’s law to compute the amount of light absortion:
Transmittance =exp(-absotrion*concentration*distance), where the absortion = -log(Transmittance)/distance.
I will post more updates on this as I’m making progress, and give out the source code/executable.
The application is written using DirectX10 right now, but it will be a trivial task to convert it to XNA once it’s done.