Graphics Reference
In-Depth Information
THREE.ImageUtils.loadTexture("../assets/
textures/debug.png")});
2. Next, set the
blending
property to the blend mode you want to use:
cubeMaterial.blending =
THREE.SubtractiveBlending;
3. Then, set the
transparent
property to
true
:
cubeMaterial.transparent = true;
You can find an overview of the available, standard blend modes by looking
at the Three.js sources:
THREE.NoBlending = 0;
THREE.NormalBlending = 1;
THREE.AdditiveBlending = 2;
THREE.SubtractiveBlending = 3;
THREE.MultiplyBlending = 4;
How it works...
As we've seen, Three.js uses WebGL to render the scenes. The blend modes you
define on the material for Three.js are used internally by WebGL to determine how
to blend the background color with the foreground color.
There's moreā¦
Besides the blend modes we've shown in this recipe, it is also possible to define
your own custom blend modes. You can do this by setting the
blending
property
to
THREE.CustomBlending
. Use these three material properties to define how
the foreground is blended with the background:
blendSrc
,
blendDst
, and
blendEquation
. For
blendSrc
, you can use the following values: