Class: DepthMaterial

zen3d.DepthMaterial()

new DepthMaterial()

A material for drawing geometry by depth. Depth is based off of the camera near and far plane. White is nearest, black is farthest.
Source:

Extends

Members

acceptLight :boolean

Whether the material is affected by lights. If set true, renderer will try to upload light uniforms.
Type:
  • boolean
Inherited From:
Default Value:
  • false
Source:

alphaMap :zen3d.Texture2D

The alpha map.
Type:
Inherited From:
Default Value:
  • null
Source:

alphaMapCoord :number

Define the UV chanel for the alpha map to use starting from 0 and defaulting to 0.
Type:
  • number
Inherited From:
Default Value:
  • 0
Source:

alphaTest :number

Sets the alpha value to be used when running an alpha test. The material will not be renderered if the opacity is lower than this value.
Type:
  • number
Inherited From:
Default Value:
  • 0
Source:

aoMap :zen3d.Texture2D

The red channel of this texture is used as the ambient occlusion map.
Type:
Inherited From:
Default Value:
  • null
Source:

aoMapCoord :number

Define the UV chanel for the ao map to use starting from 0 and defaulting to 0.
Type:
  • number
Inherited From:
Default Value:
  • 0
Source:

aoMapIntensity :number

Intensity of the ambient occlusion effect.
Type:
  • number
Inherited From:
Default Value:
  • 1
Source:

blendDst :zen3d.BLEND_FACTOR

Blending destination. The zen3d.Material#blending must be set to zen3d.BLEND_TYPE.CUSTOM for this to have any effect.
Type:
Inherited From:
Default Value:
  • zen3d.BLEND_FACTOR.ONE_MINUS_SRC_ALPHA
Source:

blendDstAlpha :zen3d.BLEND_FACTOR

The transparency of the zen3d.Material#blendDst. The zen3d.Material#blending must be set to zen3d.BLEND_TYPE.CUSTOM for this to have any effect.
Type:
Inherited From:
Default Value:
  • null
Source:

blendEquation :zen3d.BLEND_EQUATION

Blending equation to use when applying blending. The zen3d.Material#blending must be set to zen3d.BLEND_TYPE.CUSTOM for this to have any effect.
Type:
Inherited From:
Default Value:
  • zen3d.BLEND_EQUATION.ADD
Source:

blendEquationAlpha :zen3d.BLEND_EQUATION

The tranparency of the zen3d.Material#blendEquation. The zen3d.Material#blending must be set to zen3d.BLEND_TYPE.CUSTOM for this to have any effect.
Type:
Inherited From:
Default Value:
  • null
Source:

blending :zen3d.BLEND_TYPE

Which blending to use when displaying objects with this material. This must be set to zen3d.BLEND_TYPE.CUSTOM to use custom blendSrc, blendDst or blendEquation.
Type:
Inherited From:
Default Value:
  • zen3d.BLEND_TYPE.NORMAL
Source:

blendSrc :zen3d.BLEND_FACTOR

Blending source. The zen3d.Material#blending must be set to zen3d.BLEND_TYPE.CUSTOM for this to have any effect.
Type:
Inherited From:
Default Value:
  • zen3d.BLEND_FACTOR.SRC_ALPHA
Source:

blendSrcAlpha :zen3d.BLEND_FACTOR

The transparency of the zen3d.Material#blendSrc. The zen3d.Material#blending must be set to zen3d.BLEND_TYPE.CUSTOM for this to have any effect.
Type:
Inherited From:
Default Value:
  • null
Source:

bumpMap :zen3d.Texture2D

The texture to create a bump map. The black and white values map to the perceived depth in relation to the lights. Bump doesn't actually affect the geometry of the object, only the lighting.
Type:
Inherited From:
Default Value:
  • null
Source:

bumpScale :number

How much the bump map affects the material. Typical ranges are 0-1.
Type:
  • number
Inherited From:
Default Value:
  • 1
Source:

colorWrite :boolean

Whether to render the material's color. This can be used in conjunction with a mesh's renderOrder property to create invisible objects that occlude other objects.
Type:
  • boolean
Inherited From:
Default Value:
  • true
Source:

depthFunc :zen3d.WEBGL_COMPARE_FUNC

Which depth function to use. See the zen3d.WEBGL_COMPARE_FUNC constants for all possible values.
Type:
Inherited From:
Default Value:
  • zen3d.WEBGL_COMPARE_FUNC.LEQUAL
Source:

depthTest :boolean

Whether to have depth test enabled when rendering this material.
Type:
  • boolean
Inherited From:
Default Value:
  • true
Source:

depthWrite :boolean

Whether rendering this material has any effect on the depth buffer. When drawing 2D overlays it can be useful to disable the depth writing in order to layer several things together without creating z-index artifacts.
Type:
  • boolean
