It is a threex extension for three.js which provide realistic bubble with fresnel effect.
- examples/basic.html [view source] : It shows a bubble with a texture cube.
- examples/diamond.html [view source] : It shows a diamond with fresnel and a sprite lensflare.
- examples/diamond-sslensflare.html [view source] : It shows a diamond with fresnel and a screen space lensflare.
- examples/skull.html [view source] : It shows a glass skull in the sky. It is a remake of the excelent "glass" demo made by bartek
You can install it via script tag
<script src='threex.bubble.js'></script>
Or you can install with bower, as you wish.
bower install threex.bubble
You can create a bubble with those simple lines. You create the mesh and adds it to the scene. The texture cube can be dynamic or static, it is up to you.
var mesh = new THREEx.BubbleMesh(textureCube)
scene.add(mesh)
You can use only the material if you want. Just create a THREEx.BubbleMaterial
to get a material suitable for bubble.
Internally, this is simply a THREE.FresnelShader
in a THREE.ShaderMaterial
.
var material = new THREEx.BubbleMaterial(textureCube)