Realistic glass

Hello, anyone knows how to make this kind of refraction in the bge? I’d like to use a normal map for this.

Attachments


You need to program shaders for that. Using normals would only fake the shading of the glass’s geometry.

You can use nodes + render-to-texture for this. Take the UV mapping and mix it with a derivative normal map (only red and green), then use this as the mapping for the render-to-texture Texture.

Oh, I’d really like to see that. I’ll try. Failed for now…

Here is the node setup:
refraction demo.blend (673 KB)
Set mix node to around 0.1, then add mapping to the UV of the derivative map and rotate it by 90* z axis and set scale on y axis to maybe 1.2

replace the color grid with the texture from the render-to-texture module:
http://gametutorials.tutorialsforblender3d.com/RenderToTexture/Page1

Thanks very much Thatimster! That’s awesome: http://pasteall.org/blend/index.php?id=43700 . I keep it presiously in my files.
(For the normal map I just picked up a conventional normal map on the net and inverted colors in gimp). Cool!

I hooked up the same scene with a mouselook youle !

nice work people!

Attachments

refraction demo2.blend (624 KB)

Awesome BluePrintRandom :slight_smile:

Wow, adding the color of a normal map to the coordinates of a UV, thus displacing the second texture… What a beautiful hack! I love it!