RenderTransitionPass.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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" rel="noopener">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"><a href="Scene.html">Scene</a></span>, cameraA : <span class="param-type"><a href="Camera.html">Camera</a></span>, sceneB : <span class="param-type"><a href="Scene.html">Scene</a></span>, cameraB : <span class="param-type"><a href="Camera.html">Camera</a></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">
  39. <strong>sceneA</strong>
  40. </td>
  41. <td class="description last">
  42. <p>The first scene.</p>
  43. </td>
  44. </tr>
  45. <tr>
  46. <td class="name">
  47. <strong>cameraA</strong>
  48. </td>
  49. <td class="description last">
  50. <p>The camera of the first scene.</p>
  51. </td>
  52. </tr>
  53. <tr>
  54. <td class="name">
  55. <strong>sceneB</strong>
  56. </td>
  57. <td class="description last">
  58. <p>The second scene.</p>
  59. </td>
  60. </tr>
  61. <tr>
  62. <td class="name">
  63. <strong>cameraB</strong>
  64. </td>
  65. <td class="description last">
  66. <p>The camera of the second scene.</p>
  67. </td>
  68. </tr>
  69. </tbody>
  70. </table>
  71. </div>
  72. </div>
  73. <h2 class="subsection-title">Properties</h2>
  74. <div class="member">
  75. <h3 class="name" id="cameraA" translate="no">.<a href="#cameraA">cameraA</a><span class="type-signature"> : <a href="Camera.html">Camera</a></span> </h3>
  76. <div class="description">
  77. <p>The camera of the first scene.</p>
  78. </div>
  79. </div>
  80. <div class="member">
  81. <h3 class="name" id="cameraB" translate="no">.<a href="#cameraB">cameraB</a><span class="type-signature"> : <a href="Camera.html">Camera</a></span> </h3>
  82. <div class="description">
  83. <p>The camera of the second scene.</p>
  84. </div>
  85. </div>
  86. <div class="member">
  87. <h3 class="name" id="material" translate="no">.<a href="#material">material</a><span class="type-signature"> : <a href="ShaderMaterial.html">ShaderMaterial</a></span> </h3>
  88. <div class="description">
  89. <p>The pass material.</p>
  90. </div>
  91. </div>
  92. <div class="member">
  93. <h3 class="name" id="sceneA" translate="no">.<a href="#sceneA">sceneA</a><span class="type-signature"> : <a href="Scene.html">Scene</a></span> </h3>
  94. <div class="description">
  95. <p>The first scene.</p>
  96. </div>
  97. </div>
  98. <div class="member">
  99. <h3 class="name" id="sceneB" translate="no">.<a href="#sceneB">sceneB</a><span class="type-signature"> : <a href="Scene.html">Scene</a></span> </h3>
  100. <div class="description">
  101. <p>The second scene.</p>
  102. </div>
  103. </div>
  104. <h2 class="subsection-title">Methods</h2>
  105. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  106. <div class="method">
  107. <div class="description">
  108. <p>Frees the GPU-related resources allocated by this instance. Call this
  109. method whenever the pass is no longer used in your app.</p>
  110. </div>
  111. <dl class="details">
  112. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#dispose">Pass#dispose</a></dt>
  113. </dl>
  114. </div>
  115. <h3 class="name name-method" id="render" translate="no">.<a href="#render">render</a><span class="signature">( renderer : <span class="param-type"><a href="WebGLRenderer.html">WebGLRenderer</a></span>, writeBuffer : <span class="param-type"><a href="WebGLRenderTarget.html">WebGLRenderTarget</a></span>, readBuffer : <span class="param-type"><a href="WebGLRenderTarget.html">WebGLRenderTarget</a></span>, deltaTime : <span class="param-type">number</span>, maskActive : <span class="param-type">boolean</span> )</span> </h3>
  116. <div class="method">
  117. <div class="description">
  118. <p>Performs the transition pass.</p>
  119. </div>
  120. <table class="params">
  121. <tbody>
  122. <tr>
  123. <td class="name">
  124. <strong>renderer</strong>
  125. </td>
  126. <td class="description last">
  127. <p>The renderer.</p>
  128. </td>
  129. </tr>
  130. <tr>
  131. <td class="name">
  132. <strong>writeBuffer</strong>
  133. </td>
  134. <td class="description last">
  135. <p>The write buffer. This buffer is intended as the rendering
  136. destination for the pass.</p>
  137. </td>
  138. </tr>
  139. <tr>
  140. <td class="name">
  141. <strong>readBuffer</strong>
  142. </td>
  143. <td class="description last">
  144. <p>The read buffer. The pass can access the result from the
  145. previous pass from this buffer.</p>
  146. </td>
  147. </tr>
  148. <tr>
  149. <td class="name">
  150. <strong>deltaTime</strong>
  151. </td>
  152. <td class="description last">
  153. <p>The delta time in seconds.</p>
  154. </td>
  155. </tr>
  156. <tr>
  157. <td class="name">
  158. <strong>maskActive</strong>
  159. </td>
  160. <td class="description last">
  161. <p>Whether masking is active or not.</p>
  162. </td>
  163. </tr>
  164. </tbody>
  165. </table>
  166. <dl class="details">
  167. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#render">Pass#render</a></dt>
  168. </dl>
  169. </div>
  170. <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>
  171. <div class="method">
  172. <div class="description">
  173. <p>Sets the size of the pass.</p>
  174. </div>
  175. <table class="params">
  176. <tbody>
  177. <tr>
  178. <td class="name">
  179. <strong>width</strong>
  180. </td>
  181. <td class="description last">
  182. <p>The width to set.</p>
  183. </td>
  184. </tr>
  185. <tr>
  186. <td class="name">
  187. <strong>height</strong>
  188. </td>
  189. <td class="description last">
  190. <p>The height to set.</p>
  191. </td>
  192. </tr>
  193. </tbody>
  194. </table>
  195. <dl class="details">
  196. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#setSize">Pass#setSize</a></dt>
  197. </dl>
  198. </div>
  199. <h3 class="name name-method" id="setTexture" translate="no">.<a href="#setTexture">setTexture</a><span class="signature">( value : <span class="param-type"><a href="Texture.html">Texture</a></span> )</span> </h3>
  200. <div class="method">
  201. <div class="description">
  202. <p>Sets the effect texture.</p>
  203. </div>
  204. <table class="params">
  205. <tbody>
  206. <tr>
  207. <td class="name">
  208. <strong>value</strong>
  209. </td>
  210. <td class="description last">
  211. <p>The effect texture.</p>
  212. </td>
  213. </tr>
  214. </tbody>
  215. </table>
  216. </div>
  217. <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>
  218. <div class="method">
  219. <div class="description">
  220. <p>Sets the texture threshold. This value defined how strong the texture effects
  221. the transition. Must be in the range <code>[0,1]</code> (0 means full effect, 1 means no effect).</p>
  222. </div>
  223. <table class="params">
  224. <tbody>
  225. <tr>
  226. <td class="name">
  227. <strong>value</strong>
  228. </td>
  229. <td class="description last">
  230. <p>The threshold value.</p>
  231. </td>
  232. </tr>
  233. </tbody>
  234. </table>
  235. </div>
  236. <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>
  237. <div class="method">
  238. <div class="description">
  239. <p>Sets the transition factor. Must be in the range <code>[0,1]</code>.
  240. This value determines to what degree both scenes are mixed.</p>
  241. </div>
  242. <table class="params">
  243. <tbody>
  244. <tr>
  245. <td class="name">
  246. <strong>value</strong>
  247. </td>
  248. <td class="description last">
  249. <p>The transition factor.</p>
  250. </td>
  251. </tr>
  252. </tbody>
  253. </table>
  254. </div>
  255. <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>
  256. <div class="method">
  257. <div class="description">
  258. <p>Toggles the usage of a texture for the effect.</p>
  259. </div>
  260. <table class="params">
  261. <tbody>
  262. <tr>
  263. <td class="name">
  264. <strong>value</strong>
  265. </td>
  266. <td class="description last">
  267. <p>Whether to use a texture for the transition effect or not.</p>
  268. </td>
  269. </tr>
  270. </tbody>
  271. </table>
  272. </div>
  273. <h2 class="subsection-title">Source</h2>
  274. <p>
  275. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/RenderTransitionPass.js" translate="no" target="_blank" rel="noopener">examples/jsm/postprocessing/RenderTransitionPass.js</a>
  276. </p>
  277. </article>
  278. </section>
  279. <script src="../scripts/linenumber.js"></script>
  280. <script src="../scripts/page.js"></script>
  281. </body>
  282. </html>
粤ICP备19079148号