ClusteredLightsNode.html 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ClusteredLightsNode - 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="EventDispatcher.html">EventDispatcher</a> → <a href="Node.html">Node</a> → <a href="LightsNode.html">LightsNode</a> → </p>
  13. <h1 translate="no">ClusteredLightsNode</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A custom version of <code>LightsNode</code> implementing Forward+ clustered shading:
  17. the view frustum is subdivided into a 3D grid of clusters (X × Y screen tiles
  18. times an exponentially-spaced set of Z depth slices), and each cluster holds
  19. only the point lights whose spheres intersect it. At shading time each fragment
  20. looks up its cluster and loops over just that cluster's lights. Unlike 2D tiled
  21. lighting, clustered shading culls lights that share screen pixels but lie at
  22. different depths — suitable for 3D scenes with real depth complexity.</p></div>
  23. </header>
  24. <article>
  25. <h2 class="subsection-title">Import</h2>
  26. <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>
  27. <pre><code class="language-js">import { clusteredLights } from 'three/addons/tsl/lighting/ClusteredLightsNode.js';</code></pre>
  28. <div class="container-overview">
  29. <h2>Constructor</h2>
  30. <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>
  31. <div class="method">
  32. <div class="description">
  33. <p>Constructs a new clustered lights node.</p>
  34. </div>
  35. <table class="params">
  36. <tbody>
  37. <tr>
  38. <td class="name">
  39. <strong translate="no">maxLights</strong>
  40. </td>
  41. <td class="description last">
  42. <p>Maximum number of point lights.</p>
  43. <p>Default is <code>1024</code>.</p>
  44. </td>
  45. </tr>
  46. <tr>
  47. <td class="name">
  48. <strong translate="no">tileSize</strong>
  49. </td>
  50. <td class="description last">
  51. <p>Screen tile size in pixels (cluster XY size).</p>
  52. <p>Default is <code>32</code>.</p>
  53. </td>
  54. </tr>
  55. <tr>
  56. <td class="name">
  57. <strong translate="no">zSlices</strong>
  58. </td>
  59. <td class="description last">
  60. <p>Number of exponential depth slices.</p>
  61. <p>Default is <code>24</code>.</p>
  62. </td>
  63. </tr>
  64. <tr>
  65. <td class="name">
  66. <strong translate="no">maxLightsPerCluster</strong>
  67. </td>
  68. <td class="description last">
  69. <p>Per-cluster light-list capacity.</p>
  70. <p>Default is <code>64</code>.</p>
  71. </td>
  72. </tr>
  73. </tbody>
  74. </table>
  75. </div>
  76. </div>
  77. <h2 class="subsection-title">Source</h2>
  78. <p>
  79. <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>
  80. </p>
  81. </article>
  82. </section>
  83. <script src="../scripts/linenumber.js"></script>
  84. <script src="../scripts/page.js"></script>
  85. </body>
  86. </html>
粤ICP备19079148号