GTAOPass.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>GTAOPass - 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">GTAOPass</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A pass for an GTAO effect.</p>
  17. <p><code>GTAOPass</code> provides better quality than <a href="SSAOPass.html">SSAOPass</a> but is also more expensive.</p></div>
  18. <h2>Code Example</h2>
  19. <div translate="no"><pre><code class="language-js">const gtaoPass = new GTAOPass( scene, camera, width, height );
  20. gtaoPass.output = GTAOPass.OUTPUT.Denoise;
  21. composer.addPass( gtaoPass );
  22. </code></pre></div>
  23. </header>
  24. <article>
  25. <h2 class="subsection-title">Import</h2>
  26. <p><span translate="no">GTAOPass</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 { GTAOPass } from 'three/addons/postprocessing/GTAOPass.js';</code></pre>
  28. <div class="container-overview">
  29. <h2>Constructor</h2>
  30. <h3 class="name name-method" id="GTAOPass" translate="no">new <a href="#GTAOPass">GTAOPass</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>, width : <span class="param-type">number</span>, height : <span class="param-type">number</span>, parameters : <span class="param-type">Object</span>, aoParameters : <span class="param-type">Object</span>, pdParameters : <span class="param-type">Object</span> )</span> </h3>
  31. <div class="method">
  32. <div class="description">
  33. <p>Constructs a new GTAO 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 compute the AO for.</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>width</strong>
  56. </td>
  57. <td class="description last">
  58. <p>The width of the effect.</p>
  59. <p>Default is <code>512</code>.</p>
  60. </td>
  61. </tr>
  62. <tr>
  63. <td class="name">
  64. <strong>height</strong>
  65. </td>
  66. <td class="description last">
  67. <p>The height of the effect.</p>
  68. <p>Default is <code>512</code>.</p>
  69. </td>
  70. </tr>
  71. <tr>
  72. <td class="name">
  73. <strong>parameters</strong>
  74. </td>
  75. <td class="description last">
  76. <p>The pass parameters.</p>
  77. </td>
  78. </tr>
  79. <tr>
  80. <td class="name">
  81. <strong>aoParameters</strong>
  82. </td>
  83. <td class="description last">
  84. <p>The AO parameters.</p>
  85. </td>
  86. </tr>
  87. <tr>
  88. <td class="name">
  89. <strong>pdParameters</strong>
  90. </td>
  91. <td class="description last">
  92. <p>The denoise parameters.</p>
  93. </td>
  94. </tr>
  95. </tbody>
  96. </table>
  97. </div>
  98. </div>
  99. <h2 class="subsection-title">Properties</h2>
  100. <div class="member">
  101. <h3 class="name" id="blendIntensity" translate="no">.<a href="#blendIntensity">blendIntensity</a><span class="type-signature"> : number</span> </h3>
  102. <div class="description">
  103. <p>The AO blend intensity.</p>
  104. <p>Default is <code>1</code>.</p>
  105. </div>
  106. </div>
  107. <div class="member">
  108. <h3 class="name" id="camera" translate="no">.<a href="#camera">camera</a><span class="type-signature"> : <a href="Camera.html">Camera</a></span> </h3>
  109. <div class="description">
  110. <p>The camera.</p>
  111. </div>
  112. </div>
  113. <div class="member">
  114. <h3 class="name" id="clear" translate="no">.<a href="#clear">clear</a><span class="type-signature"> : boolean</span> </h3>
  115. <div class="description">
  116. <p>Overwritten to perform a clear operation by default.</p>
  117. <p>Default is <code>true</code>.</p>
  118. </div>
  119. <dl class="details">
  120. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#clear">Pass#clear</a></dt>
  121. </dl>
  122. </div>
  123. <div class="member">
  124. <h3 class="name" id="gtaoMap" translate="no">.<a href="#gtaoMap">gtaoMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> <span class="type-signature">(readonly) </span></h3>
  125. <div class="description">
  126. <p>A texture holding the computed AO.</p>
  127. </div>
  128. </div>
  129. <div class="member">
  130. <h3 class="name" id="height" translate="no">.<a href="#height">height</a><span class="type-signature"> : number</span> </h3>
  131. <div class="description">
  132. <p>The height of the effect.</p>
  133. <p>Default is <code>512</code>.</p>
  134. </div>
  135. </div>
  136. <div class="member">
  137. <h3 class="name" id="output" translate="no">.<a href="#output">output</a><span class="type-signature"> : number</span> </h3>
  138. <div class="description">
  139. <p>The output configuration.</p>
  140. <p>Default is <code>0</code>.</p>
  141. </div>
  142. </div>
  143. <div class="member">
  144. <h3 class="name" id="pdRadiusExponent" translate="no">.<a href="#pdRadiusExponent">pdRadiusExponent</a><span class="type-signature"> : number</span> </h3>
  145. <div class="description">
  146. <p>The Poisson Denoise radius exponent.</p>
  147. <p>Default is <code>2</code>.</p>
  148. </div>
  149. </div>
  150. <div class="member">
  151. <h3 class="name" id="pdRings" translate="no">.<a href="#pdRings">pdRings</a><span class="type-signature"> : number</span> </h3>
  152. <div class="description">
  153. <p>The number of Poisson Denoise rings.</p>
  154. <p>Default is <code>2</code>.</p>
  155. </div>
  156. </div>
  157. <div class="member">
  158. <h3 class="name" id="pdSamples" translate="no">.<a href="#pdSamples">pdSamples</a><span class="type-signature"> : number</span> </h3>
  159. <div class="description">
  160. <p>The Poisson Denoise sample count.</p>
  161. <p>Default is <code>16</code>.</p>
  162. </div>
  163. </div>
  164. <div class="member">
  165. <h3 class="name" id="scene" translate="no">.<a href="#scene">scene</a><span class="type-signature"> : <a href="Scene.html">Scene</a></span> </h3>
  166. <div class="description">
  167. <p>The scene to render the AO for.</p>
  168. </div>
  169. </div>
  170. <div class="member">
  171. <h3 class="name" id="width" translate="no">.<a href="#width">width</a><span class="type-signature"> : number</span> </h3>
  172. <div class="description">
  173. <p>The width of the effect.</p>
  174. <p>Default is <code>512</code>.</p>
  175. </div>
  176. </div>
  177. <h2 class="subsection-title">Methods</h2>
  178. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  179. <div class="method">
  180. <div class="description">
  181. <p>Frees the GPU-related resources allocated by this instance. Call this
  182. method whenever the pass is no longer used in your app.</p>
  183. </div>
  184. <dl class="details">
  185. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#dispose">Pass#dispose</a></dt>
  186. </dl>
  187. </div>
  188. <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>
  189. <div class="method">
  190. <div class="description">
  191. <p>Performs the GTAO pass.</p>
  192. </div>
  193. <table class="params">
  194. <tbody>
  195. <tr>
  196. <td class="name">
  197. <strong>renderer</strong>
  198. </td>
  199. <td class="description last">
  200. <p>The renderer.</p>
  201. </td>
  202. </tr>
  203. <tr>
  204. <td class="name">
  205. <strong>writeBuffer</strong>
  206. </td>
  207. <td class="description last">
  208. <p>The write buffer. This buffer is intended as the rendering
  209. destination for the pass.</p>
  210. </td>
  211. </tr>
  212. <tr>
  213. <td class="name">
  214. <strong>readBuffer</strong>
  215. </td>
  216. <td class="description last">
  217. <p>The read buffer. The pass can access the result from the
  218. previous pass from this buffer.</p>
  219. </td>
  220. </tr>
  221. <tr>
  222. <td class="name">
  223. <strong>deltaTime</strong>
  224. </td>
  225. <td class="description last">
  226. <p>The delta time in seconds.</p>
  227. </td>
  228. </tr>
  229. <tr>
  230. <td class="name">
  231. <strong>maskActive</strong>
  232. </td>
  233. <td class="description last">
  234. <p>Whether masking is active or not.</p>
  235. </td>
  236. </tr>
  237. </tbody>
  238. </table>
  239. <dl class="details">
  240. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#render">Pass#render</a></dt>
  241. </dl>
  242. </div>
  243. <h3 class="name name-method" id="setGBuffer" translate="no">.<a href="#setGBuffer">setGBuffer</a><span class="signature">( depthTexture : <span class="param-type"><a href="DepthTexture.html">DepthTexture</a></span>, normalTexture : <span class="param-type"><a href="DepthTexture.html">DepthTexture</a></span> )</span> </h3>
  244. <div class="method">
  245. <div class="description">
  246. <p>Configures the GBuffer of this pass. If no arguments are passed,
  247. the pass creates an internal render target for holding depth
  248. and normal data.</p>
  249. </div>
  250. <table class="params">
  251. <tbody>
  252. <tr>
  253. <td class="name">
  254. <strong>depthTexture</strong>
  255. </td>
  256. <td class="description last">
  257. <p>The depth texture.</p>
  258. </td>
  259. </tr>
  260. <tr>
  261. <td class="name">
  262. <strong>normalTexture</strong>
  263. </td>
  264. <td class="description last">
  265. <p>The normal texture.</p>
  266. </td>
  267. </tr>
  268. </tbody>
  269. </table>
  270. </div>
  271. <h3 class="name name-method" id="setSceneClipBox" translate="no">.<a href="#setSceneClipBox">setSceneClipBox</a><span class="signature">( box : <span class="param-type"><a href="Box3.html">Box3</a></span> )</span> </h3>
  272. <div class="method">
  273. <div class="description">
  274. <p>Configures the clip box of the GTAO shader with the given AABB.</p>
  275. </div>
  276. <table class="params">
  277. <tbody>
  278. <tr>
  279. <td class="name">
  280. <strong>box</strong>
  281. </td>
  282. <td class="description last">
  283. <p>The AABB enclosing the scene that should receive AO. When passing
  284. <code>null</code>, to clip box is used.</p>
  285. </td>
  286. </tr>
  287. </tbody>
  288. </table>
  289. </div>
  290. <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>
  291. <div class="method">
  292. <div class="description">
  293. <p>Sets the size of the pass.</p>
  294. </div>
  295. <table class="params">
  296. <tbody>
  297. <tr>
  298. <td class="name">
  299. <strong>width</strong>
  300. </td>
  301. <td class="description last">
  302. <p>The width to set.</p>
  303. </td>
  304. </tr>
  305. <tr>
  306. <td class="name">
  307. <strong>height</strong>
  308. </td>
  309. <td class="description last">
  310. <p>The height to set.</p>
  311. </td>
  312. </tr>
  313. </tbody>
  314. </table>
  315. <dl class="details">
  316. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#setSize">Pass#setSize</a></dt>
  317. </dl>
  318. </div>
  319. <h3 class="name name-method" id="updateGtaoMaterial" translate="no">.<a href="#updateGtaoMaterial">updateGtaoMaterial</a><span class="signature">( parameters : <span class="param-type">Object</span> )</span> </h3>
  320. <div class="method">
  321. <div class="description">
  322. <p>Updates the GTAO material from the given parameter object.</p>
  323. </div>
  324. <table class="params">
  325. <tbody>
  326. <tr>
  327. <td class="name">
  328. <strong>parameters</strong>
  329. </td>
  330. <td class="description last">
  331. <p>The GTAO material parameters.</p>
  332. </td>
  333. </tr>
  334. </tbody>
  335. </table>
  336. </div>
  337. <h3 class="name name-method" id="updatePdMaterial" translate="no">.<a href="#updatePdMaterial">updatePdMaterial</a><span class="signature">( parameters : <span class="param-type">Object</span> )</span> </h3>
  338. <div class="method">
  339. <div class="description">
  340. <p>Updates the Denoise material from the given parameter object.</p>
  341. </div>
  342. <table class="params">
  343. <tbody>
  344. <tr>
  345. <td class="name">
  346. <strong>parameters</strong>
  347. </td>
  348. <td class="description last">
  349. <p>The denoise parameters.</p>
  350. </td>
  351. </tr>
  352. </tbody>
  353. </table>
  354. </div>
  355. <h2 class="subsection-title">Source</h2>
  356. <p>
  357. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/GTAOPass.js" translate="no" target="_blank" rel="noopener">examples/jsm/postprocessing/GTAOPass.js</a>
  358. </p>
  359. </article>
  360. </section>
  361. <script src="../scripts/linenumber.js"></script>
  362. <script src="../scripts/page.js"></script>
  363. </body>
  364. </html>
粤ICP备19079148号