1
0

MeshStandardMaterial.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:Material] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">
  13. A standard physically based material, using Metallic-Roughness
  14. workflow.<br /><br />
  15. Physically based rendering (PBR) has recently become the standard in many
  16. 3D applications, such as
  17. [link:https://blogs.unity3d.com/2014/10/29/physically-based-shading-in-unity-5-a-primer/ Unity],
  18. [link:https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/PhysicallyBased/ Unreal] and
  19. [link:http://area.autodesk.com/blogs/the-3ds-max-blog/what039s-new-for-rendering-in-3ds-max-2017 3D Studio Max].<br /><br />
  20. This approach differs from older approaches in that instead of using
  21. approximations for the way in which light interacts with a surface, a
  22. physically correct model is used. The idea is that, instead of tweaking
  23. materials to look good under specific lighting, a material can be created
  24. that will react 'correctly' under all lighting scenarios.<br /><br />
  25. In practice this gives a more accurate and realistic looking result than
  26. the [page:MeshLambertMaterial] or [page:MeshPhongMaterial], at the cost of
  27. being somewhat more computationally expensive. [name] uses per-fragment
  28. shading.<br /><br />
  29. Note that for best results you should always specify an [page:.envMap environment map]
  30. when using this material.<br /><br />
  31. 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
  33. [link:https://www.marmoset.co marmoset]:
  34. </p>
  35. <ul>
  36. <li>
  37. [link:https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/ Basic Theory of Physically Based Rendering]
  38. </li>
  39. <li>
  40. [link:https://www.marmoset.co/posts/physically-based-rendering-and-you-can-too/ Physically Based Rendering and You Can Too]
  41. </li>
  42. </ul>
  43. <p>
  44. Technical details of the approach used in three.js (and most other PBR
  45. systems) can be found is this
  46. [link:https://media.disneyanimation.com/uploads/production/publication_asset/48/asset/s2012_pbs_disney_brdf_notes_v3.pdf paper from Disney]
  47. (pdf), by Brent Burley.
  48. </p>
  49. <iframe
  50. id="scene"
  51. src="scenes/material-browser.html#MeshStandardMaterial"
  52. ></iframe>
  53. <script>
  54. // iOS iframe auto-resize workaround
  55. if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
  56. const scene = document.getElementById( 'scene' );
  57. scene.style.width = getComputedStyle( scene ).width;
  58. scene.style.height = getComputedStyle( scene ).height;
  59. scene.setAttribute( 'scrolling', 'no' );
  60. }
  61. </script>
  62. <h2>Constructor</h2>
  63. <h3>[name]( [param:Object parameters] )</h3>
  64. <p>
  65. [page:Object parameters] - (optional) an object with one or more
  66. properties defining the material's appearance. Any property of the
  67. material (including any property inherited from [page:Material]) can be
  68. passed in here.<br /><br />
  69. The exception is the property [page:Hexadecimal color], which can be
  70. passed in as a hexadecimal string and is `0xffffff` (white) by default.
  71. [page:Color.set]( color ) is called internally.
  72. </p>
  73. <h2>Properties</h2>
  74. <p>See the base [page:Material] class for common properties.</p>
  75. <h3>[property:Texture alphaMap]</h3>
  76. <p>
  77. The alpha map is a grayscale texture that controls the opacity across the
  78. surface (black: fully transparent; white: fully opaque). Default is
  79. null.<br /><br />
  80. Only the color of the texture is used, ignoring the alpha channel if one
  81. exists. For RGB and RGBA textures, the [page:WebGLRenderer WebGL] renderer
  82. will use the green channel when sampling this texture due to the extra bit
  83. of precision provided for green in DXT-compressed and uncompressed RGB 565
  84. formats. Luminance-only and luminance/alpha textures will also still work
  85. as expected.
  86. </p>
  87. <h3>[property:Texture aoMap]</h3>
  88. <p>
  89. The red channel of this texture is used as the ambient occlusion map.
  90. Default is null. The aoMap requires a second set of UVs.
  91. </p>
  92. <h3>[property:Float aoMapIntensity]</h3>
  93. <p>
  94. Intensity of the ambient occlusion effect. Range is 0-1, where `0`
  95. disables ambient occlusion. Where intensity is `1` and the [page:.aoMap]
  96. red channel is also `1`, ambient light is fully occluded on a surface.
  97. Default is `1`.
  98. </p>
  99. <h3>[property:Texture bumpMap]</h3>
  100. <p>
  101. The texture to create a bump map. The black and white values map to the
  102. perceived depth in relation to the lights. Bump doesn't actually affect
  103. the geometry of the object, only the lighting. If a normal map is defined
  104. this will be ignored.
  105. </p>
  106. <h3>[property:Float bumpScale]</h3>
  107. <p>
  108. How much the bump map affects the material. Typical ranges are 0-1.
  109. Default is `1`.
  110. </p>
  111. <h3>[property:Color color]</h3>
  112. <p>[page:Color] of the material, by default set to white (0xffffff).</p>
  113. <h3>[property:Object defines]</h3>
  114. <p>
  115. An object of the form:
  116. <code> { 'STANDARD': '' }; </code>
  117. This is used by the [page:WebGLRenderer] for selecting shaders.
  118. </p>
  119. <h3>[property:Texture displacementMap]</h3>
  120. <p>
  121. The displacement map affects the position of the mesh's vertices. Unlike
  122. other maps which only affect the light and shade of the material the
  123. displaced vertices can cast shadows, block other objects, and otherwise
  124. act as real geometry. The displacement texture is an image where the value
  125. of each pixel (white being the highest) is mapped against, and
  126. repositions, the vertices of the mesh.
  127. </p>
  128. <h3>[property:Float displacementScale]</h3>
  129. <p>
  130. How much the displacement map affects the mesh (where black is no
  131. displacement, and white is maximum displacement). Without a displacement
  132. map set, this value is not applied. Default is `1`.
  133. </p>
  134. <h3>[property:Float displacementBias]</h3>
  135. <p>
  136. The offset of the displacement map's values on the mesh's vertices.
  137. Without a displacement map set, this value is not applied. Default is `0`.
  138. </p>
  139. <h3>[property:Color emissive]</h3>
  140. <p>
  141. Emissive (light) color of the material, essentially a solid color
  142. unaffected by other lighting. Default is black.
  143. </p>
  144. <h3>[property:Texture emissiveMap]</h3>
  145. <p>
  146. Set emissive (glow) map. Default is null. The emissive map color is
  147. modulated by the emissive color and the emissive intensity. If you have an
  148. emissive map, be sure to set the emissive color to something other than
  149. black.
  150. </p>
  151. <h3>[property:Float emissiveIntensity]</h3>
  152. <p>
  153. Intensity of the emissive light. Modulates the emissive color. Default is
  154. 1.
  155. </p>
  156. <h3>[property:Texture envMap]</h3>
  157. <p>
  158. The environment map. To ensure a physically correct rendering, you should
  159. only add environment maps which were preprocessed by
  160. [page:PMREMGenerator]. Default is null.
  161. </p>
  162. <h3>[property:Euler envMapRotation]</h3>
  163. <p>
  164. The rotation of the environment map in radians. Default is `(0,0,0)`.
  165. </p>
  166. <h3>[property:Float envMapIntensity]</h3>
  167. <p>Scales the effect of the environment map by multiplying its color.</p>
  168. <h3>[property:Boolean flatShading]</h3>
  169. <p>
  170. Define whether the material is rendered with flat shading. Default is
  171. false.
  172. </p>
  173. <h3>[property:Boolean fog]</h3>
  174. <p>Whether the material is affected by fog. Default is `true`.</p>
  175. <h3>[property:Boolean isMeshStandardMaterial]</h3>
  176. <p>Read-only flag to check if a given object is of type [name].</p>
  177. <h3>[property:Texture lightMap]</h3>
  178. <p>
  179. The light map. Default is null. The lightMap requires a second set of UVs.
  180. </p>
  181. <h3>[property:Float lightMapIntensity]</h3>
  182. <p>Intensity of the baked light. Default is `1`.</p>
  183. <h3>[property:Texture map]</h3>
  184. <p>
  185. The color map. May optionally include an alpha channel, typically combined
  186. with [page:Material.transparent .transparent] or [page:Material.alphaTest .alphaTest].
  187. Default is null. The texture map color is modulated by the diffuse [page:.color].
  188. </p>
  189. <h3>[property:Float metalness]</h3>
  190. <p>
  191. How much the material is like a metal. Non-metallic materials such as wood
  192. or stone use `0.0`, metallic use `1.0`, with nothing (usually) in between.
  193. Default is `0.0`. A value between `0.0` and `1.0` could be used for a rusty
  194. metal look. If metalnessMap is also provided, both values are multiplied.
  195. </p>
  196. <h3>[property:Texture metalnessMap]</h3>
  197. <p>
  198. The blue channel of this texture is used to alter the metalness of the
  199. material.
  200. </p>
  201. <h3>[property:Texture normalMap]</h3>
  202. <p>
  203. The texture to create a normal map. The RGB values affect the surface
  204. normal for each pixel fragment and change the way the color is lit. Normal
  205. maps do not change the actual shape of the surface, only the lighting. In
  206. case the material has a normal map authored using the left handed
  207. convention, the y component of normalScale should be negated to compensate
  208. for the different handedness.
  209. </p>
  210. <h3>[property:Integer normalMapType]</h3>
  211. <p>
  212. The type of normal map.<br /><br />
  213. Options are [page:constant THREE.TangentSpaceNormalMap] (default), and
  214. [page:constant THREE.ObjectSpaceNormalMap].
  215. </p>
  216. <h3>[property:Vector2 normalScale]</h3>
  217. <p>
  218. How much the normal map affects the material. Typical ranges are 0-1.
  219. Default is a [page:Vector2] set to (1,1).
  220. </p>
  221. <h3>[property:Float roughness]</h3>
  222. <p>
  223. How rough the material appears. `0.0` means a smooth mirror reflection, `1.0`
  224. means fully diffuse. Default is `1.0`. If roughnessMap is also provided,
  225. both values are multiplied.
  226. </p>
  227. <h3>[property:Texture roughnessMap]</h3>
  228. <p>
  229. The green channel of this texture is used to alter the roughness of the
  230. material.
  231. </p>
  232. <h3>[property:Boolean wireframe]</h3>
  233. <p>
  234. Render geometry as wireframe. Default is `false` (i.e. render as flat
  235. polygons).
  236. </p>
  237. <h3>[property:String wireframeLinecap]</h3>
  238. <p>
  239. Define appearance of line ends. Possible values are "butt", "round" and
  240. "square". Default is 'round'.<br /><br />
  241. This corresponds to the
  242. [link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineCap 2D Canvas lineCap]
  243. property and it is ignored by the [page:WebGLRenderer WebGL] renderer.
  244. </p>
  245. <h3>[property:String wireframeLinejoin]</h3>
  246. <p>
  247. Define appearance of line joints. Possible values are "round", "bevel" and
  248. "miter". Default is 'round'.<br /><br />
  249. This corresponds to the
  250. [link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineJoin 2D Canvas lineJoin]
  251. property and it is ignored by the [page:WebGLRenderer WebGL] renderer.
  252. </p>
  253. <h3>[property:Float wireframeLinewidth]</h3>
  254. <p>
  255. Controls wireframe thickness. Default is `1`.<br /><br />
  256. Due to limitations of the
  257. [link:https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf OpenGL Core Profile]
  258. with the [page:WebGLRenderer WebGL] renderer on most
  259. platforms linewidth will always be `1` regardless of the set value.
  260. </p>
  261. <h2>Methods</h2>
  262. <p>See the base [page:Material] class for common methods.</p>
  263. <h2>Source</h2>
  264. <p>
  265. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  266. </p>
  267. </body>
  268. </html>