Materials.html 6.7 KB

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