Depth peeling successfully implemented in WebGL

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Depth peeling successfully implemented in WebGL

Bruce Sherwood
In the easy-to-use WebGL-based GlowScript 3D programming environment
(glowscript.org) you can now specify the opacity of an object (other
than curve, ring, and helix). The following statement creates a
cyan-colored cube that has low opacity (high transparency):

box( {color.cyan, opacity:0.2 } )

Here is a demo:

http://www.glowscript.org/#/user/GlowScriptDemos/folder/Examples/program/Transparency

The technique used is "depth peeling" which correctly handles
transparency at the pixel level. Simpler transparency schemes, in
which objects are ordered back-to-front on the basis of their centers,
fail to make the correct display if, for example, two transparent
objects intersect each other.

The open source is at
https://bitbucket.org/davidscherer/glowscript/overview. In the Source
folder the key files are lib/glow/WebGLRenderer.js and the shader
files which are found in the shader folder.

Bruce

============================================================
FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
lectures, archives, unsubscribe, maps at http://www.friam.org