Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface MeshStandardMaterial

A standard physically based material, using Metallic-Roughness workflow. Physically based rendering (PBR) has recently become the standard in many 3D applications, such as Unity,s Unreal and 3D Studio Max. This approach differs from older approaches in that instead of using approximations for the way in which light interacts with a surface, a physically correct model is used. The idea is that, instead of tweaking materials to look good under specific lighting, a material can be created that will react 'correctly' under all lighting scenarios. In practice this gives a more accurate and realistic looking result than the MeshLambertMaterial or MeshPhongMaterial, at the cost of being somewhat more computationally expensive. Shading is calculated in the same way as for the MeshPhongMaterial, using a Phong shading model. This calculates shading per pixel (i.e. in the fragment shader,a AKA pixel shader) which gives more accurate results than the Gouraud model used by MeshLambertMaterial, at the cost of some performance. Note that for best results you should always specify an .envMap when using this material. For a non-technical introduction to the concept of PBR and how to set up a PBR material, check out these articles by the people at marmoset: Basic Theory of Physically Based Rendering Physically Based Rendering and You Can Too Technical details of the approach used in three.js (and most other PBR systems) can be found is this paper from Disney (pdf), by Brent Burley.

See the ngx3js docs page for details. See the ngx material page for a live demo.

Hierarchy

Index

Constructors

constructor

Properties

alphaMap

alphaMap: I3JS.Texture

The alpha map is a grayscale texture that controls the opacity across the surface (black: fully transparent; white: fully opaque). Default is null. Only the color of the texture is used, ignoring the alpha channel if one exists. For RGB and RGBA textures, the WebGL renderer will use the green channel when sampling this texture due to the extra bit of precision provided for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and luminance/alpha textures will also still work as expected.

default

null

alphaTest

alphaTest: number

Sets the alpha value to be used when running an alpha test. The material will not be rendered if the opacity is lower than this value. Default is 0.

default

0

alphaToCoverage

alphaToCoverage: boolean

Enables alpha to coverage. Can only be used with MSAA-enabled contexts (meaning when the renderer was created with antialias parameter set to true). Default is false.

default

false

aoMap

aoMap: I3JS.Texture

The red channel of this texture is used as the ambient occlusion map. Default is null. The aoMap requires a second set of UVs.

default

null

aoMapIntensity

aoMapIntensity: number

Intensity of the ambient occlusion effect. Default is 1. Zero is no occlusion effect.

default

1

blendDst

Blending destination. Default is OneMinusSrcAlphaFactor. See the destination factors constants for all possible values. The material's blending must be set to CustomBlending for this to have any effect.

default

THREE.OneMinusSrcAlphaFactor

blendDstAlpha

blendDstAlpha: number

The transparency of the .blendDst. Uses .blendDst value if null. Default is null.

default

null

blendEquation

blendEquation: BlendingEquation

Blending equation to use when applying blending. Default is AddEquation. See the blending equation constants for all possible values. The material's blending must be set to CustomBlending for this to have any effect.

default

THREE.AddEquation

blendEquationAlpha

blendEquationAlpha: number

The transparency of the .blendEquation. Uses .blendEquation value if null. Default is null.

default

null

blendSrc

Blending source. Default is SrcAlphaFactor. See the source factors constants for all possible values. The material's blending must be set to CustomBlending for this to have any effect.

default

THREE.SrcAlphaFactor

blendSrcAlpha

blendSrcAlpha: number

The transparency of the .blendSrc. Uses .blendSrc value if null. Default is null.

default

null

blending

blending: Blending

Which blending to use when displaying objects with this material. This must be set to CustomBlending to use custom blendSrc, blendDst or blendEquation. See the blending mode constants for all possible values. Default is NormalBlending.

default

THREE.NormalBlending

bumpMap

bumpMap: I3JS.Texture

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. If a normal map is defined this will be ignored.

default

null

bumpScale

bumpScale: number

How much the bump map affects the material. Typical ranges are 0-1. Default is 1.

default

1

clipIntersection

clipIntersection: boolean

Changes the behavior of clipping planes so that only their intersection is clipped, rather than their union. Default is false.

default

false

clipShadows

clipShadows: boolean

Defines whether to clip shadows according to the clipping planes specified on this material. Default is false.

default

false

clippingPlanes

clippingPlanes: any

User-defined clipping planes specified as THREE.Plane objects in world space. These planes apply to the objects this material is attached to. Points in space whose signed distance to the plane is negative are clipped (not rendered). This requires WebGLRenderer.localClippingEnabled to be true. See the WebGL / clipping /intersection example. Default is null.

default

null

color

color: I3JS.Color

Color of the material, by default set to white (0xffffff).

default

new THREE.Color( 0xffffff )

colorWrite

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. Default is true.

default

true

defines

defines: {}

Defines custom constants using #define directives within the GLSL code for both the vertex shader and the fragment shader; each key/value pair yields another directive:

default

{ 'STANDARD': '' }

Type declaration

  • [key: string]: any

depthFunc

