Materials.html 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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. <h1>Material Constants</h1>
  11. <p class="desc">
  12. These constants define properties common to all material types, with the
  13. exception of Texture Combine Operations which only apply to
  14. [page:MeshBasicMaterial.combine MeshBasicMaterial],
  15. [page:MeshLambertMaterial.combine MeshLambertMaterial] and
  16. [page:MeshPhongMaterial.combine MeshPhongMaterial].<br />
  17. </p>
  18. <h2>Side</h2>
  19. <code>
  20. THREE.FrontSide
  21. THREE.BackSide
  22. THREE.DoubleSide
  23. </code>
  24. <p>
  25. Defines which side of faces will be rendered - front, back or both.
  26. Default is [page:Constant FrontSide].
  27. </p>
  28. <h2>Blending Mode</h2>
  29. <code>
  30. THREE.NoBlending
  31. THREE.NormalBlending
  32. THREE.AdditiveBlending
  33. THREE.SubtractiveBlending
  34. THREE.MultiplyBlending
  35. THREE.CustomBlending
  36. </code>
  37. <p>
  38. These control the source and destination blending equations for the
  39. material's RGB and Alpha sent to the WebGLRenderer for use by WebGL.<br />
  40. [page:Constant NormalBlending] is the default.<br />
  41. Note that [page:Constant CustomBlending] must be set to use
  42. [page:CustomBlendingEquation Custom Blending Equations].<br />
  43. See the [example:webgl_materials_blending materials / blending]
  44. example.<br />
  45. </p>
  46. <h2>Depth Mode</h2>
  47. <code>
  48. THREE.NeverDepth
  49. THREE.AlwaysDepth
  50. THREE.EqualDepth
  51. THREE.LessDepth
  52. THREE.LessEqualDepth
  53. THREE.GreaterEqualDepth
  54. THREE.GreaterDepth
  55. THREE.NotEqualDepth
  56. </code>
  57. <p>
  58. Which depth function the material uses to compare incoming pixels Z-depth
  59. against the current Z-depth buffer value. If the result of the comparison
  60. is true, the pixel will be drawn.<br />
  61. [page:Materials NeverDepth] will never return true.<br />
  62. [page:Materials AlwaysDepth] will always return true.<br />
  63. [page:Materials EqualDepth] will return true if the incoming pixel Z-depth
  64. is equal to the current buffer Z-depth.<br />
  65. [page:Materials LessDepth] will return true if the incoming pixel Z-depth
  66. is less than the current buffer Z-depth.<br />
  67. [page:Materials LessEqualDepth] is the default and will return true if the
  68. incoming pixel Z-depth is less than or equal to the current buffer
  69. Z-depth.<br />
  70. [page:Materials GreaterEqualDepth] will return true if the incoming pixel
  71. Z-depth is greater than or equal to the current buffer Z-depth.<br />
  72. [page:Materials GreaterDepth] will return true if the incoming pixel
  73. Z-depth is greater than the current buffer Z-depth.<br />
  74. [page:Materials NotEqualDepth] will return true if the incoming pixel
  75. Z-depth is not equal to the current buffer Z-depth.<br />
  76. </p>
  77. <h2>Texture Combine Operations</h2>
  78. <code>
  79. THREE.MultiplyOperation
  80. THREE.MixOperation
  81. THREE.AddOperation
  82. </code>
  83. <p>
  84. These define how the result of the surface's color is combined with the
  85. environment map (if present), for [page:MeshBasicMaterial.combine MeshBasicMaterial],
  86. [page:MeshLambertMaterial.combine MeshLambertMaterial]
  87. and [page:MeshPhongMaterial.combine MeshPhongMaterial]. <br />
  88. [page:Constant MultiplyOperation] is the default and multiplies the
  89. environment map color with the surface color.<br />
  90. [page:Constant MixOperation] uses reflectivity to blend between the two
  91. colors.<br />
  92. [page:Constant AddOperation] adds the two colors.
  93. </p>
  94. <h2>Stencil Functions</h2>
  95. <code>
  96. THREE.NeverStencilFunc
  97. THREE.LessStencilFunc
  98. THREE.EqualStencilFunc
  99. THREE.LessEqualStencilFunc
  100. THREE.GreaterStencilFunc
  101. THREE.NotEqualStencilFunc
  102. THREE.GreaterEqualStencilFunc
  103. THREE.AlwaysStencilFunc
  104. </code>
  105. <p>
  106. Which stencil function the material uses to determine whether or not to
  107. perform a stencil operation.<br />
  108. [page:Materials NeverStencilFunc] will never return true.<br />
  109. [page:Materials LessStencilFunc] will return true if the stencil reference
  110. value is less than the current stencil value.<br />
  111. [page:Materials EqualStencilFunc] will return true if the stencil
  112. reference value is equal to the current stencil value.<br />
  113. [page:Materials LessEqualStencilFunc] will return true if the stencil
  114. reference value is less than or equal to the current stencil value.<br />
  115. [page:Materials GreaterStencilFunc] will return true if the stencil
  116. reference value is greater than the current stencil value.<br />
  117. [page:Materials NotEqualStencilFunc] will return true if the stencil
  118. reference value is not equal to the current stencil value.<br />
  119. [page:Materials GreaterEqualStencilFunc] will return true if the stencil
  120. reference value is greater than or equal to the current stencil value.<br />
  121. [page:Materials AlwaysStencilFunc] will always return true.<br />
  122. </p>
  123. <h2>Stencil Operations</h2>
  124. <code>
  125. THREE.ZeroStencilOp
  126. THREE.KeepStencilOp
  127. THREE.ReplaceStencilOp
  128. THREE.IncrementStencilOp
  129. THREE.DecrementStencilOp
  130. THREE.IncrementWrapStencilOp
  131. THREE.DecrementWrapStencilOp
  132. THREE.InvertStencilOp
  133. </code>
  134. <p>
  135. Which stencil operation the material will perform on the stencil buffer
  136. pixel if the provided stencil function passes.<br />
  137. [page:Materials ZeroStencilOp] will set the stencil value to `0`.<br />
  138. [page:Materials KeepStencilOp] will not change the current stencil
  139. value.<br />
  140. [page:Materials ReplaceStencilOp] will replace the stencil value with the
  141. specified stencil reference value.<br />
  142. [page:Materials IncrementStencilOp] will increment the current stencil
  143. value by `1`.<br />
  144. [page:Materials DecrementStencilOp] will decrement the current stencil
  145. value by `1`.<br />
  146. [page:Materials IncrementWrapStencilOp] will increment the current stencil
  147. value by `1`. If the value increments past `255` it will be set to `0`.<br />
  148. [page:Materials DecrementWrapStencilOp] will increment the current stencil
  149. value by `1`. If the value decrements below `0` it will be set to
  150. `255`.<br />
  151. [page:Materials InvertStencilOp] will perform a bitwise inversion of the
  152. current stencil value.<br />
  153. </p>
  154. <h2>Normal map type</h2>
  155. <code>
  156. THREE.TangentSpaceNormalMap
  157. THREE.ObjectSpaceNormalMap
  158. </code>
  159. <p>
  160. Defines the type of the normal map. For TangentSpaceNormalMap, the
  161. information is relative to the underlying surface. For
  162. ObjectSpaceNormalMap, the information is relative to the object
  163. orientation. Default is [page:Constant TangentSpaceNormalMap].
  164. </p>
  165. <h2>GLSL Version</h2>
  166. <code>
  167. THREE.GLSL1
  168. THREE.GLSL3
  169. </code>
  170. <h2>Source</h2>
  171. <p>
  172. [link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js]
  173. </p>
  174. </body>
  175. </html>