EffectComposer.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <!DOCTYPE html>
  2. <html lang="zh">
  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. 用于在three.js中实现后期处理效果。该类管理了产生最终视觉效果的后期处理过程链。
  13. 后期处理过程根据它们添加/插入的顺序来执行,最后一个过程会被自动渲染到屏幕上。
  14. </p>
  15. <h2>进口</h2>
  16. <p>
  17. [name] 是一个附加组件,必须显式导入。
  18. See [link:#manual/introduction/Installation Installation / Addons].
  19. </p>
  20. <code>
  21. import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
  22. </code>
  23. <h2>例子</h2>
  24. <p>
  25. [example:webgl_postprocessing postprocessing]<br />
  26. [example:webgl_postprocessing_advanced postprocessing advanced]<br />
  27. [example:webgl_postprocessing_backgrounds postprocessing backgrounds]<br />
  28. [example:webgl_postprocessing_crossfade postprocessing crossfade]<br />
  29. [example:webgl_postprocessing_dof postprocessing depth-of-field]<br />
  30. [example:webgl_postprocessing_dof2 postprocessing depth-of-field 2]<br />
  31. [example:webgl_postprocessing_fxaa postprocessing fxaa]<br />
  32. [example:webgl_postprocessing_glitch postprocessing glitch]<br />
  33. [example:webgl_postprocessing_godrays postprocessing godrays]<br />
  34. [example:webgl_postprocessing_masking postprocessing masking]<br />
  35. [example:webgl_postprocessing_outline postprocessing outline]<br />
  36. [example:webgl_postprocessing_pixel postprocessing pixelate]<br />
  37. [example:webgl_postprocessing_procedural postprocessing procedural]<br />
  38. [example:webgl_postprocessing_rgb_halftone postprocessing rgb halftone]<br />
  39. [example:webgl_postprocessing_sao postprocessing sao]<br />
  40. [example:webgl_postprocessing_smaa postprocessing smaa]<br />
  41. [example:webgl_postprocessing_sobel postprocessing sobel]<br />
  42. [example:webgl_postprocessing_ssaa postprocessing ssaa]<br />
  43. [example:webgl_postprocessing_ssao postprocessing ssao]<br />
  44. [example:webgl_postprocessing_taa postprocessing taa]<br />
  45. [example:webgl_postprocessing_unreal_bloom postprocessing unreal bloom]<br />
  46. [example:webgl_postprocessing_unreal_bloom_selective postprocessing unreal bloom selective]<br />
  47. </p>
  48. <h2>构造函数</h2>
  49. <h3>[name]( [param:WebGLRenderer renderer], [param:WebGLRenderTarget renderTarget] )</h3>
  50. <p>
  51. [page:WebGLRenderer renderer] -- 用于渲染场景的渲染器。<br />
  52. [page:WebGLRenderTarget renderTarget] -- (可选)一个预先配置的渲染目标,内部由 [name] 使用。
  53. </p>
  54. <h2>属性</h2>
  55. <h3>[property:Array passes]</h3>
  56. <p>
  57. 一个用于表示后期处理过程链(包含顺序)的数组。
  58. </p>
  59. <h3>[property:WebGLRenderTarget readBuffer]</h3>
  60. <p>
  61. 内部读缓冲区的引用。过程一般从该缓冲区读取先前的渲染结果。
  62. </p>
  63. <h3>[property:WebGLRenderer renderer]</h3>
  64. <p>
  65. 内部渲染器的引用。
  66. </p>
  67. <h3>[property:Boolean renderToScreen]</h3>
  68. <p>
  69. 最终过程是否被渲染到屏幕(默认帧缓冲区)。
  70. </p>
  71. <h3>[property:WebGLRenderTarget writeBuffer]</h3>
  72. <p>
  73. 内部写缓冲区的引用。过程常将它们的渲染结果写入该缓冲区。
  74. </p>
  75. <h2>方法</h2>
  76. <h3>[method:undefined addPass]( [param:Pass pass] )</h3>
  77. <p>
  78. pass -- 将被添加到过程链的过程<br /><br />
  79. 将传入的过程添加到过程链。
  80. </p>
  81. <h3>[method:undefined dispose]()</h3>
  82. <p>
  83. Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
  84. </p>
  85. <h3>[method:undefined insertPass]( [param:Pass pass], [param:Integer index] )</h3>
  86. <p>
  87. pass -- 将被插入到过程链的过程。<br />
  88. index -- 定义过程链中过程应插入的位置。<br /><br />
  89. 将传入的过程插入到过程链中所给定的索引处。
  90. </p>
  91. <h3>[method:Boolean isLastEnabledPass]( [param:Integer passIndex] )</h3>
  92. <p>
  93. passIndex -- 被用于检查的过程<br /><br />
  94. 如果给定索引的过程在过程链中是最后一个启用的过程,则返回true。
  95. 由[name]所使用,来决定哪一个过程应当被渲染到屏幕上。
  96. </p>
  97. <h3>[method:undefined removePass]( [param:Pass pass] )</h3>
  98. <p>
  99. pass -- The pass to remove from the pass chain.<br /><br />
  100. Removes the given pass from the pass chain.
  101. </p>
  102. <h3>[method:undefined render]( [param:Float deltaTime] )</h3>
  103. <p>
  104. deltaTime -- The delta time value.<br /><br />
  105. 执行所有启用的后期处理过程,来产生最终的帧,
  106. </p>
  107. <h3>[method:undefined reset]( [param:WebGLRenderTarget renderTarget] )</h3>
  108. <p>
  109. [page:WebGLRenderTarget renderTarget] -- (可选)一个预先配置的渲染目标,内部由 [name] 使用。<br /><br />
  110. 重置所有[name]的内部状态。
  111. </p>
  112. <h3>[method:undefined setPixelRatio]( [param:Float pixelRatio] )</h3>
  113. <p>
  114. pixelRatio -- 设备像素比<br /><br />
  115. 设置设备的像素比。该值通常被用于HiDPI设备,以阻止模糊的输出。
  116. 因此,该方法语义类似于[page:WebGLRenderer.setPixelRatio]()。
  117. </p>
  118. <h3>[method:undefined setSize]( [param:Integer width], [param:Integer height] )</h3>
  119. <p>
  120. width -- [name]的宽度。<br />
  121. height -- [name]的高度。<br /><br />
  122. 考虑设备像素比,重新设置内部渲染缓冲和过程的大小为(width, height)。
  123. 因此,该方法语义类似于[page:WebGLRenderer.setSize]()。
  124. </p>
  125. <h3>[method:undefined swapBuffers]()</h3>
  126. <p>交换内部的读/写缓冲。</p>
  127. <h2>源代码</h2>
  128. <p>
  129. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/EffectComposer.js examples/jsm/postprocessing/EffectComposer.js]
  130. </p>
  131. </body>
  132. </html>