[page:Material] →
[name]
A material for shiny surfaces, evaluated per pixel.
Constructor
[name]( [page:Object parameters] )
parameters -- an object with one or more of the material's properties defining the material's appearance.
color — geometry color in hexadecimal. Default is 0xffffff.
specular — Set specular color. Default is 0x111111 .
shininess — Set shininess Default is 30.
map — Set texture map. Default is null.
lightMap — Set light map. Default is null.
lightMapIntensity — Set light map intensity. Default is 1.
aoMap — Set ao map. Default is null.
aoMapIntensity — Set ao map intensity. Default is 1.
emissive - Set emissive color. Default is 0x000000.
emissiveMap — Set emissive map. Default is null.
emissiveIntensity — Set emissive map intensity. Default is 1.
bumpMap — Set bump map. Default is null.
bumpScale — Set bump map scale. Default is 1.
normalMap — Set normal map. Default is null.
normalScale — Set normal map scale. Default is (1, 1).
displacementMap — Set displacement map. Default is null.
displacementScale — Set displacement scale. Default is 1.
displacementBias — Set displacement offset. Default is 0.
specularMap — Set specular map. Default is null.
alphaMap — Set alpha map. Default is null.
envMap — Set env map. Default is null.
combine — Set combine operation. Default is THREE.MultiplyOperation.
reflectivity — Set reflectivity. Default is 1.
refractionRatio — Set refraction ratio. Default is 0.98.
fog — Define whether the material color is affected by global fog settings. Default is true.
shading — Define shading type. Default is THREE.SmoothShading.
wireframe — render geometry as wireframe. Default is false.
wireframeLinewidth — Line thickness. Default is 1.
wireframeLinecap — Define appearance of line ends. Default is 'round'.
wireframeLinejoin — Define appearance of line joints. Default is 'round'.
vertexColors — Define how the vertices gets colored. Default is THREE.NoColors.
skinning — Define whether the material uses skinning. Default is false.
morphTargets — Define whether the material uses morphTargets. Default is false.
morphNormals — Define whether the material uses morphNormals. Default is false.
Example:
materials.push( new THREE.MeshPhongMaterial( { color: 0xdddddd, specular: 0x009900, shininess: 30, shading: THREE.FlatShading } ) );
Properties
See the base [page:Material] class for common properties.
[property:Color color]
Diffuse color of the material. Default is white.
[property:Color specular]
Specular color of the material, i.e., how shiny the material is and the color of its shine. Setting this the same color as the diffuse value (times some intensity) makes the material more metallic-looking; setting this to some gray makes the material look more plastic. Default is dark gray.
[property:Float shininess]
How shiny the specular highlight is; a higher value gives a sharper highlight. Default is *30*.
[property:Texture map]
Set color texture map. Default is null. The texture map color is modulated by the diffuse color.
[property:Texture lightMap]
Set light map. Default is null. The lightMap requires a second set of UVs.
[property:Float lightMapIntensity]
TODO
[property:Texture aoMap]
Set ambient occlusion map. Default is null. The aoMap requires a second set of UVs.
[property:Float aoMapIntensity]
TODO
[property:Color emissive]
Emissive (light) color of the material, essentially a solid color unaffected by other lighting. Default is black.
[property:Texture emissiveMap]
Set emisssive (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.
[property:Float emissiveIntensity]
Intensity of the emissive light. Modulates the emissive color. Default is 1.
[property:Texture bumpMap]
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.
[property:Float bumpScale]
How much the bump map affects the material. Typical ranges are 0-1. Default is 1.
[property:Texture normalMap]
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.
[property:Vector2 normalScale]
How much the normal map affects the material. Typical ranges are 0-1. Default is (1,1).
[property:Texture displacementMap]
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, 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.
[property:Float displacementScale]
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 is 1.
[property:Float displacementBias]
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.
[property:Texture specularMap]
The specular map value affects both how much the specular surface highlight contributes and how much of the environment map affects the surface. Default is null.
[property:Texture alphaMap]
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 [page:WebGLRenderer 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.
[property:TextureCube envMap]
Set env map. Default is null.
[property:Integer combine]
How to combine the result of the surface's color with the environment map, if any.
Options are [page:Textures THREE.MultiplyOperation] (default), [page:Textures THREE.MixOperation], [page:Textures THREE.AddOperation]. If mix is chosen, the reflectivity is used to blend between the two colors.
[property:Float reflectivity]
How much the environment map affects the surface; also see "combine".
[property:Float refractionRatio]
The index of refraction for an environment map using [page:Textures THREE.CubeRefractionMapping]. Default is *0.98*.
[property:Boolean fog]
Define whether the material color is affected by global fog settings. Default is *true*.
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.
[property:Integer shading]
How the triangles of a curved surface are rendered: as a smooth surface, as flat separate facets, or no shading at all.
Options are [page:Materials THREE.SmoothShading] (default), [page:Materials THREE.FlatShading].
[property:Boolean wireframe]
Whether the triangles' edges are displayed instead of surfaces. Default is *false*.
[property:Float wireframeLinewidth]
Line thickness for wireframe mode. Default is *1.0*.
Due to limitations in the
ANGLE layer, on Windows platforms linewidth will always be 1 regardless of the set value.
[property:String wireframeLinecap]
Define appearance of line ends. Possible values are "butt", "round" and "square". Default is 'round'.
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.
[property:String wireframeLinejoin]
Define appearance of line joints. Possible values are "round", "bevel" and "miter". Default is 'round'.
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.
[property:Integer vertexColors]
Define how the vertices gets colored. Possible values are THREE.NoColors, THREE.FaceColors and THREE.VertexColors. Default is THREE.NoColors.
This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.
[property:Boolean skinning]
Define whether the material uses skinning. Default is *false*.
[property:Boolean morphTargets]
Define whether the material uses morphTargets. Default is *false*.
[property:boolean morphNormals]
Defines whether the material uses morphNormals. Set as true to pass morphNormal attributes from the [page:Geometry]
to the shader. Default is *false*.
Methods
Source
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]