GaussianBlurNode.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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" rel="noopener">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"><a href="TextureNode.html">TextureNode</a></span>, directionNode : <span class="param-type"><a href="Node.html">Node</a>.&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">
  33. <strong>textureNode</strong>
  34. </td>
  35. <td class="description last">
  36. <p>The texture node that represents the input of the effect.</p>
  37. </td>
  38. </tr>
  39. <tr>
  40. <td class="name">
  41. <strong>directionNode</strong>
  42. </td>
  43. <td class="description last">
  44. <p>Defines the direction and radius of the blur.</p>
  45. <p>Default is <code>null</code>.</p>
  46. </td>
  47. </tr>
  48. <tr>
  49. <td class="name">
  50. <strong>sigma</strong>
  51. </td>
  52. <td class="description last">
  53. <p>Controls the kernel of the blur filter. Higher values mean a wider blur radius.</p>
  54. <p>Default is <code>4</code>.</p>
  55. </td>
  56. </tr>
  57. <tr>
  58. <td class="name">
  59. <strong>options</strong>
  60. </td>
  61. <td class="description last">
  62. <p>Additional options for the gaussian blur effect.</p>
  63. <p>Default is <code>{}</code>.</p>
  64. <table class="params">
  65. <tbody>
  66. <tr>
  67. <td class="name">
  68. <strong>premultipliedAlpha</strong>
  69. </td>
  70. <td class="description last">
  71. <p>Whether to use premultiplied alpha for the blur effect.</p>
  72. <p>Default is <code>false</code>.</p>
  73. </td>
  74. </tr>
  75. <tr>
  76. <td class="name">
  77. <strong>resolutionScale</strong>
  78. </td>
  79. <td class="description last">
  80. <p>The resolution of the effect. 0.5 means half the resolution of the texture node.</p>
  81. <p>Default is <code>1</code>.</p>
  82. </td>
  83. </tr>
  84. </tbody>
  85. </table>
  86. </td>
  87. </tr>
  88. </tbody>
  89. </table>
  90. </div>
  91. </div>
  92. <h2 class="subsection-title">Properties</h2>
  93. <div class="member">
  94. <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>
  95. <div class="description">
  96. <p>Defines the direction and radius of the blur.</p>
  97. </div>
  98. </div>
  99. <div class="member">
  100. <h3 class="name" id="premultipliedAlpha" translate="no">.<a href="#premultipliedAlpha">premultipliedAlpha</a><span class="type-signature"> : boolean</span> </h3>
  101. <div class="description">
  102. <p>Whether the effect should use premultiplied alpha or not. Set this to <code>true</code>
  103. if you are going to blur texture input with transparency.</p>
  104. <p>Default is <code>false</code>.</p>
  105. </div>
  106. </div>
  107. <div class="member">
  108. <h3 class="name" id="resolution" translate="no">.<a href="#resolution">resolution</a><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  109. <div class="description">
  110. <p>The resolution scale.</p>
  111. <p>Default is <code>{(1,1)}</code>.</p>
  112. </div>
  113. <dl class="details">
  114. <dt class="important tag-deprecated"><strong>Deprecated:</strong> Yes</dt>
  115. </dl>
  116. </div>
  117. <div class="member">
  118. <h3 class="name" id="resolutionScale" translate="no">.<a href="#resolutionScale">resolutionScale</a><span class="type-signature"> : number</span> </h3>
  119. <div class="description">
  120. <p>The resolution scale.</p>
  121. <p>Default is <code>(1)</code>.</p>
  122. </div>
  123. </div>
  124. <div class="member">
  125. <h3 class="name" id="sigma" translate="no">.<a href="#sigma">sigma</a><span class="type-signature"> : number</span> </h3>
  126. <div class="description">
  127. <p>Controls the kernel of the blur filter. Higher values mean a wider blur radius.</p>
  128. </div>
  129. </div>
  130. <div class="member">
  131. <h3 class="name" id="textureNode" translate="no">.<a href="#textureNode">textureNode</a><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
  132. <div class="description">
  133. <p>The texture node that represents the input of the effect.</p>
  134. </div>
  135. </div>
  136. <div class="member">
  137. <h3 class="name" id="updateBeforeType" translate="no">.<a href="#updateBeforeType">updateBeforeType</a><span class="type-signature"> : string</span> </h3>
  138. <div class="description">
  139. <p>The <code>updateBeforeType</code> is set to <code>NodeUpdateType.FRAME</code> since the node renders
  140. its effect once per frame in <code>updateBefore()</code>.</p>
  141. <p>Default is <code>'frame'</code>.</p>
  142. </div>
  143. <dl class="details">
  144. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#updateBeforeType">TempNode#updateBeforeType</a></dt>
  145. </dl>
  146. </div>
  147. <h2 class="subsection-title">Methods</h2>
  148. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  149. <div class="method">
  150. <div class="description">
  151. <p>Frees internal resources. This method should be called
  152. when the effect is no longer required.</p>
  153. </div>
  154. <dl class="details">
  155. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#dispose">TempNode#dispose</a></dt>
  156. </dl>
  157. </div>
  158. <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>
  159. <div class="method">
  160. <div class="description">
  161. <p>Returns the result of the effect as a texture node.</p>
  162. </div>
  163. <dl class="details">
  164. <dt class="tag-returns"><strong>Returns:</strong> A texture node that represents the result of the effect.</dt>
  165. </dl>
  166. </div>
  167. <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>
  168. <div class="method">
  169. <div class="description">
  170. <p>Sets the size of the effect.</p>
  171. </div>
  172. <table class="params">
  173. <tbody>
  174. <tr>
  175. <td class="name">
  176. <strong>width</strong>
  177. </td>
  178. <td class="description last">
  179. <p>The width of the effect.</p>
  180. </td>
  181. </tr>
  182. <tr>
  183. <td class="name">
  184. <strong>height</strong>
  185. </td>
  186. <td class="description last">
  187. <p>The height of the effect.</p>
  188. </td>
  189. </tr>
  190. </tbody>
  191. </table>
  192. </div>
  193. <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>
  194. <div class="method">
  195. <div class="description">
  196. <p>This method is used to setup the effect's TSL code.</p>
  197. </div>
  198. <table class="params">
  199. <tbody>
  200. <tr>
  201. <td class="name">
  202. <strong>builder</strong>
  203. </td>
  204. <td class="description last">
  205. <p>The current node builder.</p>
  206. </td>
  207. </tr>
  208. </tbody>
  209. </table>
  210. <dl class="details">
  211. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#setup">TempNode#setup</a></dt>
  212. </dl>
  213. </div>
  214. <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>
  215. <div class="method">
  216. <div class="description">
  217. <p>This method is used to render the effect once per frame.</p>
  218. </div>
  219. <table class="params">
  220. <tbody>
  221. <tr>
  222. <td class="name">
  223. <strong>frame</strong>
  224. </td>
  225. <td class="description last">
  226. <p>The current node frame.</p>
  227. </td>
  228. </tr>
  229. </tbody>
  230. </table>
  231. <dl class="details">
  232. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#updateBefore">TempNode#updateBefore</a></dt>
  233. </dl>
  234. </div>
  235. <h2 class="subsection-title">Source</h2>
  236. <p>
  237. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/GaussianBlurNode.js" translate="no" target="_blank" rel="noopener">examples/jsm/tsl/display/GaussianBlurNode.js</a>
  238. </p>
  239. </article>
  240. </section>
  241. <script src="../scripts/linenumber.js"></script>
  242. <script src="../scripts/page.js"></script>
  243. </body>
  244. </html>
粤ICP备19079148号