EffectComposer.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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_gtao postprocessing gtao]<br />
  36. [example:webgl_postprocessing_masking postprocessing masking]<br />
  37. [example:webgl_postprocessing_outline postprocessing outline]<br />
  38. [example:webgl_postprocessing_pixel postprocessing pixelate]<br />
  39. [example:webgl_postprocessing_procedural postprocessing procedural]<br />
  40. [example:webgl_postprocessing_rgb_halftone postprocessing rgb halftone]<br />
  41. [example:webgl_postprocessing_sao postprocessing sao]<br />
  42. [example:webgl_postprocessing_smaa postprocessing smaa]<br />
  43. [example:webgl_postprocessing_sobel postprocessing sobel]<br />
  44. [example:webgl_postprocessing_ssaa postprocessing ssaa]<br />
  45. [example:webgl_postprocessing_ssao postprocessing ssao]<br />
  46. [example:webgl_postprocessing_taa postprocessing taa]<br />
  47. [example:webgl_postprocessing_unreal_bloom postprocessing unreal bloom]<br />
  48. [example:webgl_postprocessing_unreal_bloom_selective postprocessing unreal bloom selective]<br />
  49. </p>
  50. <h2>Constructor</h2>
  51. <h3>[name]( [param:WebGLRenderer renderer], [param:WebGLRenderTarget renderTarget] )</h3>
  52. <p>
  53. [page:WebGLRenderer renderer] -- The renderer used to render the scene. <br />
  54. [page:WebGLRenderTarget renderTarget] -- (optional) A preconfigured render target internally used by [name].
  55. </p>
  56. <h2>Properties</h2>
  57. <h3>[property:Array passes]</h3>
  58. <p>
  59. An array representing the (ordered) chain of post-processing passes.
  60. </p>
  61. <h3>[property:WebGLRenderTarget readBuffer]</h3>
  62. <p>
  63. A reference to the internal read buffer. Passes usually read the previous render result from this buffer.
  64. </p>
  65. <h3>[property:WebGLRenderer renderer]</h3>
  66. <p>
  67. A reference to the internal renderer.
  68. </p>
  69. <h3>[property:Boolean renderToScreen]</h3>
  70. <p>
  71. Whether the final pass is rendered to the screen (default framebuffer) or not.
  72. </p>
  73. <h3>[property:WebGLRenderTarget writeBuffer]</h3>
  74. <p>
  75. A reference to the internal write buffer. Passes usually write their result into this buffer.
  76. </p>
  77. <h2>Methods</h2>
  78. <h3>[method:undefined addPass]( [param:Pass pass] )</h3>
  79. <p>
  80. pass -- The pass to add to the pass chain.<br /><br />
  81. Adds the given pass to the pass chain.
  82. </p>
  83. <h3>[method:undefined dispose]()</h3>
  84. <p>
  85. Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
  86. </p>
  87. <h3>[method:undefined insertPass]( [param:Pass pass], [param:Integer index] )</h3>
  88. <p>
  89. pass -- The pass to insert into the pass chain.<br />
  90. index -- Defines the position in the pass chain where the pass should be inserted.<br /><br />
  91. Inserts the given pass into the pass chain at the given index.
  92. </p>
  93. <h3>[method:Boolean isLastEnabledPass]( [param:Integer passIndex] )</h3>
  94. <p>
  95. passIndex -- The pass to check.<br /><br />
  96. Returns true if the pass for the given index is the last enabled pass in the pass chain.
  97. Used by [name] to determine when a pass should be rendered to screen.
  98. </p>
  99. <h3>[method:undefined removePass]( [param:Pass pass] )</h3>
  100. <p>
  101. pass -- The pass to remove from the pass chain.<br /><br />
  102. Removes the given pass from the pass chain.
  103. </p>
  104. <h3>[method:undefined render]( [param:Float deltaTime] )</h3>
  105. <p>
  106. deltaTime -- The delta time value.<br /><br />
  107. Executes all enabled post-processing passes in order to produce the final frame.
  108. </p>
  109. <h3>[method:undefined reset]( [param:WebGLRenderTarget renderTarget] )</h3>
  110. <p>
  111. [page:WebGLRenderTarget renderTarget] -- (optional) A preconfigured render target internally used by [name]..<br /><br />
  112. Resets the internal state of the [name].
  113. </p>
  114. <h3>[method:undefined setPixelRatio]( [param:Float pixelRatio] )</h3>
  115. <p>
  116. pixelRatio -- The device pixel ratio.<br /><br />
  117. Sets device pixel ratio. This is usually used for HiDPI device to prevent blurring output.
  118. Thus, the semantic of the method is similar to [page:WebGLRenderer.setPixelRatio]().
  119. </p>
  120. <h3>[method:undefined setSize]( [param:Integer width], [param:Integer height] )</h3>
  121. <p>
  122. width -- The width of the [name].<br />
  123. height -- The height of the [name].<br /><br />
  124. Resizes the internal render buffers and passes to (width, height) with device pixel ratio taken into account.
  125. Thus, the semantic of the method is similar to [page:WebGLRenderer.setSize]().
  126. </p>
  127. <h3>[method:undefined swapBuffers]()</h3>
  128. <p>Swaps the internal read/write buffers.</p>
  129. <h2>Source</h2>
  130. <p>
  131. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/EffectComposer.js examples/jsm/postprocessing/EffectComposer.js]
  132. </p>
  133. </body>
  134. </html>