| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>MeshPhongMaterial - Three.js Docs</title>
- <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
- <script src="../scripts/highlight.min.js"></script>
- <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
- <link type="text/css" rel="stylesheet" href="../styles/page.css">
- </head>
- <body>
- <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Material.html">Material</a> → </p>
- <h1 translate="no">MeshPhongMaterial</h1>
- <section>
- <header>
- <div class="class-description"><p>A material for shiny surfaces with specular highlights.</p>
- <p>The material uses a non-physically based <a href="https://en.wikipedia.org/wiki/Blinn-Phong_shading_model" target="_blank" rel="noopener">Blinn-Phong</a>
- model for calculating reflectance. Unlike the Lambertian model used in the
- <a href="MeshLambertMaterial.html">MeshLambertMaterial</a> this can simulate shiny surfaces with specular
- highlights (such as varnished wood). <code>MeshPhongMaterial</code> uses per-fragment shading.</p>
- <p>Performance will generally be greater when using this material over the
- <a href="MeshStandardMaterial.html">MeshStandardMaterial</a> or <a href="MeshPhysicalMaterial.html">MeshPhysicalMaterial</a>, at the cost of
- some graphical accuracy.</p></div>
- <iframe id="viewer" src="../scenes/material-browser.html#MeshPhongMaterial"></iframe>
- </header>
- <article>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="MeshPhongMaterial" translate="no">new <a href="#MeshPhongMaterial">MeshPhongMaterial</a><span class="signature">( parameters : <span class="param-type">Object</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new mesh phong material.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>parameters</strong>
- </td>
- <td class="description last">
- <p>An object with one or more properties
- defining the material's appearance. Any property of the material
- (including any property from inherited materials) can be passed
- in here. Color values can be passed any type of value accepted
- by <a href="Color.html#set">Color#set</a>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="alphaMap" translate="no">.<a href="#alphaMap">alphaMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
- <div class="description">
- <p>The alpha map is a grayscale texture that controls the opacity across the
- surface (black: fully transparent; white: fully opaque).</p>
- <p>Only the color of the texture is used, ignoring the alpha channel if one
- exists. For RGB and RGBA textures, the 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.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="aoMap" translate="no">.<a href="#aoMap">aoMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
- <div class="description">
- <p>The red channel of this texture is used as the ambient occlusion map.
- Requires a second set of UVs.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="aoMapIntensity" translate="no">.<a href="#aoMapIntensity">aoMapIntensity</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>Intensity of the ambient occlusion effect. Range is <code>[0,1]</code>, where <code>0</code>
- disables ambient occlusion. Where intensity is <code>1</code> and the AO map's
- red channel is also <code>1</code>, ambient light is fully occluded on a surface.</p>
- <p>Default is <code>1</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="bumpMap" translate="no">.<a href="#bumpMap">bumpMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
- <div class="description">
- <p>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.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="bumpScale" translate="no">.<a href="#bumpScale">bumpScale</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>How much the bump map affects the material. Typical range is <code>[0,1]</code>.</p>
- <p>Default is <code>1</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="color" translate="no">.<a href="#color">color</a><span class="type-signature"> : <a href="Color.html">Color</a></span> </h3>
- <div class="description">
- <p>Color of the material.</p>
- <p>Default is <code>(1,1,1)</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="combine" translate="no">.<a href="#combine">combine</a><span class="type-signature"> : <a href="global.html#MultiplyOperation">MultiplyOperation</a> | <a href="global.html#MixOperation">MixOperation</a> | <a href="global.html#AddOperation">AddOperation</a></span> </h3>
- <div class="description">
- <p>How to combine the result of the surface's color with the environment map, if any.</p>
- <p>When set to <code>MixOperation</code>, the <a href="MeshBasicMaterial.html#reflectivity">MeshBasicMaterial#reflectivity</a> is used to
- blend between the two colors.</p>
- <p>Default is <code>MultiplyOperation</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="displacementBias" translate="no">.<a href="#displacementBias">displacementBias</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>The offset of the displacement map's values on the mesh's vertices.
- The bias is added to the scaled sample of the displacement map.
- Without a displacement map set, this value is not applied.</p>
- <p>Default is <code>0</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="displacementMap" translate="no">.<a href="#displacementMap">displacementMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
- <div class="description">
- <p>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.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="displacementScale" translate="no">.<a href="#displacementScale">displacementScale</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>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.</p>
- <p>Default is <code>0</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="emissive" translate="no">.<a href="#emissive">emissive</a><span class="type-signature"> : <a href="Color.html">Color</a></span> </h3>
- <div class="description">
- <p>Emissive (light) color of the material, essentially a solid color
- unaffected by other lighting.</p>
- <p>Default is <code>(0,0,0)</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="emissiveIntensity" translate="no">.<a href="#emissiveIntensity">emissiveIntensity</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>Intensity of the emissive light. Modulates the emissive color.</p>
- <p>Default is <code>1</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="emissiveMap" translate="no">.<a href="#emissiveMap">emissiveMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
- <div class="description">
- <p>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.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="envMap" translate="no">.<a href="#envMap">envMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
- <div class="description">
- <p>The environment map.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="envMapRotation" translate="no">.<a href="#envMapRotation">envMapRotation</a><span class="type-signature"> : <a href="Euler.html">Euler</a></span> </h3>
- <div class="description">
- <p>The rotation of the environment map in radians.</p>
- <p>Default is <code>(0,0,0)</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="flatShading" translate="no">.<a href="#flatShading">flatShading</a><span class="type-signature"> : boolean</span> </h3>
- <div class="description">
- <p>Whether the material is rendered with flat shading or not.</p>
- <p>Default is <code>false</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="fog" translate="no">.<a href="#fog">fog</a><span class="type-signature"> : boolean</span> </h3>
- <div class="description">
- <p>Whether the material is affected by fog or not.</p>
- <p>Default is <code>true</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="isMeshPhongMaterial" translate="no">.<a href="#isMeshPhongMaterial">isMeshPhongMaterial</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>This flag can be used for type testing.</p>
- <p>Default is <code>true</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="lightMap" translate="no">.<a href="#lightMap">lightMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
- <div class="description">
- <p>The light map. Requires a second set of UVs.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="lightMapIntensity" translate="no">.<a href="#lightMapIntensity">lightMapIntensity</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>Intensity of the baked light.</p>
- <p>Default is <code>1</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="map" translate="no">.<a href="#map">map</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
- <div class="description">
- <p>The color map. May optionally include an alpha channel, typically combined
- with <a href="Material.html#transparent">Material#transparent</a> or <a href="Material.html#alphaTest">Material#alphaTest</a>. The texture map
- color is modulated by the diffuse <code>color</code>.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="normalMap" translate="no">.<a href="#normalMap">normalMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
- <div class="description">
- <p>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. In
- case the material has a normal map authored using the left handed
- convention, the <code>y</code> component of <code>normalScale</code> should be negated to compensate
- for the different handedness.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="normalMapType" translate="no">.<a href="#normalMapType">normalMapType</a><span class="type-signature"> : <a href="global.html#TangentSpaceNormalMap">TangentSpaceNormalMap</a> | <a href="global.html#ObjectSpaceNormalMap">ObjectSpaceNormalMap</a></span> </h3>
- <div class="description">
- <p>The type of normal map.</p>
- <p>Default is <code>TangentSpaceNormalMap</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="normalScale" translate="no">.<a href="#normalScale">normalScale</a><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
- <div class="description">
- <p>How much the normal map affects the material. Typical value range is <code>[0,1]</code>.</p>
- <p>Default is <code>(1,1)</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="reflectivity" translate="no">.<a href="#reflectivity">reflectivity</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>How much the environment map affects the surface.
- The valid range is between <code>0</code> (no reflections) and <code>1</code> (full reflections).</p>
- <p>Default is <code>1</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="refractionRatio" translate="no">.<a href="#refractionRatio">refractionRatio</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>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 <a href="global.html#CubeRefractionMapping">CubeRefractionMapping</a> and <a href="global.html#EquirectangularRefractionMapping">EquirectangularRefractionMapping</a>.
- The refraction ratio should not exceed <code>1</code>.</p>
- <p>Default is <code>0.98</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="shininess" translate="no">.<a href="#shininess">shininess</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>How shiny the specular highlight is; a higher value gives a sharper highlight.</p>
- <p>Default is <code>30</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="specular" translate="no">.<a href="#specular">specular</a><span class="type-signature"> : <a href="Color.html">Color</a></span> </h3>
- <div class="description">
- <p>Specular color of the material. The default color is set to <code>0x111111</code> (very dark grey)</p>
- <p>This defines how shiny the material is and the color of its shine.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="specularMap" translate="no">.<a href="#specularMap">specularMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
- <div class="description">
- <p>The specular map value affects both how much the specular surface
- highlight contributes and how much of the environment map affects the
- surface.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="wireframe" translate="no">.<a href="#wireframe">wireframe</a><span class="type-signature"> : boolean</span> </h3>
- <div class="description">
- <p>Renders the geometry as a wireframe.</p>
- <p>Default is <code>false</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="wireframeLinecap" translate="no">.<a href="#wireframeLinecap">wireframeLinecap</a><span class="type-signature"> : 'round' | 'bevel' | 'miter'</span> </h3>
- <div class="description">
- <p>Defines appearance of wireframe ends.</p>
- <p>Can only be used with <a href="SVGRenderer.html">SVGRenderer</a>.</p>
- <p>Default is <code>'round'</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="wireframeLinejoin" translate="no">.<a href="#wireframeLinejoin">wireframeLinejoin</a><span class="type-signature"> : 'round' | 'bevel' | 'miter'</span> </h3>
- <div class="description">
- <p>Defines appearance of wireframe joints.</p>
- <p>Can only be used with <a href="SVGRenderer.html">SVGRenderer</a>.</p>
- <p>Default is <code>'round'</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="wireframeLinewidth" translate="no">.<a href="#wireframeLinewidth">wireframeLinewidth</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>Controls the thickness of the wireframe.</p>
- <p>Can only be used with <a href="SVGRenderer.html">SVGRenderer</a>.</p>
- <p>Default is <code>1</code>.</p>
- </div>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/src/materials/MeshPhongMaterial.js" translate="no" target="_blank" rel="noopener">src/materials/MeshPhongMaterial.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|