Material Constants

These constants define properties common to all material types, with the exception of Texture Combine Operations which only apply to MeshBasicMaterial and MeshLambertMaterial.

Side

v3d.FrontSide v3d.BackSide v3d.DoubleSide v3d.TwoPassDoubleSide

Defines which side of faces will be rendered - front, back or both. Default is FrontSide.

TwoPassDoubleSide will renderer double-sided transparent materials in two passes in back-front order to mitigate transparency artifacts.

Blending Mode

v3d.NoBlending v3d.NormalBlending v3d.AdditiveBlending v3d.SubtractiveBlending v3d.MultiplyBlending v3d.CustomBlending

These control the source and destination blending equations for the material's RGB and Alpha sent to the WebGLRenderer for use by WebGL. NormalBlending is the default. Note that CustomBlending must be set to use custom blending equations (see below).

Depth Mode

v3d.NeverDepth v3d.AlwaysDepth v3d.EqualDepth v3d.LessDepth v3d.LessEqualDepth v3d.GreaterEqualDepth v3d.GreaterDepth v3d.NotEqualDepth

Which depth function the material uses to compare incoming pixels Z-depth against the current Z-depth buffer value. If the result of the comparison is true, the pixel will be drawn.

Texture Combine Operations

v3d.MultiplyOperation v3d.MixOperation v3d.AddOperation

These define how the result of the surface's color is combined with the environment map (if present), for MeshBasicMaterial and MeshLambertMaterial.

Stencil Functions

v3d.NeverStencilFunc v3d.LessStencilFunc v3d.EqualStencilFunc v3d.LessEqualStencilFunc v3d.GreaterStencilFunc v3d.NotEqualStencilFunc v3d.GreaterEqualStencilFunc v3d.AlwaysStencilFunc

Which stencil function the material uses to determine whether or not to perform a stencil operation.

Stencil Operations

v3d.ZeroStencilOp v3d.KeepStencilOp v3d.ReplaceStencilOp v3d.IncrementStencilOp v3d.DecrementStencilOp v3d.IncrementWrapStencilOp v3d.DecrementWrapStencilOp v3d.InvertStencilOp

Which stencil operation the material will perform on the stencil buffer pixel if the provided stencil function passes.

Normal map type

v3d.TangentSpaceNormalMap v3d.ObjectSpaceNormalMap

Defines the type of the normal map. For TangentSpaceNormalMap, the information is relative to the underlying surface. For ObjectSpaceNormalMap, the information is relative to the object orientation. Default is TangentSpaceNormalMap.

GLSL Version

v3d.GLSL1 v3d.GLSL3

Custom Blending Equation Constants

These work with all material types. First set the material's blending mode to v3d.CustomBlending, then set the desired Blending Equation, Source Factor and Destination Factor.

Code Example

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

Blending Equations

v3d.AddEquation v3d.SubtractEquation v3d.ReverseSubtractEquation v3d.MinEquation v3d.MaxEquation

Source Factors

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

Destination Factors

All of the Source Factors are valid as Destination Factors, except for v3d.SrcAlphaSaturateFactor.

Source

For more info on how to obtain the source code of this module see this page.