EffectComposer.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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>[name]</h1>
  11. <p class="desc">
  12. Used to implement post-processing effects in three.js. The class manages a chain of post-processing passes
  13. to produce the final visual result. Post-processing passes are executed in order of their addition/insertion.
  14. The last pass is automatically rendered to screen.
  15. </p>
  16. <h2>Import</h2>
  17. <p>
  18. [name] is an add-on, and must be imported explicitly.
  19. See [link:#manual/introduction/Installation Installation / Addons].
  20. </p>
  21. <code>
  22. import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
  23. </code>
  24. <h2>Examples</h2>
  25. <p>
  26. [example:webgl_postprocessing postprocessing]<br />
  27. [example:webgl_postprocessing_advanced postprocessing advanced]<br />
  28. [example:webgl_postprocessing_backgrounds postprocessing backgrounds]<br />
  29. [example:webgl_postprocessing_crossfade postprocessing crossfade]<br />
  30. [example:webgl_postprocessing_dof postprocessing depth-of-field]<br />
  31. [example:webgl_postprocessing_dof2 postprocessing depth-of-field 2]<br />
  32. [example:webgl_postprocessing_fxaa postprocessing fxaa]<br />
  33. [example:webgl_postprocessing_glitch postprocessing glitch]<br />
  34. [example:webgl_postprocessing_godrays postprocessing godrays]<br />
  35. [example:webgl_postprocessing_masking postprocessing masking]<br />
  36. [example:webgl_postprocessing_outline postprocessing outline]<br />
  37. [example:webgl_postprocessing_pixel postprocessing pixelate]<br />
  38. [example:webgl_postprocessing_procedural postprocessing procedural]<br />
  39. [example:webgl_postprocessing_rgb_halftone postprocessing rgb halftone]<br />
  40. [example:webgl_postprocessing_sao postprocessing sao]<br />
  41. [example:webgl_postprocessing_smaa postprocessing smaa]<br />
  42. [example:webgl_postprocessing_sobel postprocessing sobel]<br />
  43. [example:webgl_postprocessing_ssaa postprocessing ssaa]<br />
  44. [example:webgl_postprocessing_ssao postprocessing ssao]<br />
  45. [example:webgl_postprocessing_taa postprocessing taa]<br />
  46. [example:webgl_postprocessing_unreal_bloom postprocessing unreal bloom]<br />
  47. [example:webgl_postprocessing_unreal_bloom_selective postprocessing unreal bloom selective]<br />
  48. </p>
  49. <h2>Constructor</h2>
  50. <h3>[name]( [param:WebGLRenderer renderer], [param:WebGLRenderTarget renderTarget] )</h3>
  51. <p>
  52. [page:WebGLRenderer renderer] -- The renderer used to render the scene. <br />
  53. [page:WebGLRenderTarget renderTarget] -- (optional) A preconfigured render target internally used by [name].
  54. </p>
  55. <h2>Properties</h2>
  56. <h3>[property:Array passes]</h3>
  57. <p>
  58. An array representing the (ordered) chain of post-processing passes.
  59. </p>
  60. <h3>[property:WebGLRenderTarget readBuffer]</h3>
  61. <p>
  62. A reference to the internal read buffer. Passes usually read the previous render result from this buffer.
  63. </p>
  64. <h3>[property:WebGLRenderer renderer]</h3>
  65. <p>
  66. A reference to the internal renderer.
  67. </p>
  68. <h3>[property:Boolean renderToScreen]</h3>
  69. <p>
  70. Whether the final pass is rendered to the screen (default framebuffer) or not.
  71. </p>
  72. <h3>[property:WebGLRenderTarget writeBuffer]</h3>
  73. <p>
  74. A reference to the internal write buffer. Passes usually write their result into this buffer.
  75. </p>
  76. <h2>Methods</h2>
  77. <h3>[method:undefined addPass]( [param:Pass pass] )</h3>
  78. <p>
  79. pass -- The pass to add to the pass chain.<br /><br />
  80. Adds the given pass to the pass chain.
  81. </p>
  82. <h3>[method:undefined dispose]()</h3>
  83. <p>
  84. Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
  85. </p>
  86. <h3>[method:undefined insertPass]( [param:Pass pass], [param:Integer index] )</h3>
  87. <p>
  88. pass -- The pass to insert into the pass chain.<br />
  89. index -- Defines the position in the pass chain where the pass should be inserted.<br /><br />
  90. Inserts the given pass into the pass chain at the given index.
  91. </p>
  92. <h3>[method:Boolean isLastEnabledPass]( [param:Integer passIndex] )</h3>
  93. <p>
  94. passIndex -- The pass to check.<br /><br />
  95. Returns true if the pass for the given index is the last enabled pass in the pass chain.
  96. Used by [name] to determine when a pass should be rendered to screen.
  97. </p>
  98. <h3>[method:undefined removePass]( [param:Pass pass] )</h3>
  99. <p>
  100. pass -- The pass to remove from the pass chain.<br /><br />
  101. Removes the given pass from the pass chain.
  102. </p>
  103. <h3>[method:undefined render]( [param:Float deltaTime] )</h3>
  104. <p>
  105. deltaTime -- The delta time value.<br /><br />
  106. Executes all enabled post-processing passes in order to produce the final frame.
  107. </p>
  108. <h3>[method:undefined reset]( [param:WebGLRenderTarget renderTarget] )</h3>
  109. <p>
  110. [page:WebGLRenderTarget renderTarget] -- (optional) A preconfigured render target internally used by [name]..<br /><br />
  111. Resets the internal state of the [name].
  112. </p>
  113. <h3>[method:undefined setPixelRatio]( [param:Float pixelRatio] )</h3>
  114. <p>
  115. pixelRatio -- The device pixel ratio.<br /><br />
  116. Sets device pixel ratio. This is usually used for HiDPI device to prevent blurring output.
  117. Thus, the semantic of the method is similar to [page:WebGLRenderer.setPixelRatio]().
  118. </p>
  119. <h3>[method:undefined setSize]( [param:Integer width], [param:Integer height] )</h3>
  120. <p>
  121. width -- The width of the [name].<br />
  122. height -- The height of the [name].<br /><br />
  123. Resizes the internal render buffers and passes to (width, height) with device pixel ratio taken into account.
  124. Thus, the semantic of the method is similar to [page:WebGLRenderer.setSize]().
  125. </p>
  126. <h3>[method:undefined swapBuffers]()</h3>
  127. <p>Swaps the internal read/write buffers.</p>
  128. <h2>Source</h2>
  129. <p>
  130. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/EffectComposer.js examples/jsm/postprocessing/EffectComposer.js]
  131. </p>
  132. </body>
  133. </html>