| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>ShaderPass - Three.js Docs</title>
- <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
- <script src="../scripts/highlight.min.js"></script>
- <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
- <link type="text/css" rel="stylesheet" href="../styles/page.css">
- </head>
- <body>
- <p class="inheritance" translate="no"><a href="Pass.html">Pass</a> → </p>
- <h1 translate="no">ShaderPass</h1>
- <section>
- <header>
- <div class="class-description"><p>This pass can be used to create a post processing effect
- with a raw GLSL shader object. Useful for implementing custom
- effects.</p></div>
- <h2>Code Example</h2>
- <div translate="no"><pre><code class="language-js">const fxaaPass = new ShaderPass( FXAAShader );
- composer.addPass( fxaaPass );
- </code></pre></div>
- </header>
- <article>
- <h2 class="subsection-title">Import</h2>
- <p><span translate="no">ShaderPass</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank">Installation#Addons</a>.</p>
- <pre><code class="language-js">import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js';</code></pre>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="ShaderPass" translate="no">new <a href="#ShaderPass">ShaderPass</a><span class="signature">( shader : <span class="param-type">Object | ShaderMaterial</span>, textureID : <span class="param-type">string</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new shader pass.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name"><code>shader</code></td>
- <td class="description last"><p>A shader object holding vertex and fragment shader as well as
- defines and uniforms. It's also valid to pass a custom shader material.</p></td>
- </tr>
- <tr>
- <td class="name"><code>textureID</code></td>
- <td class="description last"><p>The name of the texture uniform that should sample
- the read buffer.<br/>Default is <code>'tDiffuse'</code>.</p></td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="material" translate="no">.<a href="#material">material</a><span class="type-signature"> : <a href="ShaderMaterial.html">ShaderMaterial</a></span> </h3>
- <div class="description">
- <p>The pass material.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="textureID" translate="no">.<a href="#textureID">textureID</a><span class="type-signature"> : string</span> </h3>
- <div class="description">
- <p>The name of the texture uniform that should sample the read buffer.<br/>Default is <code>'tDiffuse'</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="uniforms" translate="no">.<a href="#uniforms">uniforms</a><span class="type-signature"> : Object</span> </h3>
- <div class="description">
- <p>The pass uniforms.</p>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Frees the GPU-related resources allocated by this instance. Call this
- method whenever the pass is no longer used in your app.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#dispose">Pass#dispose</a></dt>
- </dl>
- </div>
- <h3 class="name name-method" id="render" translate="no">.<a href="#render">render</a><span class="signature">( renderer : <span class="param-type">WebGLRenderer</span>, writeBuffer : <span class="param-type">WebGLRenderTarget</span>, readBuffer : <span class="param-type">WebGLRenderTarget</span>, deltaTime : <span class="param-type">number</span>, maskActive : <span class="param-type">boolean</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Performs the shader pass.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name"><code>renderer</code></td>
- <td class="description last"><p>The renderer.</p></td>
- </tr>
- <tr>
- <td class="name"><code>writeBuffer</code></td>
- <td class="description last"><p>The write buffer. This buffer is intended as the rendering
- destination for the pass.</p></td>
- </tr>
- <tr>
- <td class="name"><code>readBuffer</code></td>
- <td class="description last"><p>The read buffer. The pass can access the result from the
- previous pass from this buffer.</p></td>
- </tr>
- <tr>
- <td class="name"><code>deltaTime</code></td>
- <td class="description last"><p>The delta time in seconds.</p></td>
- </tr>
- <tr>
- <td class="name"><code>maskActive</code></td>
- <td class="description last"><p>Whether masking is active or not.</p></td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Pass.html#render">Pass#render</a></dt>
- </dl>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/ShaderPass.js" target="_blank" rel="noopener" translate="no">examples/jsm/postprocessing/ShaderPass.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|