MeshStandardMaterial.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>MeshStandardMaterial - 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">MeshStandardMaterial</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A standard physically based material, using Metallic-Roughness workflow.</p>
  17. <p>Physically based rendering (PBR) has recently become the standard in many
  18. 3D applications, such as <a href="https://blogs.unity3d.com/2014/10/29/physically-based-shading-in-unity-5-a-primer/" target="_blank" rel="noopener">Unity</a>,
  19. <a href="https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/PhysicallyBased/" target="_blank" rel="noopener">Unreal</a> and
  20. <a href="http://area.autodesk.com/blogs/the-3ds-max-blog/what039s-new-for-rendering-in-3ds-max-2017" target="_blank" rel="noopener">3D Studio Max</a>.</p>
  21. <p>This approach differs from older approaches in that instead of using
  22. approximations for the way in which light interacts with a surface, a
  23. physically correct model is used. The idea is that, instead of tweaking
  24. materials to look good under specific lighting, a material can be created
  25. that will react 'correctly' under all lighting scenarios.</p>
  26. <p>In practice this gives a more accurate and realistic looking result than
  27. the <a href="MeshLambertMaterial.html">MeshLambertMaterial</a> or <a href="MeshPhongMaterial.html">MeshPhongMaterial</a>, at the cost of
  28. being somewhat more computationally expensive. <code>MeshStandardMaterial</code> uses per-fragment
  29. shading.</p>
  30. <p>Note that for best results you should always specify an environment map when using this material.</p>
  31. <p>For a non-technical introduction to the concept of PBR and how to set up a
  32. PBR material, check out these articles by the people at <a href="https://www.marmoset.co" target="_blank" rel="noopener">marmoset</a>:</p>
  33. <ul>
  34. <li><a href="https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/" target="_blank" rel="noopener">Basic Theory of Physically Based Rendering</a></li>
  35. <li><a href="https://www.marmoset.co/posts/physically-based-rendering-and-you-can-too/" target="_blank" rel="noopener">Physically Based Rendering and You Can Too</a></li>
  36. </ul>
  37. <p>Technical details of the approach used in three.js (and most other PBR systems) can be found is this
  38. <a href="https://media.disneyanimation.com/uploads/production/publication_asset/48/asset/s2012_pbs_disney_brdf_notes_v3.pdf" target="_blank" rel="noopener">paper from Disney</a>
  39. (pdf), by Brent Burley.</p></div>
  40. <iframe id="viewer" src="../scenes/material-browser.html#MeshStandardMaterial"></iframe>
  41. </header>
  42. <article>
  43. <div class="container-overview">
  44. <h2>Constructor</h2>
  45. <h3 class="name name-method" id="MeshStandardMaterial" translate="no">new <a href="#MeshStandardMaterial">MeshStandardMaterial</a><span class="signature">( parameters : <span class="param-type">Object</span> )</span> </h3>
  46. <div class="method">
  47. <div class="description">
  48. <p>Constructs a new mesh standard material.</p>
  49. </div>
  50. <table class="params">
  51. <tbody>
  52. <tr>
  53. <td class="name">
  54. <strong>parameters</strong>
  55. </td>
  56. <td class="description last">
  57. <p>An object with one or more properties
  58. defining the material's appearance. Any property of the material
  59. (including any property from inherited materials) can be passed
  60. in here. Color values can be passed any type of value accepted
  61. by <a href="Color.html#set">Color#set</a>.</p>
  62. </td>
  63. </tr>
  64. </tbody>
  65. </table>
  66. </div>
  67. </div>
  68. <h2 class="subsection-title">Properties</h2>
  69. <div class="member">
  70. <h3 class="name" id="alphaMap" translate="no">.<a href="#alphaMap">alphaMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  71. <div class="description">
  72. <p>The alpha map is a grayscale texture that controls the opacity across the
  73. surface (black: fully transparent; white: fully opaque).</p>
  74. <p>Only the color of the texture is used, ignoring the alpha channel if one
  75. exists. For RGB and RGBA textures, the renderer will use the green channel
  76. when sampling this texture due to the extra bit of precision provided for
  77. green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
  78. luminance/alpha textures will also still work as expected.</p>
  79. <p>Default is <code>null</code>.</p>
  80. </div>
  81. </div>
  82. <div class="member">
  83. <h3 class="name" id="aoMap" translate="no">.<a href="#aoMap">aoMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  84. <div class="description">
  85. <p>The red channel of this texture is used as the ambient occlusion map.
  86. Requires a second set of UVs.</p>
  87. <p>Default is <code>null</code>.</p>
  88. </div>
  89. </div>
  90. <div class="member">
  91. <h3 class="name" id="aoMapIntensity" translate="no">.<a href="#aoMapIntensity">aoMapIntensity</a><span class="type-signature"> : number</span> </h3>
  92. <div class="description">
  93. <p>Intensity of the ambient occlusion effect. Range is <code>[0,1]</code>, where <code>0</code>
  94. disables ambient occlusion. Where intensity is <code>1</code> and the AO map's
  95. red channel is also <code>1</code>, ambient light is fully occluded on a surface.</p>
  96. <p>Default is <code>1</code>.</p>
  97. </div>
  98. </div>
  99. <div class="member">
  100. <h3 class="name" id="bumpMap" translate="no">.<a href="#bumpMap">bumpMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  101. <div class="description">
  102. <p>The texture to create a bump map. The black and white values map to the
  103. perceived depth in relation to the lights. Bump doesn't actually affect
  104. the geometry of the object, only the lighting. If a normal map is defined
  105. this will be ignored.</p>
  106. <p>Default is <code>null</code>.</p>
  107. </div>
  108. </div>
  109. <div class="member">
  110. <h3 class="name" id="bumpScale" translate="no">.<a href="#bumpScale">bumpScale</a><span class="type-signature"> : number</span> </h3>
  111. <div class="description">
  112. <p>How much the bump map affects the material. Typical range is <code>[0,1]</code>.</p>
  113. <p>Default is <code>1</code>.</p>
  114. </div>
  115. </div>
  116. <div class="member">
  117. <h3 class="name" id="color" translate="no">.<a href="#color">color</a><span class="type-signature"> : <a href="Color.html">Color</a></span> </h3>
  118. <div class="description">
  119. <p>Color of the material.</p>
  120. <p>Default is <code>(1,1,1)</code>.</p>
  121. </div>
  122. </div>
  123. <div class="member">
  124. <h3 class="name" id="displacementBias" translate="no">.<a href="#displacementBias">displacementBias</a><span class="type-signature"> : number</span> </h3>
  125. <div class="description">
  126. <p>The offset of the displacement map's values on the mesh's vertices.
  127. The bias is added to the scaled sample of the displacement map.
  128. Without a displacement map set, this value is not applied.</p>
  129. <p>Default is <code>0</code>.</p>
  130. </div>
  131. </div>
  132. <div class="member">
  133. <h3 class="name" id="displacementMap" translate="no">.<a href="#displacementMap">displacementMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  134. <div class="description">
  135. <p>The displacement map affects the position of the mesh's vertices. Unlike
  136. other maps which only affect the light and shade of the material the
  137. displaced vertices can cast shadows, block other objects, and otherwise
  138. act as real geometry. The displacement texture is an image where the value
  139. of each pixel (white being the highest) is mapped against, and
  140. repositions, the vertices of the mesh.</p>
  141. <p>Default is <code>null</code>.</p>
  142. </div>
  143. </div>
  144. <div class="member">
  145. <h3 class="name" id="displacementScale" translate="no">.<a href="#displacementScale">displacementScale</a><span class="type-signature"> : number</span> </h3>
  146. <div class="description">
  147. <p>How much the displacement map affects the mesh (where black is no
  148. displacement, and white is maximum displacement). Without a displacement
  149. map set, this value is not applied.</p>
  150. <p>Default is <code>0</code>.</p>
  151. </div>
  152. </div>
  153. <div class="member">
  154. <h3 class="name" id="emissive" translate="no">.<a href="#emissive">emissive</a><span class="type-signature"> : <a href="Color.html">Color</a></span> </h3>
  155. <div class="description">
  156. <p>Emissive (light) color of the material, essentially a solid color
  157. unaffected by other lighting.</p>
  158. <p>Default is <code>(0,0,0)</code>.</p>
  159. </div>
  160. </div>
  161. <div class="member">
  162. <h3 class="name" id="emissiveIntensity" translate="no">.<a href="#emissiveIntensity">emissiveIntensity</a><span class="type-signature"> : number</span> </h3>
  163. <div class="description">
  164. <p>Intensity of the emissive light. Modulates the emissive color.</p>
  165. <p>Default is <code>1</code>.</p>
  166. </div>
  167. </div>
  168. <div class="member">
  169. <h3 class="name" id="emissiveMap" translate="no">.<a href="#emissiveMap">emissiveMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  170. <div class="description">
  171. <p>Set emissive (glow) map. The emissive map color is modulated by the
  172. emissive color and the emissive intensity. If you have an emissive map,
  173. be sure to set the emissive color to something other than black.</p>
  174. <p>Default is <code>null</code>.</p>
  175. </div>
  176. </div>
  177. <div class="member">
  178. <h3 class="name" id="envMap" translate="no">.<a href="#envMap">envMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  179. <div class="description">
  180. <p>The environment map. To ensure a physically correct rendering, environment maps
  181. are internally pre-processed with <a href="PMREMGenerator.html">PMREMGenerator</a>.</p>
  182. <p>Default is <code>null</code>.</p>
  183. </div>
  184. </div>
  185. <div class="member">
  186. <h3 class="name" id="envMapIntensity" translate="no">.<a href="#envMapIntensity">envMapIntensity</a><span class="type-signature"> : number</span> </h3>
  187. <div class="description">
  188. <p>Scales the effect of the environment map by multiplying its color.</p>
  189. <p>Default is <code>1</code>.</p>
  190. </div>
  191. </div>
  192. <div class="member">
  193. <h3 class="name" id="envMapRotation" translate="no">.<a href="#envMapRotation">envMapRotation</a><span class="type-signature"> : <a href="Euler.html">Euler</a></span> </h3>
  194. <div class="description">
  195. <p>The rotation of the environment map in radians.</p>
  196. <p>Default is <code>(0,0,0)</code>.</p>
  197. </div>
  198. </div>
  199. <div class="member">
  200. <h3 class="name" id="flatShading" translate="no">.<a href="#flatShading">flatShading</a><span class="type-signature"> : boolean</span> </h3>
  201. <div class="description">
  202. <p>Whether the material is rendered with flat shading or not.</p>
  203. <p>Default is <code>false</code>.</p>
  204. </div>
  205. </div>
  206. <div class="member">
  207. <h3 class="name" id="fog" translate="no">.<a href="#fog">fog</a><span class="type-signature"> : boolean</span> </h3>
  208. <div class="description">
  209. <p>Whether the material is affected by fog or not.</p>
  210. <p>Default is <code>true</code>.</p>
  211. </div>
  212. </div>
  213. <div class="member">
  214. <h3 class="name" id="isMeshStandardMaterial" translate="no">.<a href="#isMeshStandardMaterial">isMeshStandardMaterial</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  215. <div class="description">
  216. <p>This flag can be used for type testing.</p>
  217. <p>Default is <code>true</code>.</p>
  218. </div>
  219. </div>
  220. <div class="member">
  221. <h3 class="name" id="lightMap" translate="no">.<a href="#lightMap">lightMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  222. <div class="description">
  223. <p>The light map. Requires a second set of UVs.</p>
  224. <p>Default is <code>null</code>.</p>
  225. </div>
  226. </div>
  227. <div class="member">
  228. <h3 class="name" id="lightMapIntensity" translate="no">.<a href="#lightMapIntensity">lightMapIntensity</a><span class="type-signature"> : number</span> </h3>
  229. <div class="description">
  230. <p>Intensity of the baked light.</p>
  231. <p>Default is <code>1</code>.</p>
  232. </div>
  233. </div>
  234. <div class="member">
  235. <h3 class="name" id="map" translate="no">.<a href="#map">map</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  236. <div class="description">
  237. <p>The color map. May optionally include an alpha channel, typically combined
  238. with <a href="Material.html#transparent">Material#transparent</a> or <a href="Material.html#alphaTest">Material#alphaTest</a>. The texture map
  239. color is modulated by the diffuse <code>color</code>.</p>
  240. <p>Default is <code>null</code>.</p>
  241. </div>
  242. </div>
  243. <div class="member">
  244. <h3 class="name" id="metalness" translate="no">.<a href="#metalness">metalness</a><span class="type-signature"> : number</span> </h3>
  245. <div class="description">
  246. <p>How much the material is like a metal. Non-metallic materials such as wood
  247. or stone use <code>0.0</code>, metallic use <code>1.0</code>, with nothing (usually) in between.
  248. A value between <code>0.0</code> and <code>1.0</code> could be used for a rusty metal look.
  249. If <code>metalnessMap</code> is also provided, both values are multiplied.</p>
  250. <p>Default is <code>0</code>.</p>
  251. </div>
  252. </div>
  253. <div class="member">
  254. <h3 class="name" id="metalnessMap" translate="no">.<a href="#metalnessMap">metalnessMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  255. <div class="description">
  256. <p>The blue channel of this texture is used to alter the metalness of the
  257. material.</p>
  258. <p>Default is <code>null</code>.</p>
  259. </div>
  260. </div>
  261. <div class="member">
  262. <h3 class="name" id="normalMap" translate="no">.<a href="#normalMap">normalMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  263. <div class="description">
  264. <p>The texture to create a normal map. The RGB values affect the surface
  265. normal for each pixel fragment and change the way the color is lit. Normal
  266. maps do not change the actual shape of the surface, only the lighting. In
  267. case the material has a normal map authored using the left handed
  268. convention, the <code>y</code> component of <code>normalScale</code> should be negated to compensate
  269. for the different handedness.</p>
  270. <p>Default is <code>null</code>.</p>
  271. </div>
  272. </div>
  273. <div class="member">
  274. <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>
  275. <div class="description">
  276. <p>The type of normal map.</p>
  277. <p>Default is <code>TangentSpaceNormalMap</code>.</p>
  278. </div>
  279. </div>
  280. <div class="member">
  281. <h3 class="name" id="normalScale" translate="no">.<a href="#normalScale">normalScale</a><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  282. <div class="description">
  283. <p>How much the normal map affects the material. Typical value range is <code>[0,1]</code>.</p>
  284. <p>Default is <code>(1,1)</code>.</p>
  285. </div>
  286. </div>
  287. <div class="member">
  288. <h3 class="name" id="roughness" translate="no">.<a href="#roughness">roughness</a><span class="type-signature"> : number</span> </h3>
  289. <div class="description">
  290. <p>How rough the material appears. <code>0.0</code> means a smooth mirror reflection, <code>1.0</code>
  291. means fully diffuse. If <code>roughnessMap</code> is also provided,
  292. both values are multiplied.</p>
  293. <p>Default is <code>1</code>.</p>
  294. </div>
  295. </div>
  296. <div class="member">
  297. <h3 class="name" id="roughnessMap" translate="no">.<a href="#roughnessMap">roughnessMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  298. <div class="description">
  299. <p>The green channel of this texture is used to alter the roughness of the
  300. material.</p>
  301. <p>Default is <code>null</code>.</p>
  302. </div>
  303. </div>
  304. <div class="member">
  305. <h3 class="name" id="wireframe" translate="no">.<a href="#wireframe">wireframe</a><span class="type-signature"> : boolean</span> </h3>
  306. <div class="description">
  307. <p>Renders the geometry as a wireframe.</p>
  308. <p>Default is <code>false</code>.</p>
  309. </div>
  310. </div>
  311. <div class="member">
  312. <h3 class="name" id="wireframeLinecap" translate="no">.<a href="#wireframeLinecap">wireframeLinecap</a><span class="type-signature"> : 'round' | 'bevel' | 'miter'</span> </h3>
  313. <div class="description">
  314. <p>Defines appearance of wireframe ends.</p>
  315. <p>Can only be used with <a href="SVGRenderer.html">SVGRenderer</a>.</p>
  316. <p>Default is <code>'round'</code>.</p>
  317. </div>
  318. </div>
  319. <div class="member">
  320. <h3 class="name" id="wireframeLinejoin" translate="no">.<a href="#wireframeLinejoin">wireframeLinejoin</a><span class="type-signature"> : 'round' | 'bevel' | 'miter'</span> </h3>
  321. <div class="description">
  322. <p>Defines appearance of wireframe joints.</p>
  323. <p>Can only be used with <a href="SVGRenderer.html">SVGRenderer</a>.</p>
  324. <p>Default is <code>'round'</code>.</p>
  325. </div>
  326. </div>
  327. <div class="member">
  328. <h3 class="name" id="wireframeLinewidth" translate="no">.<a href="#wireframeLinewidth">wireframeLinewidth</a><span class="type-signature"> : number</span> </h3>
  329. <div class="description">
  330. <p>Controls the thickness of the wireframe.</p>
  331. <p>Can only be used with <a href="SVGRenderer.html">SVGRenderer</a>.</p>
  332. <p>Default is <code>1</code>.</p>
  333. </div>
  334. </div>
  335. <h2 class="subsection-title">Source</h2>
  336. <p>
  337. <a href="https://github.com/mrdoob/three.js/blob/master/src/materials/MeshStandardMaterial.js" translate="no" target="_blank" rel="noopener">src/materials/MeshStandardMaterial.js</a>
  338. </p>
  339. </article>
  340. </section>
  341. <script src="../scripts/linenumber.js"></script>
  342. <script src="../scripts/page.js"></script>
  343. </body>
  344. </html>
粤ICP备19079148号