SSRPass.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>SSRPass - 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">SSRPass</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A pass for a basic SSR effect.</p></div>
  17. <h2>Code Example</h2>
  18. <div translate="no"><pre><code class="language-js">const ssrPass = new SSRPass( {
  19. renderer,
  20. scene,
  21. camera,
  22. width: innerWidth,
  23. height: innerHeight
  24. } );
  25. composer.addPass( ssrPass );
  26. </code></pre></div>
  27. </header>
  28. <article>
  29. <h2 class="subsection-title">Import</h2>
  30. <p><span translate="no">SSRPass</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>
  31. <pre><code class="language-js">import { SSRPass } from 'three/addons/postprocessing/SSRPass.js';</code></pre>
  32. <div class="container-overview">
  33. <h2>Constructor</h2>
  34. <h3 class="name name-method" id="SSRPass" translate="no">new <a href="#SSRPass">SSRPass</a><span class="signature">( options : <span class="param-type"><a href="SSRPass.html#~Options">SSRPass~Options</a></span> )</span> </h3>
  35. <div class="method">
  36. <div class="description">
  37. <p>Constructs a new SSR pass.</p>
  38. </div>
  39. <table class="params">
  40. <tbody>
  41. <tr>
  42. <td class="name">
  43. <strong>options</strong>
  44. </td>
  45. <td class="description last">
  46. <p>The pass options.</p>
  47. </td>
  48. </tr>
  49. </tbody>
  50. </table>
  51. </div>
  52. </div>
  53. <h2 class="subsection-title">Properties</h2>
  54. <div class="member">
  55. <h3 class="name" id="blur" translate="no">.<a href="#blur">blur</a><span class="type-signature"> : boolean</span> </h3>
  56. <div class="description">
  57. <p>Whether to blur reflections or not.</p>
  58. <p>Default is <code>true</code>.</p>
  59. </div>
  60. </div>
  61. <div class="member">
  62. <h3 class="name" id="bouncing" translate="no">.<a href="#bouncing">bouncing</a><span class="type-signature"> : boolean</span> </h3>
  63. <div class="description">
  64. <p>Whether bouncing is enabled or not.</p>
  65. <p>Default is <code>false</code>.</p>
  66. </div>
  67. </div>
  68. <div class="member">
  69. <h3 class="name" id="camera" translate="no">.<a href="#camera">camera</a><span class="type-signature"> : <a href="Camera.html">Camera</a></span> </h3>
  70. <div class="description">
  71. <p>The camera.</p>
  72. </div>
  73. </div>
  74. <div class="member">
  75. <h3 class="name" id="clear" translate="no">.<a href="#clear">clear</a><span class="type-signature"> : boolean</span> </h3>
  76. <div class="description">
  77. <p>Overwritten to perform a clear operation by default.</p>
  78. <p>Default is <code>true</code>.</p>
  79. </div>
  80. <dl class="details">
  81. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#clear">Pass#clear</a></dt>
  82. </dl>
  83. </div>
  84. <div class="member">
  85. <h3 class="name" id="distanceAttenuation" translate="no">.<a href="#distanceAttenuation">distanceAttenuation</a><span class="type-signature"> : boolean</span> </h3>
  86. <div class="description">
  87. <p>Whether to use distance attenuation or not.</p>
  88. <p>Default is <code>true</code>.</p>
  89. </div>
  90. </div>
  91. <div class="member">
  92. <h3 class="name" id="fresnel" translate="no">.<a href="#fresnel">fresnel</a><span class="type-signature"> : boolean</span> </h3>
  93. <div class="description">
  94. <p>Whether to use fresnel or not.</p>
  95. <p>Default is <code>true</code>.</p>
  96. </div>
  97. </div>
  98. <div class="member">
  99. <h3 class="name" id="groundReflector" translate="no">.<a href="#groundReflector">groundReflector</a><span class="type-signature"> : <a href="ReflectorForSSRPass.html">ReflectorForSSRPass</a></span> </h3>
  100. <div class="description">
  101. <p>The ground reflector.</p>
  102. <p>Default is <code>0</code>.</p>
  103. </div>
  104. </div>
  105. <div class="member">
  106. <h3 class="name" id="height" translate="no">.<a href="#height">height</a><span class="type-signature"> : number</span> </h3>
  107. <div class="description">
  108. <p>The height of the effect.</p>
  109. <p>Default is <code>512</code>.</p>
  110. </div>
  111. </div>
  112. <div class="member">
  113. <h3 class="name" id="infiniteThick" translate="no">.<a href="#infiniteThick">infiniteThick</a><span class="type-signature"> : boolean</span> </h3>
  114. <div class="description">
  115. <p>Whether to use infinite thickness or not.</p>
  116. <p>Default is <code>false</code>.</p>
  117. </div>
  118. </div>
  119. <div class="member">
  120. <h3 class="name" id="maxDistance" translate="no">.<a href="#maxDistance">maxDistance</a><span class="type-signature"> : number</span> </h3>
  121. <div class="description">
  122. <p>Controls how far a fragment can reflect.</p>
  123. <p>Default is <code>180</code>.</p>
  124. </div>
  125. </div>
  126. <div class="member">
  127. <h3 class="name" id="opacity" translate="no">.<a href="#opacity">opacity</a><span class="type-signature"> : number</span> </h3>
  128. <div class="description">
  129. <p>The opacity.</p>
  130. <p>Default is <code>0.5</code>.</p>
  131. </div>
  132. </div>
  133. <div class="member">
  134. <h3 class="name" id="output" translate="no">.<a href="#output">output</a><span class="type-signature"> : number</span> </h3>
  135. <div class="description">
  136. <p>The output configuration.</p>
  137. <p>Default is <code>0</code>.</p>
  138. </div>
  139. </div>
  140. <div class="member">
  141. <h3 class="name" id="renderer" translate="no">.<a href="#renderer">renderer</a><span class="type-signature"> : <a href="WebGLRenderer.html">WebGLRenderer</a></span> </h3>
  142. <div class="description">
  143. <p>The renderer.</p>
  144. </div>
  145. </div>
  146. <div class="member">
  147. <h3 class="name" id="resolutionScale" translate="no">.<a href="#resolutionScale">resolutionScale</a><span class="type-signature"> : number</span> </h3>
  148. <div class="description">
  149. <p>The resolution scale. Valid values are in the range
  150. <code>[0,1]</code>. <code>1</code> means best quality but also results in
  151. more computational overhead. Setting to <code>0.5</code> means
  152. the effect is computed in half-resolution.</p>
  153. <p>Default is <code>1</code>.</p>
  154. </div>
  155. </div>
  156. <div class="member">
  157. <h3 class="name" id="scene" translate="no">.<a href="#scene">scene</a><span class="type-signature"> : <a href="Scene.html">Scene</a></span> </h3>
  158. <div class="description">
  159. <p>The scene to render.</p>
  160. </div>
  161. </div>
  162. <div class="member">
  163. <h3 class="name" id="selective" translate="no">.<a href="#selective">selective</a><span class="type-signature"> : boolean</span> </h3>
  164. <div class="description">
  165. <p>Whether the pass is selective or not.</p>
  166. <p>Default is <code>false</code>.</p>
  167. </div>
  168. </div>
  169. <div class="member">
  170. <h3 class="name" id="selects" translate="no">.<a href="#selects">selects</a><span class="type-signature"> : Array.&lt;<a href="Object3D.html">Object3D</a>></span> </h3>
  171. <div class="description">
  172. <p>Which 3D objects should be affected by SSR. If not set, the entire scene is affected.</p>
  173. <p>Default is <code>null</code>.</p>
  174. </div>
  175. </div>
  176. <div class="member">
  177. <h3 class="name" id="thickness" translate="no">.<a href="#thickness">thickness</a><span class="type-signature"> : number</span> </h3>
  178. <div class="description">
  179. <p>Controls the cutoff between what counts as a
  180. possible reflection hit and what does not.</p>
  181. <p>Default is <code>.018</code>.</p>
  182. </div>
  183. </div>
  184. <div class="member">
  185. <h3 class="name" id="width" translate="no">.<a href="#width">width</a><span class="type-signature"> : number</span> </h3>
  186. <div class="description">
  187. <p>The width of the effect.</p>
  188. <p>Default is <code>512</code>.</p>
  189. </div>
  190. </div>
  191. <h2 class="subsection-title">Methods</h2>
  192. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  193. <div class="method">
  194. <div class="description">
  195. <p>Frees the GPU-related resources allocated by this instance. Call this
  196. method whenever the pass is no longer used in your app.</p>
  197. </div>
  198. <dl class="details">
  199. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#dispose">Pass#dispose</a></dt>
  200. </dl>
  201. </div>
  202. <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>
  203. <div class="method">
  204. <div class="description">
  205. <p>Performs the SSR pass.</p>
  206. </div>
  207. <table class="params">
  208. <tbody>
  209. <tr>
  210. <td class="name">
  211. <strong>renderer</strong>
  212. </td>
  213. <td class="description last">
  214. <p>The renderer.</p>
  215. </td>
  216. </tr>
  217. <tr>
  218. <td class="name">
  219. <strong>writeBuffer</strong>
  220. </td>
  221. <td class="description last">
  222. <p>The write buffer. This buffer is intended as the rendering
  223. destination for the pass.</p>
  224. </td>
  225. </tr>
  226. <tr>
  227. <td class="name">
  228. <strong>readBuffer</strong>
  229. </td>
  230. <td class="description last">
  231. <p>The read buffer. The pass can access the result from the
  232. previous pass from this buffer.</p>
  233. </td>
  234. </tr>
  235. <tr>
  236. <td class="name">
  237. <strong>deltaTime</strong>
  238. </td>
  239. <td class="description last">
  240. <p>The delta time in seconds.</p>
  241. </td>
  242. </tr>
  243. <tr>
  244. <td class="name">
  245. <strong>maskActive</strong>
  246. </td>
  247. <td class="description last">
  248. <p>Whether masking is active or not.</p>
  249. </td>
  250. </tr>
  251. </tbody>
  252. </table>
  253. <dl class="details">
  254. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#render">Pass#render</a></dt>
  255. </dl>
  256. </div>
  257. <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>
  258. <div class="method">
  259. <div class="description">
  260. <p>Sets the size of the pass.</p>
  261. </div>
  262. <table class="params">
  263. <tbody>
  264. <tr>
  265. <td class="name">
  266. <strong>width</strong>
  267. </td>
  268. <td class="description last">
  269. <p>The width to set.</p>
  270. </td>
  271. </tr>
  272. <tr>
  273. <td class="name">
  274. <strong>height</strong>
  275. </td>
  276. <td class="description last">
  277. <p>The height to set.</p>
  278. </td>
  279. </tr>
  280. </tbody>
  281. </table>
  282. <dl class="details">
  283. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#setSize">Pass#setSize</a></dt>
  284. </dl>
  285. </div>
  286. <h2 class="subsection-title">Type Definitions</h2>
  287. <div class="member">
  288. <h3 class="name" id="~Options" translate="no">.<a href="#~Options">Options</a> </h3>
  289. <div class="description">
  290. <p>Constructor options of <code>SSRPass</code>.</p>
  291. </div>
  292. <table class="props">
  293. <tbody>
  294. <tr>
  295. <td class="name">
  296. <strong>renderer</strong>
  297. <br>
  298. <span class="param-type"><a href="WebGLRenderer.html">WebGLRenderer</a></span>
  299. </td>
  300. <td class="description last">
  301. <p>The renderer.</p>
  302. </td>
  303. </tr>
  304. <tr>
  305. <td class="name">
  306. <strong>scene</strong>
  307. <br>
  308. <span class="param-type"><a href="Scene.html">Scene</a></span>
  309. </td>
  310. <td class="description last">
  311. <p>The scene to render.</p>
  312. </td>
  313. </tr>
  314. <tr>
  315. <td class="name">
  316. <strong>camera</strong>
  317. <br>
  318. <span class="param-type"><a href="Camera.html">Camera</a></span>
  319. </td>
  320. <td class="description last">
  321. <p>The camera.</p>
  322. </td>
  323. </tr>
  324. <tr>
  325. <td class="name">
  326. <strong>width</strong>
  327. <br>
  328. <span class="param-type">number</span>
  329. </td>
  330. <td class="description last">
  331. <p>The width of the effect.</p>
  332. <p>Default is <code>512</code>.</p>
  333. </td>
  334. </tr>
  335. <tr>
  336. <td class="name">
  337. <strong>height</strong>
  338. <br>
  339. <span class="param-type">number</span>
  340. </td>
  341. <td class="description last">
  342. <p>The width of the effect.</p>
  343. <p>Default is <code>512</code>.</p>
  344. </td>
  345. </tr>
  346. <tr>
  347. <td class="name">
  348. <strong>selects</strong>
  349. <br>
  350. <span class="param-type">Array.&lt;<a href="Object3D.html">Object3D</a>></span>
  351. </td>
  352. <td class="description last">
  353. <p>Which 3D objects should be affected by SSR. If not set, the entire scene is affected.</p>
  354. <p>Default is <code>null</code>.</p>
  355. </td>
  356. </tr>
  357. <tr>
  358. <td class="name">
  359. <strong>bouncing</strong>
  360. <br>
  361. <span class="param-type">boolean</span>
  362. </td>
  363. <td class="description last">
  364. <p>Whether bouncing is enabled or not.</p>
  365. <p>Default is <code>false</code>.</p>
  366. </td>
  367. </tr>
  368. <tr>
  369. <td class="name">
  370. <strong>groundReflector</strong>
  371. <br>
  372. <span class="param-type"><a href="ReflectorForSSRPass.html">ReflectorForSSRPass</a></span>
  373. </td>
  374. <td class="description last">
  375. <p>A ground reflector.</p>
  376. <p>Default is <code>null</code>.</p>
  377. </td>
  378. </tr>
  379. </tbody>
  380. </table>
  381. </div>
  382. <h2 class="subsection-title">Source</h2>
  383. <p>
  384. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/SSRPass.js" translate="no" target="_blank" rel="noopener">examples/jsm/postprocessing/SSRPass.js</a>
  385. </p>
  386. </article>
  387. </section>
  388. <script src="../scripts/linenumber.js"></script>
  389. <script src="../scripts/page.js"></script>
  390. </body>
  391. </html>
粤ICP备19079148号