Post news RSS [w]tech - Refraction

Technique for simulating glass, water and other transparent material is now available in [w]tech

Posted by on

When you look through water on the ground it is distorted. In [w]tech we are now able to simulate this with a technique called "Refraction", discribed in GPU Gems 2.

How is it rendered?

You cannot read and write on a rendertarget at the same time, this is why we have to use two of them: We render the whole scene to our first one, then the second one is used to render all meshes with a refractive shader. Therefore the first rendertarget is filled at first and is then able to give its information to the second rendering pass. After the second rendertarget is filled and all refractive meshes are rendered, both rendertargets are blended together to the final scene.

What does it look like?

The first animation shows a flat shaded mesh with a refraction shader. We use a kind of refraction technique which uses the normals of the rendered mesh to distort the background.

At the moment neither lit nor a overlapping of multiple transparent meshes is rendered correctly, but we will find a way to simulate this as well.
The second animation shows a smooth shaded mesh. In fact, there is a big difference in the way it looks like. With flat shaded meshes you can simulate diamonds or glass in general.
When you want to create water you can use a smooth shaded mesh to have correct distortion.

In addition to that, you are able to use a normal map to add further details to the surface.

Here is a screenshot of our testmap with the figure rendered with a refractive figure:

For more information visit:



Reply Good karma Bad karma+3 votes
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.