depthFunc: DepthModes

Which depth function to use. Default is LessEqualDepth. See the depth mode constants for all possible values.

default

THREE.LessEqualDepth

depthTest

depthTest: boolean

Whether to have depth test enabled when rendering this material. Default is true.

default

true

depthWrite

depthWrite: boolean

Whether rendering this material has any effect on the depth buffer. Default is true. 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.

default

true

displacementBias

displacementBias: number

The offset of the displacement map's values on the mesh's vertices. Without a displacement map set, this value is not applied. Default is 0.

default

0

displacementMap

displacementMap: I3JS.Texture

The displacement map affects the position of the mesh's vertices. Unlike other maps which only affect the light and shade of the material the displaced vertices can cast shadows,s block other objects, and otherwise act as real geometry. The displacement texture is an image where the value of each pixel (white being the highest) is mapped against, and repositions, the vertices of the mesh.

default

null

displacementScale

displacementScale: number

How much the displacement map affects the mesh (where black is no displacement, and white is maximum displacement). Without a displacement map set, this value is not applied.

default

1

dithering

dithering: boolean

Whether to apply dithering to the color to remove the appearance of banding. Default is false.

default

false

emissive

emissive: I3JS.Color

Emissive (light) color of the material, essentially a solid color unaffected by other lighting. Default is black.

default

new THREE.Color( 0x000000 )

emissiveIntensity

emissiveIntensity: number

Intensity of the emissive light. Modulates the emissive color. Default is 1.

default

1

emissiveMap

emissiveMap: I3JS.Texture

Set emissive (glow) map. Default is null. 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.

default

null

envMap

envMap: I3JS.Texture

The environment map. Default is null.

default

null

envMapIntensity

envMapIntensity: number

Scales the effect of the environment map by multiplying its color.

default

1

flatShading

flatShading: boolean

Define whether the material is rendered with flat shading. Default is false.

default

false

fog

fog: boolean

Whether the material is affected by fog. Default is true.

default

true

format

format: PixelFormat

When this property is set to THREE.RGBFormat, the material is considered to be opaque and alpha values are ignored. Default is THREE.RGBAFormat.

default

THREE.RGBAFormat

id

id: number

Unique number for this material instance.

Readonly isMaterial

isMaterial: true

Used to check whether this or derived classes are materials. Default is true. You should not change this, as it used internally for optimisation.

isMeshStandardMaterial

isMeshStandardMaterial: boolean

lightMap

lightMap: I3JS.Texture

The light map. Default is null. The lightMap requires a second set of UVs.

default

null

lightMapIntensity

lightMapIntensity: number

Intensity of the baked light. Default is 1.

default

1

map

The color map. Default is null.

default

null

metalness

metalness: number

How much the material is like a metal. Non-metallic materials such as wood or stone use 0.0, metallic use 1.0, with nothing (usually) in between. Default is 0.0. A value between 0.0 and 1.0 could be used for a rusty metal look. If metalnessMap is also provided, both values are multiplied.

default

0

metalnessMap

metalnessMap: I3JS.Texture

The blue channel of this texture is used to alter the metalness of the material.

default

null

name

name: string

