ClusteredLighting.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ClusteredLighting - 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="Lighting.html">Lighting</a> → </p>
  13. <h1 translate="no">ClusteredLighting</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A custom lighting implementation based on Forward+ Clustered Shading that
  17. overwrites the default lighting system in <a href="WebGPURenderer.html">WebGPURenderer</a>. Suitable
  18. for 3D scenes with many point lights and real depth complexity — the view
  19. frustum is partitioned into a 3D cluster grid so only the lights actually
  20. reaching each fragment are evaluated.</p></div>
  21. <h2>Code Example</h2>
  22. <div translate="no"><pre><code class="language-js">const lighting = new ClusteredLighting();
  23. renderer.lighting = lighting; // set lighting system
  24. </code></pre></div>
  25. </header>
  26. <article>
  27. <h2 class="subsection-title">Import</h2>
  28. <p><span translate="no">ClusteredLighting</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>
  29. <pre><code class="language-js">import { ClusteredLighting } from 'three/addons/lighting/ClusteredLighting.js';</code></pre>
  30. <div class="container-overview">
  31. <h2>Constructor</h2>
  32. <h3 class="name name-method" id="ClusteredLighting" translate="no">new <a href="#ClusteredLighting">ClusteredLighting</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>
  33. <div class="method">
  34. <div class="description">
  35. <p>Constructs a new clustered lighting system.</p>
  36. </div>
  37. <table class="params">
  38. <tbody>
  39. <tr>
  40. <td class="name">
  41. <strong translate="no">maxLights</strong>
  42. </td>
  43. <td class="description last">
  44. <p>Maximum number of point lights.</p>
  45. <p>Default is <code>1024</code>.</p>
  46. </td>
  47. </tr>
  48. <tr>
  49. <td class="name">
  50. <strong translate="no">tileSize</strong>
  51. </td>
  52. <td class="description last">
  53. <p>Screen tile size in pixels (cluster XY size).</p>
  54. <p>Default is <code>32</code>.</p>
  55. </td>
  56. </tr>
  57. <tr>
  58. <td class="name">
  59. <strong translate="no">zSlices</strong>
  60. </td>
  61. <td class="description last">
  62. <p>Number of exponential depth slices.</p>
  63. <p>Default is <code>24</code>.</p>
  64. </td>
  65. </tr>
  66. <tr>
  67. <td class="name">
  68. <strong translate="no">maxLightsPerCluster</strong>
  69. </td>
  70. <td class="description last">
  71. <p>Per-cluster light-list capacity.</p>
  72. <p>Default is <code>64</code>.</p>
  73. </td>
  74. </tr>
  75. </tbody>
  76. </table>
  77. </div>
  78. </div>
  79. <h2 class="subsection-title">Classes</h2>
  80. <dl>
  81. <dt><a href="ClusteredLighting.html">ClusteredLighting</a></dt>
  82. <dd></dd>
  83. </dl>
  84. <h2 class="subsection-title">Methods</h2>
  85. <h3 class="name name-method" id="createNode" translate="no">.<a href="#createNode">createNode</a><span class="signature">( lights : <span class="param-type">Array.&lt;<a href="Light.html">Light</a>></span> )</span><span class="type-signature"> : <a href="ClusteredLightsNode.html">ClusteredLightsNode</a></span> </h3>
  86. <div class="method">
  87. <div class="description">
  88. <p>Creates a new clustered lights node for the given array of lights.</p>
  89. <p>This method is called internally by the renderer and must be overwritten by
  90. all custom lighting implementations.</p>
  91. </div>
  92. <table class="params">
  93. <tbody>
  94. <tr>
  95. <td class="name">
  96. <strong translate="no">lights</strong>
  97. </td>
  98. <td class="description last">
  99. <p>The lights.</p>
  100. </td>
  101. </tr>
  102. </tbody>
  103. </table>
  104. <dl class="details">
  105. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Lighting.html#createNode">Lighting#createNode</a></dt>
  106. </dl>
  107. <dl class="details">
  108. <dt class="tag-returns"><strong>Returns:</strong> The clustered lights node.</dt>
  109. </dl>
  110. </div>
  111. <h2 class="subsection-title">Source</h2>
  112. <p>
  113. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/lighting/ClusteredLighting.js" translate="no" target="_blank" rel="noopener">examples/jsm/lighting/ClusteredLighting.js</a>
  114. </p>
  115. </article>
  116. </section>
  117. <script src="../scripts/linenumber.js"></script>
  118. <script src="../scripts/page.js"></script>
  119. </body>
  120. </html>
粤ICP备19079148号