Inherited From:
Default Value:
  • true
Source:

diffuse :zen3d.Color3

The diffuse color.
Type:
Inherited From:
Default Value:
  • zen3d.Color3(0xffffff)
Source:

diffuseMap :zen3d.Texture2D

The diffuse map.
Type:
Inherited From:
Default Value:
  • null
Source:

diffuseMapCoord :number

Define the UV chanel for the diffuse map to use starting from 0 and defaulting to 0.
Type:
  • number
Inherited From:
Default Value:
  • 0
Source:

dithering :boolean

Whether to apply dithering to the color to remove the appearance of banding.
Type:
  • boolean
Inherited From:
Default Value:
  • false
Source:

drawMode :zen3d.DRAW_MODE

Determines how the mesh triangles are constructed from the vertices.
Type:
Inherited From:
Default Value:
  • zen3d.DRAW_MODE.TRIANGLES
Source:

emissive :zen3d.Color3

Emissive (light) color of the material, essentially a solid color unaffected by other lighting.
Type:
Inherited From:
Default Value:
  • zen3d.Color3(0x000000)
Source:

emissiveIntensity :number

Intensity of the emissive light. Modulates the emissive color.
Type:
  • number
Inherited From:
Default Value:
  • 1
Source:

emissiveMap :zen3d.Texture2D

Set emissive (glow) map. The emissive map color is modulated by the emissive color and the emissive intensity. If you have an emissive map, be sure to set the emissive color to something other than black.
Type:
Inherited From:
Default Value:
  • null
Source:

emissiveMapCoord :number

Define the UV chanel for the emissive map to use starting from 0 and defaulting to 0.
Type:
  • number
Inherited From:
Default Value:
  • 0
Source:

envMap :zen3d.TextureCube

The environment map.
Type:
Inherited From:
Default Value:
  • null
Source:

envMapCombine :zen3d.ENVMAP_COMBINE_TYPE

How to combine the result of the surface's color with the environment map, if any. This has no effect in a zen3d.PBRMaterial.
Type:
Inherited From:
Default Value:
  • zen3d.ENVMAP_COMBINE_TYPE.MULTIPLY
Source:

envMapIntensity :number

Scales the effect of the environment map by multiplying its color.
Type:
  • number
Inherited From:
Default Value:
  • 1
Source:

needsUpdate :boolean

Specifies that the material needs to be recompiled. This property is automatically set to true when instancing a new material.
Type:
  • boolean
Inherited From:
Default Value:
  • true
Source:

normalMap :zen3d.Texture2D

The normal map.
Type:
Inherited From:
Default Value:
  • null
Source:

opacity :number

Float in the range of 0.0 - 1.0 indicating how transparent the material is. A value of 0.0 indicates fully transparent, 1.0 is fully opaque.
Type:
  • number
Inherited From:
Default Value:
  • 1
Source:

packToRGBA :boolean

Encoding for depth packing.
Type:
  • boolean
Default Value:
  • false
Source:

polygonOffset :boolean

Whether to use polygon offset. This corresponds to the GL_POLYGON_OFFSET_FILL WebGL feature.
Type:
  • boolean
Inherited From:
Default Value:
  • false
Source:

polygonOffsetFactor :number

Sets the polygon offset factor.
Type:
  • number
Inherited From:
Default Value:
  • 0
Source:

polygonOffsetUnits :number

Sets the polygon offset units.
Type:
  • number
Inherited From:
Default Value:
  • 0
Source:

precision :string

Override the renderer's default precision for this material. Can be "highp", "mediump" or "lowp".
Type:
  • string
Inherited From:
Default Value:
  • null
Source:

premultipliedAlpha :boolean

Whether to premultiply the alpha (transparency) value.
Type:
  • boolean
Inherited From:
Default Value:
  • false
Source:

shading :zen3d.SHADING_TYPE

Define whether the material is rendered with flat shading or smooth shading.
Type:
Inherited From:
Default Value:
  • zen3d.SHADING_TYPE.SMOOTH_SHADING
Source:

side :zen3d.DRAW_SIDE

Defines which side of faces will be rendered - front, back or double.
Type:
Inherited From:
Default Value:
  • zen3d.DRAW_SIDE.FRONT
Source:

stencilFail :zen3d.WEBGL_OP

Which stencil operation to perform when the comparison function returns false. See the zen3d.WEBGL_OP constants for all possible values.
Type:
Inherited From:
Default Value:
  • zen3d.WEBGL_OP.KEEP
Source:

stencilFailBack :zen3d.WEBGL_OP|null

Which stencil operation to perform when the comparison function returns false. See the zen3d.WEBGL_OP constants for all possible values. You can explicitly specify the two-sided stencil op state by defining stencilFailBack, stencilZFailBack and stencilZPassBack.
Type:
Inherited From:
Default Value:
  • null
