MeshPhongMaterial.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>MeshPhongMaterial - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Material.html">Material</a> → </p>
  13. <h1 translate="no">MeshPhongMaterial</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A material for shiny surfaces with specular highlights.</p>
  17. <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>
  18. model for calculating reflectance. Unlike the Lambertian model used in the
  19. <a href="MeshLambertMaterial.html">MeshLambertMaterial</a> this can simulate shiny surfaces with specular
  20. highlights (such as varnished wood). <code>MeshPhongMaterial</code> uses per-fragment shading.</p>
  21. <p>Performance will generally be greater when using this material over the
  22. <a href="MeshStandardMaterial.html">MeshStandardMaterial</a> or <a href="MeshPhysicalMaterial.html">MeshPhysicalMaterial</a>, at the cost of
  23. some graphical accuracy.</p></div>
  24. <iframe id="viewer" src="../scenes/material-browser.html#MeshPhongMaterial"></iframe>
  25. </header>
  26. <article>
  27. <div class="container-overview">
  28. <h2>Constructor</h2>
  29. <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>
  30. <div class="method">
  31. <div class="description">
  32. <p>Constructs a new mesh phong material.</p>
  33. </div>
  34. <table class="params">
  35. <tbody>
  36. <tr>
  37. <td class="name">
  38. <strong>parameters</strong>
  39. </td>
  40. <td class="description last">
  41. <p>An object with one or more properties
  42. defining the material's appearance. Any property of the material
  43. (including any property from inherited materials) can be passed
  44. in here. Color values can be passed any type of value accepted
  45. by <a href="Color.html#set">Color#set</a>.</p>
  46. </td>
  47. </tr>
  48. </tbody>
  49. </table>
  50. </div>
  51. </div>
  52. <h2 class="subsection-title">Properties</h2>
  53. <div class="member">
  54. <h3 class="name" id="alphaMap" translate="no">.<a href="#alphaMap">alphaMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  55. <div class="description">
  56. <p>The alpha map is a grayscale texture that controls the opacity across the
  57. surface (black: fully transparent; white: fully opaque).</p>
  58. <p>Only the color of the texture is used, ignoring the alpha channel if one
  59. exists. For RGB and RGBA textures, the renderer will use the green channel
  60. when sampling this texture due to the extra bit of precision provided for
  61. green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
  62. luminance/alpha textures will also still work as expected.</p>
  63. <p>Default is <code>null</code>.</p>
  64. </div>
  65. </div>
  66. <div class="member">
  67. <h3 class="name" id="aoMap" translate="no">.<a href="#aoMap">aoMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  68. <div class="description">
  69. <p>The red channel of this texture is used as the ambient occlusion map.
  70. Requires a second set of UVs.</p>
  71. <p>Default is <code>null</code>.</p>
  72. </div>
  73. </div>
  74. <div class="member">
  75. <h3 class="name" id="aoMapIntensity" translate="no">.<a href="#aoMapIntensity">aoMapIntensity</a><span class="type-signature"> : number</span> </h3>
  76. <div class="description">
  77. <p>Intensity of the ambient occlusion effect. Range is <code>[0,1]</code>, where <code>0</code>
  78. disables ambient occlusion. Where intensity is <code>1</code> and the AO map's
  79. red channel is also <code>1</code>, ambient light is fully occluded on a surface.</p>
  80. <p>Default is <code>1</code>.</p>
  81. </div>
  82. </div>
  83. <div class="member">
  84. <h3 class="name" id="bumpMap" translate="no">.<a href="#bumpMap">bumpMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  85. <div class="description">
  86. <p>The texture to create a bump map. The black and white values map to the
  87. perceived depth in relation to the lights. Bump doesn't actually affect
  88. the geometry of the object, only the lighting. If a normal map is defined
  89. this will be ignored.</p>
  90. <p>Default is <code>null</code>.</p>
  91. </div>
  92. </div>
  93. <div class="member">
  94. <h3 class="name" id="bumpScale" translate="no">.<a href="#bumpScale">bumpScale</a><span class="type-signature"> : number</span> </h3>
  95. <div class="description">
  96. <p>How much the bump map affects the material. Typical range is <code>[0,1]</code>.</p>
  97. <p>Default is <code>1</code>.</p>
  98. </div>
  99. </div>
  100. <div class="member">
  101. <h3 class="name" id="color" translate="no">.<a href="#color">color</a><span class="type-signature"> : <a href="Color.html">Color</a></span> </h3>
  102. <div class="description">
  103. <p>Color of the material.</p>
  104. <p>Default is <code>(1,1,1)</code>.</p>
  105. </div>
  106. </div>
  107. <div class="member">
  108. <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>
  109. <div class="description">
  110. <p>How to combine the result of the surface's color with the environment map, if any.</p>
  111. <p>When set to <code>MixOperation</code>, the <a href="MeshBasicMaterial.html#reflectivity">MeshBasicMaterial#reflectivity</a> is used to
  112. blend between the two colors.</p>
  113. <p>Default is <code>MultiplyOperation</code>.</p>
  114. </div>
  115. </div>
  116. <div class="member">
  117. <h3 class="name" id="displacementBias" translate="no">.<a href="#displacementBias">displacementBias</a><span class="type-signature"> : number</span> </h3>
  118. <div class="description">
  119. <p>The offset of the displacement map's values on the mesh's vertices.
  120. The bias is added to the scaled sample of the displacement map.
  121. Without a displacement map set, this value is not applied.</p>
  122. <p>Default is <code>0</code>.</p>
  123. </div>
  124. </div>
  125. <div class="member">
  126. <h3 class="name" id="displacementMap" translate="no">.<a href="#displacementMap">displacementMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  127. <div class="description">
  128. <p>The displacement map affects the position of the mesh's vertices. Unlike
  129. other maps which only affect the light and shade of the material the
  130. displaced vertices can cast shadows, block other objects, and otherwise
  131. act as real geometry. The displacement texture is an image where the value
  132. of each pixel (white being the highest) is mapped against, and
  133. repositions, the vertices of the mesh.</p>
  134. <p>Default is <code>null</code>.</p>
  135. </div>
  136. </div>
  137. <div class="member">
  138. <h3 class="name" id="displacementScale" translate="no">.<a href="#displacementScale">displacementScale</a><span class="type-signature"> : number</span> </h3>
  139. <div class="description">
  140. <p>How much the displacement map affects the mesh (where black is no
  141. displacement, and white is maximum displacement). Without a displacement
  142. map set, this value is not applied.</p>
  143. <p>Default is <code>0</code>.</p>
  144. </div>
  145. </div>
  146. <div class="member">
  147. <h3 class="name" id="emissive" translate="no">.<a href="#emissive">emissive</a><span class="type-signature"> : <a href="Color.html">Color</a></span> </h3>
  148. <div class="description">
  149. <p>Emissive (light) color of the material, essentially a solid color
  150. unaffected by other lighting.</p>
  151. <p>Default is <code>(0,0,0)</code>.</p>
  152. </div>
  153. </div>
  154. <div class="member">
  155. <h3 class="name" id="emissiveIntensity" translate="no">.<a href="#emissiveIntensity">emissiveIntensity</a><span class="type-signature"> : number</span> </h3>
  156. <div class="description">
  157. <p>Intensity of the emissive light. Modulates the emissive color.</p>
  158. <p>Default is <code>1</code>.</p>
  159. </div>
  160. </div>
  161. <div class="member">
  162. <h3 class="name" id="emissiveMap" translate="no">.<a href="#emissiveMap">emissiveMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  163. <div class="description">
  164. <p>Set emissive (glow) map. The emissive map color is modulated by the
  165. emissive color and the emissive intensity. If you have an emissive map,
  166. be sure to set the emissive color to something other than black.</p>
  167. <p>Default is <code>null</code>.</p>
  168. </div>
  169. </div>
  170. <div class="member">
  171. <h3 class="name" id="envMap" translate="no">.<a href="#envMap">envMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  172. <div class="description">
  173. <p>The environment map.</p>
  174. <p>Default is <code>null</code>.</p>
  175. </div>
  176. </div>
  177. <div class="member">
  178. <h3 class="name" id="envMapRotation" translate="no">.<a href="#envMapRotation">envMapRotation</a><span class="type-signature"> : <a href="Euler.html">Euler</a></span> </h3>
  179. <div class="description">
  180. <p>The rotation of the environment map in radians.</p>
  181. <p>Default is <code>(0,0,0)</code>.</p>
  182. </div>
  183. </div>
  184. <div class="member">
  185. <h3 class="name" id="flatShading" translate="no">.<a href="#flatShading">flatShading</a><span class="type-signature"> : boolean</span> </h3>
  186. <div class="description">
  187. <p>Whether the material is rendered with flat shading or not.</p>
  188. <p>Default is <code>false</code>.</p>
  189. </div>
  190. </div>
  191. <div class="member">
  192. <h3 class="name" id="fog" translate="no">.<a href="#fog">fog</a><span class="type-signature"> : boolean</span> </h3>
  193. <div class="description">
  194. <p>Whether the material is affected by fog or not.</p>
  195. <p>Default is <code>true</code>.</p>
  196. </div>
  197. </div>
  198. <div class="member">
  199. <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>
  200. <div class="description">
  201. <p>This flag can be used for type testing.</p>
  202. <p>Default is <code>true</code>.</p>
  203. </div>
  204. </div>
  205. <div class="member">
  206. <h3 class="name" id="lightMap" translate="no">.<a href="#lightMap">lightMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  207. <div class="description">
  208. <p>The light map. Requires a second set of UVs.</p>
  209. <p>Default is <code>null</code>.</p>
  210. </div>
  211. </div>
  212. <div class="member">
  213. <h3 class="name" id="lightMapIntensity" translate="no">.<a href="#lightMapIntensity">lightMapIntensity</a><span class="type-signature"> : number</span> </h3>
  214. <div class="description">
  215. <p>Intensity of the baked light.</p>
  216. <p>Default is <code>1</code>.</p>
  217. </div>
  218. </div>
  219. <div class="member">
  220. <h3 class="name" id="map" translate="no">.<a href="#map">map</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  221. <div class="description">
  222. <p>The color map. May optionally include an alpha channel, typically combined
  223. with <a href="Material.html#transparent">Material#transparent</a> or <a href="Material.html#alphaTest">Material#alphaTest</a>. The texture map
  224. color is modulated by the diffuse <code>color</code>.</p>
  225. <p>Default is <code>null</code>.</p>
  226. </div>
  227. </div>
  228. <div class="member">
  229. <h3 class="name" id="normalMap" translate="no">.<a href="#normalMap">normalMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  230. <div class="description">
  231. <p>The texture to create a normal map. The RGB values affect the surface
  232. normal for each pixel fragment and change the way the color is lit. Normal
  233. maps do not change the actual shape of the surface, only the lighting. In
  234. case the material has a normal map authored using the left handed
  235. convention, the <code>y</code> component of <code>normalScale</code> should be negated to compensate
  236. for the different handedness.</p>
  237. <p>Default is <code>null</code>.</p>
  238. </div>
  239. </div>
  240. <div class="member">
  241. <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>
  242. <div class="description">
  243. <p>The type of normal map.</p>
  244. <p>Default is <code>TangentSpaceNormalMap</code>.</p>
  245. </div>
  246. </div>
  247. <div class="member">
  248. <h3 class="name" id="normalScale" translate="no">.<a href="#normalScale">normalScale</a><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  249. <div class="description">
  250. <p>How much the normal map affects the material. Typical value range is <code>[0,1]</code>.</p>
  251. <p>Default is <code>(1,1)</code>.</p>
  252. </div>
  253. </div>
  254. <div class="member">
  255. <h3 class="name" id="reflectivity" translate="no">.<a href="#reflectivity">reflectivity</a><span class="type-signature"> : number</span> </h3>
  256. <div class="description">
  257. <p>How much the environment map affects the surface.
  258. The valid range is between <code>0</code> (no reflections) and <code>1</code> (full reflections).</p>
  259. <p>Default is <code>1</code>.</p>
  260. </div>
  261. </div>
  262. <div class="member">
  263. <h3 class="name" id="refractionRatio" translate="no">.<a href="#refractionRatio">refractionRatio</a><span class="type-signature"> : number</span> </h3>
  264. <div class="description">
  265. <p>The index of refraction (IOR) of air (approximately 1) divided by the
  266. index of refraction of the material. It is used with environment mapping
  267. modes <a href="global.html#CubeRefractionMapping">CubeRefractionMapping</a> and <a href="global.html#EquirectangularRefractionMapping">EquirectangularRefractionMapping</a>.
  268. The refraction ratio should not exceed <code>1</code>.</p>
  269. <p>Default is <code>0.98</code>.</p>
  270. </div>
  271. </div>
  272. <div class="member">
  273. <h3 class="name" id="shininess" translate="no">.<a href="#shininess">shininess</a><span class="type-signature"> : number</span> </h3>
  274. <div class="description">
  275. <p>How shiny the specular highlight is; a higher value gives a sharper highlight.</p>
  276. <p>Default is <code>30</code>.</p>
  277. </div>
  278. </div>
  279. <div class="member">
  280. <h3 class="name" id="specular" translate="no">.<a href="#specular">specular</a><span class="type-signature"> : <a href="Color.html">Color</a></span> </h3>
  281. <div class="description">
  282. <p>Specular color of the material. The default color is set to <code>0x111111</code> (very dark grey)</p>
  283. <p>This defines how shiny the material is and the color of its shine.</p>
  284. </div>
  285. </div>
  286. <div class="member">
  287. <h3 class="name" id="specularMap" translate="no">.<a href="#specularMap">specularMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  288. <div class="description">
  289. <p>The specular map value affects both how much the specular surface
  290. highlight contributes and how much of the environment map affects the
  291. surface.</p>
  292. <p>Default is <code>null</code>.</p>
  293. </div>
  294. </div>
  295. <div class="member">
  296. <h3 class="name" id="wireframe" translate="no">.<a href="#wireframe">wireframe</a><span class="type-signature"> : boolean</span> </h3>
  297. <div class="description">
  298. <p>Renders the geometry as a wireframe.</p>
  299. <p>Default is <code>false</code>.</p>
  300. </div>
  301. </div>
  302. <div class="member">
  303. <h3 class="name" id="wireframeLinecap" translate="no">.<a href="#wireframeLinecap">wireframeLinecap</a><span class="type-signature"> : 'round' | 'bevel' | 'miter'</span> </h3>
  304. <div class="description">
  305. <p>Defines appearance of wireframe ends.</p>
  306. <p>Can only be used with <a href="SVGRenderer.html">SVGRenderer</a>.</p>
  307. <p>Default is <code>'round'</code>.</p>
  308. </div>
  309. </div>
  310. <div class="member">
  311. <h3 class="name" id="wireframeLinejoin" translate="no">.<a href="#wireframeLinejoin">wireframeLinejoin</a><span class="type-signature"> : 'round' | 'bevel' | 'miter'</span> </h3>
  312. <div class="description">
  313. <p>Defines appearance of wireframe joints.</p>
  314. <p>Can only be used with <a href="SVGRenderer.html">SVGRenderer</a>.</p>
  315. <p>Default is <code>'round'</code>.</p>
  316. </div>
  317. </div>
  318. <div class="member">
  319. <h3 class="name" id="wireframeLinewidth" translate="no">.<a href="#wireframeLinewidth">wireframeLinewidth</a><span class="type-signature"> : number</span> </h3>
  320. <div class="description">
  321. <p>Controls the thickness of the wireframe.</p>
  322. <p>Can only be used with <a href="SVGRenderer.html">SVGRenderer</a>.</p>
  323. <p>Default is <code>1</code>.</p>
  324. </div>
  325. </div>
  326. <h2 class="subsection-title">Source</h2>
  327. <p>
  328. <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>
  329. </p>
  330. </article>
  331. </section>
  332. <script src="../scripts/linenumber.js"></script>
  333. <script src="../scripts/page.js"></script>
  334. </body>
  335. </html>
粤ICP备19079148号