| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>ProgressiveLightMap - 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>
- <h1 translate="no">ProgressiveLightMap</h1>
- <section>
- <header>
- <div class="class-description"><p>Progressive Light Map Accumulator, by <a href="https://github.com/zalo/" target="_blank" rel="noopener">zalo</a>.</p>
- <p>To use, simply construct a <code>ProgressiveLightMap</code> object,
- <code>plmap.addObjectsToLightMap(object)</code> an array of semi-static
- objects and lights to the class once, and then call
- <code>plmap.update(camera)</code> every frame to begin accumulating
- lighting samples.</p>
- <p>This should begin accumulating lightmaps which apply to
- your objects, so you can start jittering lighting to achieve
- the texture-space effect you're looking for.</p>
- <p>This class can only be used with <a href="WebGLRenderer.html">WebGLRenderer</a>.
- When using <a href="WebGPURenderer.html">WebGPURenderer</a>, import from <code>ProgressiveLightMapGPU.js</code>.</p></div>
- </header>
- <article>
- <h2 class="subsection-title">Import</h2>
- <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>
- <pre><code class="language-js">import { ProgressiveLightMap } from 'three/addons/misc/ProgressiveLightMap.js';</code></pre>
- <div class="container-overview">
- <h2>Constructor</h2>
- <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>
- <div class="method">
- <div class="description">
- <p>Constructs a new progressive light map.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>renderer</strong>
- </td>
- <td class="description last">
- <p>The renderer.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>res</strong>
- </td>
- <td class="description last">
- <p>The side-long dimension of the total lightmap.</p>
- <p>Default is <code>1024</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="renderer" translate="no">.<a href="#renderer">renderer</a><span class="type-signature"> : <a href="WebGLRenderer.html">WebGLRenderer</a></span> </h3>
- <div class="description">
- <p>The renderer.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="res" translate="no">.<a href="#res">res</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>The side-long dimension of the total lightmap.</p>
- <p>Default is <code>1024</code>.</p>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <h3 class="name name-method" id="addObjectsToLightMap" translate="no">.<a href="#addObjectsToLightMap">addObjectsToLightMap</a><span class="signature">( objects : <span class="param-type">Array.<<a href="Object3D.html">Object3D</a>></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets these objects' materials' lightmaps and modifies their uv1's.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>objects</strong>
- </td>
- <td class="description last">
- <p>An array of objects and lights to set up your lightmap.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Frees all internal resources.</p>
- </div>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>Draws the lightmap in the main scene. Call this after adding the objects to it.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>visible</strong>
- </td>
- <td class="description last">
- <p>Whether the debug plane should be visible</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>position</strong>
- </td>
- <td class="description last">
- <p>Where the debug plane should be drawn</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <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>
- <div class="method">
- <div class="description">
- <p>This function renders each mesh one at a time into their respective surface maps.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>camera</strong>
- </td>
- <td class="description last">
- <p>The camera the scene is rendered with.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>blendWindow</strong>
- </td>
- <td class="description last">
- <p>When >1, samples will accumulate over time.</p>
- <p>Default is <code>100</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>blurEdges</strong>
- </td>
- <td class="description last">
- <p>Whether to fix UV Edges via blurring.</p>
- <p>Default is <code>true</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <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>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|