FilmPass.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>FilmPass - 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">FilmPass</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This pass can be used to create a film grain effect.</p></div>
  17. <h2>Code Example</h2>
  18. <div translate="no"><pre><code class="language-js">const filmPass = new FilmPass();
  19. composer.addPass( filmPass );
  20. </code></pre></div>
  21. </header>
  22. <article>
  23. <h2 class="subsection-title">Import</h2>
  24. <p><span translate="no">FilmPass</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 { FilmPass } from 'three/addons/postprocessing/FilmPass.js';</code></pre>
  26. <div class="container-overview">
  27. <h2>Constructor</h2>
  28. <h3 class="name name-method" id="FilmPass" translate="no">new <a href="#FilmPass">FilmPass</a><span class="signature">( intensity : <span class="param-type">number</span>, grayscale : <span class="param-type">boolean</span> )</span> </h3>
  29. <div class="method">
  30. <div class="description">
  31. <p>Constructs a new film pass.</p>
  32. </div>
  33. <table class="params">
  34. <tbody>
  35. <tr>
  36. <td class="name">
  37. <strong>intensity</strong>
  38. </td>
  39. <td class="description last">
  40. <p>The grain intensity in the range <code>[0,1]</code> (0 = no effect, 1 = full effect).</p>
  41. <p>Default is <code>0.5</code>.</p>
  42. </td>
  43. </tr>
  44. <tr>
  45. <td class="name">
  46. <strong>grayscale</strong>
  47. </td>
  48. <td class="description last">
  49. <p>Whether to apply a grayscale effect or not.</p>
  50. <p>Default is <code>false</code>.</p>
  51. </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="material" translate="no">.<a href="#material">material</a><span class="type-signature"> : <a href="ShaderMaterial.html">ShaderMaterial</a></span> </h3>
  60. <div class="description">
  61. <p>The pass material.</p>
  62. </div>
  63. </div>
  64. <div class="member">
  65. <h3 class="name" id="uniforms" translate="no">.<a href="#uniforms">uniforms</a><span class="type-signature"> : Object</span> </h3>
  66. <div class="description">
  67. <p>The pass uniforms. Use this object if you want to update the
  68. <code>intensity</code> or <code>grayscale</code> values at runtime.</p>
  69. <pre><code class="language-js">pass.uniforms.intensity.value = 1;
  70. pass.uniforms.grayscale.value = true;
  71. </code></pre>
  72. </div>
  73. </div>
  74. <h2 class="subsection-title">Methods</h2>
  75. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  76. <div class="method">
  77. <div class="description">
  78. <p>Frees the GPU-related resources allocated by this instance. Call this
  79. method whenever the pass is no longer used in your app.</p>
  80. </div>
  81. <dl class="details">
  82. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#dispose">Pass#dispose</a></dt>
  83. </dl>
  84. </div>
  85. <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>
  86. <div class="method">
  87. <div class="description">
  88. <p>Performs the film pass.</p>
  89. </div>
  90. <table class="params">
  91. <tbody>
  92. <tr>
  93. <td class="name">
  94. <strong>renderer</strong>
  95. </td>
  96. <td class="description last">
  97. <p>The renderer.</p>
  98. </td>
  99. </tr>
  100. <tr>
  101. <td class="name">
  102. <strong>writeBuffer</strong>
  103. </td>
  104. <td class="description last">
  105. <p>The write buffer. This buffer is intended as the rendering
  106. destination for the pass.</p>
  107. </td>
  108. </tr>
  109. <tr>
  110. <td class="name">
  111. <strong>readBuffer</strong>
  112. </td>
  113. <td class="description last">
  114. <p>The read buffer. The pass can access the result from the
  115. previous pass from this buffer.</p>
  116. </td>
  117. </tr>
  118. <tr>
  119. <td class="name">
  120. <strong>deltaTime</strong>
  121. </td>
  122. <td class="description last">
  123. <p>The delta time in seconds.</p>
  124. </td>
  125. </tr>
  126. <tr>
  127. <td class="name">
  128. <strong>maskActive</strong>
  129. </td>
  130. <td class="description last">
  131. <p>Whether masking is active or not.</p>
  132. </td>
  133. </tr>
  134. </tbody>
  135. </table>
  136. <dl class="details">
  137. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#render">Pass#render</a></dt>
  138. </dl>
  139. </div>
  140. <h2 class="subsection-title">Source</h2>
  141. <p>
  142. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/FilmPass.js" translate="no" target="_blank" rel="noopener">examples/jsm/postprocessing/FilmPass.js</a>
  143. </p>
  144. </article>
  145. </section>
  146. <script src="../scripts/linenumber.js"></script>
  147. <script src="../scripts/page.js"></script>
  148. </body>
  149. </html>
粤ICP备19079148号