UnrealBloomPass.html 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>UnrealBloomPass - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <p class="inheritance" translate="no"><a href="Pass.html">Pass</a> → </p>
  13. <h1 translate="no">UnrealBloomPass</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This pass is inspired by the bloom pass of Unreal Engine. It creates a
  17. mip map chain of bloom textures and blurs them with different radii. Because
  18. of the weighted combination of mips, and because larger blurs are done on
  19. higher mips, this effect provides good quality and performance.</p>
  20. <p>When using this pass, tone mapping must be enabled in the renderer settings.</p>
  21. <p>Reference:</p>
  22. <ul>
  23. <li><a href="https://docs.unrealengine.com/latest/INT/Engine/Rendering/PostProcessEffects/Bloom/" target="_blank" rel="noopener">Bloom in Unreal Engine</a></li>
  24. </ul></div>
  25. <h2>Code Example</h2>
  26. <div translate="no"><pre><code class="language-js">const resolution = new THREE.Vector2( window.innerWidth, window.innerHeight );
  27. const bloomPass = new UnrealBloomPass( resolution, 1.5, 0.4, 0.85 );
  28. composer.addPass( bloomPass );
  29. </code></pre></div>
  30. </header>
  31. <article>
  32. <h2 class="subsection-title">Import</h2>
  33. <p><span translate="no">UnrealBloomPass</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
  34. <pre><code class="language-js">import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js';</code></pre>
  35. <div class="container-overview">
  36. <h2>Constructor</h2>
  37. <h3 class="name name-method" id="UnrealBloomPass" translate="no">new <a href="#UnrealBloomPass">UnrealBloomPass</a><span class="signature">( resolution : <span class="param-type"><a href="Vector2.html">Vector2</a></span>, strength : <span class="param-type">number</span>, radius : <span class="param-type">number</span>, threshold : <span class="param-type">number</span> )</span> </h3>
  38. <div class="method">
  39. <div class="description">
  40. <p>Constructs a new Unreal Bloom pass.</p>
  41. </div>
  42. <table class="params">
  43. <tbody>
  44. <tr>
  45. <td class="name">
  46. <strong>resolution</strong>
  47. </td>
  48. <td class="description last">
  49. <p>The effect's resolution.</p>
  50. </td>
  51. </tr>
  52. <tr>
  53. <td class="name">
  54. <strong>strength</strong>
  55. </td>
  56. <td class="description last">
  57. <p>The Bloom strength.</p>
  58. <p>Default is <code>1</code>.</p>
  59. </td>
  60. </tr>
  61. <tr>
  62. <td class="name">
  63. <strong>radius</strong>
  64. </td>
  65. <td class="description last">
  66. <p>The Bloom radius.</p>
  67. </td>
  68. </tr>
  69. <tr>
  70. <td class="name">
  71. <strong>threshold</strong>
  72. </td>
  73. <td class="description last">
  74. <p>The luminance threshold limits which bright areas contribute to the Bloom effect.</p>
  75. </td>
  76. </tr>
  77. </tbody>
  78. </table>
  79. </div>
  80. </div>
  81. <h2 class="subsection-title">Properties</h2>
  82. <div class="member">
  83. <h3 class="name" id="clearColor" translate="no">.<a href="#clearColor">clearColor</a><span class="type-signature"> : <a href="Color.html">Color</a></span> </h3>
  84. <div class="description">
  85. <p>The effect's clear color</p>
  86. <p>Default is <code>(0,0,0)</code>.</p>
  87. </div>
  88. </div>
  89. <div class="member">
  90. <h3 class="name" id="needsSwap" translate="no">.<a href="#needsSwap">needsSwap</a><span class="type-signature"> : boolean</span> </h3>
  91. <div class="description">
  92. <p>Overwritten to disable the swap.</p>
  93. <p>Default is <code>false</code>.</p>
  94. </div>
  95. <dl class="details">
  96. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#needsSwap">Pass#needsSwap</a></dt>
  97. </dl>
  98. </div>
  99. <div class="member">
  100. <h3 class="name" id="radius" translate="no">.<a href="#radius">radius</a><span class="type-signature"> : number</span> </h3>
  101. <div class="description">
  102. <p>The Bloom radius.</p>
  103. </div>
  104. </div>
  105. <div class="member">
  106. <h3 class="name" id="resolution" translate="no">.<a href="#resolution">resolution</a><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  107. <div class="description">
  108. <p>The effect's resolution.</p>
  109. <p>Default is <code>(256,256)</code>.</p>
  110. </div>
  111. </div>
  112. <div class="member">
  113. <h3 class="name" id="strength" translate="no">.<a href="#strength">strength</a><span class="type-signature"> : number</span> </h3>
  114. <div class="description">
  115. <p>The Bloom strength.</p>
  116. <p>Default is <code>1</code>.</p>
  117. </div>
  118. </div>
  119. <div class="member">
  120. <h3 class="name" id="threshold" translate="no">.<a href="#threshold">threshold</a><span class="type-signature"> : number</span> </h3>
  121. <div class="description">
  122. <p>The luminance threshold limits which bright areas contribute to the Bloom effect.</p>
  123. </div>
  124. </div>
  125. <h2 class="subsection-title">Methods</h2>
  126. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  127. <div class="method">
  128. <div class="description">
  129. <p>Frees the GPU-related resources allocated by this instance. Call this
  130. method whenever the pass is no longer used in your app.</p>
  131. </div>
  132. <dl class="details">
  133. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#dispose">Pass#dispose</a></dt>
  134. </dl>
  135. </div>
  136. <h3 class="name name-method" id="render" translate="no">.<a href="#render">render</a><span class="signature">( renderer : <span class="param-type"><a href="WebGLRenderer.html">WebGLRenderer</a></span>, writeBuffer : <span class="param-type"><a href="WebGLRenderTarget.html">WebGLRenderTarget</a></span>, readBuffer : <span class="param-type"><a href="WebGLRenderTarget.html">WebGLRenderTarget</a></span>, deltaTime : <span class="param-type">number</span>, maskActive : <span class="param-type">boolean</span> )</span> </h3>
  137. <div class="method">
  138. <div class="description">
  139. <p>Performs the Bloom pass.</p>
  140. </div>
  141. <table class="params">
  142. <tbody>
  143. <tr>
  144. <td class="name">
  145. <strong>renderer</strong>
  146. </td>
  147. <td class="description last">
  148. <p>The renderer.</p>
  149. </td>
  150. </tr>
  151. <tr>
  152. <td class="name">
  153. <strong>writeBuffer</strong>
  154. </td>
  155. <td class="description last">
  156. <p>The write buffer. This buffer is intended as the rendering
  157. destination for the pass.</p>
  158. </td>
  159. </tr>
  160. <tr>
  161. <td class="name">
  162. <strong>readBuffer</strong>
  163. </td>
  164. <td class="description last">
  165. <p>The read buffer. The pass can access the result from the
  166. previous pass from this buffer.</p>
  167. </td>
  168. </tr>
  169. <tr>
  170. <td class="name">
  171. <strong>deltaTime</strong>
  172. </td>
  173. <td class="description last">
  174. <p>The delta time in seconds.</p>
  175. </td>
  176. </tr>
  177. <tr>
  178. <td class="name">
  179. <strong>maskActive</strong>
  180. </td>
  181. <td class="description last">
  182. <p>Whether masking is active or not.</p>
  183. </td>
  184. </tr>
  185. </tbody>
  186. </table>
  187. <dl class="details">
  188. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#render">Pass#render</a></dt>
  189. </dl>
  190. </div>
  191. <h3 class="name name-method" id="setSize" translate="no">.<a href="#setSize">setSize</a><span class="signature">( width : <span class="param-type">number</span>, height : <span class="param-type">number</span> )</span> </h3>
  192. <div class="method">
  193. <div class="description">
  194. <p>Sets the size of the pass.</p>
  195. </div>
  196. <table class="params">
  197. <tbody>
  198. <tr>
  199. <td class="name">
  200. <strong>width</strong>
  201. </td>
  202. <td class="description last">
  203. <p>The width to set.</p>
  204. </td>
  205. </tr>
  206. <tr>
  207. <td class="name">
  208. <strong>height</strong>
  209. </td>
  210. <td class="description last">
  211. <p>The height to set.</p>
  212. </td>
  213. </tr>
  214. </tbody>
  215. </table>
  216. <dl class="details">
  217. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#setSize">Pass#setSize</a></dt>
  218. </dl>
  219. </div>
  220. <h2 class="subsection-title">Source</h2>
  221. <p>
  222. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/UnrealBloomPass.js" translate="no" target="_blank" rel="noopener">examples/jsm/postprocessing/UnrealBloomPass.js</a>
  223. </p>
  224. </article>
  225. </section>
  226. <script src="../scripts/linenumber.js"></script>
  227. <script src="../scripts/page.js"></script>
  228. </body>
  229. </html>
粤ICP备19079148号