MeshStandardMaterial.html 12 KB

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