自定义混合方程常量(Custom Blending Equation Constants)

优质
小牛编辑
133浏览
2023-12-01

这个常量可以用于所有的材质类型。首先将材质的混合模式设置为THREE.CustomBlending,然后设置所需要的混合方程、源因子和目标因子。

代码示例

const material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
material.blending = THREE.CustomBlending;
material.blendEquation = THREE.AddEquation; //default
material.blendSrc = THREE.SrcAlphaFactor; //default
material.blendDst = THREE.OneMinusSrcAlphaFactor; //default

例子

materials / blending / custom

混合方程

THREE.AddEquation
THREE.SubtractEquation
THREE.ReverseSubtractEquation
THREE.MinEquation
THREE.MaxEquation

源因子

THREE.ZeroFactor
THREE.OneFactor
THREE.SrcColorFactor
THREE.OneMinusSrcColorFactor
THREE.SrcAlphaFactor
THREE.OneMinusSrcAlphaFactor
THREE.DstAlphaFactor
THREE.OneMinusDstAlphaFactor
THREE.DstColorFactor
THREE.OneMinusDstColorFactor
THREE.SrcAlphaSaturateFactor

目标因子

所有的源因子的值,在目标因子中都是有效的。除了:

THREE.SrcAlphaSaturateFactor

源代码

src/constants.js