| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>DepthOfFieldNode - 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="EventDispatcher.html">EventDispatcher</a> → <a href="Node.html">Node</a> → <a href="TempNode.html">TempNode</a> → </p>
- <h1 translate="no">DepthOfFieldNode</h1>
- <section>
- <header>
- <div class="class-description"><p>Post processing node for creating depth of field (DOF) effect.</p>
- <p>References:</p>
- <ul>
- <li><a href="https://pixelmischiefblog.wordpress.com/2016/11/25/bokeh-depth-of-field/" target="_blank" rel="noopener">https://pixelmischiefblog.wordpress.com/2016/11/25/bokeh-depth-of-field/</a></li>
- <li><a href="https://www.adriancourreges.com/blog/2016/09/09/doom-2016-graphics-study/" target="_blank" rel="noopener">https://www.adriancourreges.com/blog/2016/09/09/doom-2016-graphics-study/</a></li>
- </ul></div>
- </header>
- <article>
- <h2 class="subsection-title">Import</h2>
- <p><span translate="no">DepthOfFieldNode</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>
- <pre><code class="language-js">import { dof } from 'three/addons/tsl/display/DepthOfFieldNode.js';</code></pre>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="DepthOfFieldNode" translate="no">new <a href="#DepthOfFieldNode">DepthOfFieldNode</a><span class="signature">( textureNode : <span class="param-type"><a href="TextureNode.html">TextureNode</a></span>, viewZNode : <span class="param-type"><a href="Node.html">Node</a>.<float></span>, focusDistanceNode : <span class="param-type"><a href="Node.html">Node</a>.<float></span>, focalLengthNode : <span class="param-type"><a href="Node.html">Node</a>.<float></span>, bokehScaleNode : <span class="param-type"><a href="Node.html">Node</a>.<float></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new DOF node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>textureNode</strong>
- </td>
- <td class="description last">
- <p>The texture node that represents the input of the effect.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>viewZNode</strong>
- </td>
- <td class="description last">
- <p>Represents the viewZ depth values of the scene.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>focusDistanceNode</strong>
- </td>
- <td class="description last">
- <p>Defines the effect's focus which is the distance along the camera's look direction in world units.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>focalLengthNode</strong>
- </td>
- <td class="description last">
- <p>How far an object can be from the focal plane before it goes completely out-of-focus in world units.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>bokehScaleNode</strong>
- </td>
- <td class="description last">
- <p>A unitless value for artistic purposes to adjust the size of the bokeh.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="bokehScaleNode" translate="no">.<a href="#bokehScaleNode">bokehScaleNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.<float></span> </h3>
- <div class="description">
- <p>A unitless value for artistic purposes to adjust the size of the bokeh.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="focalLengthNode" translate="no">.<a href="#focalLengthNode">focalLengthNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.<float></span> </h3>
- <div class="description">
- <p>How far an object can be from the focal plane before it goes completely out-of-focus in world units.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="focusDistanceNode" translate="no">.<a href="#focusDistanceNode">focusDistanceNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.<float></span> </h3>
- <div class="description">
- <p>Defines the effect's focus which is the distance along the camera's look direction in world units.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="textureNode" translate="no">.<a href="#textureNode">textureNode</a><span class="type-signature"> : <a href="TextureNode.html">TextureNode</a></span> </h3>
- <div class="description">
- <p>The texture node that represents the input of the effect.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="updateBeforeType" translate="no">.<a href="#updateBeforeType">updateBeforeType</a><span class="type-signature"> : string</span> </h3>
- <div class="description">
- <p>The <code>updateBeforeType</code> is set to <code>NodeUpdateType.FRAME</code> since the node updates
- its internal uniforms once per frame in <code>updateBefore()</code>.</p>
- <p>Default is <code>'frame'</code>.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#updateBeforeType">TempNode#updateBeforeType</a></dt>
- </dl>
- </div>
- <div class="member">
- <h3 class="name" id="viewZNode" translate="no">.<a href="#viewZNode">viewZNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.<float></span> </h3>
- <div class="description">
- <p>Represents the viewZ depth values of the scene.</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 internal resources. This method should be called
- when the effect is no longer required.</p>
- </div>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#dispose">TempNode#dispose</a></dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getTextureNode" translate="no">.<a href="#getTextureNode">getTextureNode</a><span class="signature">()</span><span class="type-signature"> : <a href="PassTextureNode.html">PassTextureNode</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the result of the effect as a texture node.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A texture node that represents the result of the effect.</dt>
- </dl>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Sets the size of the effect.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>width</strong>
- </td>
- <td class="description last">
- <p>The width of the effect.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>height</strong>
- </td>
- <td class="description last">
- <p>The height of the effect.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h3 class="name name-method" id="setup" translate="no">.<a href="#setup">setup</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : ShaderCallNodeInternal</span> </h3>
- <div class="method">
- <div class="description">
- <p>This method is used to setup the effect's TSL code.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>builder</strong>
- </td>
- <td class="description last">
- <p>The current node builder.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#setup">TempNode#setup</a></dt>
- </dl>
- </div>
- <h3 class="name name-method" id="updateBefore" translate="no">.<a href="#updateBefore">updateBefore</a><span class="signature">( frame : <span class="param-type"><a href="NodeFrame.html">NodeFrame</a></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>This method is used to update the effect's uniforms once per frame.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>frame</strong>
- </td>
- <td class="description last">
- <p>The current node frame.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#updateBefore">TempNode#updateBefore</a></dt>
- </dl>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/DepthOfFieldNode.js" translate="no" target="_blank" rel="noopener">examples/jsm/tsl/display/DepthOfFieldNode.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|