Materials.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. <h1>Material Constants</h1>
  12. <p class="desc">
  13. These constants define properties common to all material types,
  14. 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 />
  15. </p>
  16. <h2>Side</h2>
  17. <code>
  18. THREE.FrontSide
  19. THREE.BackSide
  20. THREE.DoubleSide
  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. <h2>Blending Mode</h2>
  27. <code>
  28. THREE.NoBlending
  29. THREE.NormalBlending
  30. THREE.AdditiveBlending
  31. THREE.SubtractiveBlending
  32. THREE.MultiplyBlending
  33. THREE.CustomBlending
  34. </code>
  35. <p>
  36. These control the source and destination blending equations for the material's RGB and Alpha sent to the WebGLRenderer for use by WebGL.<br />
  37. [page:Constant NormalBlending] is the default.<br />
  38. Note that [page:Constant CustomBlending] must be set to use [page:CustomBlendingEquation Custom Blending Equations].<br />
  39. See the [example:webgl_materials_blending materials / blending] example.<br />
  40. </p>
  41. <h2>Depth Mode</h2>
  42. <code>
  43. THREE.NeverDepth
  44. THREE.AlwaysDepth
  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 LessDepth] will return true if the incoming pixel Z-depth is less than the current buffer Z-depth.<br />
  56. [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 />
  57. [page:Materials GreaterEqualDepth] will return true if the incoming pixel Z-depth is greater than or equal to the current buffer Z-depth.<br />
  58. [page:Materials GreaterDepth] will return true if the incoming pixel Z-depth is greater than the current buffer Z-depth.<br />
  59. [page:Materials NotEqualDepth] will return true if the incoming pixel Z-depth is not equal to the current buffer Z-depth.<br />
  60. </p>
  61. <h2>Texture Combine Operations</h2>
  62. <code>
  63. THREE.MultiplyOperation
  64. THREE.MixOperation
  65. THREE.AddOperation
  66. </code>
  67. <p>
  68. 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 />
  69. [page:Constant MultiplyOperation] is the default and multiplies the environment map color with the surface color.<br />
  70. [page:Constant MixOperation] uses reflectivity to blend between the two colors.<br />
  71. [page:Constant AddOperation] adds the two colors.
  72. </p>
  73. <h2>Stencil Functions</h2>
  74. <code>
  75. THREE.NeverStencilFunc
  76. THREE.LessStencilFunc
  77. THREE.EqualStencilFunc
  78. THREE.LessEqualStencilFunc
  79. THREE.GreaterStencilFunc
  80. THREE.NotEqualStencilFunc
  81. THREE.GreaterEqualStencilFunc
  82. THREE.AlwaysStencilFunc
  83. </code>
  84. <p>
  85. Which stencil function the material uses to determine whether or not to perform a stencil operation.<br />
  86. [page:Materials NeverStencilFunc] will never return true.<br />
  87. [page:Materials LessStencilFunc] will return true if the stencil reference value is less than the current stencil value.<br />
  88. [page:Materials EqualStencilFunc] will return true if the stencil reference value is equal to the current stencil value.<br />
  89. [page:Materials LessEqualStencilFunc] will return true if the stencil reference value is less than or equal to the current stencil value.<br />
  90. [page:Materials GreaterStencilFunc] will return true if the stencil reference value is greater than the current stencil value.<br />
  91. [page:Materials NotEqualStencilFunc] will return true if the stencil reference value is not equal to the current stencil value.<br />
  92. [page:Materials GreaterEqualStencilFunc] will return true if the stencil reference value is greater than or equal to the current stencil value.<br />
  93. [page:Materials AlwaysStencilFunc] will always return true.<br />
  94. </p>
  95. <h2>Stencil Operations</h2>
  96. <code>
  97. THREE.ZeroStencilOp
  98. THREE.KeepStencilOp
  99. THREE.ReplaceStencilOp
  100. THREE.IncrementStencilOp
  101. THREE.DecrementStencilOp
  102. THREE.IncrementWrapStencilOp
  103. THREE.DecrementWrapStencilOp
  104. THREE.InvertStencilOp
  105. </code>
  106. <p>
  107. Which stencil operation the material will perform on the stencil buffer pixel if the provided stencil function passes.<br />
  108. [page:Materials ZeroStencilOp] will set the stencil value to 0.<br />
  109. [page:Materials KeepStencilOp] will not change the current stencil value.<br />
  110. [page:Materials ReplaceStencilOp] will replace the stencil value with the specified stencil reference value.<br />
  111. [page:Materials IncrementStencilOp] will increment the current stencil value by 1.<br />
  112. [page:Materials DecrementStencilOp] will decrement the current stencil value by 1.<br />
  113. [page:Materials IncrementWrapStencilOp] will increment the current stencil value by 1. If the value increments past 255 it will be set to 0.<br />
  114. [page:Materials DecrementWrapStencilOp] will increment the current stencil value by 1. If the value decrements below 0 it will be set to 255.<br />
  115. [page:Materials InvertStencilOp] will perform a bitwise iversion of the current stencil value.<br />
  116. </p>
  117. <h2>Source</h2>
  118. <p>
  119. [link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js]
  120. </p>
  121. </body>
  122. </html>