TRAANode.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>TRAANode - 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">TRAANode</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A special node that applies TRAA (Temporal Reprojection Anti-Aliasing).</p>
  17. <p>References:</p>
  18. <ul>
  19. <li><a href="https://alextardif.com/TAA.html" target="_blank" rel="noopener">https://alextardif.com/TAA.html</a></li>
  20. <li><a href="https://www.elopezr.com/temporal-aa-and-the-quest-for-the-holy-trail/" target="_blank" rel="noopener">https://www.elopezr.com/temporal-aa-and-the-quest-for-the-holy-trail/</a></li>
  21. </ul></div>
  22. </header>
  23. <article>
  24. <h2 class="subsection-title">Import</h2>
  25. <p><span translate="no">TRAANode</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>
  26. <pre><code class="language-js">import { traa } from 'three/addons/tsl/display/TRAANode.js';</code></pre>
  27. <div class="container-overview">
  28. <h2>Constructor</h2>
  29. <h3 class="name name-method" id="TRAANode" translate="no">new <a href="#TRAANode">TRAANode</a><span class="signature">( beautyNode : <span class="param-type"><a href="TextureNode.html">TextureNode</a></span>, depthNode : <span class="param-type"><a href="TextureNode.html">TextureNode</a></span>, velocityNode : <span class="param-type"><a href="TextureNode.html">TextureNode</a></span>, camera : <span class="param-type"><a href="Camera.html">Camera</a></span> )</span> </h3>
  30. <div class="method">
  31. <div class="description">
  32. <p>Constructs a new TRAA node.</p>
  33. </div>
  34. <table class="params">
  35. <tbody>
  36. <tr>
  37. <td class="name">
  38. <strong>beautyNode</strong>
  39. </td>
  40. <td class="description last">
  41. <p>The texture node that represents the input of the effect.</p>
  42. </td>
  43. </tr>
  44. <tr>
  45. <td class="name">
  46. <strong>depthNode</strong>
  47. </td>
  48. <td class="description last">
  49. <p>A node that represents the scene's depth.</p>
  50. </td>
  51. </tr>
  52. <tr>
  53. <td class="name">
  54. <strong>velocityNode</strong>
  55. </td>
  56. <td class="description last">
  57. <p>A node that represents the scene's velocity.</p>
  58. </td>
  59. </tr>
  60. <tr>
  61. <td class="name">
  62. <strong>camera</strong>
  63. </td>
  64. <td class="description last">
  65. <p>The camera the scene is rendered with.</p>
  66. </td>
  67. </tr>
  68. </tbody>
  69. </table>
  70. </div>
  71. </div>
  72. <h2 class="subsection-title">Properties</h2>
  73. <div class="member">
  74. <h3 class="name" id="beautyNode" translate="no">.<a href="#beautyNode">beautyNode</a><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
  75. <div class="description">
  76. <p>The texture node that represents the input of the effect.</p>
  77. </div>
  78. </div>
  79. <div class="member">
  80. <h3 class="name" id="camera" translate="no">.<a href="#camera">camera</a><span class="type-signature"> : <a href="Camera.html">Camera</a></span> </h3>
  81. <div class="description">
  82. <p>The camera the scene is rendered with.</p>
  83. </div>
  84. </div>
  85. <div class="member">
  86. <h3 class="name" id="depthNode" translate="no">.<a href="#depthNode">depthNode</a><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
  87. <div class="description">
  88. <p>A node that represents the scene's velocity.</p>
  89. </div>
  90. </div>
  91. <div class="member">
  92. <h3 class="name" id="isTRAANode" translate="no">.<a href="#isTRAANode">isTRAANode</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  93. <div class="description">
  94. <p>This flag can be used for type testing.</p>
  95. <p>Default is <code>true</code>.</p>
  96. </div>
  97. </div>
  98. <div class="member">
  99. <h3 class="name" id="updateBeforeType" translate="no">.<a href="#updateBeforeType">updateBeforeType</a><span class="type-signature"> : string</span> </h3>
  100. <div class="description">
  101. <p>The <code>updateBeforeType</code> is set to <code>NodeUpdateType.FRAME</code> since the node renders
  102. its effect once per frame in <code>updateBefore()</code>.</p>
  103. <p>Default is <code>'frame'</code>.</p>
  104. </div>
  105. <dl class="details">
  106. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#updateBeforeType">TempNode#updateBeforeType</a></dt>
  107. </dl>
  108. </div>
  109. <div class="member">
  110. <h3 class="name" id="velocityNode" translate="no">.<a href="#velocityNode">velocityNode</a><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
  111. <div class="description">
  112. <p>A node that represents the scene's velocity.</p>
  113. </div>
  114. </div>
  115. <h2 class="subsection-title">Methods</h2>
  116. <h3 class="name name-method" id="clearViewOffset" translate="no">.<a href="#clearViewOffset">clearViewOffset</a><span class="signature">()</span> </h3>
  117. <div class="method">
  118. <div class="description">
  119. <p>Clears the view offset from the scene's camera.</p>
  120. </div>
  121. </div>
  122. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  123. <div class="method">
  124. <div class="description">
  125. <p>Frees internal resources. This method should be called
  126. when the effect is no longer required.</p>
  127. </div>
  128. <dl class="details">
  129. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#dispose">TempNode#dispose</a></dt>
  130. </dl>
  131. </div>
  132. <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>
  133. <div class="method">
  134. <div class="description">
  135. <p>Returns the result of the effect as a texture node.</p>
  136. </div>
  137. <dl class="details">
  138. <dt class="tag-returns"><strong>Returns:</strong> A texture node that represents the result of the effect.</dt>
  139. </dl>
  140. </div>
  141. <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>
  142. <div class="method">
  143. <div class="description">
  144. <p>Sets the size of the effect.</p>
  145. </div>
  146. <table class="params">
  147. <tbody>
  148. <tr>
  149. <td class="name">
  150. <strong>width</strong>
  151. </td>
  152. <td class="description last">
  153. <p>The width of the effect.</p>
  154. </td>
  155. </tr>
  156. <tr>
  157. <td class="name">
  158. <strong>height</strong>
  159. </td>
  160. <td class="description last">
  161. <p>The height of the effect.</p>
  162. </td>
  163. </tr>
  164. </tbody>
  165. </table>
  166. </div>
  167. <h3 class="name name-method" id="setViewOffset" translate="no">.<a href="#setViewOffset">setViewOffset</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>Defines the TRAA's current jitter as a view offset
  171. to the scene's camera.</p>
  172. </div>
  173. <table class="params">
  174. <tbody>
  175. <tr>
  176. <td class="name">
  177. <strong>width</strong>
  178. </td>
  179. <td class="description last">
  180. <p>The width of the effect.</p>
  181. </td>
  182. </tr>
  183. <tr>
  184. <td class="name">
  185. <strong>height</strong>
  186. </td>
  187. <td class="description last">
  188. <p>The height of the effect.</p>
  189. </td>
  190. </tr>
  191. </tbody>
  192. </table>
  193. </div>
  194. <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>
  195. <div class="method">
  196. <div class="description">
  197. <p>This method is used to setup the effect's render targets and TSL code.</p>
  198. </div>
  199. <table class="params">
  200. <tbody>
  201. <tr>
  202. <td class="name">
  203. <strong>builder</strong>
  204. </td>
  205. <td class="description last">
  206. <p>The current node builder.</p>
  207. </td>
  208. </tr>
  209. </tbody>
  210. </table>
  211. <dl class="details">
  212. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#setup">TempNode#setup</a></dt>
  213. </dl>
  214. </div>
  215. <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>
  216. <div class="method">
  217. <div class="description">
  218. <p>This method is used to render the effect once per frame.</p>
  219. </div>
  220. <table class="params">
  221. <tbody>
  222. <tr>
  223. <td class="name">
  224. <strong>frame</strong>
  225. </td>
  226. <td class="description last">
  227. <p>The current node frame.</p>
  228. </td>
  229. </tr>
  230. </tbody>
  231. </table>
  232. <dl class="details">
  233. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#updateBefore">TempNode#updateBefore</a></dt>
  234. </dl>
  235. </div>
  236. <h2 class="subsection-title">Source</h2>
  237. <p>
  238. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/TRAANode.js" translate="no" target="_blank" rel="noopener">examples/jsm/tsl/display/TRAANode.js</a>
  239. </p>
  240. </article>
  241. </section>
  242. <script src="../scripts/linenumber.js"></script>
  243. <script src="../scripts/page.js"></script>
  244. </body>
  245. </html>
粤ICP备19079148号