2
0

MeshToonMaterial.html 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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. Default is `1`. Zero is no
  63. occlusion effect.
  64. </p>
  65. <h3>[property:Texture bumpMap]</h3>
  66. <p>
  67. The texture to create a bump map. The black and white values map to the
  68. perceived depth in relation to the lights. Bump doesn't actually affect
  69. the geometry of the object, only the lighting. If a normal map is defined
  70. this will be ignored.
  71. </p>
  72. <h3>[property:Float bumpScale]</h3>
  73. <p>
  74. How much the bump map affects the material. Typical ranges are 0-1.
  75. Default is `1`.
  76. </p>
  77. <h3>[property:Color color]</h3>
  78. <p>[page:Color] of the material, by default set to white (0xffffff).</p>
  79. <h3>[property:Texture displacementMap]</h3>
  80. <p>
  81. The displacement map affects the position of the mesh's vertices. Unlike
  82. other maps which only affect the light and shade of the material the
  83. displaced vertices can cast shadows, block other objects, and otherwise
  84. act as real geometry. The displacement texture is an image where the value
  85. of each pixel (white being the highest) is mapped against, and
  86. repositions, the vertices of the mesh.
  87. </p>
  88. <h3>[property:Float displacementScale]</h3>
  89. <p>
  90. How much the displacement map affects the mesh (where black is no
  91. displacement, and white is maximum displacement). Without a displacement
  92. map set, this value is not applied. Default is `1`.
  93. </p>
  94. <h3>[property:Float displacementBias]</h3>
  95. <p>
  96. The offset of the displacement map's values on the mesh's vertices.
  97. Without a displacement map set, this value is not applied. Default is `0`.
  98. </p>
  99. <h3>[property:Color emissive]</h3>
  100. <p>
  101. Emissive (light) color of the material, essentially a solid color
  102. unaffected by other lighting. Default is black.
  103. </p>
  104. <h3>[property:Texture emissiveMap]</h3>
  105. <p>
  106. Set emissive (glow) map. Default is null. The emissive map color is
  107. modulated by the emissive color and the emissive intensity. If you have an
  108. emissive map, be sure to set the emissive color to something other than
  109. black.
  110. </p>
  111. <h3>[property:Float emissiveIntensity]</h3>
  112. <p>
  113. Intensity of the emissive light. Modulates the emissive color. Default is
  114. 1.
  115. </p>
  116. <h3>[property:Boolean fog]</h3>
  117. <p>Whether the material is affected by fog. Default is `true`.</p>
  118. <h3>[property:Texture gradientMap]</h3>
  119. <p>
  120. Gradient map for toon shading. It's required to set
  121. [page:Texture.minFilter] and [page:Texture.magFilter] to [page:Textures THREE.NearestFilter]
  122. when using this type of texture. Default is `null`.
  123. </p>
  124. <h3>[property:Texture lightMap]</h3>
  125. <p>
  126. The light map. Default is null. The lightMap requires a second set of UVs.
  127. </p>
  128. <h3>[property:Float lightMapIntensity]</h3>
  129. <p>Intensity of the baked light. Default is `1`.</p>
  130. <h3>[property:Texture map]</h3>
  131. <p>
  132. The color map. May optionally include an alpha channel, typically combined
  133. with [page:Material.transparent .transparent] or [page:Material.alphaTest .alphaTest].
  134. Default is null. The texture map color is modulated by the diffuse [page:.color].
  135. </p>
  136. <h3>[property:Texture normalMap]</h3>
  137. <p>
  138. The texture to create a normal map. The RGB values affect the surface
  139. normal for each pixel fragment and change the way the color is lit. Normal
  140. maps do not change the actual shape of the surface, only the lighting. In
  141. case the material has a normal map authored using the left handed
  142. convention, the y component of normalScale should be negated to compensate
  143. for the different handedness.
  144. </p>
  145. <h3>[property:Integer normalMapType]</h3>
  146. <p>
  147. The type of normal map.<br /><br />
  148. Options are [page:constant THREE.TangentSpaceNormalMap] (default), and
  149. [page:constant THREE.ObjectSpaceNormalMap].
  150. </p>
  151. <h3>[property:Vector2 normalScale]</h3>
  152. <p>
  153. How much the normal map affects the material. Typical ranges are 0-1.
  154. Default is a [page:Vector2] set to (1,1).
  155. </p>
  156. <h3>[property:Boolean wireframe]</h3>
  157. <p>
  158. Render geometry as wireframe. Default is `false` (i.e. render as flat
  159. polygons).
  160. </p>
  161. <h3>[property:String wireframeLinecap]</h3>
  162. <p>
  163. Define appearance of line ends. Possible values are "butt", "round" and
  164. "square". Default is 'round'.<br /><br />
  165. This corresponds to the
  166. [link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineCap 2D Canvas lineCap]
  167. property and it is ignored by the [page:WebGLRenderer WebGL] renderer.
  168. </p>
  169. <h3>[property:String wireframeLinejoin]</h3>
  170. <p>
  171. Define appearance of line joints. Possible values are "round", "bevel" and
  172. "miter". Default is 'round'.<br /><br />
  173. This corresponds to the
  174. [link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineJoin 2D Canvas lineJoin]
  175. property and it is ignored by the [page:WebGLRenderer WebGL] renderer.
  176. </p>
  177. <h3>[property:Float wireframeLinewidth]</h3>
  178. <p>
  179. Controls wireframe thickness. Default is `1`.<br /><br />
  180. Due to limitations of the
  181. [link:https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf OpenGL Core Profile]
  182. with the [page:WebGLRenderer WebGL] renderer on most
  183. platforms linewidth will always be `1` regardless of the set value.
  184. </p>
  185. <h2>Methods</h2>
  186. <p>See the base [page:Material] class for common methods.</p>
  187. <h2>Source</h2>
  188. <p>
  189. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  190. </p>
  191. </body>
  192. </html>