WebGL - Blending objects part 1

In this episode, I discuss how to blend objects in WebGL.
Concepts:
  • Blending
  • When drawing blended and unblended objects together, first enable DEPTHTEST,
draw all the opaque objects (alpha = 1), then turn depth mask read only gl.depthMask(false), and finally draw all transparent objects (from furthest back to closest) and turn the depth mask back on
Resources:
  • https://github.com/davidwparker/programmingtil-webgl/tree/master/0082-blending-part-1
© programmingtil.com