MeshStandardMaterial.html 11 KB

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