an object with one or more properties defining the material's appearance.
This creates a generic material.
Creates eventDispatcher object. It needs to be call with '.call' to add the functionality to an object.
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.
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.
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.
The red channel of this texture is used as the ambient occlusion map. Default is null. The aoMap requires a second set of UVs.
Intensity of the ambient occlusion effect. Default is 1. Zero is no occlusion effect.
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.
The transparency of the .blendDst. Uses .blendDst value if null. Default is null.
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.
The transparency of the .blendEquation. Uses .blendEquation value if null. Default is null.
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.
The transparency of the .blendSrc. Uses .blendSrc value if null. Default is null.
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.
Changes the behavior of clipping planes so that only their intersection is clipped, rather than their union. Default is false.
Defines whether to clip shadows according to the clipping planes specified on this material. Default is false.
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.
Color of the material, by default set to white (0xffffff).
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.
How to combine the result of the surface's color with the environment map, if any. Options are THREE.Multiply (default), THREE.MixOperation, THREE.AddOperation. If mix is chosen, the .reflectivity is used to blend between the two colors.
Custom defines to be injected into the shader. These are passed in form of an object literal, with key/value pairs. { MY_CUSTOM_DEFINE: '' , PI2: Math.PI * 2 }. The pairs are defined in both vertex and fragment shaders. Default is undefined.
Which depth function to use. Default is LessEqualDepth. See the depth mode constants for all possible values.
Whether to have depth test enabled when rendering this material. Default is true.
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.
Whether to apply dithering to the color to remove the appearance of banding. Default is false.
Emissive (light) color of the material, essentially a solid color unaffected by other lighting. Default is black.
Intensity of the emissive light. Modulates the emissive color. Default is 1.
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.
The environment map. Default is null.
Whether the material is affected by fog. Default is true.
When this property is set to THREE.RGBFormat, the material is considered to be opaque and alpha values are ignored. Default is THREE.RGBAFormat.
Unique number for this material instance.
Used to check whether this or derived classes are materials. Default is true. You should not change this, as it used internally for optimisation.
The light map. Default is null. The lightMap requires a second set of UVs.
Intensity of the baked light. Default is 1.
The color map. Default is null.
Optional name of the object (doesn't need to be unique). Default is an empty string.
Specifies that the material needs to be recompiled.
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.
Whether to use polygon offset. Default is false. This corresponds to the GL_POLYGON_OFFSET_FILL WebGL feature.
Sets the polygon offset factor. Default is 0.
Sets the polygon offset units. Default is 0.
Override the renderer's default precision for this material. Can be "highp", "mediump" or "lowp". Default is null.
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.
How much the environment map affects the surface; also see .combine. The default value is 1 and the valid range is between 0 (no reflections) and 1 (full reflections).
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.
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:
Defines which side of faces will be rendered - front, back or both. Default is THREE.FrontSide. Other options are THREE.BackSide and THREE.DoubleSide.
Specular map used by the material. Default is null.
Which stencil operation to perform when the comparison function returns false. Default is KeepStencilOp. See the stencil operations constants for all possible values.
The stencil comparison function to use. Default is AlwaysStencilFunc. See stencil function constants for all possible values.
The bit mask to use when comparing against the stencil buffer. Default is 0xFF.
The value to use when performing stencil comparisons or stencil operations. Default is 0.
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.
The bit mask to use when writing to the stencil buffer. Default is 0xFF.
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.
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.
Defines whether this material is tone mapped according to the renderer's toneMapping setting. Default is true.
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.
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.
UUID of this material instance. This gets automatically assigned, so this shouldn't be edited.
This starts at 0 and counts how many times [property:Boolean needsUpdate] is set to true.
Defines whether vertex coloring is used. Default is false.
Defines whether this material is visible. Default is true.
Render geometry as wireframe. Default is false (i.e. render as flat polygons).
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.
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.
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.
Adds a listener to an event type.
The type of event to listen to.
The that gets called when the event is fired.
Return a new material with the same parameters as this material.
Copy the parameters from the passed material into this material.
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().
Fire an event type.
This disposes the material. Textures of a material don't get disposed. These needs to be disposed by Texture.
Checks if listener is added to an event type.
The type of event to listen to.
The that gets called when the event is fired.
Source code of the shader
WebGLRenderer Context that is initializing the material
Removes a listener from an event type.
The type of the listener that gets removed.
The listener that gets removed.
Sets the properties based on the parameters.
A container with parameters.
Convert the material to three.js JSON Object/Scene format.
Generated using TypeDoc
A material for non-shiny surfaces, without specular highlights. The material uses a non-physically based Lambertian model for calculating reflectance. This can simulate some surfaces (such as untreated wood or stone) well, but cannot simulate shiny surfaces with specular highlights (such as varnished wood). Shading is calculated using a Gouraud shading model. This calculates shading per vertex (i.e. in the vertex shader) and interpolates the results over the polygon's faces. Due to the simplicity of the reflectance and illumination models, performance will be greater when using this material over the MeshPhongMaterial, MeshStandardMaterial or MeshPhysicalMaterial, at the cost of some graphical accuracy.
See the ngx3js docs page for details. See the ngx material page for a live demo.