ProgressiveLightMap.html 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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/">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">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">WebGLRenderer</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"><code>renderer</code></td>
  42. <td class="description last"><p>The renderer.</p></td>
  43. </tr>
  44. <tr>
  45. <td class="name"><code>res</code></td>
  46. <td class="description last"><p>The side-long dimension of the total lightmap.<br/>Default is <code>1024</code>.</p></td>
  47. </tr>
  48. </tbody>
  49. </table>
  50. </div>
  51. </div>
  52. <h2 class="subsection-title">Properties</h2>
  53. <div class="member">
  54. <h3 class="name" id="renderer" translate="no">.<a href="#renderer">renderer</a><span class="type-signature"> : <a href="WebGLRenderer.html">WebGLRenderer</a></span> </h3>
  55. <div class="description">
  56. <p>The renderer.</p>
  57. </div>
  58. </div>
  59. <div class="member">
  60. <h3 class="name" id="res" translate="no">.<a href="#res">res</a><span class="type-signature"> : number</span> </h3>
  61. <div class="description">
  62. <p>The side-long dimension of the total lightmap.<br/>Default is <code>1024</code>.</p>
  63. </div>
  64. </div>
  65. <h2 class="subsection-title">Methods</h2>
  66. <h3 class="name name-method" id="addObjectsToLightMap" translate="no">.<a href="#addObjectsToLightMap">addObjectsToLightMap</a><span class="signature">( objects : <span class="param-type">Array.&lt;Object3D></span> )</span> </h3>
  67. <div class="method">
  68. <div class="description">
  69. <p>Sets these objects' materials' lightmaps and modifies their uv1's.</p>
  70. </div>
  71. <table class="params">
  72. <tbody>
  73. <tr>
  74. <td class="name"><code>objects</code></td>
  75. <td class="description last"><p>An array of objects and lights to set up your lightmap.</p></td>
  76. </tr>
  77. </tbody>
  78. </table>
  79. </div>
  80. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  81. <div class="method">
  82. <div class="description">
  83. <p>Frees all internal resources.</p>
  84. </div>
  85. </div>
  86. <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">Vector3</span> )</span> </h3>
  87. <div class="method">
  88. <div class="description">
  89. <p>Draws the lightmap in the main scene. Call this after adding the objects to it.</p>
  90. </div>
  91. <table class="params">
  92. <tbody>
  93. <tr>
  94. <td class="name"><code>visible</code></td>
  95. <td class="description last"><p>Whether the debug plane should be visible</p></td>
  96. </tr>
  97. <tr>
  98. <td class="name"><code>position</code></td>
  99. <td class="description last"><p>Where the debug plane should be drawn</p></td>
  100. </tr>
  101. </tbody>
  102. </table>
  103. </div>
  104. <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">( camera : <span class="param-type">Camera</span>, blendWindow : <span class="param-type">number</span>, blurEdges : <span class="param-type">boolean</span> )</span> </h3>
  105. <div class="method">
  106. <div class="description">
  107. <p>This function renders each mesh one at a time into their respective surface maps.</p>
  108. </div>
  109. <table class="params">
  110. <tbody>
  111. <tr>
  112. <td class="name"><code>camera</code></td>
  113. <td class="description last"><p>The camera the scene is rendered with.</p></td>
  114. </tr>
  115. <tr>
  116. <td class="name"><code>blendWindow</code></td>
  117. <td class="description last"><p>When &gt;1, samples will accumulate over time.<br/>Default is <code>100</code>.</p></td>
  118. </tr>
  119. <tr>
  120. <td class="name"><code>blurEdges</code></td>
  121. <td class="description last"><p>Whether to fix UV Edges via blurring.<br/>Default is <code>true</code>.</p></td>
  122. </tr>
  123. </tbody>
  124. </table>
  125. </div>
  126. <h2 class="subsection-title">Source</h2>
  127. <p>
  128. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/ProgressiveLightMap.js" target="_blank" rel="noopener" translate="no">examples/jsm/misc/ProgressiveLightMap.js</a>
  129. </p>
  130. </article>
  131. </section>
  132. <script src="../scripts/linenumber.js"></script>
  133. <script src="../scripts/page.js"></script>
  134. </body>
  135. </html>
粤ICP备19079148号