SSAARenderPass.html 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>SSAARenderPass - 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">SSAARenderPass</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Supersample Anti-Aliasing Render Pass.</p>
  17. <p>This manual approach to SSAA re-renders the scene ones for each sample with camera jitter and accumulates the results.</p></div>
  18. <h2>Code Example</h2>
  19. <div translate="no"><pre><code class="language-js">const ssaaRenderPass = new SSAARenderPass( scene, camera );
  20. ssaaRenderPass.sampleLevel = 3;
  21. composer.addPass( ssaaRenderPass );
  22. </code></pre></div>
  23. </header>
  24. <article>
  25. <h2 class="subsection-title">Import</h2>
  26. <p><span translate="no">SSAARenderPass</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 { SSAARenderPass } from 'three/addons/postprocessing/SSAARenderPass.js';</code></pre>
  28. <div class="container-overview">
  29. <h2>Constructor</h2>
  30. <h3 class="name name-method" id="SSAARenderPass" translate="no">new <a href="#SSAARenderPass">SSAARenderPass</a><span class="signature">( scene : <span class="param-type">Scene</span>, camera : <span class="param-type">Camera</span>, clearColor : <span class="param-type">number | Color | string</span>, clearAlpha : <span class="param-type">number</span> )</span> </h3>
  31. <div class="method">
  32. <div class="description">
  33. <p>Constructs a new SSAA render pass.</p>
  34. </div>
  35. <table class="params">
  36. <tbody>
  37. <tr>
  38. <td class="name"><code>scene</code></td>
  39. <td class="description last"><p>The scene to render.</p></td>
  40. </tr>
  41. <tr>
  42. <td class="name"><code>camera</code></td>
  43. <td class="description last"><p>The camera.</p></td>
  44. </tr>
  45. <tr>
  46. <td class="name"><code>clearColor</code></td>
  47. <td class="description last"><p>The clear color of the render pass.<br/>Default is <code>0x000000</code>.</p></td>
  48. </tr>
  49. <tr>
  50. <td class="name"><code>clearAlpha</code></td>
  51. <td class="description last"><p>The clear alpha of the render pass.<br/>Default is <code>0</code>.</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="camera" translate="no">.<a href="#camera">camera</a><span class="type-signature"> : <a href="Camera.html">Camera</a></span> </h3>
  60. <div class="description">
  61. <p>The camera.</p>
  62. </div>
  63. </div>
  64. <div class="member">
  65. <h3 class="name" id="clearAlpha" translate="no">.<a href="#clearAlpha">clearAlpha</a><span class="type-signature"> : number</span> </h3>
  66. <div class="description">
  67. <p>The clear alpha of the render pass.<br/>Default is <code>0</code>.</p>
  68. </div>
  69. </div>
  70. <div class="member">
  71. <h3 class="name" id="clearColor" translate="no">.<a href="#clearColor">clearColor</a><span class="type-signature"> : number | <a href="Color.html">Color</a> | string</span> </h3>
  72. <div class="description">
  73. <p>The clear color of the render pass.<br/>Default is <code>0x000000</code>.</p>
  74. </div>
  75. </div>
  76. <div class="member">
  77. <h3 class="name" id="sampleLevel" translate="no">.<a href="#sampleLevel">sampleLevel</a><span class="type-signature"> : number</span> </h3>
  78. <div class="description">
  79. <p>The sample level. Specified as n, where the number of
  80. samples is 2^n, so sampleLevel = 4, is 2^4 samples, 16.<br/>Default is <code>4</code>.</p>
  81. </div>
  82. </div>
  83. <div class="member">
  84. <h3 class="name" id="scene" translate="no">.<a href="#scene">scene</a><span class="type-signature"> : <a href="Scene.html">Scene</a></span> </h3>
  85. <div class="description">
  86. <p>The scene to render.</p>
  87. </div>
  88. </div>
  89. <div class="member">
  90. <h3 class="name" id="stencilBuffer" translate="no">.<a href="#stencilBuffer">stencilBuffer</a><span class="type-signature"> : boolean</span> </h3>
  91. <div class="description">
  92. <p>Whether to use a stencil buffer or not. This property can't
  93. be changed after the first render.<br/>Default is <code>false</code>.</p>
  94. </div>
  95. </div>
  96. <div class="member">
  97. <h3 class="name" id="unbiased" translate="no">.<a href="#unbiased">unbiased</a><span class="type-signature"> : boolean</span> </h3>
  98. <div class="description">
  99. <p>Whether the pass should be unbiased or not. This property has the most
  100. visible effect when rendering to a RGBA8 buffer because it mitigates
  101. rounding errors. By default RGBA16F is used.<br/>Default is <code>true</code>.</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">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>
  116. <div class="method">
  117. <div class="description">
  118. <p>Performs the SSAA render pass.</p>
  119. </div>
  120. <table class="params">
  121. <tbody>
  122. <tr>
  123. <td class="name"><code>renderer</code></td>
  124. <td class="description last"><p>The renderer.</p></td>
  125. </tr>
  126. <tr>
  127. <td class="name"><code>writeBuffer</code></td>
  128. <td class="description last"><p>The write buffer. This buffer is intended as the rendering
  129. destination for the pass.</p></td>
  130. </tr>
  131. <tr>
  132. <td class="name"><code>readBuffer</code></td>
  133. <td class="description last"><p>The read buffer. The pass can access the result from the
  134. previous pass from this buffer.</p></td>
  135. </tr>
  136. <tr>
  137. <td class="name"><code>deltaTime</code></td>
  138. <td class="description last"><p>The delta time in seconds.</p></td>
  139. </tr>
  140. <tr>
  141. <td class="name"><code>maskActive</code></td>
  142. <td class="description last"><p>Whether masking is active or not.</p></td>
  143. </tr>
  144. </tbody>
  145. </table>
  146. <dl class="details">
  147. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#render">Pass#render</a></dt>
  148. </dl>
  149. </div>
  150. <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>
  151. <div class="method">
  152. <div class="description">
  153. <p>Sets the size of the pass.</p>
  154. </div>
  155. <table class="params">
  156. <tbody>
  157. <tr>
  158. <td class="name"><code>width</code></td>
  159. <td class="description last"><p>The width to set.</p></td>
  160. </tr>
  161. <tr>
  162. <td class="name"><code>height</code></td>
  163. <td class="description last"><p>The height to set.</p></td>
  164. </tr>
  165. </tbody>
  166. </table>
  167. <dl class="details">
  168. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#setSize">Pass#setSize</a></dt>
  169. </dl>
  170. </div>
  171. <h2 class="subsection-title">Source</h2>
  172. <p>
  173. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/SSAARenderPass.js" target="_blank" rel="noopener" translate="no">examples/jsm/postprocessing/SSAARenderPass.js</a>
  174. </p>
  175. </article>
  176. </section>
  177. <script src="../scripts/linenumber.js"></script>
  178. <script src="../scripts/page.js"></script>
  179. </body>
  180. </html>
粤ICP备19079148号