| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>ClusteredLightsNode - 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="LightsNode.html">LightsNode</a> → </p>
- <h1 translate="no">ClusteredLightsNode</h1>
- <section>
- <header>
- <div class="class-description"><p>A custom version of <code>LightsNode</code> implementing Forward+ clustered shading:
- the view frustum is subdivided into a 3D grid of clusters (X × Y screen tiles
- times an exponentially-spaced set of Z depth slices), and each cluster holds
- only the point lights whose spheres intersect it. At shading time each fragment
- looks up its cluster and loops over just that cluster's lights. Unlike 2D tiled
- lighting, clustered shading culls lights that share screen pixels but lie at
- different depths — suitable for 3D scenes with real depth complexity.</p></div>
- </header>
- <article>
- <h2 class="subsection-title">Import</h2>
- <p><span translate="no">ClusteredLightsNode</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 { clusteredLights } from 'three/addons/tsl/lighting/ClusteredLightsNode.js';</code></pre>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="ClusteredLightsNode" translate="no">new <a href="#ClusteredLightsNode">ClusteredLightsNode</a><span class="signature">( maxLights : <span class="param-type">number</span>, tileSize : <span class="param-type">number</span>, zSlices : <span class="param-type">number</span>, maxLightsPerCluster : <span class="param-type">number</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new clustered lights node.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong translate="no">maxLights</strong>
- </td>
- <td class="description last">
- <p>Maximum number of point lights.</p>
- <p>Default is <code>1024</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong translate="no">tileSize</strong>
- </td>
- <td class="description last">
- <p>Screen tile size in pixels (cluster XY size).</p>
- <p>Default is <code>32</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong translate="no">zSlices</strong>
- </td>
- <td class="description last">
- <p>Number of exponential depth slices.</p>
- <p>Default is <code>24</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong translate="no">maxLightsPerCluster</strong>
- </td>
- <td class="description last">
- <p>Per-cluster light-list capacity.</p>
- <p>Default is <code>64</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/lighting/ClusteredLightsNode.js" translate="no" target="_blank" rel="noopener">examples/jsm/tsl/lighting/ClusteredLightsNode.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|