Water and Glass material
06:42 27 Mar 2014

I try to simulate light reflection, refraction, etc. in a fish tank and I need water material and glass material.

Actually I use no water and a phong material for the glass because I haven't found better for now, a testing demo can be see here: http://ledohm.free.fr/test_webgl/

For the water I don't need to simulate the waves, which means I can use the same material as the glass but with differents values for opacity, reflexion and refractive index.

I've found this example which seems to perfectly simulate glass but I don't understand how to adapt the material for my needs. From what I understood the refraction is computed from the envMap but I've no texture. I just want a wall of glass which simulate reflexion/refraction/... like in the reality as much as possible. How I can create (or find) a material like this?


Edit 1:

green: water total internal reflection
red: glass reflection

glass and water reflection


1: refracted by water
2: refracted by water + glass
3 & 4: lost

glass and water reflection and refraction


Edit 2:

Thanks to this tutorial I've unsdertood how shaders works and more specifically this example but, if I understand correctly, I can't use a shader to simulate light in a material with a thickness because shaders apply only on the surfaces of a mesh, I'm right?

three.js aero-glass