SSAARenderPass.html 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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" rel="noopener">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"><a href="Scene.html">Scene</a></span>, camera : <span class="param-type"><a href="Camera.html">Camera</a></span>, clearColor : <span class="param-type">number | <a href="Color.html">Color</a> | 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">
  39. <strong>scene</strong>
  40. </td>
  41. <td class="description last">
  42. <p>The scene to render.</p>
  43. </td>
  44. </tr>
  45. <tr>
  46. <td class="name">
  47. <strong>camera</strong>
  48. </td>
  49. <td class="description last">
  50. <p>The camera.</p>
  51. </td>
  52. </tr>
  53. <tr>
  54. <td class="name">
  55. <strong>clearColor</strong>
  56. </td>
  57. <td class="description last">
  58. <p>The clear color of the render pass.</p>
  59. <p>Default is <code>0x000000</code>.</p>
  60. </td>
  61. </tr>
  62. <tr>
  63. <td class="name">
  64. <strong>clearAlpha</strong>
  65. </td>
  66. <td class="description last">
  67. <p>The clear alpha of the render pass.</p>
  68. <p>Default is <code>0</code>.</p>
  69. </td>
  70. </tr>
  71. </tbody>
  72. </table>
  73. </div>
  74. </div>
  75. <h2 class="subsection-title">Properties</h2>
  76. <div class="member">
  77. <h3 class="name" id="camera" translate="no">.<a href="#camera">camera</a><span class="type-signature"> : <a href="Camera.html">Camera</a></span> </h3>
  78. <div class="description">
  79. <p>The camera.</p>
  80. </div>
  81. </div>
  82. <div class="member">
  83. <h3 class="name" id="clearAlpha" translate="no">.<a href="#clearAlpha">clearAlpha</a><span class="type-signature"> : number</span> </h3>
  84. <div class="description">
  85. <p>The clear alpha of the render pass.</p>
  86. <p>Default is <code>0</code>.</p>
  87. </div>
  88. </div>
  89. <div class="member">
  90. <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>
  91. <div class="description">
  92. <p>The clear color of the render pass.</p>
  93. <p>Default is <code>0x000000</code>.</p>
  94. </div>
  95. </div>
  96. <div class="member">
  97. <h3 class="name" id="sampleLevel" translate="no">.<a href="#sampleLevel">sampleLevel</a><span class="type-signature"> : number</span> </h3>
  98. <div class="description">
  99. <p>The sample level. Specified as n, where the number of
  100. samples is 2^n, so sampleLevel = 4, is 2^4 samples, 16.</p>
  101. <p>Default is <code>4</code>.</p>
  102. </div>
  103. </div>
  104. <div class="member">
  105. <h3 class="name" id="scene" translate="no">.<a href="#scene">scene</a><span class="type-signature"> : <a href="Scene.html">Scene</a></span> </h3>
  106. <div class="description">
  107. <p>The scene to render.</p>
  108. </div>
  109. </div>
  110. <div class="member">
  111. <h3 class="name" id="stencilBuffer" translate="no">.<a href="#stencilBuffer">stencilBuffer</a><span class="type-signature"> : boolean</span> </h3>
  112. <div class="description">
  113. <p>Whether to use a stencil buffer or not. This property can't
  114. be changed after the first render.</p>
  115. <p>Default is <code>false</code>.</p>
  116. </div>
  117. </div>
  118. <div class="member">
  119. <h3 class="name" id="unbiased" translate="no">.<a href="#unbiased">unbiased</a><span class="type-signature"> : boolean</span> </h3>
  120. <div class="description">
  121. <p>Whether the pass should be unbiased or not. This property has the most
  122. visible effect when rendering to a RGBA8 buffer because it mitigates
  123. rounding errors. By default RGBA16F is used.</p>
  124. <p>Default is <code>true</code>.</p>
  125. </div>
  126. </div>
  127. <h2 class="subsection-title">Methods</h2>
  128. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  129. <div class="method">
  130. <div class="description">
  131. <p>Frees the GPU-related resources allocated by this instance. Call this
  132. method whenever the pass is no longer used in your app.</p>
  133. </div>
  134. <dl class="details">
  135. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#dispose">Pass#dispose</a></dt>
  136. </dl>
  137. </div>
  138. <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>
  139. <div class="method">
  140. <div class="description">
  141. <p>Performs the SSAA render pass.</p>
  142. </div>
  143. <table class="params">
  144. <tbody>
  145. <tr>
  146. <td class="name">
  147. <strong>renderer</strong>
  148. </td>
  149. <td class="description last">
  150. <p>The renderer.</p>
  151. </td>
  152. </tr>
  153. <tr>
  154. <td class="name">
  155. <strong>writeBuffer</strong>
  156. </td>
  157. <td class="description last">
  158. <p>The write buffer. This buffer is intended as the rendering
  159. destination for the pass.</p>
  160. </td>
  161. </tr>
  162. <tr>
  163. <td class="name">
  164. <strong>readBuffer</strong>
  165. </td>
  166. <td class="description last">
  167. <p>The read buffer. The pass can access the result from the
  168. previous pass from this buffer.</p>
  169. </td>
  170. </tr>
  171. <tr>
  172. <td class="name">
  173. <strong>deltaTime</strong>
  174. </td>
  175. <td class="description last">
  176. <p>The delta time in seconds.</p>
  177. </td>
  178. </tr>
  179. <tr>
  180. <td class="name">
  181. <strong>maskActive</strong>
  182. </td>
  183. <td class="description last">
  184. <p>Whether masking is active or not.</p>
  185. </td>
  186. </tr>
  187. </tbody>
  188. </table>
  189. <dl class="details">
  190. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#render">Pass#render</a></dt>
  191. </dl>
  192. </div>
  193. <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>
  194. <div class="method">
  195. <div class="description">
  196. <p>Sets the size of the pass.</p>
  197. </div>
  198. <table class="params">
  199. <tbody>
  200. <tr>
  201. <td class="name">
  202. <strong>width</strong>
  203. </td>
  204. <td class="description last">
  205. <p>The width to set.</p>
  206. </td>
  207. </tr>
  208. <tr>
  209. <td class="name">
  210. <strong>height</strong>
  211. </td>
  212. <td class="description last">
  213. <p>The height to set.</p>
  214. </td>
  215. </tr>
  216. </tbody>
  217. </table>
  218. <dl class="details">
  219. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#setSize">Pass#setSize</a></dt>
  220. </dl>
  221. </div>
  222. <h2 class="subsection-title">Source</h2>
  223. <p>
  224. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/SSAARenderPass.js" translate="no" target="_blank" rel="noopener">examples/jsm/postprocessing/SSAARenderPass.js</a>
  225. </p>
  226. </article>
  227. </section>
  228. <script src="../scripts/linenumber.js"></script>
  229. <script src="../scripts/page.js"></script>
  230. </body>
  231. </html>
粤ICP备19079148号