RenderTransitionPass.html 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>RenderTransitionPass - 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="Pass.html">Pass</a> → </p>
  13. <h1 translate="no">RenderTransitionPass</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A special type of render pass for implementing transition effects.
  17. When active, the pass will transition from scene A to scene B.</p></div>
  18. <h2>Code Example</h2>
  19. <div translate="no"><pre><code class="language-js">const renderTransitionPass = new RenderTransitionPass( fxSceneA.scene, fxSceneA.camera, fxSceneB.scene, fxSceneB.camera );
  20. renderTransitionPass.setTexture( textures[ 0 ] );
  21. composer.addPass( renderTransitionPass );
  22. </code></pre></div>
  23. </header>
  24. <article>
  25. <h2 class="subsection-title">Import</h2>
  26. <p><span translate="no">RenderTransitionPass</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank">Installation#Addons</a>.</p>
  27. <pre><code class="language-js">import { RenderTransitionPass } from 'three/addons/postprocessing/RenderTransitionPass.js';</code></pre>
  28. <div class="container-overview">
  29. <h2>Constructor</h2>
  30. <h3 class="name name-method" id="RenderTransitionPass" translate="no">new <a href="#RenderTransitionPass">RenderTransitionPass</a><span class="signature">( sceneA : <span class="param-type">Scene</span>, cameraA : <span class="param-type">Camera</span>, sceneB : <span class="param-type">Scene</span>, cameraB : <span class="param-type">Camera</span> )</span> </h3>
  31. <div class="method">
  32. <div class="description">
  33. <p>Constructs a render transition pass.</p>
  34. </div>
  35. <table class="params">
  36. <tbody>
  37. <tr>
  38. <td class="name"><code>sceneA</code></td>
  39. <td class="description last"><p>The first scene.</p></td>
  40. </tr>
  41. <tr>
  42. <td class="name"><code>cameraA</code></td>
  43. <td class="description last"><p>The camera of the first scene.</p></td>
  44. </tr>
  45. <tr>
  46. <td class="name"><code>sceneB</code></td>
  47. <td class="description last"><p>The second scene.</p></td>
  48. </tr>
  49. <tr>
  50. <td class="name"><code>cameraB</code></td>
  51. <td class="description last"><p>The camera of the second scene.</p></td>
  52. </tr>
  53. </tbody>
  54. </table>
  55. </div>
  56. </div>
  57. <h2 class="subsection-title">Properties</h2>
  58. <div class="member">
  59. <h3 class="name" id="cameraA" translate="no">.<a href="#cameraA">cameraA</a><span class="type-signature"> : <a href="Camera.html">Camera</a></span> </h3>
  60. <div class="description">
  61. <p>The camera of the first scene.</p>
  62. </div>
  63. </div>
  64. <div class="member">
  65. <h3 class="name" id="cameraB" translate="no">.<a href="#cameraB">cameraB</a><span class="type-signature"> : <a href="Camera.html">Camera</a></span> </h3>
  66. <div class="description">
  67. <p>The camera of the second scene.</p>
  68. </div>
  69. </div>
  70. <div class="member">
  71. <h3 class="name" id="material" translate="no">.<a href="#material">material</a><span class="type-signature"> : <a href="ShaderMaterial.html">ShaderMaterial</a></span> </h3>
  72. <div class="description">
  73. <p>The pass material.</p>
  74. </div>
  75. </div>
  76. <div class="member">
  77. <h3 class="name" id="sceneA" translate="no">.<a href="#sceneA">sceneA</a><span class="type-signature"> : <a href="Scene.html">Scene</a></span> </h3>
  78. <div class="description">
  79. <p>The first scene.</p>
  80. </div>
  81. </div>
  82. <div class="member">
  83. <h3 class="name" id="sceneB" translate="no">.<a href="#sceneB">sceneB</a><span class="type-signature"> : <a href="Scene.html">Scene</a></span> </h3>
  84. <div class="description">
  85. <p>The second scene.</p>
  86. </div>
  87. </div>
  88. <h2 class="subsection-title">Methods</h2>
  89. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  90. <div class="method">
  91. <div class="description">
  92. <p>Frees the GPU-related resources allocated by this instance. Call this
  93. method whenever the pass is no longer used in your app.</p>
  94. </div>
  95. <dl class="details">
  96. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#dispose">Pass#dispose</a></dt>
  97. </dl>
  98. </div>
  99. <h3 class="name name-method" id="render" translate="no">.<a href="#render">render</a><span class="signature">( renderer : <span class="param-type">WebGLRenderer</span>, writeBuffer : <span class="param-type">WebGLRenderTarget</span>, readBuffer : <span class="param-type">WebGLRenderTarget</span>, deltaTime : <span class="param-type">number</span>, maskActive : <span class="param-type">boolean</span> )</span> </h3>
  100. <div class="method">
  101. <div class="description">
  102. <p>Performs the transition pass.</p>
  103. </div>
  104. <table class="params">
  105. <tbody>
  106. <tr>
  107. <td class="name"><code>renderer</code></td>
  108. <td class="description last"><p>The renderer.</p></td>
  109. </tr>
  110. <tr>
  111. <td class="name"><code>writeBuffer</code></td>
  112. <td class="description last"><p>The write buffer. This buffer is intended as the rendering
  113. destination for the pass.</p></td>
  114. </tr>
  115. <tr>
  116. <td class="name"><code>readBuffer</code></td>
  117. <td class="description last"><p>The read buffer. The pass can access the result from the
  118. previous pass from this buffer.</p></td>
  119. </tr>
  120. <tr>
  121. <td class="name"><code>deltaTime</code></td>
  122. <td class="description last"><p>The delta time in seconds.</p></td>
  123. </tr>
  124. <tr>
  125. <td class="name"><code>maskActive</code></td>
  126. <td class="description last"><p>Whether masking is active or not.</p></td>
  127. </tr>
  128. </tbody>
  129. </table>
  130. <dl class="details">
  131. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#render">Pass#render</a></dt>
  132. </dl>
  133. </div>
  134. <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>
  135. <div class="method">
  136. <div class="description">
  137. <p>Sets the size of the pass.</p>
  138. </div>
  139. <table class="params">
  140. <tbody>
  141. <tr>
  142. <td class="name"><code>width</code></td>
  143. <td class="description last"><p>The width to set.</p></td>
  144. </tr>
  145. <tr>
  146. <td class="name"><code>height</code></td>
  147. <td class="description last"><p>The height to set.</p></td>
  148. </tr>
  149. </tbody>
  150. </table>
  151. <dl class="details">
  152. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#setSize">Pass#setSize</a></dt>
  153. </dl>
  154. </div>
  155. <h3 class="name name-method" id="setTexture" translate="no">.<a href="#setTexture">setTexture</a><span class="signature">( value : <span class="param-type">Texture</span> )</span> </h3>
  156. <div class="method">
  157. <div class="description">
  158. <p>Sets the effect texture.</p>
  159. </div>
  160. <table class="params">
  161. <tbody>
  162. <tr>
  163. <td class="name"><code>value</code></td>
  164. <td class="description last"><p>The effect texture.</p></td>
  165. </tr>
  166. </tbody>
  167. </table>
  168. </div>
  169. <h3 class="name name-method" id="setTextureThreshold" translate="no">.<a href="#setTextureThreshold">setTextureThreshold</a><span class="signature">( value : <span class="param-type">boolean | number</span> )</span> </h3>
  170. <div class="method">
  171. <div class="description">
  172. <p>Sets the texture threshold. This value defined how strong the texture effects
  173. the transition. Must be in the range <code>[0,1]</code> (0 means full effect, 1 means no effect).</p>
  174. </div>
  175. <table class="params">
  176. <tbody>
  177. <tr>
  178. <td class="name"><code>value</code></td>
  179. <td class="description last"><p>The threshold value.</p></td>
  180. </tr>
  181. </tbody>
  182. </table>
  183. </div>
  184. <h3 class="name name-method" id="setTransition" translate="no">.<a href="#setTransition">setTransition</a><span class="signature">( value : <span class="param-type">boolean | number</span> )</span> </h3>
  185. <div class="method">
  186. <div class="description">
  187. <p>Sets the transition factor. Must be in the range <code>[0,1]</code>.
  188. This value determines to what degree both scenes are mixed.</p>
  189. </div>
  190. <table class="params">
  191. <tbody>
  192. <tr>
  193. <td class="name"><code>value</code></td>
  194. <td class="description last"><p>The transition factor.</p></td>
  195. </tr>
  196. </tbody>
  197. </table>
  198. </div>
  199. <h3 class="name name-method" id="useTexture" translate="no">.<a href="#useTexture">useTexture</a><span class="signature">( value : <span class="param-type">boolean</span> )</span> </h3>
  200. <div class="method">
  201. <div class="description">
  202. <p>Toggles the usage of a texture for the effect.</p>
  203. </div>
  204. <table class="params">
  205. <tbody>
  206. <tr>
  207. <td class="name"><code>value</code></td>
  208. <td class="description last"><p>Whether to use a texture for the transition effect or not.</p></td>
  209. </tr>
  210. </tbody>
  211. </table>
  212. </div>
  213. <h2 class="subsection-title">Source</h2>
  214. <p>
  215. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/RenderTransitionPass.js" target="_blank" rel="noopener" translate="no">examples/jsm/postprocessing/RenderTransitionPass.js</a>
  216. </p>
  217. </article>
  218. </section>
  219. <script src="../scripts/linenumber.js"></script>
  220. <script src="../scripts/page.js"></script>
  221. </body>
  222. </html>
粤ICP备19079148号