BilateralBlurNode.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>BilateralBlurNode - 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">BilateralBlurNode</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Post processing node for creating a bilateral blur effect.</p>
  17. <p>Bilateral blur smooths an image while preserving sharp edges. Unlike a
  18. standard Gaussian blur which blurs everything equally, bilateral blur
  19. analyzes the intensity/color of neighboring pixels. If a neighbor is too
  20. different from the center pixel (indicating an edge), it is excluded
  21. from the blurring process.</p>
  22. <p>Reference: <a href="https://en.wikipedia.org/wiki/Bilateral_filter" target="_blank" rel="noopener">https://en.wikipedia.org/wiki/Bilateral_filter</a></p></div>
  23. </header>
  24. <article>
  25. <h2 class="subsection-title">Import</h2>
  26. <p><span translate="no">BilateralBlurNode</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>
  27. <pre><code class="language-js">import { bilateralBlur } from 'three/addons/tsl/display/BilateralBlurNode.js';</code></pre>
  28. <div class="container-overview">
  29. <h2>Constructor</h2>
  30. <h3 class="name name-method" id="BilateralBlurNode" translate="no">new <a href="#BilateralBlurNode">BilateralBlurNode</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>, sigmaColor : <span class="param-type">number</span> )</span> </h3>
  31. <div class="method">
  32. <div class="description">
  33. <p>Constructs a new bilateral blur node.</p>
  34. </div>
  35. <table class="params">
  36. <tbody>
  37. <tr>
  38. <td class="name">
  39. <strong translate="no">textureNode</strong>
  40. </td>
  41. <td class="description last">
  42. <p>The texture node that represents the input of the effect.</p>
  43. </td>
  44. </tr>
  45. <tr>
  46. <td class="name">
  47. <strong translate="no">directionNode</strong>
  48. </td>
  49. <td class="description last">
  50. <p>Defines the direction and radius of the blur.</p>
  51. <p>Default is <code>null</code>.</p>
  52. </td>
  53. </tr>
  54. <tr>
  55. <td class="name">
  56. <strong translate="no">sigma</strong>
  57. </td>
  58. <td class="description last">
  59. <p>Controls the spatial kernel of the blur filter. Higher values mean a wider blur radius.</p>
  60. <p>Default is <code>4</code>.</p>
  61. </td>
  62. </tr>
  63. <tr>
  64. <td class="name">
  65. <strong translate="no">sigmaColor</strong>
  66. </td>
  67. <td class="description last">
  68. <p>Controls the intensity kernel. Higher values allow more color difference to be blurred together.</p>
  69. <p>Default is <code>0.1</code>.</p>
  70. </td>
  71. </tr>
  72. </tbody>
  73. </table>
  74. </div>
  75. </div>
  76. <h2 class="subsection-title">Properties</h2>
  77. <div class="member">
  78. <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>
  79. <div class="description">
  80. <p>Defines the direction and radius of the blur.</p>
  81. </div>
  82. </div>
  83. <div class="member">
  84. <h3 class="name" id="resolutionScale" translate="no">.<a href="#resolutionScale">resolutionScale</a><span class="type-signature"> : number</span> </h3>
  85. <div class="description">
  86. <p>The resolution scale.</p>
  87. <p>Default is <code>1</code>.</p>
  88. </div>
  89. </div>
  90. <div class="member">
  91. <h3 class="name" id="sigma" translate="no">.<a href="#sigma">sigma</a><span class="type-signature"> : number</span> </h3>
  92. <div class="description">
  93. <p>Controls the spatial kernel of the blur filter. Higher values mean a wider blur radius.</p>
  94. </div>
  95. </div>
  96. <div class="member">
  97. <h3 class="name" id="sigmaColor" translate="no">.<a href="#sigmaColor">sigmaColor</a><span class="type-signature"> : number</span> </h3>
  98. <div class="description">
  99. <p>Controls the color/intensity kernel. Higher values allow more color difference
  100. to be blurred together. Lower values preserve edges more strictly.</p>
  101. </div>
  102. </div>
  103. <div class="member">
  104. <h3 class="name" id="textureNode" translate="no">.<a href="#textureNode">textureNode</a><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
  105. <div class="description">
  106. <p>The texture node that represents the input of the effect.</p>
  107. </div>
  108. </div>
  109. <div class="member">
  110. <h3 class="name" id="updateBeforeType" translate="no">.<a href="#updateBeforeType">updateBeforeType</a><span class="type-signature"> : string</span> </h3>
  111. <div class="description">
  112. <p>The <code>updateBeforeType</code> is set to <code>NodeUpdateType.FRAME</code> since the node renders
  113. its effect once per frame in <code>updateBefore()</code>.</p>
  114. <p>Default is <code>'frame'</code>.</p>
  115. </div>
  116. <dl class="details">
  117. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#updateBeforeType">TempNode#updateBeforeType</a></dt>
  118. </dl>
  119. </div>
  120. <h2 class="subsection-title">Methods</h2>
  121. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  122. <div class="method">
  123. <div class="description">
  124. <p>Frees internal resources. This method should be called
  125. when the effect is no longer required.</p>
  126. </div>
  127. <dl class="details">
  128. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#dispose">TempNode#dispose</a></dt>
  129. </dl>
  130. </div>
  131. <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>
  132. <div class="method">
  133. <div class="description">
  134. <p>Returns the result of the effect as a texture node.</p>
  135. </div>
  136. <dl class="details">
  137. <dt class="tag-returns"><strong>Returns:</strong> A texture node that represents the result of the effect.</dt>
  138. </dl>
  139. </div>
  140. <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>
  141. <div class="method">
  142. <div class="description">
  143. <p>Sets the size of the effect.</p>
  144. </div>
  145. <table class="params">
  146. <tbody>
  147. <tr>
  148. <td class="name">
  149. <strong translate="no">width</strong>
  150. </td>
  151. <td class="description last">
  152. <p>The width of the effect.</p>
  153. </td>
  154. </tr>
  155. <tr>
  156. <td class="name">
  157. <strong translate="no">height</strong>
  158. </td>
  159. <td class="description last">
  160. <p>The height of the effect.</p>
  161. </td>
  162. </tr>
  163. </tbody>
  164. </table>
  165. </div>
  166. <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>
  167. <div class="method">
  168. <div class="description">
  169. <p>This method is used to setup the effect's TSL code.</p>
  170. </div>
  171. <table class="params">
  172. <tbody>
  173. <tr>
  174. <td class="name">
  175. <strong translate="no">builder</strong>
  176. </td>
  177. <td class="description last">
  178. <p>The current node builder.</p>
  179. </td>
  180. </tr>
  181. </tbody>
  182. </table>
  183. <dl class="details">
  184. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#setup">TempNode#setup</a></dt>
  185. </dl>
  186. </div>
  187. <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>
  188. <div class="method">
  189. <div class="description">
  190. <p>This method is used to render the effect once per frame.</p>
  191. </div>
  192. <table class="params">
  193. <tbody>
  194. <tr>
  195. <td class="name">
  196. <strong translate="no">frame</strong>
  197. </td>
  198. <td class="description last">
  199. <p>The current node frame.</p>
  200. </td>
  201. </tr>
  202. </tbody>
  203. </table>
  204. <dl class="details">
  205. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#updateBefore">TempNode#updateBefore</a></dt>
  206. </dl>
  207. </div>
  208. <h2 class="subsection-title">Source</h2>
  209. <p>
  210. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/BilateralBlurNode.js" translate="no" target="_blank" rel="noopener">examples/jsm/tsl/display/BilateralBlurNode.js</a>
  211. </p>
  212. </article>
  213. </section>
  214. <script src="../scripts/linenumber.js"></script>
  215. <script src="../scripts/page.js"></script>
  216. </body>
  217. </html>
粤ICP备19079148号