| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>LightShadow - 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">LightShadow</h1>
- <section>
- <header>
- <div class="class-description"><p>Abstract base class for light shadow classes. These classes
- represent the shadow configuration for different light types.</p></div>
- </header>
- <article>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="LightShadow" translate="no">new <a href="#LightShadow">LightShadow</a><span class="signature">( camera : <span class="param-type"><a href="Camera.html">Camera</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new light shadow.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>camera</strong>
- </td>
- <td class="description last">
- <p>The light's view of the world.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="autoUpdate" translate="no">.<a href="#autoUpdate">autoUpdate</a><span class="type-signature"> : boolean</span> </h3>
- <div class="description">
- <p>Enables automatic updates of the light's shadow. If you do not require dynamic
- lighting / shadows, you may set this to <code>false</code>.</p>
- <p>Default is <code>true</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="bias" translate="no">.<a href="#bias">bias</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>Shadow map bias, how much to add or subtract from the normalized depth
- when deciding whether a surface is in shadow.</p>
- <p>The default is <code>0</code>. Very tiny adjustments here (in the order of <code>0.0001</code>)
- may help reduce artifacts in shadows.</p>
- <p>Default is <code>0</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="blurSamples" translate="no">.<a href="#blurSamples">blurSamples</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>The amount of samples to use when blurring a VSM shadow map.</p>
- <p>Default is <code>8</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="camera" translate="no">.<a href="#camera">camera</a><span class="type-signature"> : <a href="Camera.html">Camera</a></span> </h3>
- <div class="description">
- <p>The light's view of the world.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="intensity" translate="no">.<a href="#intensity">intensity</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>The intensity of the shadow. The default is <code>1</code>.
- Valid values are in the range <code>[0, 1]</code>.</p>
- <p>Default is <code>1</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="map" translate="no">.<a href="#map">map</a><span class="type-signature"> : <a href="RenderTarget.html">RenderTarget</a></span> </h3>
- <div class="description">
- <p>The depth map generated using the internal camera; a location beyond a
- pixel's depth is in shadow. Computed internally during rendering.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="mapPass" translate="no">.<a href="#mapPass">mapPass</a><span class="type-signature"> : <a href="RenderTarget.html">RenderTarget</a></span> </h3>
- <div class="description">
- <p>The distribution map generated using the internal camera; an occlusion is
- calculated based on the distribution of depths. Computed internally during
- rendering.</p>
- <p>Default is <code>null</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="mapSize" translate="no">.<a href="#mapSize">mapSize</a><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
- <div class="description">
- <p>Defines the width and height of the shadow map. Higher values give better quality
- shadows at the cost of computation time. Values must be powers of two.</p>
- <p>Default is <code>(512,512)</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="mapType" translate="no">.<a href="#mapType">mapType</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>The type of shadow texture. The default is <code>UnsignedByteType</code>.</p>
- <p>Default is <code>UnsignedByteType</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="matrix" translate="no">.<a href="#matrix">matrix</a><span class="type-signature"> : <a href="Matrix4.html">Matrix4</a></span> </h3>
- <div class="description">
- <p>Model to shadow camera space, to compute location and depth in shadow map.
- This is computed internally during rendering.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="needsUpdate" translate="no">.<a href="#needsUpdate">needsUpdate</a><span class="type-signature"> : boolean</span> </h3>
- <div class="description">
- <p>When set to <code>true</code>, shadow maps will be updated in the next <code>render</code> call.
- If you have set <a href="LightShadow.html#autoUpdate">LightShadow#autoUpdate</a> to <code>false</code>, you will need to
- set this property to <code>true</code> and then make a render call to update the light's shadow.</p>
- <p>Default is <code>false</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="normalBias" translate="no">.<a href="#normalBias">normalBias</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>Defines how much the position used to query the shadow map is offset along
- the object normal. The default is <code>0</code>. Increasing this value can be used to
- reduce shadow acne especially in large scenes where light shines onto
- geometry at a shallow angle. The cost is that shadows may appear distorted.</p>
- <p>Default is <code>0</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="radius" translate="no">.<a href="#radius">radius</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>Setting this to values greater than 1 will blur the edges of the shadow.
- High values will cause unwanted banding effects in the shadows - a greater
- map size will allow for a higher value to be used here before these effects
- become visible.</p>
- <p>The property has no effect when the shadow map type is <code>BasicShadowMap</code>.</p>
- <p>Default is <code>1</code>.</p>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <h3 class="name name-method" id="clone" translate="no">.<a href="#clone">clone</a><span class="signature">()</span><span class="type-signature"> : <a href="LightShadow.html">LightShadow</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns a new light shadow instance with copied values from this instance.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A clone of this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="copy" translate="no">.<a href="#copy">copy</a><span class="signature">( source : <span class="param-type"><a href="LightShadow.html">LightShadow</a></span> )</span><span class="type-signature"> : <a href="LightShadow.html">LightShadow</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Copies the values of the given light shadow instance to this instance.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>source</strong>
- </td>
- <td class="description last">
- <p>The light shadow to copy.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this light shadow instance.</dt>
- </dl>
- </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 the GPU-related resources allocated by this instance. Call this
- method whenever this instance is no longer used in your app.</p>
- </div>
- </div>
- <h3 class="name name-method" id="getFrameExtents" translate="no">.<a href="#getFrameExtents">getFrameExtents</a><span class="signature">()</span><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns the frame extends.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The frame extends.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getFrustum" translate="no">.<a href="#getFrustum">getFrustum</a><span class="signature">()</span><span class="type-signature"> : <a href="Frustum.html">Frustum</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Gets the shadow cameras frustum. Used internally by the renderer to cull objects.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The shadow camera frustum.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getViewport" translate="no">.<a href="#getViewport">getViewport</a><span class="signature">( viewportIndex : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Vector4.html">Vector4</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns a viewport definition for the given viewport index.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>viewportIndex</strong>
- </td>
- <td class="description last">
- <p>The viewport index.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The viewport.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getViewportCount" translate="no">.<a href="#getViewportCount">getViewportCount</a><span class="signature">()</span><span class="type-signature"> : number</span> </h3>
- <div class="method">
- <div class="description">
- <p>Used internally by the renderer to get the number of viewports that need
- to be rendered for this shadow.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The viewport count.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="toJSON" translate="no">.<a href="#toJSON">toJSON</a><span class="signature">()</span><span class="type-signature"> : Object</span> </h3>
- <div class="method">
- <div class="description">
- <p>Serializes the light shadow into JSON.</p>
- </div>
- <dl class="details">
- <dt class="tag-see">See:</dt>
- <dd class="tag-see">
- <ul>
- <li><a href="ObjectLoader.html#parse">ObjectLoader#parse</a></li>
- </ul>
- </dd>
- </dl>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A JSON object representing the serialized light shadow.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="updateMatrices" translate="no">.<a href="#updateMatrices">updateMatrices</a><span class="signature">( light : <span class="param-type"><a href="Light.html">Light</a></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Update the matrices for the camera and shadow, used internally by the renderer.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>light</strong>
- </td>
- <td class="description last">
- <p>The light for which the shadow is being rendered.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/src/lights/LightShadow.js" translate="no" target="_blank" rel="noopener">src/lights/LightShadow.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|