RenderPixelatedPass.html 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>RenderPixelatedPass - 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">RenderPixelatedPass</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A special type of render pass that produces a pixelated beauty pass.</p></div>
  17. <h2>Code Example</h2>
  18. <div translate="no"><pre><code class="language-js">const renderPixelatedPass = new RenderPixelatedPass( 6, scene, camera );
  19. composer.addPass( renderPixelatedPass );
  20. </code></pre></div>
  21. </header>
  22. <article>
  23. <h2 class="subsection-title">Import</h2>
  24. <p><span translate="no">RenderPixelatedPass</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>
  25. <pre><code class="language-js">import { RenderPixelatedPass } from 'three/addons/postprocessing/RenderPixelatedPass.js';</code></pre>
  26. <div class="container-overview">
  27. <h2>Constructor</h2>
  28. <h3 class="name name-method" id="RenderPixelatedPass" translate="no">new <a href="#RenderPixelatedPass">RenderPixelatedPass</a><span class="signature">( pixelSize : <span class="param-type">number</span>, scene : <span class="param-type"><a href="Scene.html">Scene</a></span>, camera : <span class="param-type"><a href="Camera.html">Camera</a></span>, options : <span class="param-type">Object</span> )</span> </h3>
  29. <div class="method">
  30. <div class="description">
  31. <p>Constructs a new render pixelated pass.</p>
  32. </div>
  33. <table class="params">
  34. <tbody>
  35. <tr>
  36. <td class="name">
  37. <strong>pixelSize</strong>
  38. </td>
  39. <td class="description last">
  40. <p>The effect's pixel size.</p>
  41. </td>
  42. </tr>
  43. <tr>
  44. <td class="name">
  45. <strong>scene</strong>
  46. </td>
  47. <td class="description last">
  48. <p>The scene to render.</p>
  49. </td>
  50. </tr>
  51. <tr>
  52. <td class="name">
  53. <strong>camera</strong>
  54. </td>
  55. <td class="description last">
  56. <p>The camera.</p>
  57. </td>
  58. </tr>
  59. <tr>
  60. <td class="name">
  61. <strong>options</strong>
  62. </td>
  63. <td class="description last">
  64. <p>The pass options.</p>
  65. </td>
  66. </tr>
  67. </tbody>
  68. </table>
  69. </div>
  70. </div>
  71. <h2 class="subsection-title">Properties</h2>
  72. <div class="member">
  73. <h3 class="name" id="camera" translate="no">.<a href="#camera">camera</a><span class="type-signature"> : <a href="Camera.html">Camera</a></span> </h3>
  74. <div class="description">
  75. <p>The camera.</p>
  76. </div>
  77. </div>
  78. <div class="member">
  79. <h3 class="name" id="depthEdgeStrength" translate="no">.<a href="#depthEdgeStrength">depthEdgeStrength</a><span class="type-signature"> : number</span> </h3>
  80. <div class="description">
  81. <p>The normal edge strength.</p>
  82. <p>Default is <code>0.4</code>.</p>
  83. </div>
  84. </div>
  85. <div class="member">
  86. <h3 class="name" id="normalEdgeStrength" translate="no">.<a href="#normalEdgeStrength">normalEdgeStrength</a><span class="type-signature"> : number</span> </h3>
  87. <div class="description">
  88. <p>The normal edge strength.</p>
  89. <p>Default is <code>0.3</code>.</p>
  90. </div>
  91. </div>
  92. <div class="member">
  93. <h3 class="name" id="pixelSize" translate="no">.<a href="#pixelSize">pixelSize</a><span class="type-signature"> : number</span> </h3>
  94. <div class="description">
  95. <p>The effect's pixel size.</p>
  96. </div>
  97. </div>
  98. <div class="member">
  99. <h3 class="name" id="pixelatedMaterial" translate="no">.<a href="#pixelatedMaterial">pixelatedMaterial</a><span class="type-signature"> : <a href="ShaderMaterial.html">ShaderMaterial</a></span> </h3>
  100. <div class="description">
  101. <p>The pixelated material.</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. <h2 class="subsection-title">Methods</h2>
  111. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  112. <div class="method">
  113. <div class="description">
  114. <p>Frees the GPU-related resources allocated by this instance. Call this
  115. method whenever the pass is no longer used in your app.</p>
  116. </div>
  117. <dl class="details">
  118. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#dispose">Pass#dispose</a></dt>
  119. </dl>
  120. </div>
  121. <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>
  122. <div class="method">
  123. <div class="description">
  124. <p>Performs the pixelation pass.</p>
  125. </div>
  126. <table class="params">
  127. <tbody>
  128. <tr>
  129. <td class="name">
  130. <strong>renderer</strong>
  131. </td>
  132. <td class="description last">
  133. <p>The renderer.</p>
  134. </td>
  135. </tr>
  136. <tr>
  137. <td class="name">
  138. <strong>writeBuffer</strong>
  139. </td>
  140. <td class="description last">
  141. <p>The write buffer. This buffer is intended as the rendering
  142. destination for the pass.</p>
  143. </td>
  144. </tr>
  145. <tr>
  146. <td class="name">
  147. <strong>readBuffer</strong>
  148. </td>
  149. <td class="description last">
  150. <p>The read buffer. The pass can access the result from the
  151. previous pass from this buffer.</p>
  152. </td>
  153. </tr>
  154. <tr>
  155. <td class="name">
  156. <strong>deltaTime</strong>
  157. </td>
  158. <td class="description last">
  159. <p>The delta time in seconds.</p>
  160. </td>
  161. </tr>
  162. <tr>
  163. <td class="name">
  164. <strong>maskActive</strong>
  165. </td>
  166. <td class="description last">
  167. <p>Whether masking is active or not.</p>
  168. </td>
  169. </tr>
  170. </tbody>
  171. </table>
  172. <dl class="details">
  173. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#render">Pass#render</a></dt>
  174. </dl>
  175. </div>
  176. <h3 class="name name-method" id="setPixelSize" translate="no">.<a href="#setPixelSize">setPixelSize</a><span class="signature">( pixelSize : <span class="param-type">number</span> )</span> </h3>
  177. <div class="method">
  178. <div class="description">
  179. <p>Sets the effect's pixel size.</p>
  180. </div>
  181. <table class="params">
  182. <tbody>
  183. <tr>
  184. <td class="name">
  185. <strong>pixelSize</strong>
  186. </td>
  187. <td class="description last">
  188. <p>The pixel size to set.</p>
  189. </td>
  190. </tr>
  191. </tbody>
  192. </table>
  193. </div>
  194. <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>
  195. <div class="method">
  196. <div class="description">
  197. <p>Sets the size of the pass.</p>
  198. </div>
  199. <table class="params">
  200. <tbody>
  201. <tr>
  202. <td class="name">
  203. <strong>width</strong>
  204. </td>
  205. <td class="description last">
  206. <p>The width to set.</p>
  207. </td>
  208. </tr>
  209. <tr>
  210. <td class="name">
  211. <strong>height</strong>
  212. </td>
  213. <td class="description last">
  214. <p>The height to set.</p>
  215. </td>
  216. </tr>
  217. </tbody>
  218. </table>
  219. <dl class="details">
  220. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#setSize">Pass#setSize</a></dt>
  221. </dl>
  222. </div>
  223. <h2 class="subsection-title">Source</h2>
  224. <p>
  225. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/RenderPixelatedPass.js" translate="no" target="_blank" rel="noopener">examples/jsm/postprocessing/RenderPixelatedPass.js</a>
  226. </p>
  227. </article>
  228. </section>
  229. <script src="../scripts/linenumber.js"></script>
  230. <script src="../scripts/page.js"></script>
  231. </body>
  232. </html>
粤ICP备19079148号