MeshToonMaterial.html 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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. <div class="desc">A material implementing toon shading.</div>
  13. <iframe
  14. id="scene"
  15. src="scenes/material-browser.html#MeshToonMaterial"
  16. ></iframe>
  17. <script>
  18. // iOS iframe auto-resize workaround
  19. if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
  20. const scene = document.getElementById( 'scene' );
  21. scene.style.width = getComputedStyle( scene ).width;
  22. scene.style.height = getComputedStyle( scene ).height;
  23. scene.setAttribute( 'scrolling', 'no' );
  24. }
  25. </script>
  26. <h2>Examples</h2>
  27. <p>
  28. [example:webgl_materials_toon materials / toon]
  29. </p>
  30. <h2>Constructor</h2>
  31. <h3>[name]( [param:Object parameters] )</h3>
  32. <p>
  33. [page:Object parameters] - (optional) an object with one or more
  34. properties defining the material's appearance. Any property of the
  35. material (including any property inherited from [page:Material]) can be
  36. passed in here.<br /><br />
  37. The exception is the property [page:Hexadecimal color], which can be
  38. passed in as a hexadecimal string and is `0xffffff` (white) by default.
  39. [page:Color.set]( color ) is called internally.
  40. </p>
  41. <h2>Properties</h2>
  42. <p>See the base [page:Material] class for common properties.</p>
  43. <h3>[property:Texture alphaMap]</h3>
  44. <p>
  45. The alpha map is a grayscale texture that controls the opacity across the
  46. surface (black: fully transparent; white: fully opaque). Default is
  47. null.<br /><br />
  48. Only the color of the texture is used, ignoring the alpha channel if one
  49. exists. For RGB and RGBA textures, the [page:WebGLRenderer WebGL] renderer
  50. will use the green channel when sampling this texture due to the extra bit
  51. of precision provided for green in DXT-compressed and uncompressed RGB 565
  52. formats. Luminance-only and luminance/alpha textures will also still work
  53. as expected.
  54. </p>
  55. <h3>[property:Texture aoMap]</h3>
  56. <p>
  57. The red channel of this texture is used as the ambient occlusion map.
  58. Default is null. The aoMap requires a second set of UVs.
  59. </p>
  60. <h3>[property:Float aoMapIntensity]</h3>
  61. <p>
  62. Intensity of the ambient occlusion effect. Range is 0-1, where `0`
  63. disables ambient occlusion. Where intensity is `1` and the [page:.aoMap]
  64. red channel is also `1`, ambient light is fully occluded on a surface.
  65. Default is `1`.
  66. </p>
  67. <h3>[property:Texture bumpMap]</h3>
  68. <p>
  69. The texture to create a bump map. The black and white values map to the
  70. perceived depth in relation to the lights. Bump doesn't actually affect
  71. the geometry of the object, only the lighting. If a normal map is defined
  72. this will be ignored.
  73. </p>
  74. <h3>[property:Float bumpScale]</h3>
  75. <p>
  76. How much the bump map affects the material. Typical ranges are 0-1.
  77. Default is `1`.
  78. </p>
  79. <h3>[property:Color color]</h3>
  80. <p>[page:Color] of the material, by default set to white (0xffffff).</p>
  81. <h3>[property:Texture displacementMap]</h3>
  82. <p>
  83. The displacement map affects the position of the mesh's vertices. Unlike
  84. other maps which only affect the light and shade of the material the
  85. displaced vertices can cast shadows, block other objects, and otherwise
  86. act as real geometry. The displacement texture is an image where the value
  87. of each pixel (white being the highest) is mapped against, and
  88. repositions, the vertices of the mesh.
  89. </p>
  90. <h3>[property:Float displacementScale]</h3>
  91. <p>
  92. How much the displacement map affects the mesh (where black is no
  93. displacement, and white is maximum displacement). Without a displacement
  94. map set, this value is not applied. Default is `1`.
  95. </p>
  96. <h3>[property:Float displacementBias]</h3>
  97. <p>
  98. The offset of the displacement map's values on the mesh's vertices.
  99. Without a displacement map set, this value is not applied. Default is `0`.
  100. </p>
  101. <h3>[property:Color emissive]</h3>
  102. <p>
  103. Emissive (light) color of the material, essentially a solid color
  104. unaffected by other lighting. Default is black.
  105. </p>
  106. <h3>[property:Texture emissiveMap]</h3>
  107. <p>
  108. Set emissive (glow) map. Default is null. The emissive map color is
  109. modulated by the emissive color and the emissive intensity. If you have an
  110. emissive map, be sure to set the emissive color to something other than
  111. black.
  112. </p>
  113. <h3>[property:Float emissiveIntensity]</h3>
  114. <p>
  115. Intensity of the emissive light. Modulates the emissive color. Default is
  116. 1.
  117. </p>
  118. <h3>[property:Boolean fog]</h3>
  119. <p>Whether the material is affected by fog. Default is `true`.</p>
  120. <h3>[property:Texture gradientMap]</h3>
  121. <p>
  122. Gradient map for toon shading. It's required to set
  123. [page:Texture.minFilter] and [page:Texture.magFilter] to [page:Textures THREE.NearestFilter]
  124. when using this type of texture. Default is `null`.
  125. </p>
  126. <h3>[property:Texture lightMap]</h3>
  127. <p>
  128. The light map. Default is null. The lightMap requires a second set of UVs.
  129. </p>
  130. <h3>[property:Float lightMapIntensity]</h3>
  131. <p>Intensity of the baked light. Default is `1`.</p>
  132. <h3>[property:Texture map]</h3>
  133. <p>
  134. The color map. May optionally include an alpha channel, typically combined
  135. with [page:Material.transparent .transparent] or [page:Material.alphaTest .alphaTest].
  136. Default is null. The texture map color is modulated by the diffuse [page:.color].
  137. </p>
  138. <h3>[property:Texture normalMap]</h3>
  139. <p>
  140. The texture to create a normal map. The RGB values affect the surface
  141. normal for each pixel fragment and change the way the color is lit. Normal
  142. maps do not change the actual shape of the surface, only the lighting. In
  143. case the material has a normal map authored using the left handed
  144. convention, the y component of normalScale should be negated to compensate
  145. for the different handedness.
  146. </p>
  147. <h3>[property:Integer normalMapType]</h3>
  148. <p>
  149. The type of normal map.<br /><br />
  150. Options are [page:constant THREE.TangentSpaceNormalMap] (default), and
  151. [page:constant THREE.ObjectSpaceNormalMap].
  152. </p>
  153. <h3>[property:Vector2 normalScale]</h3>
  154. <p>
  155. How much the normal map affects the material. Typical ranges are 0-1.
  156. Default is a [page:Vector2] set to (1,1).
  157. </p>
  158. <h3>[property:Boolean wireframe]</h3>
  159. <p>
  160. Render geometry as wireframe. Default is `false` (i.e. render as flat
  161. polygons).
  162. </p>
  163. <h3>[property:String wireframeLinecap]</h3>
  164. <p>
  165. Define appearance of line ends. Possible values are "butt", "round" and
  166. "square". Default is 'round'.<br /><br />
  167. This corresponds to the
  168. [link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineCap 2D Canvas lineCap]
  169. property and it is ignored by the [page:WebGLRenderer WebGL] renderer.
  170. </p>
  171. <h3>[property:String wireframeLinejoin]</h3>
  172. <p>
  173. Define appearance of line joints. Possible values are "round", "bevel" and
  174. "miter". Default is 'round'.<br /><br />
  175. This corresponds to the
  176. [link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineJoin 2D Canvas lineJoin]
  177. property and it is ignored by the [page:WebGLRenderer WebGL] renderer.
  178. </p>
  179. <h3>[property:Float wireframeLinewidth]</h3>
  180. <p>
  181. Controls wireframe thickness. Default is `1`.<br /><br />
  182. Due to limitations of the
  183. [link:https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf OpenGL Core Profile]
  184. with the [page:WebGLRenderer WebGL] renderer on most
  185. platforms linewidth will always be `1` regardless of the set value.
  186. </p>
  187. <h2>Methods</h2>
  188. <p>See the base [page:Material] class for common methods.</p>
  189. <h2>Source</h2>
  190. <p>
  191. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  192. </p>
  193. </body>
  194. </html>