Optional name of the object (doesn't need to be unique). Default is an empty string.

default

''

needsUpdate

needsUpdate: boolean

Specifies that the material needs to be recompiled.

default

false

normalMap

normalMap: I3JS.Texture

The texture to create a normal map. The RGB values affect the surface normal for each pixel fragment and change the way the color is lit. Normal maps do not change the actual shape of the surface, only the lighting.e In case the material has a normal map authored using the left handed convention, the y component of normalScale should be negated to compensate for the different handedness.

default

null

normalMapType

normalMapType: NormalMapTypes

The type of normal map. Options are THREE.TangentSpaceNormalMap (default), and THREE.ObjectSpaceNormalMap.

default

THREE.TangentSpaceNormalMap

normalScale

normalScale: I3JS.Vector2

How much the normal map affects the material. Typical ranges are 0-1. Default is a Vector2 set to (1,1).

default

new THREE.Vector2( 1, 1 )

opacity

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. If the material's transparent property is not set to true, the material will remain fully opaque and this value will only affect its color. Default is 1.0.

default

1

polygonOffset

polygonOffset: boolean

Whether to use polygon offset. Default is false. This corresponds to the GL_POLYGON_OFFSET_FILL WebGL feature.

default

false

polygonOffsetFactor

polygonOffsetFactor: number

Sets the polygon offset factor. Default is 0.

default

0

polygonOffsetUnits

polygonOffsetUnits: number

Sets the polygon offset units. Default is 0.

default

0

precision

precision: "highp" | "mediump" | "lowp"

Override the renderer's default precision for this material. Can be "highp", "mediump" or "lowp". Default is null.

default

null

premultipliedAlpha

premultipliedAlpha: boolean

Whether to premultiply the alpha (transparency) value. See [Example:webgl_materials_physical_transmission WebGL / Materials / Physical / Transmission] for an example of the difference. Default is false.

default

false

refractionRatio

refractionRatio: number

The index of refraction (IOR) of air (approximately 1) divided by the index of refraction of the material. It is used with environment mapping modes THREE.CubeRefractionMapping and THREE.EquirectangularRefractionMapping. The refraction ratio should not exceed 1. Default is 0.98.

default

0.98

roughness

roughness: number

How rough the material appears. 0.0 means a smooth mirror reflection, 1.0 means fully diffuse. Default is 1.0. If roughnessMap is also provided, both values are multiplied.

default

1

roughnessMap

roughnessMap: I3JS.Texture

The green channel of this texture is used to alter the roughness of the material.

default

null

shadowSide

shadowSide: Side

Defines which side of faces cast shadows. When set, can be THREE.FrontSide, THREE.BackSide, or THREE.DoubleSide. Default is null. If null, the side casting shadows is determined as follows:

default

null

side

side: Side

Defines which side of faces will be rendered - front, back or both. Default is THREE.FrontSide. Other options are THREE.BackSide and THREE.DoubleSide.

default

THREE.FrontSide

stencilFail

stencilFail: StencilOp

Which stencil operation to perform when the comparison function returns false. Default is KeepStencilOp. See the stencil operations constants for all possible values.

default

THREE.KeepStencilOp

stencilFunc

stencilFunc: StencilFunc

The stencil comparison function to use. Default is AlwaysStencilFunc. See stencil function constants for all possible values.

default

THREE.AlwaysStencilFunc

stencilFuncMask

stencilFuncMask: number

The bit mask to use when comparing against the stencil buffer. Default is 0xFF.

default

0xff

stencilRef

stencilRef: number

The value to use when performing stencil comparisons or stencil operations. Default is 0.

default

0

stencilWrite

stencilWrite: 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. Default is false.

default

false

stencilWriteMask

stencilWriteMask: number

The bit mask to use when writing to the stencil buffer. Default is 0xFF.

default

0xff

stencilZFail

stencilZFail: StencilOp

Which stencil operation to perform when the comparison function returns true but the depth test fails. Default is KeepStencilOp. See the stencil operations constants for all possible values.

default

THREE.KeepStencilOp

stencilZPass

stencilZPass: StencilOp

Which stencil operation to perform when the comparison function returns true and the depth test passes. Default is KeepStencilOp. See the stencil operations constants for all possible values.

default

THREE.KeepStencilOp

toneMapped

toneMapped: boolean

Defines whether this material is tone mapped according to the renderer's toneMapping setting. Default is true.

default

true

transparent

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. g When set to true, the extent to which the material is transparent is controlled by setting its opacity property. Default is false.

default

false

type

type: string
default

'MeshStandardMaterial'

userData

userData: any

An object that can be used to store custom data about the Material. It should not hold references to functions as these will not be cloned.

default

{}

uuid

uuid: string

UUID of this material instance. This gets automatically assigned, so this shouldn't be edited.

version

version: number

This starts at 0 and counts how many times [property:Boolean needsUpdate] is set to true.

default

0

vertexColors

vertexColors: boolean

Defines whether vertex coloring is used. Default is false.

default

false

visible

visible: boolean

Defines whether this material is visible. Default is true.

default

true

wireframe

wireframe: boolean

Render geometry as wireframe. Default is false (i.e. render as flat polygons).

default

false

wireframeLinecap

wireframeLinecap: string

Define appearance of line ends. Possible values are "butt", "round" and "square". Default is 'round'. This corresponds to the 2D Canvas lineCap property and it is ignored by the WebGL renderer.

default

'round'

wireframeLinejoin

wireframeLinejoin: string

Define appearance of line joints. Possible values are "round", "bevel" and "miter". Default is 'round'. This corresponds to the 2D Canvas lineJoin property and it is ignored by the WebGL renderer.

default

'round'

wireframeLinewidth

wireframeLinewidth: number

Controls wireframe thickness. Default is 1. Due to limitations of the OpenGL Core Profile with the WebGL renderer on most platforms linewidth will always be 1 regardless of the set value.

default

1

Methods

addEventListener

clone

copy

customProgramCacheKey

  • customProgramCacheKey(): string
  • In case onBeforeCompile is used, this callback can be used to identify values of settings used in onBeforeCompile, so three.js can reuse a cached shader or recompile the shader for this material as needed. For example, if onBeforeCompile contains a conditional statement like:

    if ( black ) {
    shader.fragmentShader = shader.fragmentShader.replace('gl_FragColor = vec4(1)', 'gl_FragColor = vec4(0)')
    }
    // then customProgramCacheKey should be set like this:
    material.customProgramCacheKey = function() {
    return black ? '1' : '0';
    }

    Unlike properties, the callback is not supported by .clone(), .copy() and .toJSON().

    Returns string

dispatchEvent

  • dispatchEvent(event: Event): void

dispose

  • dispose(): void

hasEventListener

onBeforeCompile

removeEventListener

setValues

toJSON

  • toJSON(meta?: any): any

Generated using TypeDoc