CustomBlendingEquations.html 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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>Custom Blending Equation Constants</h1>
  12. <h2>Example</h2>
  13. <p>[example:webgl_materials_blending_custom materials / blending / custom ]</p>
  14. <h2>Usage</h2>
  15. <p>
  16. These work with all material types. First set the material's blending mode to THREE.CustomBlending, then set the desired Blending Equation, Source Factor and Destination Factor.
  17. </p>
  18. <code>
  19. var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
  20. material.blending = THREE.CustomBlending;
  21. material.blendEquation = THREE.AddEquation; //default
  22. material.blendSrc = THREE.SrcAlphaFactor; //default
  23. material.blendDst = THREE.OneMinusSrcAlphaFactor; //default
  24. </code>
  25. <h2>Blending Equations</h2>
  26. <code>
  27. THREE.AddEquation
  28. THREE.SubtractEquation
  29. THREE.ReverseSubtractEquation
  30. THREE.MinEquation
  31. THREE.MaxEquation
  32. </code>
  33. <h2>Source Factors</h2>
  34. <code>
  35. THREE.ZeroFactor
  36. THREE.OneFactor
  37. THREE.SrcColorFactor
  38. THREE.OneMinusSrcColorFactor
  39. THREE.SrcAlphaFactor
  40. THREE.OneMinusSrcAlphaFactor
  41. THREE.DstAlphaFactor
  42. THREE.OneMinusDstAlphaFactor
  43. THREE.DstColorFactor
  44. THREE.OneMinusDstColorFactor
  45. THREE.SrcAlphaSaturateFactor
  46. </code>
  47. <h2>Destination Factors</h2>
  48. <p>
  49. All of the Source Factors are valid as Destination Factors, except for <code>THREE.SrcAlphaSaturateFactor</code>
  50. </p>
  51. <h2>Source</h2>
  52. [link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js]
  53. </body>
  54. </html>