1
0

ProgressiveLightMap.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ProgressiveLightMap - 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. <h1 translate="no">ProgressiveLightMap</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>Progressive Light Map Accumulator, by <a href="https://github.com/zalo/" target="_blank" rel="noopener">zalo</a>.</p>
  16. <p>To use, simply construct a <code>ProgressiveLightMap</code> object,
  17. <code>plmap.addObjectsToLightMap(object)</code> an array of semi-static
  18. objects and lights to the class once, and then call
  19. <code>plmap.update(camera)</code> every frame to begin accumulating
  20. lighting samples.</p>
  21. <p>This should begin accumulating lightmaps which apply to
  22. your objects, so you can start jittering lighting to achieve
  23. the texture-space effect you're looking for.</p>
  24. <p>This class can only be used with <a href="WebGLRenderer.html">WebGLRenderer</a>.
  25. When using <a href="WebGPURenderer.html">WebGPURenderer</a>, import from <code>ProgressiveLightMapGPU.js</code>.</p></div>
  26. </header>
  27. <article>
  28. <h2 class="subsection-title">Import</h2>
  29. <p><span translate="no">ProgressiveLightMap</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>
  30. <pre><code class="language-js">import { ProgressiveLightMap } from 'three/addons/misc/ProgressiveLightMap.js';</code></pre>
  31. <div class="container-overview">
  32. <h2>Constructor</h2>
  33. <h3 class="name name-method" id="ProgressiveLightMap" translate="no">new <a href="#ProgressiveLightMap">ProgressiveLightMap</a><span class="signature">( renderer : <span class="param-type"><a href="WebGLRenderer.html">WebGLRenderer</a></span>, res : <span class="param-type">number</span> )</span> </h3>
  34. <div class="method">
  35. <div class="description">
  36. <p>Constructs a new progressive light map.</p>
  37. </div>
  38. <table class="params">
  39. <tbody>
  40. <tr>
  41. <td class="name">
  42. <strong>renderer</strong>
  43. </td>
  44. <td class="description last">
  45. <p>The renderer.</p>
  46. </td>
  47. </tr>
  48. <tr>
  49. <td class="name">
  50. <strong>res</strong>
  51. </td>
  52. <td class="description last">
  53. <p>The side-long dimension of the total lightmap.</p>
  54. <p>Default is <code>1024</code>.</p>
  55. </td>
  56. </tr>
  57. </tbody>
  58. </table>
  59. </div>
  60. </div>
  61. <h2 class="subsection-title">Properties</h2>
  62. <div class="member">
  63. <h3 class="name" id="renderer" translate="no">.<a href="#renderer">renderer</a><span class="type-signature"> : <a href="WebGLRenderer.html">WebGLRenderer</a></span> </h3>
  64. <div class="description">
  65. <p>The renderer.</p>
  66. </div>
  67. </div>
  68. <div class="member">
  69. <h3 class="name" id="res" translate="no">.<a href="#res">res</a><span class="type-signature"> : number</span> </h3>
  70. <div class="description">
  71. <p>The side-long dimension of the total lightmap.</p>
  72. <p>Default is <code>1024</code>.</p>
  73. </div>
  74. </div>
  75. <h2 class="subsection-title">Methods</h2>
  76. <h3 class="name name-method" id="addObjectsToLightMap" translate="no">.<a href="#addObjectsToLightMap">addObjectsToLightMap</a><span class="signature">( objects : <span class="param-type">Array.&lt;<a href="Object3D.html">Object3D</a>></span> )</span> </h3>
  77. <div class="method">
  78. <div class="description">
  79. <p>Sets these objects' materials' lightmaps and modifies their uv1's.</p>
  80. </div>
  81. <table class="params">
  82. <tbody>
  83. <tr>
  84. <td class="name">
  85. <strong>objects</strong>
  86. </td>
  87. <td class="description last">
  88. <p>An array of objects and lights to set up your lightmap.</p>
  89. </td>
  90. </tr>
  91. </tbody>
  92. </table>
  93. </div>
  94. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  95. <div class="method">
  96. <div class="description">
  97. <p>Frees all internal resources.</p>
  98. </div>
  99. </div>
  100. <h3 class="name name-method" id="showDebugLightmap" translate="no">.<a href="#showDebugLightmap">showDebugLightmap</a><span class="signature">( visible : <span class="param-type">boolean</span>, position : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span> </h3>
  101. <div class="method">
  102. <div class="description">
  103. <p>Draws the lightmap in the main scene. Call this after adding the objects to it.</p>
  104. </div>
  105. <table class="params">
  106. <tbody>
  107. <tr>
  108. <td class="name">
  109. <strong>visible</strong>
  110. </td>
  111. <td class="description last">
  112. <p>Whether the debug plane should be visible</p>
  113. </td>
  114. </tr>
  115. <tr>
  116. <td class="name">
  117. <strong>position</strong>
  118. </td>
  119. <td class="description last">
  120. <p>Where the debug plane should be drawn</p>
  121. </td>
  122. </tr>
  123. </tbody>
  124. </table>
  125. </div>
  126. <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">( camera : <span class="param-type"><a href="Camera.html">Camera</a></span>, blendWindow : <span class="param-type">number</span>, blurEdges : <span class="param-type">boolean</span> )</span> </h3>
  127. <div class="method">
  128. <div class="description">
  129. <p>This function renders each mesh one at a time into their respective surface maps.</p>
  130. </div>
  131. <table class="params">
  132. <tbody>
  133. <tr>
  134. <td class="name">
  135. <strong>camera</strong>
  136. </td>
  137. <td class="description last">
  138. <p>The camera the scene is rendered with.</p>
  139. </td>
  140. </tr>
  141. <tr>
  142. <td class="name">
  143. <strong>blendWindow</strong>
  144. </td>
  145. <td class="description last">
  146. <p>When &gt;1, samples will accumulate over time.</p>
  147. <p>Default is <code>100</code>.</p>
  148. </td>
  149. </tr>
  150. <tr>
  151. <td class="name">
  152. <strong>blurEdges</strong>
  153. </td>
  154. <td class="description last">
  155. <p>Whether to fix UV Edges via blurring.</p>
  156. <p>Default is <code>true</code>.</p>
  157. </td>
  158. </tr>
  159. </tbody>
  160. </table>
  161. </div>
  162. <h2 class="subsection-title">Source</h2>
  163. <p>
  164. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/ProgressiveLightMap.js" translate="no" target="_blank" rel="noopener">examples/jsm/misc/ProgressiveLightMap.js</a>
  165. </p>
  166. </article>
  167. </section>
  168. <script src="../scripts/linenumber.js"></script>
  169. <script src="../scripts/page.js"></script>
  170. </body>
  171. </html>
粤ICP备19079148号