MeshPhongMaterial.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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 material for shiny surfaces with specular highlights.<br /><br />
  14. The material uses a non-physically based
  15. [link:https://en.wikipedia.org/wiki/Blinn-Phong_shading_model Blinn-Phong]
  16. model for calculating reflectance. Unlike the Lambertian model used in the
  17. [page:MeshLambertMaterial] this can simulate shiny surfaces with specular
  18. highlights (such as varnished wood). [name] uses per-fragment shading.<br /><br />
  19. Performance will generally be greater when using this material over the
  20. [page:MeshStandardMaterial] or [page:MeshPhysicalMaterial], at the cost of
  21. some graphical accuracy.
  22. </p>
  23. <iframe
  24. id="scene"
  25. src="scenes/material-browser.html#MeshPhongMaterial"
  26. ></iframe>
  27. <script>
  28. // iOS iframe auto-resize workaround
  29. if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
  30. const scene = document.getElementById( 'scene' );
  31. scene.style.width = getComputedStyle( scene ).width;
  32. scene.style.height = getComputedStyle( scene ).height;
  33. scene.setAttribute( 'scrolling', 'no' );
  34. }
  35. </script>
  36. <h2>Constructor</h2>
  37. <h3>[name]( [param:Object parameters] )</h3>
  38. <p>
  39. [page:Object parameters] - (optional) an object with one or more
  40. properties defining the material's appearance. Any property of the
  41. material (including any property inherited from [page:Material]) can be
  42. passed in here.<br /><br />
  43. The exception is the property [page:Hexadecimal color], which can be
  44. passed in as a hexadecimal string and is `0xffffff` (white) by default.
  45. [page:Color.set]( color ) is called internally.
  46. </p>
  47. <h2>Properties</h2>
  48. <p>See the base [page:Material] class for common properties.</p>
  49. <h3>[property:Texture alphaMap]</h3>
  50. <p>
  51. The alpha map is a grayscale texture that controls the opacity across the
  52. surface (black: fully transparent; white: fully opaque). Default is
  53. null.<br /><br />
  54. Only the color of the texture is used, ignoring the alpha channel if one
  55. exists. For RGB and RGBA textures, the [page:WebGLRenderer WebGL] renderer
  56. will use the green channel when sampling this texture due to the extra bit
  57. of precision provided for green in DXT-compressed and uncompressed RGB 565
  58. formats. Luminance-only and luminance/alpha textures will also still work
  59. as expected.
  60. </p>
  61. <h3>[property:Texture aoMap]</h3>
  62. <p>
  63. The red channel of this texture is used as the ambient occlusion map.
  64. Default is null. The aoMap requires a second set of UVs.
  65. </p>
  66. <h3>[property:Float aoMapIntensity]</h3>
  67. <p>
  68. Intensity of the ambient occlusion effect. Default is `1`. Zero is no
  69. occlusion effect.
  70. </p>
  71. <h3>[property:Texture bumpMap]</h3>
  72. <p>
  73. The texture to create a bump map. The black and white values map to the
  74. perceived depth in relation to the lights. Bump doesn't actually affect
  75. the geometry of the object, only the lighting. If a normal map is defined
  76. this will be ignored.
  77. </p>
  78. <h3>[property:Float bumpScale]</h3>
  79. <p>
  80. How much the bump map affects the material. Typical ranges are 0-1.
  81. Default is `1`.
  82. </p>
  83. <h3>[property:Color color]</h3>
  84. <p>[page:Color] of the material, by default set to white (0xffffff).</p>
  85. <h3>[property:Integer combine]</h3>
  86. <p>
  87. How to combine the result of the surface's color with the environment map,
  88. if any.<br /><br />
  89. Options are [page:Materials THREE.MultiplyOperation] (default),
  90. [page:Materials THREE.MixOperation], [page:Materials THREE.AddOperation].
  91. If mix is chosen, the [page:.reflectivity] is used to blend between the
  92. two colors.
  93. </p>
  94. <h3>[property:Texture displacementMap]</h3>
  95. <p>
  96. The displacement map affects the position of the mesh's vertices. Unlike
  97. other maps which only affect the light and shade of the material the
  98. displaced vertices can cast shadows, block other objects, and otherwise
  99. act as real geometry. The displacement texture is an image where the value
  100. of each pixel (white being the highest) is mapped against, and
  101. repositions, the vertices of the mesh.
  102. </p>
  103. <h3>[property:Float displacementScale]</h3>
  104. <p>
  105. How much the displacement map affects the mesh (where black is no
  106. displacement, and white is maximum displacement). Without a displacement
  107. map set, this value is not applied. Default is `1`.
  108. </p>
  109. <h3>[property:Float displacementBias]</h3>
  110. <p>
  111. The offset of the displacement map's values on the mesh's vertices.
  112. Without a displacement map set, this value is not applied. Default is `0`.
  113. </p>
  114. <h3>[property:Color emissive]</h3>
  115. <p>
  116. Emissive (light) color of the material, essentially a solid color
  117. unaffected by other lighting. Default is black.
  118. </p>
  119. <h3>[property:Texture emissiveMap]</h3>
  120. <p>
  121. Set emissive (glow) map. Default is null. The emissive map color is
  122. modulated by the emissive color and the emissive intensity. If you have an
  123. emissive map, be sure to set the emissive color to something other than
  124. black.
  125. </p>
  126. <h3>[property:Float emissiveIntensity]</h3>
  127. <p>
  128. Intensity of the emissive light. Modulates the emissive color. Default is
  129. 1.
  130. </p>
  131. <h3>[property:Texture envMap]</h3>
  132. <p>The environment map. Default is null.</p>
  133. <h3>[property:Euler envMapRotation]</h3>
  134. <p>
  135. The rotation of the environment map in radians. Default is `(0,0,0)`.
  136. </p>
  137. <h3>[property:Boolean flatShading]</h3>
  138. <p>
  139. Define whether the material is rendered with flat shading. Default is
  140. false.
  141. </p>
  142. <h3>[property:Boolean fog]</h3>
  143. <p>Whether the material is affected by fog. Default is `true`.</p>
  144. <h3>[property:Texture lightMap]</h3>
  145. <p>
  146. The light map. Default is null. The lightMap requires a second set of UVs.
  147. </p>
  148. <h3>[property:Float lightMapIntensity]</h3>
  149. <p>Intensity of the baked light. Default is `1`.</p>
  150. <h3>[property:Texture map]</h3>
  151. <p>
  152. The color map. May optionally include an alpha channel, typically combined
  153. with [page:Material.transparent .transparent] or [page:Material.alphaTest .alphaTest].
  154. Default is null. The texture map color is modulated by the
  155. diffuse [page:.color].
  156. </p>
  157. <h3>[property:Texture normalMap]</h3>
  158. <p>
  159. The texture to create a normal map. The RGB values affect the surface
  160. normal for each pixel fragment and change the way the color is lit. Normal
  161. maps do not change the actual shape of the surface, only the lighting. In
  162. case the material has a normal map authored using the left handed
  163. convention, the y component of normalScale should be negated to compensate
  164. for the different handedness.
  165. </p>
  166. <h3>[property:Integer normalMapType]</h3>
  167. <p>
  168. The type of normal map.<br /><br />
  169. Options are [page:constant THREE.TangentSpaceNormalMap] (default), and
  170. [page:constant THREE.ObjectSpaceNormalMap].
  171. </p>
  172. <h3>[property:Vector2 normalScale]</h3>
  173. <p>
  174. How much the normal map affects the material. Typical ranges are 0-1.
  175. Default is a [page:Vector2] set to (1,1).
  176. </p>
  177. <h3>[property:Float reflectivity]</h3>
  178. <p>
  179. How much the environment map affects the surface; also see
  180. [page:.combine]. The default value is `1` and the valid range is between `0`
  181. (no reflections) and `1` (full reflections).
  182. </p>
  183. <h3>[property:Float refractionRatio]</h3>
  184. <p>
  185. The index of refraction (IOR) of air (approximately 1) divided by the
  186. index of refraction of the material. It is used with environment mapping
  187. modes [page:Textures THREE.CubeRefractionMapping] and [page:Textures THREE.EquirectangularRefractionMapping].
  188. The refraction ratio should not exceed `1`. Default is `0.98`.
  189. </p>
  190. <h3>[property:Float shininess]</h3>
  191. <p>
  192. How shiny the [page:.specular] highlight is; a higher value gives a
  193. sharper highlight. Default is `30`.
  194. </p>
  195. <h3>[property:Color specular]</h3>
  196. <p>
  197. Specular color of the material. Default is a [page:Color] set to
  198. `0x111111` (very dark grey).<br /><br />
  199. This defines how shiny the material is and the color of its shine.
  200. </p>
  201. <h3>[property:Texture specularMap]</h3>
  202. <p>
  203. The specular map value affects both how much the specular surface
  204. highlight contributes and how much of the environment map affects the
  205. surface. Default is null.
  206. </p>
  207. <h3>[property:Boolean wireframe]</h3>
  208. <p>
  209. Render geometry as wireframe. Default is `false` (i.e. render as flat
  210. polygons).
  211. </p>
  212. <h3>[property:String wireframeLinecap]</h3>
  213. <p>
  214. Define appearance of line ends. Possible values are "butt", "round" and
  215. "square". Default is 'round'.<br /><br />
  216. This corresponds to the
  217. [link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineCap 2D Canvas lineCap]
  218. property and it is ignored by the [page:WebGLRenderer WebGL] renderer.
  219. </p>
  220. <h3>[property:String wireframeLinejoin]</h3>
  221. <p>
  222. Define appearance of line joints. Possible values are "round", "bevel" and
  223. "miter". Default is 'round'.<br /><br />
  224. This corresponds to the
  225. [link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineJoin 2D Canvas lineJoin]
  226. property and it is ignored by the [page:WebGLRenderer WebGL] renderer.
  227. </p>
  228. <h3>[property:Float wireframeLinewidth]</h3>
  229. <p>
  230. Controls wireframe thickness. Default is `1`.<br /><br />
  231. Due to limitations of the
  232. [link:https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf OpenGL Core Profile]
  233. with the [page:WebGLRenderer WebGL] renderer on most
  234. platforms linewidth will always be `1` regardless of the set value.
  235. </p>
  236. <h2>Methods</h2>
  237. <p>See the base [page:Material] class for common methods.</p>
  238. <h2>Source</h2>
  239. <p>
  240. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  241. </p>
  242. </body>
  243. </html>