Source:

stencilFunc :zen3d.WEBGL_COMPARE_FUNC

The stencil comparison function to use. See the zen3d.WEBGL_COMPARE_FUNC constants for all possible values.
Type:
Inherited From:
Default Value:
  • zen3d.WEBGL_COMPARE_FUNC.ALWAYS
Source:

stencilFuncBack :zen3d.WEBGL_COMPARE_FUNC|null

The stencil comparison function to use. See the zen3d.WEBGL_COMPARE_FUNC constants for all possible values. You can explicitly specify the two-sided stencil function state by defining stencilFuncBack, stencilRefBack and stencilFuncMaskBack.
Type:
Inherited From:
Default Value:
  • null
Source:

stencilFuncMask :number

The bit mask to use when comparing against the stencil buffer.
Type:
  • number
Inherited From:
Default Value:
  • 0xFF
Source:

stencilFuncMaskBack :number|null

The bit mask to use when comparing against the stencil buffer. You can explicitly specify the two-sided stencil function state by defining stencilFuncBack, stencilRefBack and stencilFuncMaskBack.
Type:
  • number | null
Inherited From:
Default Value:
  • null
Source:

stencilRef :number

The value to use when performing stencil comparisons or stencil operations.
Type:
  • number
Inherited From:
Default Value:
  • 0
Source:

stencilRefBack :number|null

The value to use when performing stencil comparisons or stencil operations. You can explicitly specify the two-sided stencil function state by defining stencilFuncBack, stencilRefBack and stencilFuncMaskBack.
Type:
  • number | null
Inherited From:
Default Value:
  • null
Source:

stencilTest :boolean

Whether stencil operations are performed against the stencil buffer. In order to perform writes or comparisons against the stencil buffer this value must be true.
Type:
  • boolean
Inherited From:
Default Value:
  • false
Source:

stencilWriteMask :number

The bit mask to use when writing to the stencil buffer.
Type:
  • number
Inherited From:
Default Value:
  • 0xFF
Source:

stencilZFail :zen3d.WEBGL_OP

Which stencil operation to perform when the comparison function returns true but the depth test fails. See the zen3d.WEBGL_OP constants for all possible values.
Type:
Inherited From:
Default Value:
  • zen3d.WEBGL_OP.KEEP
Source:

stencilZFailBack :zen3d.WEBGL_OP|null

Which stencil operation to perform when the comparison function returns true but the depth test fails. See the zen3d.WEBGL_OP constants for all possible values. You can explicitly specify the two-sided stencil op state by defining stencilFailBack, stencilZFailBack and stencilZPassBack.
Type:
Inherited From:
Default Value:
  • null
Source:

stencilZPass :zen3d.WEBGL_OP

Which stencil operation to perform when the comparison function returns true and the depth test passes. See the zen3d.WEBGL_OP constants for all possible values.
Type:
Inherited From:
Default Value:
  • zen3d.WEBGL_OP.KEEP
Source:

stencilZPassBack :zen3d.WEBGL_OP|null

Which stencil operation to perform when the comparison function returns true and the depth test passes. See the zen3d.WEBGL_OP constants for all possible values. You can explicitly specify the two-sided stencil op state by defining stencilFailBack, stencilZFailBack and stencilZPassBack.
Type:
Inherited From:
Default Value:
  • null
Source:

transparent :boolean

Defines whether this material is transparent. This has an effect on rendering as transparent objects need special treatment and are rendered after non-transparent objects. When set to true, the extent to which the material is transparent is controlled by setting it's blending property.
Type:
  • boolean
Inherited From:
Default Value:
  • false
Source:

uuid :string

UUID of this material instance. This gets automatically assigned, so this shouldn't be edited.
Type:
  • string
Inherited From:
Source:

vertexColors :zen3d.VERTEX_COLOR

Defines whether vertex coloring is used.
Type:
Inherited From:
Default Value:
  • zen3d.VERTEX_COLOR.NONE
Source:

vertexTangents :boolean

Defines whether precomputed vertex tangents, which must be provided in a vec4 "tangent" attribute, are used. When disabled, tangents are derived automatically. Using precomputed tangents will give more accurate normal map details in some cases, such as with mirrored UVs.
Type:
  • boolean
Inherited From:
Default Value:
  • false
Source:

Methods

clone() → {zen3d.Material}

Return a new material with the same parameters as this material.
Inherited From:
Source:
Returns:
Type
zen3d.Material

copy(source) → {zen3d.Material}

Copy the parameters from the passed material into this material.
Parameters:
Name Type Description
source zen3d.Material The material to be copied.
Inherited From:
Source:
Returns:
Type
zen3d.Material

dispose()

This disposes the material. Textures of a material don't get disposed. These needs to be disposed by Texture.
Inherited From:
Source: