1
0

BloomNode.html 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>BloomNode - 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="EventDispatcher.html">EventDispatcher</a> → <a href="Node.html">Node</a> → <a href="TempNode.html">TempNode</a> → </p>
  13. <h1 translate="no">BloomNode</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Post processing node for creating a bloom effect.</p>
  17. <p>By default, the node affects the entire image. For a selective bloom,
  18. use the <code>emissive</code> material property to control which objects should
  19. contribute to bloom or not. This can be achieved via MRT.</p>
  20. <pre><code class="language-js">const postProcessing = new THREE.PostProcessing( renderer );
  21. const scenePass = pass( scene, camera );
  22. scenePass.setMRT( mrt( {
  23. output,
  24. emissive
  25. } ) );
  26. const scenePassColor = scenePass.getTextureNode( 'output' );
  27. const emissivePass = scenePass.getTextureNode( 'emissive' );
  28. const bloomPass = bloom( emissivePass );
  29. postProcessing.outputNode = scenePassColor.add( bloomPass );
  30. </code></pre></div>
  31. <h2>Code Example</h2>
  32. <div translate="no"><pre><code class="language-js">const postProcessing = new THREE.PostProcessing( renderer );
  33. const scenePass = pass( scene, camera );
  34. const scenePassColor = scenePass.getTextureNode( 'output' );
  35. const bloomPass = bloom( scenePassColor );
  36. postProcessing.outputNode = scenePassColor.add( bloomPass );
  37. </code></pre></div>
  38. </header>
  39. <article>
  40. <h2 class="subsection-title">Import</h2>
  41. <p><span translate="no">BloomNode</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>
  42. <pre><code class="language-js">import { bloom } from 'three/addons/tsl/display/BloomNode.js';</code></pre>
  43. <div class="container-overview">
  44. <h2>Constructor</h2>
  45. <h3 class="name name-method" id="BloomNode" translate="no">new <a href="#BloomNode">BloomNode</a><span class="signature">( inputNode : <span class="param-type"><a href="Node.html">Node</a>.&lt;vec4></span>, strength : <span class="param-type">number</span>, radius : <span class="param-type">number</span>, threshold : <span class="param-type">number</span> )</span> </h3>
  46. <div class="method">
  47. <div class="description">
  48. <p>Constructs a new bloom node.</p>
  49. </div>
  50. <table class="params">
  51. <tbody>
  52. <tr>
  53. <td class="name">
  54. <strong>inputNode</strong>
  55. </td>
  56. <td class="description last">
  57. <p>The node that represents the input of the effect.</p>
  58. </td>
  59. </tr>
  60. <tr>
  61. <td class="name">
  62. <strong>strength</strong>
  63. </td>
  64. <td class="description last">
  65. <p>The strength of the bloom.</p>
  66. <p>Default is <code>1</code>.</p>
  67. </td>
  68. </tr>
  69. <tr>
  70. <td class="name">
  71. <strong>radius</strong>
  72. </td>
  73. <td class="description last">
  74. <p>The radius of the bloom.</p>
  75. <p>Default is <code>0</code>.</p>
  76. </td>
  77. </tr>
  78. <tr>
  79. <td class="name">
  80. <strong>threshold</strong>
  81. </td>
  82. <td class="description last">
  83. <p>The luminance threshold limits which bright areas contribute to the bloom effect.</p>
  84. <p>Default is <code>0</code>.</p>
  85. </td>
  86. </tr>
  87. </tbody>
  88. </table>
  89. </div>
  90. </div>
  91. <h2 class="subsection-title">Properties</h2>
  92. <div class="member">
  93. <h3 class="name" id="inputNode" translate="no">.<a href="#inputNode">inputNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;vec4></span> </h3>
  94. <div class="description">
  95. <p>The node that represents the input of the effect.</p>
  96. </div>
  97. </div>
  98. <div class="member">
  99. <h3 class="name" id="radius" translate="no">.<a href="#radius">radius</a><span class="type-signature"> : <a href="UniformNode.html">UniformNode</a>.&lt;float></span> </h3>
  100. <div class="description">
  101. <p>The radius of the bloom.</p>
  102. </div>
  103. </div>
  104. <div class="member">
  105. <h3 class="name" id="smoothWidth" translate="no">.<a href="#smoothWidth">smoothWidth</a><span class="type-signature"> : <a href="UniformNode.html">UniformNode</a>.&lt;float></span> </h3>
  106. <div class="description">
  107. <p>Can be used to tweak the extracted luminance from the scene.</p>
  108. </div>
  109. </div>
  110. <div class="member">
  111. <h3 class="name" id="strength" translate="no">.<a href="#strength">strength</a><span class="type-signature"> : <a href="UniformNode.html">UniformNode</a>.&lt;float></span> </h3>
  112. <div class="description">
  113. <p>The strength of the bloom.</p>
  114. </div>
  115. </div>
  116. <div class="member">
  117. <h3 class="name" id="threshold" translate="no">.<a href="#threshold">threshold</a><span class="type-signature"> : <a href="UniformNode.html">UniformNode</a>.&lt;float></span> </h3>
  118. <div class="description">
  119. <p>The luminance threshold limits which bright areas contribute to the bloom effect.</p>
  120. </div>
  121. </div>
  122. <div class="member">
  123. <h3 class="name" id="updateBeforeType" translate="no">.<a href="#updateBeforeType">updateBeforeType</a><span class="type-signature"> : string</span> </h3>
  124. <div class="description">
  125. <p>The <code>updateBeforeType</code> is set to <code>NodeUpdateType.FRAME</code> since the node renders
  126. its effect once per frame in <code>updateBefore()</code>.</p>
  127. <p>Default is <code>'frame'</code>.</p>
  128. </div>
  129. <dl class="details">
  130. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#updateBeforeType">TempNode#updateBeforeType</a></dt>
  131. </dl>
  132. </div>
  133. <h2 class="subsection-title">Methods</h2>
  134. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  135. <div class="method">
  136. <div class="description">
  137. <p>Frees internal resources. This method should be called
  138. when the effect is no longer required.</p>
  139. </div>
  140. <dl class="details">
  141. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#dispose">TempNode#dispose</a></dt>
  142. </dl>
  143. </div>
  144. <h3 class="name name-method" id="getTextureNode" translate="no">.<a href="#getTextureNode">getTextureNode</a><span class="signature">()</span><span class="type-signature"> : <a href="PassTextureNode.html">PassTextureNode</a></span> </h3>
  145. <div class="method">
  146. <div class="description">
  147. <p>Returns the result of the effect as a texture node.</p>
  148. </div>
  149. <dl class="details">
  150. <dt class="tag-returns"><strong>Returns:</strong> A texture node that represents the result of the effect.</dt>
  151. </dl>
  152. </div>
  153. <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>
  154. <div class="method">
  155. <div class="description">
  156. <p>Sets the size of the effect.</p>
  157. </div>
  158. <table class="params">
  159. <tbody>
  160. <tr>
  161. <td class="name">
  162. <strong>width</strong>
  163. </td>
  164. <td class="description last">
  165. <p>The width of the effect.</p>
  166. </td>
  167. </tr>
  168. <tr>
  169. <td class="name">
  170. <strong>height</strong>
  171. </td>
  172. <td class="description last">
  173. <p>The height of the effect.</p>
  174. </td>
  175. </tr>
  176. </tbody>
  177. </table>
  178. </div>
  179. <h3 class="name name-method" id="setup" translate="no">.<a href="#setup">setup</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : <a href="PassTextureNode.html">PassTextureNode</a></span> </h3>
  180. <div class="method">
  181. <div class="description">
  182. <p>This method is used to setup the effect's TSL code.</p>
  183. </div>
  184. <table class="params">
  185. <tbody>
  186. <tr>
  187. <td class="name">
  188. <strong>builder</strong>
  189. </td>
  190. <td class="description last">
  191. <p>The current node builder.</p>
  192. </td>
  193. </tr>
  194. </tbody>
  195. </table>
  196. <dl class="details">
  197. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#setup">TempNode#setup</a></dt>
  198. </dl>
  199. </div>
  200. <h3 class="name name-method" id="updateBefore" translate="no">.<a href="#updateBefore">updateBefore</a><span class="signature">( frame : <span class="param-type"><a href="NodeFrame.html">NodeFrame</a></span> )</span> </h3>
  201. <div class="method">
  202. <div class="description">
  203. <p>This method is used to render the effect once per frame.</p>
  204. </div>
  205. <table class="params">
  206. <tbody>
  207. <tr>
  208. <td class="name">
  209. <strong>frame</strong>
  210. </td>
  211. <td class="description last">
  212. <p>The current node frame.</p>
  213. </td>
  214. </tr>
  215. </tbody>
  216. </table>
  217. <dl class="details">
  218. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#updateBefore">TempNode#updateBefore</a></dt>
  219. </dl>
  220. </div>
  221. <h2 class="subsection-title">Source</h2>
  222. <p>
  223. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/BloomNode.js" translate="no" target="_blank" rel="noopener">examples/jsm/tsl/display/BloomNode.js</a>
  224. </p>
  225. </article>
  226. </section>
  227. <script src="../scripts/linenumber.js"></script>
  228. <script src="../scripts/page.js"></script>
  229. </body>
  230. </html>
粤ICP备19079148号