GaussianBlurNode.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>GaussianBlurNode - 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">GaussianBlurNode</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Post processing node for creating a gaussian blur effect.</p></div>
  17. </header>
  18. <article>
  19. <h2 class="subsection-title">Import</h2>
  20. <p><span translate="no">GaussianBlurNode</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank">Installation#Addons</a>.</p>
  21. <pre><code class="language-js">import { gaussianBlur, premultipliedGaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js';</code></pre>
  22. <div class="container-overview">
  23. <h2>Constructor</h2>
  24. <h3 class="name name-method" id="GaussianBlurNode" translate="no">new <a href="#GaussianBlurNode">GaussianBlurNode</a><span class="signature">( textureNode : <span class="param-type">TextureNode</span>, directionNode : <span class="param-type">Node.&lt;(vec2|float)></span>, sigma : <span class="param-type">number</span>, options : <span class="param-type">Object</span> )</span> </h3>
  25. <div class="method">
  26. <div class="description">
  27. <p>Constructs a new gaussian blur node.</p>
  28. </div>
  29. <table class="params">
  30. <tbody>
  31. <tr>
  32. <td class="name"><code>textureNode</code></td>
  33. <td class="description last"><p>The texture node that represents the input of the effect.</p></td>
  34. </tr>
  35. <tr>
  36. <td class="name"><code>directionNode</code></td>
  37. <td class="description last"><p>Defines the direction and radius of the blur.<br/>Default is <code>null</code>.</p></td>
  38. </tr>
  39. <tr>
  40. <td class="name"><code>sigma</code></td>
  41. <td class="description last"><p>Controls the kernel of the blur filter. Higher values mean a wider blur radius.<br/>Default is <code>4</code>.</p></td>
  42. </tr>
  43. <tr>
  44. <td class="name"><code>options</code></td>
  45. <td class="description last"><p>Additional options for the gaussian blur effect.<br/>Default is <code>{}</code>.</p>
  46. <h6>Properties</h6>
  47. <table class="params">
  48. <tbody>
  49. <tr>
  50. <td class="name"><code>premultipliedAlpha</code></td>
  51. <td class="description last"><p>Whether to use premultiplied alpha for the blur effect.<br/>Default is <code>false</code>.</p></td>
  52. </tr>
  53. <tr>
  54. <td class="name"><code>resolutionScale</code></td>
  55. <td class="description last"><p>The resolution of the effect. 0.5 means half the resolution of the texture node.<br/>Default is <code>1</code>.</p></td>
  56. </tr>
  57. </tbody>
  58. </table>
  59. </td>
  60. </tr>
  61. </tbody>
  62. </table>
  63. </div>
  64. </div>
  65. <h2 class="subsection-title">Properties</h2>
  66. <div class="member">
  67. <h3 class="name" id="directionNode" translate="no">.<a href="#directionNode">directionNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;(vec2|float)></span> </h3>
  68. <div class="description">
  69. <p>Defines the direction and radius of the blur.</p>
  70. </div>
  71. </div>
  72. <div class="member">
  73. <h3 class="name" id="premultipliedAlpha" translate="no">.<a href="#premultipliedAlpha">premultipliedAlpha</a><span class="type-signature"> : boolean</span> </h3>
  74. <div class="description">
  75. <p>Whether the effect should use premultiplied alpha or not. Set this to <code>true</code>
  76. if you are going to blur texture input with transparency.<br/>Default is <code>false</code>.</p>
  77. </div>
  78. </div>
  79. <div class="member">
  80. <h3 class="name" id="resolution" translate="no">.<a href="#resolution">resolution</a><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  81. <div class="description">
  82. <p>The resolution scale.<br/>Default is <code>{(1,1)}</code>.</p>
  83. </div>
  84. <dl class="details">
  85. <dt class="important tag-deprecated"><strong>Deprecated:</strong> Yes</dt>
  86. </dl>
  87. </div>
  88. <div class="member">
  89. <h3 class="name" id="resolutionScale" translate="no">.<a href="#resolutionScale">resolutionScale</a><span class="type-signature"> : number</span> </h3>
  90. <div class="description">
  91. <p>The resolution scale.<br/>Default is <code>(1)</code>.</p>
  92. </div>
  93. </div>
  94. <div class="member">
  95. <h3 class="name" id="sigma" translate="no">.<a href="#sigma">sigma</a><span class="type-signature"> : number</span> </h3>
  96. <div class="description">
  97. <p>Controls the kernel of the blur filter. Higher values mean a wider blur radius.</p>
  98. </div>
  99. </div>
  100. <div class="member">
  101. <h3 class="name" id="textureNode" translate="no">.<a href="#textureNode">textureNode</a><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
  102. <div class="description">
  103. <p>The texture node that represents the input of the effect.</p>
  104. </div>
  105. </div>
  106. <div class="member">
  107. <h3 class="name" id="updateBeforeType" translate="no">.<a href="#updateBeforeType">updateBeforeType</a><span class="type-signature"> : string</span> </h3>
  108. <div class="description">
  109. <p>The <code>updateBeforeType</code> is set to <code>NodeUpdateType.FRAME</code> since the node renders
  110. its effect once per frame in <code>updateBefore()</code>.<br/>Default is <code>'frame'</code>.</p>
  111. </div>
  112. <dl class="details">
  113. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#updateBeforeType">TempNode#updateBeforeType</a></dt>
  114. </dl>
  115. </div>
  116. <h2 class="subsection-title">Methods</h2>
  117. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  118. <div class="method">
  119. <div class="description">
  120. <p>Frees internal resources. This method should be called
  121. when the effect is no longer required.</p>
  122. </div>
  123. <dl class="details">
  124. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#dispose">TempNode#dispose</a></dt>
  125. </dl>
  126. </div>
  127. <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>
  128. <div class="method">
  129. <div class="description">
  130. <p>Returns the result of the effect as a texture node.</p>
  131. </div>
  132. <dl class="details">
  133. <dt class="tag-returns"><strong>Returns:</strong> A texture node that represents the result of the effect.</dt>
  134. </dl>
  135. </div>
  136. <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>
  137. <div class="method">
  138. <div class="description">
  139. <p>Sets the size of the effect.</p>
  140. </div>
  141. <table class="params">
  142. <tbody>
  143. <tr>
  144. <td class="name"><code>width</code></td>
  145. <td class="description last"><p>The width of the effect.</p></td>
  146. </tr>
  147. <tr>
  148. <td class="name"><code>height</code></td>
  149. <td class="description last"><p>The height of the effect.</p></td>
  150. </tr>
  151. </tbody>
  152. </table>
  153. </div>
  154. <h3 class="name name-method" id="setup" translate="no">.<a href="#setup">setup</a><span class="signature">( builder : <span class="param-type">NodeBuilder</span> )</span><span class="type-signature"> : <a href="PassTextureNode.html">PassTextureNode</a></span> </h3>
  155. <div class="method">
  156. <div class="description">
  157. <p>This method is used to setup the effect's TSL code.</p>
  158. </div>
  159. <table class="params">
  160. <tbody>
  161. <tr>
  162. <td class="name"><code>builder</code></td>
  163. <td class="description last"><p>The current node builder.</p></td>
  164. </tr>
  165. </tbody>
  166. </table>
  167. <dl class="details">
  168. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#setup">TempNode#setup</a></dt>
  169. </dl>
  170. <dl class="details">
  171. <dt class="tag-returns"><strong>Returns:</strong> </dt>
  172. </dl>
  173. </div>
  174. <h3 class="name name-method" id="updateBefore" translate="no">.<a href="#updateBefore">updateBefore</a><span class="signature">( frame : <span class="param-type">NodeFrame</span> )</span> </h3>
  175. <div class="method">
  176. <div class="description">
  177. <p>This method is used to render the effect once per frame.</p>
  178. </div>
  179. <table class="params">
  180. <tbody>
  181. <tr>
  182. <td class="name"><code>frame</code></td>
  183. <td class="description last"><p>The current node frame.</p></td>
  184. </tr>
  185. </tbody>
  186. </table>
  187. <dl class="details">
  188. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#updateBefore">TempNode#updateBefore</a></dt>
  189. </dl>
  190. </div>
  191. <h2 class="subsection-title">Source</h2>
  192. <p>
  193. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/GaussianBlurNode.js" target="_blank" rel="noopener" translate="no">examples/jsm/tsl/display/GaussianBlurNode.js</a>
  194. </p>
  195. </article>
  196. </section>
  197. <script src="../scripts/linenumber.js"></script>
  198. <script src="../scripts/page.js"></script>
  199. </body>
  200. </html>
粤ICP备19079148号