2
0

Materials.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. </code>
  21. <p>
  22. Defines which side of faces will be rendered - front, back or both.
  23. Default is [page:Constant FrontSide].
  24. </p>
  25. <h2>Blending Mode</h2>
  26. <code>
  27. THREE.NoBlending
  28. THREE.NormalBlending
  29. THREE.AdditiveBlending
  30. THREE.SubtractiveBlending
  31. THREE.MultiplyBlending
  32. THREE.CustomBlending
  33. </code>
  34. <p>
  35. These control the source and destination blending equations for the material's RGB and Alpha sent to the WebGLRenderer for use by WebGL.<br />
  36. [page:Constant NormalBlending] is the default.<br />
  37. Note that [page:Constant CustomBlending] must be set to use [page:CustomBlendingEquation Custom Blending Equations].<br />
  38. See the [example:webgl_materials_blending materials / blending] example.<br />
  39. </p>
  40. <h2>Depth Mode</h2>
  41. <code>
  42. THREE.NeverDepth
  43. THREE.AlwaysDepth
  44. THREE.EqualDepth
  45. THREE.LessDepth
  46. THREE.LessEqualDepth
  47. THREE.GreaterEqualDepth
  48. THREE.GreaterDepth
  49. THREE.NotEqualDepth
  50. </code>
  51. <p>
  52. 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 />
  53. [page:Materials NeverDepth] will never return true.<br />
  54. [page:Materials AlwaysDepth] will always return true.<br />
  55. [page:Materials EqualDepth] will return true if the incoming pixel Z-depth is equal to the current buffer Z-depth.<br />
  56. [page:Materials LessDepth] will return true if the incoming pixel Z-depth is less than the current buffer Z-depth.<br />
  57. [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 />
  58. [page:Materials GreaterEqualDepth] will return true if the incoming pixel Z-depth is greater than or equal to the current buffer Z-depth.<br />
  59. [page:Materials GreaterDepth] will return true if the incoming pixel Z-depth is greater than the current buffer Z-depth.<br />
  60. [page:Materials NotEqualDepth] will return true if the incoming pixel Z-depth is not equal to the current buffer Z-depth.<br />
  61. </p>
  62. <h2>Texture Combine Operations</h2>
  63. <code>
  64. THREE.MultiplyOperation
  65. THREE.MixOperation
  66. THREE.AddOperation
  67. </code>
  68. <p>
  69. 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 />
  70. [page:Constant MultiplyOperation] is the default and multiplies the environment map color with the surface color.<br />
  71. [page:Constant MixOperation] uses reflectivity to blend between the two colors.<br />
  72. [page:Constant AddOperation] adds the two colors.
  73. </p>
  74. <h2>Stencil Functions</h2>
  75. <code>
  76. THREE.NeverStencilFunc
  77. THREE.LessStencilFunc
  78. THREE.EqualStencilFunc
  79. THREE.LessEqualStencilFunc
  80. THREE.GreaterStencilFunc
  81. THREE.NotEqualStencilFunc
  82. THREE.GreaterEqualStencilFunc
  83. THREE.AlwaysStencilFunc
  84. </code>
  85. <p>
  86. Which stencil function the material uses to determine whether or not to perform a stencil operation.<br />
  87. [page:Materials NeverStencilFunc] will never return true.<br />
  88. [page:Materials LessStencilFunc] will return true if the stencil reference value is less than the current stencil value.<br />
  89. [page:Materials EqualStencilFunc] will return true if the stencil reference value is equal to the current stencil value.<br />
  90. [page:Materials LessEqualStencilFunc] will return true if the stencil reference value is less than or equal to the current stencil value.<br />
  91. [page:Materials GreaterStencilFunc] will return true if the stencil reference value is greater than the current stencil value.<br />
  92. [page:Materials NotEqualStencilFunc] will return true if the stencil reference value is not equal to the current stencil value.<br />
  93. [page:Materials GreaterEqualStencilFunc] will return true if the stencil reference value is greater than or equal to the current stencil value.<br />
  94. [page:Materials AlwaysStencilFunc] will always return true.<br />
  95. </p>
  96. <h2>Stencil Operations</h2>
  97. <code>
  98. THREE.ZeroStencilOp
  99. THREE.KeepStencilOp
  100. THREE.ReplaceStencilOp
  101. THREE.IncrementStencilOp
  102. THREE.DecrementStencilOp
  103. THREE.IncrementWrapStencilOp
  104. THREE.DecrementWrapStencilOp
  105. THREE.InvertStencilOp
  106. </code>
  107. <p>
  108. Which stencil operation the material will perform on the stencil buffer pixel if the provided stencil function passes.<br />
  109. [page:Materials ZeroStencilOp] will set the stencil value to 0.<br />
  110. [page:Materials KeepStencilOp] will not change the current stencil value.<br />
  111. [page:Materials ReplaceStencilOp] will replace the stencil value with the specified stencil reference value.<br />
  112. [page:Materials IncrementStencilOp] will increment the current stencil value by `1`.<br />
  113. [page:Materials DecrementStencilOp] will decrement the current stencil value by `1`.<br />
  114. [page:Materials IncrementWrapStencilOp] will increment the current stencil value by `1`. If the value increments past `255` it will be set to `0`.<br />
  115. [page:Materials DecrementWrapStencilOp] will increment the current stencil value by `1`. If the value decrements below `0` it will be set to `255`.<br />
  116. [page:Materials InvertStencilOp] will perform a bitwise inversion of the current stencil value.<br />
  117. </p>
  118. <h2>Source</h2>
  119. <p>
  120. [link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js]
  121. </p>
  122. </body>
  123. </html>