TRAANode.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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">https://alextardif.com/TAA.html</a></li>
  20. <li><a href="https://www.elopezr.com/temporal-aa-and-the-quest-for-the-holy-trail/">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">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">TextureNode</span>, depthNode : <span class="param-type">TextureNode</span>, velocityNode : <span class="param-type">TextureNode</span>, camera : <span class="param-type">Camera</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"><code>beautyNode</code></td>
  38. <td class="description last"><p>The texture node that represents the input of the effect.</p></td>
  39. </tr>
  40. <tr>
  41. <td class="name"><code>depthNode</code></td>
  42. <td class="description last"><p>A node that represents the scene's depth.</p></td>
  43. </tr>
  44. <tr>
  45. <td class="name"><code>velocityNode</code></td>
  46. <td class="description last"><p>A node that represents the scene's velocity.</p></td>
  47. </tr>
  48. <tr>
  49. <td class="name"><code>camera</code></td>
  50. <td class="description last"><p>The camera the scene is rendered with.</p></td>
  51. </tr>
  52. </tbody>
  53. </table>
  54. </div>
  55. </div>
  56. <h2 class="subsection-title">Properties</h2>
  57. <div class="member">
  58. <h3 class="name" id="beautyNode" translate="no">.<a href="#beautyNode">beautyNode</a><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
  59. <div class="description">
  60. <p>The texture node that represents the input of the effect.</p>
  61. </div>
  62. </div>
  63. <div class="member">
  64. <h3 class="name" id="camera" translate="no">.<a href="#camera">camera</a><span class="type-signature"> : <a href="Camera.html">Camera</a></span> </h3>
  65. <div class="description">
  66. <p>The camera the scene is rendered with.</p>
  67. </div>
  68. </div>
  69. <div class="member">
  70. <h3 class="name" id="depthNode" translate="no">.<a href="#depthNode">depthNode</a><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
  71. <div class="description">
  72. <p>A node that represents the scene's velocity.</p>
  73. </div>
  74. </div>
  75. <div class="member">
  76. <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>
  77. <div class="description">
  78. <p>This flag can be used for type testing.<br/>Default is <code>true</code>.</p>
  79. </div>
  80. </div>
  81. <div class="member">
  82. <h3 class="name" id="updateBeforeType" translate="no">.<a href="#updateBeforeType">updateBeforeType</a><span class="type-signature"> : string</span> </h3>
  83. <div class="description">
  84. <p>The <code>updateBeforeType</code> is set to <code>NodeUpdateType.FRAME</code> since the node renders
  85. its effect once per frame in <code>updateBefore()</code>.<br/>Default is <code>'frame'</code>.</p>
  86. </div>
  87. <dl class="details">
  88. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#updateBeforeType">TempNode#updateBeforeType</a></dt>
  89. </dl>
  90. </div>
  91. <div class="member">
  92. <h3 class="name" id="velocityNode" translate="no">.<a href="#velocityNode">velocityNode</a><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
  93. <div class="description">
  94. <p>A node that represents the scene's velocity.</p>
  95. </div>
  96. </div>
  97. <h2 class="subsection-title">Methods</h2>
  98. <h3 class="name name-method" id="clearViewOffset" translate="no">.<a href="#clearViewOffset">clearViewOffset</a><span class="signature">()</span> </h3>
  99. <div class="method">
  100. <div class="description">
  101. <p>Clears the view offset from the scene's camera.</p>
  102. </div>
  103. </div>
  104. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  105. <div class="method">
  106. <div class="description">
  107. <p>Frees internal resources. This method should be called
  108. when the effect is no longer required.</p>
  109. </div>
  110. <dl class="details">
  111. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#dispose">TempNode#dispose</a></dt>
  112. </dl>
  113. </div>
  114. <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>
  115. <div class="method">
  116. <div class="description">
  117. <p>Returns the result of the effect as a texture node.</p>
  118. </div>
  119. <dl class="details">
  120. <dt class="tag-returns"><strong>Returns:</strong> A texture node that represents the result of the effect.</dt>
  121. </dl>
  122. </div>
  123. <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>
  124. <div class="method">
  125. <div class="description">
  126. <p>Sets the size of the effect.</p>
  127. </div>
  128. <table class="params">
  129. <tbody>
  130. <tr>
  131. <td class="name"><code>width</code></td>
  132. <td class="description last"><p>The width of the effect.</p></td>
  133. </tr>
  134. <tr>
  135. <td class="name"><code>height</code></td>
  136. <td class="description last"><p>The height of the effect.</p></td>
  137. </tr>
  138. </tbody>
  139. </table>
  140. </div>
  141. <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>
  142. <div class="method">
  143. <div class="description">
  144. <p>Defines the TRAA's current jitter as a view offset
  145. to the scene's camera.</p>
  146. </div>
  147. <table class="params">
  148. <tbody>
  149. <tr>
  150. <td class="name"><code>width</code></td>
  151. <td class="description last"><p>The width of the effect.</p></td>
  152. </tr>
  153. <tr>
  154. <td class="name"><code>height</code></td>
  155. <td class="description last"><p>The height of the effect.</p></td>
  156. </tr>
  157. </tbody>
  158. </table>
  159. </div>
  160. <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>
  161. <div class="method">
  162. <div class="description">
  163. <p>This method is used to setup the effect's render targets and TSL code.</p>
  164. </div>
  165. <table class="params">
  166. <tbody>
  167. <tr>
  168. <td class="name"><code>builder</code></td>
  169. <td class="description last"><p>The current node builder.</p></td>
  170. </tr>
  171. </tbody>
  172. </table>
  173. <dl class="details">
  174. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#setup">TempNode#setup</a></dt>
  175. </dl>
  176. <dl class="details">
  177. <dt class="tag-returns"><strong>Returns:</strong> </dt>
  178. </dl>
  179. </div>
  180. <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>
  181. <div class="method">
  182. <div class="description">
  183. <p>This method is used to render the effect once per frame.</p>
  184. </div>
  185. <table class="params">
  186. <tbody>
  187. <tr>
  188. <td class="name"><code>frame</code></td>
  189. <td class="description last"><p>The current node frame.</p></td>
  190. </tr>
  191. </tbody>
  192. </table>
  193. <dl class="details">
  194. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#updateBefore">TempNode#updateBefore</a></dt>
  195. </dl>
  196. </div>
  197. <h2 class="subsection-title">Source</h2>
  198. <p>
  199. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/TRAANode.js" target="_blank" rel="noopener" translate="no">examples/jsm/tsl/display/TRAANode.js</a>
  200. </p>
  201. </article>
  202. </section>
  203. <script src="../scripts/linenumber.js"></script>
  204. <script src="../scripts/page.js"></script>
  205. </body>
  206. </html>
粤ICP备19079148号