|
|
@@ -1835,7 +1835,7 @@ function probeAsync( gl, sync, interval ) {
|
|
|
/**
|
|
|
* This modules allows to dispatch event objects on custom JavaScript objects.
|
|
|
*
|
|
|
- * Main repository: [eventdispatcher.js]{@link https://github.com/mrdoob/eventdispatcher.js/}
|
|
|
+ * Main repository: [eventdispatcher.js](https://github.com/mrdoob/eventdispatcher.js/)
|
|
|
*
|
|
|
* Code Example:
|
|
|
* ```js
|
|
|
@@ -1970,7 +1970,7 @@ const DEG2RAD = Math.PI / 180;
|
|
|
const RAD2DEG = 180 / Math.PI;
|
|
|
|
|
|
/**
|
|
|
- * Generate a [UUID]{@link https://en.wikipedia.org/wiki/Universally_unique_identifier}
|
|
|
+ * Generate a [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier)
|
|
|
* (universally unique identifier).
|
|
|
*
|
|
|
* @return {string} The UUID.
|
|
|
@@ -2083,7 +2083,7 @@ function lerp( x, y, t ) {
|
|
|
/**
|
|
|
* Smoothly interpolate a number from `x` to `y` in a spring-like manner using a delta
|
|
|
* time to maintain frame rate independent movement. For details, see
|
|
|
- * [Frame rate independent damping using lerp]{@link http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/}.
|
|
|
+ * [Frame rate independent damping using lerp](http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/).
|
|
|
*
|
|
|
* @param {number} x - The current point.
|
|
|
* @param {number} y - The target point.
|
|
|
@@ -2118,7 +2118,7 @@ function pingpong( x, length = 1 ) {
|
|
|
* moved between `min` and `max`, but smoothed or slowed down the closer `x` is to
|
|
|
* the `min` and `max`.
|
|
|
*
|
|
|
- * See [Smoothstep]{@link http://en.wikipedia.org/wiki/Smoothstep} for more details.
|
|
|
+ * See [Smoothstep](http://en.wikipedia.org/wiki/Smoothstep) for more details.
|
|
|
*
|
|
|
* @param {number} x - The value to evaluate based on its position between min and max.
|
|
|
* @param {number} min - The min value. Any x value below min will be `0`.
|
|
|
@@ -2137,7 +2137,7 @@ function smoothstep( x, min, max ) {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * A [variation on smoothstep]{@link https://en.wikipedia.org/wiki/Smoothstep#Variations}
|
|
|
+ * A [variation on smoothstep](https://en.wikipedia.org/wiki/Smoothstep#Variations)
|
|
|
* that has zero 1st and 2nd order derivatives at x=0 and x=1.
|
|
|
*
|
|
|
* @param {number} x - The value to evaluate based on its position between min and max.
|
|
|
@@ -2277,7 +2277,7 @@ function floorPowerOfTwo( value ) {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Sets the given quaternion from the [Intrinsic Proper Euler Angles]{@link https://en.wikipedia.org/wiki/Euler_angles}
|
|
|
+ * Sets the given quaternion from the [Intrinsic Proper Euler Angles](https://en.wikipedia.org/wiki/Euler_angles)
|
|
|
* defined by the given angles and order.
|
|
|
*
|
|
|
* Rotations are applied to the axes in the order specified by order:
|
|
|
@@ -2442,7 +2442,7 @@ const MathUtils = {
|
|
|
DEG2RAD: DEG2RAD,
|
|
|
RAD2DEG: RAD2DEG,
|
|
|
/**
|
|
|
- * Generate a [UUID]{@link https://en.wikipedia.org/wiki/Universally_unique_identifier}
|
|
|
+ * Generate a [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier)
|
|
|
* (universally unique identifier).
|
|
|
*
|
|
|
* @static
|
|
|
@@ -2513,7 +2513,7 @@ const MathUtils = {
|
|
|
/**
|
|
|
* Smoothly interpolate a number from `x` to `y` in a spring-like manner using a delta
|
|
|
* time to maintain frame rate independent movement. For details, see
|
|
|
- * [Frame rate independent damping using lerp]{@link http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/}.
|
|
|
+ * [Frame rate independent damping using lerp](http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/).
|
|
|
*
|
|
|
* @static
|
|
|
* @method
|
|
|
@@ -2540,7 +2540,7 @@ const MathUtils = {
|
|
|
* moved between `min` and `max`, but smoothed or slowed down the closer `x` is to
|
|
|
* the `min` and `max`.
|
|
|
*
|
|
|
- * See [Smoothstep]{@link http://en.wikipedia.org/wiki/Smoothstep} for more details.
|
|
|
+ * See [Smoothstep](http://en.wikipedia.org/wiki/Smoothstep) for more details.
|
|
|
*
|
|
|
* @static
|
|
|
* @method
|
|
|
@@ -2551,7 +2551,7 @@ const MathUtils = {
|
|
|
*/
|
|
|
smoothstep: smoothstep,
|
|
|
/**
|
|
|
- * A [variation on smoothstep]{@link https://en.wikipedia.org/wiki/Smoothstep#Variations}
|
|
|
+ * A [variation on smoothstep](https://en.wikipedia.org/wiki/Smoothstep#Variations)
|
|
|
* that has zero 1st and 2nd order derivatives at x=0 and x=1.
|
|
|
*
|
|
|
* @static
|
|
|
@@ -2646,7 +2646,7 @@ const MathUtils = {
|
|
|
*/
|
|
|
floorPowerOfTwo: floorPowerOfTwo,
|
|
|
/**
|
|
|
- * Sets the given quaternion from the [Intrinsic Proper Euler Angles]{@link https://en.wikipedia.org/wiki/Euler_angles}
|
|
|
+ * Sets the given quaternion from the [Intrinsic Proper Euler Angles](https://en.wikipedia.org/wiki/Euler_angles)
|
|
|
* defined by the given angles and order.
|
|
|
*
|
|
|
* Rotations are applied to the axes in the order specified by order:
|
|
|
@@ -5749,7 +5749,7 @@ const _quaternion$4 = /*@__PURE__*/ new Quaternion();
|
|
|
* A Note on Row-Major and Column-Major Ordering:
|
|
|
*
|
|
|
* The constructor and {@link Matrix3#set} method take arguments in
|
|
|
- * [row-major]{@link https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order}
|
|
|
+ * [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order)
|
|
|
* order, while internally they are stored in the {@link Matrix3#elements} array in column-major order.
|
|
|
* This means that calling:
|
|
|
* ```js
|
|
|
@@ -6023,7 +6023,7 @@ class Matrix3 {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Inverts this matrix, using the [analytic method]{@link https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution}.
|
|
|
+ * Inverts this matrix, using the [analytic method](https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution).
|
|
|
* You can not invert with a determinant of zero. If you attempt this, the method produces
|
|
|
* a zero matrix instead.
|
|
|
*
|
|
|
@@ -11382,7 +11382,7 @@ class Ray {
|
|
|
* Represents a 4x4 matrix.
|
|
|
*
|
|
|
* The most common use of a 4x4 matrix in 3D computer graphics is as a transformation matrix.
|
|
|
- * For an introduction to transformation matrices as used in WebGL, check out [this tutorial]{@link https://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices}
|
|
|
+ * For an introduction to transformation matrices as used in WebGL, check out [this tutorial](https://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices)
|
|
|
*
|
|
|
* This allows a 3D vector representing a point in 3D space to undergo
|
|
|
* transformations such as translation, rotation, shear, scale, reflection,
|
|
|
@@ -11392,7 +11392,7 @@ class Ray {
|
|
|
* A Note on Row-Major and Column-Major Ordering:
|
|
|
*
|
|
|
* The constructor and {@link Matrix3#set} method take arguments in
|
|
|
- * [row-major]{@link https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order}
|
|
|
+ * [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order)
|
|
|
* order, while internally they are stored in the {@link Matrix3#elements} array in column-major order.
|
|
|
* This means that calling:
|
|
|
* ```js
|
|
|
@@ -11686,7 +11686,7 @@ class Matrix4 {
|
|
|
* Sets the rotation component (the upper left 3x3 matrix) of this matrix to
|
|
|
* the rotation specified by the given Euler angles. The rest of
|
|
|
* the matrix is set to the identity. Depending on the {@link Euler#order},
|
|
|
- * there are six possible outcomes. See [this page]{@link https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix}
|
|
|
+ * there are six possible outcomes. See [this page](https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix)
|
|
|
* for a complete list.
|
|
|
*
|
|
|
* @param {Euler} euler - The Euler angles.
|
|
|
@@ -11816,7 +11816,7 @@ class Matrix4 {
|
|
|
|
|
|
/**
|
|
|
* Sets the rotation component of this matrix to the rotation specified by
|
|
|
- * the given Quaternion as outlined [here]{@link https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion}
|
|
|
+ * the given Quaternion as outlined [here](https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion)
|
|
|
* The rest of the matrix is set to the identity.
|
|
|
*
|
|
|
* @param {Quaternion} q - The Quaternion.
|
|
|
@@ -11978,7 +11978,7 @@ class Matrix4 {
|
|
|
/**
|
|
|
* Computes and returns the determinant of this matrix.
|
|
|
*
|
|
|
- * Based on the method outlined [here]{@link http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.html}.
|
|
|
+ * Based on the method outlined [here](http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.html).
|
|
|
*
|
|
|
* @return {number} The determinant.
|
|
|
*/
|
|
|
@@ -12085,7 +12085,7 @@ class Matrix4 {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Inverts this matrix, using the [analytic method]{@link https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution}.
|
|
|
+ * Inverts this matrix, using the [analytic method](https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution).
|
|
|
* You can not invert with a determinant of zero. If you attempt this, the method produces
|
|
|
* a zero matrix instead.
|
|
|
*
|
|
|
@@ -12288,7 +12288,7 @@ class Matrix4 {
|
|
|
* the given angle.
|
|
|
*
|
|
|
* This is a somewhat controversial but mathematically sound alternative to
|
|
|
- * rotating via Quaternions. See the discussion [here]{@link https://www.gamedev.net/articles/programming/math-and-physics/do-we-really-need-quaternions-r1199}.
|
|
|
+ * rotating via Quaternions. See the discussion [here](https://www.gamedev.net/articles/programming/math-and-physics/do-we-really-need-quaternions-r1199).
|
|
|
*
|
|
|
* @param {Vector3} axis - The normalized rotation axis.
|
|
|
* @param {number} angle - The rotation in radians.
|
|
|
@@ -15653,7 +15653,7 @@ class Color {
|
|
|
/**
|
|
|
* Sets this color from a CSS-style string. For example, `rgb(250, 0,0)`,
|
|
|
* `rgb(100%, 0%, 0%)`, `hsl(0, 100%, 50%)`, `#ff0000`, `#f00`, or `red` ( or
|
|
|
- * any [X11 color name]{@link https://en.wikipedia.org/wiki/X11_color_names#Color_name_chart} -
|
|
|
+ * any [X11 color name](https://en.wikipedia.org/wiki/X11_color_names#Color_name_chart) -
|
|
|
* all 140 color names are supported).
|
|
|
*
|
|
|
* @param {string} style - Color as a CSS-style string.
|
|
|
@@ -16860,7 +16860,7 @@ class Material extends EventDispatcher {
|
|
|
*
|
|
|
* This method can only be used when rendering with {@link WebGLRenderer}. The
|
|
|
* recommended approach when customizing materials is to use `WebGPURenderer` with the new
|
|
|
- * Node Material system and [TSL]{@link https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language}.
|
|
|
+ * Node Material system and [TSL](https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language).
|
|
|
*
|
|
|
* @param {{vertexShader:string,fragmentShader:string,uniforms:Object}} shaderobject - The object holds the uniforms and the vertex and fragment shader source.
|
|
|
* @param {WebGLRenderer} renderer - A reference to the renderer.
|
|
|
@@ -21102,7 +21102,7 @@ var default_fragment = "void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0
|
|
|
* - You can use the directive `#pragma unroll_loop_start` and `#pragma unroll_loop_end`
|
|
|
* in order to unroll a `for` loop in GLSL by the shader preprocessor. The directive has
|
|
|
* to be placed right above the loop. The loop formatting has to correspond to a defined standard.
|
|
|
- * - The loop has to be [normalized]{@link https://en.wikipedia.org/wiki/Normalized_loop}.
|
|
|
+ * - The loop has to be [normalized](https://en.wikipedia.org/wiki/Normalized_loop).
|
|
|
* - The loop variable has to be *i*.
|
|
|
* - The value `UNROLLED_LOOP_INDEX` will be replaced with the explicitly
|
|
|
* value of *i* for the given iteration and can be used in preprocessor
|
|
|
@@ -21308,7 +21308,7 @@ class ShaderMaterial extends Material {
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
- * If set, this calls [gl.bindAttribLocation]{@link https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bindAttribLocation}
|
|
|
+ * If set, this calls [gl.bindAttribLocation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bindAttribLocation)
|
|
|
* to bind a generic vertex index to an attribute variable.
|
|
|
*
|
|
|
* @type {string|undefined}
|
|
|
@@ -21595,7 +21595,7 @@ const _minTarget = /*@__PURE__*/ new Vector2();
|
|
|
const _maxTarget = /*@__PURE__*/ new Vector2();
|
|
|
|
|
|
/**
|
|
|
- * Camera that uses [perspective projection]{@link https://en.wikipedia.org/wiki/Perspective_(graphical)}.
|
|
|
+ * Camera that uses [perspective projection](https://en.wikipedia.org/wiki/Perspective_(graphical)).
|
|
|
*
|
|
|
* This projection mode is designed to mimic the way the human eye sees. It
|
|
|
* is the most common projection mode used for rendering a 3D scene.
|
|
|
@@ -23278,7 +23278,7 @@ class Scene extends Object3D {
|
|
|
* "Interleaved" means that multiple attributes, possibly of different types,
|
|
|
* (e.g., position, normal, uv, color) are packed into a single array buffer.
|
|
|
*
|
|
|
- * An introduction into interleaved arrays can be found here: [Interleaved array basics]{@link https://blog.tojicode.com/2011/05/interleaved-array-basics.html}
|
|
|
+ * An introduction into interleaved arrays can be found here: [Interleaved array basics](https://blog.tojicode.com/2011/05/interleaved-array-basics.html)
|
|
|
*/
|
|
|
class InterleavedBuffer {
|
|
|
|
|
|
@@ -26084,7 +26084,7 @@ const _normalMatrix = /*@__PURE__*/ new Matrix3();
|
|
|
|
|
|
/**
|
|
|
* A two dimensional surface that extends infinitely in 3D space, represented
|
|
|
- * in [Hessian normal form]{@link http://mathworld.wolfram.com/HessianNormalForm.html}
|
|
|
+ * in [Hessian normal form](http://mathworld.wolfram.com/HessianNormalForm.html)
|
|
|
* by a unit length normal vector and a constant.
|
|
|
*/
|
|
|
class Plane {
|
|
|
@@ -29235,7 +29235,7 @@ class PointsMaterial extends Material {
|
|
|
/**
|
|
|
* Defines the size of the points in pixels.
|
|
|
*
|
|
|
- * Might be capped if the value exceeds hardware dependent parameters like [gl.ALIASED_POINT_SIZE_RANGE]{@link https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getParamete}.
|
|
|
+ * Might be capped if the value exceeds hardware dependent parameters like [gl.ALIASED_POINT_SIZE_RANGE](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getParamete).
|
|
|
*
|
|
|
* @type {number}
|
|
|
* @default 1
|
|
|
@@ -38128,9 +38128,9 @@ class RawShaderMaterial extends ShaderMaterial {
|
|
|
* A standard physically based material, using Metallic-Roughness workflow.
|
|
|
*
|
|
|
* Physically based rendering (PBR) has recently become the standard in many
|
|
|
- * 3D applications, such as [Unity]{@link https://blogs.unity3d.com/2014/10/29/physically-based-shading-in-unity-5-a-primer/},
|
|
|
- * [Unreal]{@link https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/PhysicallyBased/} and
|
|
|
- * [3D Studio Max]{@link http://area.autodesk.com/blogs/the-3ds-max-blog/what039s-new-for-rendering-in-3ds-max-2017}.
|
|
|
+ * 3D applications, such as [Unity](https://blogs.unity3d.com/2014/10/29/physically-based-shading-in-unity-5-a-primer/),
|
|
|
+ * [Unreal](https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/PhysicallyBased/) and
|
|
|
+ * [3D Studio Max](http://area.autodesk.com/blogs/the-3ds-max-blog/what039s-new-for-rendering-in-3ds-max-2017).
|
|
|
*
|
|
|
* This approach differs from older approaches in that instead of using
|
|
|
* approximations for the way in which light interacts with a surface, a
|
|
|
@@ -38146,13 +38146,13 @@ class RawShaderMaterial extends ShaderMaterial {
|
|
|
* Note that for best results you should always specify an environment map when using this material.
|
|
|
*
|
|
|
* For a non-technical introduction to the concept of PBR and how to set up a
|
|
|
- * PBR material, check out these articles by the people at [marmoset]{@link https://www.marmoset.co}:
|
|
|
+ * PBR material, check out these articles by the people at [marmoset](https://www.marmoset.co):
|
|
|
*
|
|
|
- * - [Basic Theory of Physically Based Rendering]{@link https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/}
|
|
|
- * - [Physically Based Rendering and You Can Too]{@link https://www.marmoset.co/posts/physically-based-rendering-and-you-can-too/}
|
|
|
+ * - [Basic Theory of Physically Based Rendering](https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/)
|
|
|
+ * - [Physically Based Rendering and You Can Too](https://www.marmoset.co/posts/physically-based-rendering-and-you-can-too/)
|
|
|
*
|
|
|
* Technical details of the approach used in three.js (and most other PBR systems) can be found is this
|
|
|
- * [paper from Disney]{@link https://media.disneyanimation.com/uploads/production/publication_asset/48/asset/s2012_pbs_disney_brdf_notes_v3.pdf}
|
|
|
+ * [paper from Disney](https://media.disneyanimation.com/uploads/production/publication_asset/48/asset/s2012_pbs_disney_brdf_notes_v3.pdf)
|
|
|
* (pdf), by Brent Burley.
|
|
|
*
|
|
|
* @augments Material
|
|
|
@@ -39075,7 +39075,7 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
/**
|
|
|
* A material for shiny surfaces with specular highlights.
|
|
|
*
|
|
|
- * The material uses a non-physically based [Blinn-Phong]{@link https://en.wikipedia.org/wiki/Blinn-Phong_shading_model}
|
|
|
+ * The material uses a non-physically based [Blinn-Phong](https://en.wikipedia.org/wiki/Blinn-Phong_shading_model)
|
|
|
* model for calculating reflectance. Unlike the Lambertian model used in the
|
|
|
* {@link MeshLambertMaterial} this can simulate shiny surfaces with specular
|
|
|
* highlights (such as varnished wood). `MeshPhongMaterial` uses per-fragment shading.
|
|
|
@@ -39965,7 +39965,7 @@ class MeshNormalMaterial extends Material {
|
|
|
/**
|
|
|
* A material for non-shiny surfaces, without specular highlights.
|
|
|
*
|
|
|
- * The material uses a non-physically based [Lambertian]{@link https://en.wikipedia.org/wiki/Lambertian_reflectance}
|
|
|
+ * The material uses a non-physically based [Lambertian](https://en.wikipedia.org/wiki/Lambertian_reflectance)
|
|
|
* model for calculating reflectance. This can simulate some surfaces (such
|
|
|
* as untreated wood or stone) well, but cannot simulate shiny surfaces with
|
|
|
* specular highlights (such as varnished wood). `MeshLambertMaterial` uses per-fragment
|
|
|
@@ -43904,7 +43904,7 @@ class Loader {
|
|
|
this.resourcePath = '';
|
|
|
|
|
|
/**
|
|
|
- * The [request header]{@link https://developer.mozilla.org/en-US/docs/Glossary/Request_header}
|
|
|
+ * The [request header](https://developer.mozilla.org/en-US/docs/Glossary/Request_header)
|
|
|
* used in HTTP request.
|
|
|
*
|
|
|
* @type {Object<string, any>}
|
|
|
@@ -43969,7 +43969,7 @@ class Loader {
|
|
|
|
|
|
/**
|
|
|
* Whether the XMLHttpRequest uses credentials such as cookies, authorization
|
|
|
- * headers or TLS client certificates, see [XMLHttpRequest.withCredentials]{@link https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials}.
|
|
|
+ * headers or TLS client certificates, see [XMLHttpRequest.withCredentials](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials).
|
|
|
*
|
|
|
* Note: This setting has no effect if you are loading files locally or from the same domain.
|
|
|
*
|
|
|
@@ -44012,7 +44012,7 @@ class Loader {
|
|
|
/**
|
|
|
* Sets the given request header.
|
|
|
*
|
|
|
- * @param {Object} requestHeader - A [request header]{@link https://developer.mozilla.org/en-US/docs/Glossary/Request_header}
|
|
|
+ * @param {Object} requestHeader - A [request header](https://developer.mozilla.org/en-US/docs/Glossary/Request_header)
|
|
|
* for configuring the HTTP request.
|
|
|
* @return {Loader} A reference to this instance.
|
|
|
*/
|
|
|
@@ -44104,7 +44104,7 @@ class FileLoader extends Loader {
|
|
|
|
|
|
/**
|
|
|
* The expected mime type. Valid values can be found
|
|
|
- * [here]{@link hhttps://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#mimetype}
|
|
|
+ * [here](hhttps://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#mimetype)
|
|
|
*
|
|
|
* @type {string}
|
|
|
*/
|
|
|
@@ -44675,7 +44675,7 @@ const _loading = new WeakMap();
|
|
|
* ```
|
|
|
* Please note that `ImageLoader` has dropped support for progress
|
|
|
* events in `r84`. For an `ImageLoader` that supports progress events, see
|
|
|
- * [this thread]{@link https://github.com/mrdoob/three.js/issues/10439#issuecomment-275785639}.
|
|
|
+ * [this thread](https://github.com/mrdoob/three.js/issues/10439#issuecomment-275785639).
|
|
|
*
|
|
|
* @augments Loader
|
|
|
*/
|
|
|
@@ -45079,7 +45079,7 @@ class DataTextureLoader extends Loader {
|
|
|
* ```
|
|
|
* Please note that `TextureLoader` has dropped support for progress
|
|
|
* events in `r84`. For a `TextureLoader` that supports progress events, see
|
|
|
- * [this thread]{@link https://github.com/mrdoob/three.js/issues/10439#issuecomment-293260145}.
|
|
|
+ * [this thread](https://github.com/mrdoob/three.js/issues/10439#issuecomment-293260145).
|
|
|
*
|
|
|
* @augments Loader
|
|
|
*/
|
|
|
@@ -46082,7 +46082,7 @@ class PointLight extends Light {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Camera that uses [orthographic projection]{@link https://en.wikipedia.org/wiki/Orthographic_projection}.
|
|
|
+ * Camera that uses [orthographic projection](https://en.wikipedia.org/wiki/Orthographic_projection).
|
|
|
*
|
|
|
* In this projection mode, an object's size in the rendered image stays
|
|
|
* constant regardless of its distance from the camera. This can be useful
|
|
|
@@ -47773,7 +47773,7 @@ class BufferGeometryLoader extends Loader {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * A loader for loading a JSON resource in the [JSON Object/Scene format]{@link https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4}.
|
|
|
+ * A loader for loading a JSON resource in the [JSON Object/Scene format](https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4).
|
|
|
* The files are internally loaded via {@link FileLoader}.
|
|
|
*
|
|
|
* ```js
|
|
|
@@ -48973,7 +48973,7 @@ const TEXTURE_FILTER = {
|
|
|
const _errorMap = new WeakMap();
|
|
|
|
|
|
/**
|
|
|
- * A loader for loading images as an [ImageBitmap]{@link https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap}.
|
|
|
+ * A loader for loading images as an [ImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap).
|
|
|
* An `ImageBitmap` provides an asynchronous and resource efficient pathway to prepare
|
|
|
* textures for rendering.
|
|
|
*
|
|
|
@@ -49047,7 +49047,7 @@ class ImageBitmapLoader extends Loader {
|
|
|
|
|
|
/**
|
|
|
* Sets the given loader options. The structure of the object must match the `options` parameter of
|
|
|
- * [createImageBitmap]{@link https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap}.
|
|
|
+ * [createImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap).
|
|
|
*
|
|
|
* @param {Object} options - The loader options to set.
|
|
|
* @return {ImageBitmapLoader} A reference to this image bitmap loader.
|
|
|
@@ -49322,8 +49322,8 @@ const _projectionMatrix = /*@__PURE__*/ new Matrix4();
|
|
|
/**
|
|
|
* A special type of camera that uses two perspective cameras with
|
|
|
* stereoscopic projection. Can be used for rendering stereo effects
|
|
|
- * like [3D Anaglyph]{@link https://en.wikipedia.org/wiki/Anaglyph_3D} or
|
|
|
- * [Parallax Barrier]{@link https://en.wikipedia.org/wiki/parallax_barrier}.
|
|
|
+ * like [3D Anaglyph](https://en.wikipedia.org/wiki/Anaglyph_3D) or
|
|
|
+ * [Parallax Barrier](https://en.wikipedia.org/wiki/parallax_barrier).
|
|
|
*/
|
|
|
class StereoCamera {
|
|
|
|
|
|
@@ -49846,7 +49846,7 @@ class AudioListener extends Object3D {
|
|
|
/**
|
|
|
* Represents a non-positional ( global ) audio object.
|
|
|
*
|
|
|
- * This and related audio modules make use of the [Web Audio API]{@link https://www.w3.org/TR/webaudio-1.1/}.
|
|
|
+ * This and related audio modules make use of the [Web Audio API](https://www.w3.org/TR/webaudio-1.1/).
|
|
|
*
|
|
|
* ```js
|
|
|
* // create an AudioListener and add it to the camera
|
|
|
@@ -50769,7 +50769,7 @@ class PositionalAudio extends Audio {
|
|
|
* Defines which algorithm to use to reduce the volume of the audio source
|
|
|
* as it moves away from the listener.
|
|
|
*
|
|
|
- * Read [the spec]{@link https://www.w3.org/TR/webaudio-1.1/#enumdef-distancemodeltype}
|
|
|
+ * Read [the spec](https://www.w3.org/TR/webaudio-1.1/#enumdef-distancemodeltype)
|
|
|
* for more details.
|
|
|
*
|
|
|
* @param {('linear'|'inverse'|'exponential')} value - The distance model to set.
|
|
|
@@ -55259,7 +55259,7 @@ function handleVisibilityChange() {
|
|
|
|
|
|
/**
|
|
|
* This class can be used to represent points in 3D space as
|
|
|
- * [Spherical coordinates]{@link https://en.wikipedia.org/wiki/Spherical_coordinate_system}.
|
|
|
+ * [Spherical coordinates](https://en.wikipedia.org/wiki/Spherical_coordinate_system).
|
|
|
*/
|
|
|
class Spherical {
|
|
|
|
|
|
@@ -55403,7 +55403,7 @@ class Spherical {
|
|
|
|
|
|
/**
|
|
|
* This class can be used to represent points in 3D space as
|
|
|
- * [Cylindrical coordinates]{@link https://en.wikipedia.org/wiki/Cylindrical_coordinate_system}.
|
|
|
+ * [Cylindrical coordinates](https://en.wikipedia.org/wiki/Cylindrical_coordinate_system).
|
|
|
*/
|
|
|
class Cylindrical {
|
|
|
|
|
|
@@ -55526,7 +55526,7 @@ class Cylindrical {
|
|
|
* A Note on Row-Major and Column-Major Ordering:
|
|
|
*
|
|
|
* The constructor and {@link Matrix2#set} method take arguments in
|
|
|
- * [row-major]{@link https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order}
|
|
|
+ * [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order)
|
|
|
* order, while internally they are stored in the {@link Matrix2#elements} array in column-major order.
|
|
|
* This means that calling:
|
|
|
* ```js
|
|
|
@@ -57262,7 +57262,7 @@ const _camera = /*@__PURE__*/ new Camera();
|
|
|
* This helps with visualizing what a camera contains in its frustum. It
|
|
|
* visualizes the frustum of a camera using a line segments.
|
|
|
*
|
|
|
- * Based on frustum visualization in [lightgl.js shadowmap example]{@link https://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html}.
|
|
|
+ * Based on frustum visualization in [lightgl.js shadowmap example](https://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html).
|
|
|
*
|
|
|
* `CameraHelper` must be a child of the scene.
|
|
|
*
|
|
|
@@ -61590,16 +61590,18 @@ function WebGLCubeMaps( renderer ) {
|
|
|
|
|
|
const LOD_MIN = 4;
|
|
|
|
|
|
-// The standard deviations (radians) associated with the extra mips. These are
|
|
|
-// chosen to approximate a Trowbridge-Reitz distribution function times the
|
|
|
-// geometric shadowing function. These sigma values squared must match the
|
|
|
-// variance #defines in cube_uv_reflection_fragment.glsl.js.
|
|
|
+// The standard deviations (radians) associated with the extra mips.
|
|
|
+// Used for scene blur in fromScene() method.
|
|
|
const EXTRA_LOD_SIGMA = [ 0.125, 0.215, 0.35, 0.446, 0.526, 0.582 ];
|
|
|
|
|
|
// The maximum length of the blur for loop. Smaller sigmas will use fewer
|
|
|
// samples and exit early, but not recompile the shader.
|
|
|
+// Used for scene blur in fromScene() method.
|
|
|
const MAX_SAMPLES = 20;
|
|
|
|
|
|
+// GGX VNDF importance sampling configuration
|
|
|
+const GGX_SAMPLES = 2048;
|
|
|
+
|
|
|
const _flatCamera = /*@__PURE__*/ new OrthographicCamera();
|
|
|
const _clearColor = /*@__PURE__*/ new Color();
|
|
|
let _oldTarget = null;
|
|
|
@@ -61607,24 +61609,6 @@ let _oldActiveCubeFace = 0;
|
|
|
let _oldActiveMipmapLevel = 0;
|
|
|
let _oldXrEnabled = false;
|
|
|
|
|
|
-// Golden Ratio
|
|
|
-const PHI = ( 1 + Math.sqrt( 5 ) ) / 2;
|
|
|
-const INV_PHI = 1 / PHI;
|
|
|
-
|
|
|
-// Vertices of a dodecahedron (except the opposites, which represent the
|
|
|
-// same axis), used as axis directions evenly spread on a sphere.
|
|
|
-const _axisDirections = [
|
|
|
- /*@__PURE__*/ new Vector3( - PHI, INV_PHI, 0 ),
|
|
|
- /*@__PURE__*/ new Vector3( PHI, INV_PHI, 0 ),
|
|
|
- /*@__PURE__*/ new Vector3( - INV_PHI, 0, PHI ),
|
|
|
- /*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),
|
|
|
- /*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),
|
|
|
- /*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),
|
|
|
- /*@__PURE__*/ new Vector3( -1, 1, -1 ),
|
|
|
- /*@__PURE__*/ new Vector3( 1, 1, -1 ),
|
|
|
- /*@__PURE__*/ new Vector3( -1, 1, 1 ),
|
|
|
- /*@__PURE__*/ new Vector3( 1, 1, 1 ) ];
|
|
|
-
|
|
|
const _origin = /*@__PURE__*/ new Vector3();
|
|
|
|
|
|
/**
|
|
|
@@ -61638,8 +61622,9 @@ const _origin = /*@__PURE__*/ new Vector3();
|
|
|
* higher roughness levels. In this way we maintain resolution to smoothly
|
|
|
* interpolate diffuse lighting while limiting sampling computation.
|
|
|
*
|
|
|
- * Paper: Fast, Accurate Image-Based Lighting:
|
|
|
- * {@link https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view}
|
|
|
+ * The prefiltering uses GGX VNDF (Visible Normal Distribution Function)
|
|
|
+ * importance sampling to generate environment maps that accurately represent
|
|
|
+ * the material's BRDF for image-based lighting.
|
|
|
*/
|
|
|
class PMREMGenerator {
|
|
|
|
|
|
@@ -61660,6 +61645,7 @@ class PMREMGenerator {
|
|
|
this._sigmas = [];
|
|
|
|
|
|
this._blurMaterial = null;
|
|
|
+ this._ggxMaterial = null;
|
|
|
this._cubemapMaterial = null;
|
|
|
this._equirectMaterial = null;
|
|
|
|
|
|
@@ -61802,6 +61788,7 @@ class PMREMGenerator {
|
|
|
_dispose() {
|
|
|
|
|
|
if ( this._blurMaterial !== null ) this._blurMaterial.dispose();
|
|
|
+ if ( this._ggxMaterial !== null ) this._ggxMaterial.dispose();
|
|
|
|
|
|
if ( this._pingPongRenderTarget !== null ) this._pingPongRenderTarget.dispose();
|
|
|
|
|
|
@@ -62051,17 +62038,77 @@ class PMREMGenerator {
|
|
|
renderer.autoClear = false;
|
|
|
const n = this._lodPlanes.length;
|
|
|
|
|
|
+ // Use GGX VNDF importance sampling
|
|
|
for ( let i = 1; i < n; i ++ ) {
|
|
|
|
|
|
- const sigma = Math.sqrt( this._sigmas[ i ] * this._sigmas[ i ] - this._sigmas[ i - 1 ] * this._sigmas[ i - 1 ] );
|
|
|
+ this._applyGGXFilter( cubeUVRenderTarget, i - 1, i );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ renderer.autoClear = autoClear;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Applies GGX VNDF importance sampling filter to generate a prefiltered environment map.
|
|
|
+ * Uses Monte Carlo integration with VNDF importance sampling to accurately represent the
|
|
|
+ * GGX BRDF for physically-based rendering. Reads from the previous LOD level and
|
|
|
+ * applies incremental roughness filtering to avoid over-blurring.
|
|
|
+ *
|
|
|
+ * @private
|
|
|
+ * @param {WebGLRenderTarget} cubeUVRenderTarget
|
|
|
+ * @param {number} lodIn - Source LOD level to read from
|
|
|
+ * @param {number} lodOut - Target LOD level to write to
|
|
|
+ */
|
|
|
+ _applyGGXFilter( cubeUVRenderTarget, lodIn, lodOut ) {
|
|
|
+
|
|
|
+ const renderer = this._renderer;
|
|
|
+ const pingPongRenderTarget = this._pingPongRenderTarget;
|
|
|
|
|
|
- const poleAxis = _axisDirections[ ( n - i - 1 ) % _axisDirections.length ];
|
|
|
+ if ( this._ggxMaterial === null ) {
|
|
|
|
|
|
- this._blur( cubeUVRenderTarget, i - 1, i, sigma, poleAxis );
|
|
|
+ const width = 3 * Math.max( this._cubeSize, 16 );
|
|
|
+ const height = 4 * this._cubeSize;
|
|
|
+ this._ggxMaterial = _getGGXShader( this._lodMax, width, height );
|
|
|
|
|
|
}
|
|
|
|
|
|
- renderer.autoClear = autoClear;
|
|
|
+ const ggxMaterial = this._ggxMaterial;
|
|
|
+ const ggxMesh = new Mesh( this._lodPlanes[ lodOut ], ggxMaterial );
|
|
|
+ const ggxUniforms = ggxMaterial.uniforms;
|
|
|
+
|
|
|
+ // Calculate incremental roughness between LOD levels
|
|
|
+ const targetRoughness = lodOut / ( this._lodPlanes.length - 1 );
|
|
|
+ const sourceRoughness = lodIn / ( this._lodPlanes.length - 1 );
|
|
|
+ const incrementalRoughness = Math.sqrt( targetRoughness * targetRoughness - sourceRoughness * sourceRoughness );
|
|
|
+
|
|
|
+ // Apply blur strength mapping for better quality across the roughness range
|
|
|
+ const blurStrength = 0.05 + targetRoughness * 0.95;
|
|
|
+ const adjustedRoughness = incrementalRoughness * blurStrength;
|
|
|
+
|
|
|
+ // Calculate viewport position based on output LOD level
|
|
|
+ const { _lodMax } = this;
|
|
|
+ const outputSize = this._sizeLods[ lodOut ];
|
|
|
+ const x = 3 * outputSize * ( lodOut > _lodMax - LOD_MIN ? lodOut - _lodMax + LOD_MIN : 0 );
|
|
|
+ const y = 4 * ( this._cubeSize - outputSize );
|
|
|
+
|
|
|
+ // Read from previous LOD with incremental roughness
|
|
|
+ ggxUniforms[ 'envMap' ].value = cubeUVRenderTarget.texture;
|
|
|
+ ggxUniforms[ 'roughness' ].value = adjustedRoughness;
|
|
|
+ ggxUniforms[ 'mipInt' ].value = _lodMax - lodIn; // Sample from input LOD
|
|
|
+
|
|
|
+ _setViewport( pingPongRenderTarget, x, y, 3 * outputSize, 2 * outputSize );
|
|
|
+ renderer.setRenderTarget( pingPongRenderTarget );
|
|
|
+ renderer.render( ggxMesh, _flatCamera );
|
|
|
+
|
|
|
+ // Copy from pingPong back to cubeUV (simple direct copy)
|
|
|
+ ggxUniforms[ 'envMap' ].value = pingPongRenderTarget.texture;
|
|
|
+ ggxUniforms[ 'roughness' ].value = 0.0; // Direct copy
|
|
|
+ ggxUniforms[ 'mipInt' ].value = _lodMax - lodOut; // Read from the level we just wrote
|
|
|
+
|
|
|
+ _setViewport( cubeUVRenderTarget, x, y, 3 * outputSize, 2 * outputSize );
|
|
|
+ renderer.setRenderTarget( cubeUVRenderTarget );
|
|
|
+ renderer.render( ggxMesh, _flatCamera );
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -62072,6 +62119,8 @@ class PMREMGenerator {
|
|
|
* the poles) to approximate the orthogonally-separable blur. It is least
|
|
|
* accurate at the poles, but still does a decent job.
|
|
|
*
|
|
|
+ * Used for initial scene blur in fromScene() method when sigma > 0.
|
|
|
+ *
|
|
|
* @private
|
|
|
* @param {WebGLRenderTarget} cubeUVRenderTarget
|
|
|
* @param {number} lodIn
|
|
|
@@ -62287,6 +62336,153 @@ function _setViewport( target, x, y, width, height ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+function _getGGXShader( lodMax, width, height ) {
|
|
|
+
|
|
|
+ const shaderMaterial = new ShaderMaterial( {
|
|
|
+
|
|
|
+ name: 'PMREMGGXConvolution',
|
|
|
+
|
|
|
+ defines: {
|
|
|
+ 'GGX_SAMPLES': GGX_SAMPLES,
|
|
|
+ 'CUBEUV_TEXEL_WIDTH': 1.0 / width,
|
|
|
+ 'CUBEUV_TEXEL_HEIGHT': 1.0 / height,
|
|
|
+ 'CUBEUV_MAX_MIP': `${lodMax}.0`,
|
|
|
+ },
|
|
|
+
|
|
|
+ uniforms: {
|
|
|
+ 'envMap': { value: null },
|
|
|
+ 'roughness': { value: 0.0 },
|
|
|
+ 'mipInt': { value: 0 }
|
|
|
+ },
|
|
|
+
|
|
|
+ vertexShader: _getCommonVertexShader(),
|
|
|
+
|
|
|
+ fragmentShader: /* glsl */`
|
|
|
+
|
|
|
+ precision mediump float;
|
|
|
+ precision mediump int;
|
|
|
+
|
|
|
+ varying vec3 vOutputDirection;
|
|
|
+
|
|
|
+ uniform sampler2D envMap;
|
|
|
+ uniform float roughness;
|
|
|
+ uniform float mipInt;
|
|
|
+
|
|
|
+ #define ENVMAP_TYPE_CUBE_UV
|
|
|
+ #include <cube_uv_reflection_fragment>
|
|
|
+
|
|
|
+ #define PI 3.14159265359
|
|
|
+
|
|
|
+ // Van der Corput radical inverse
|
|
|
+ float radicalInverse_VdC(uint bits) {
|
|
|
+ bits = (bits << 16u) | (bits >> 16u);
|
|
|
+ bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
|
|
|
+ bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
|
|
|
+ bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
|
|
|
+ bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
|
|
|
+ return float(bits) * 2.3283064365386963e-10; // / 0x100000000
|
|
|
+ }
|
|
|
+
|
|
|
+ // Hammersley sequence
|
|
|
+ vec2 hammersley(uint i, uint N) {
|
|
|
+ return vec2(float(i) / float(N), radicalInverse_VdC(i));
|
|
|
+ }
|
|
|
+
|
|
|
+ // GGX VNDF importance sampling (Eric Heitz 2018)
|
|
|
+ // "Sampling the GGX Distribution of Visible Normals"
|
|
|
+ vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
|
|
|
+ float alpha = roughness * roughness;
|
|
|
+
|
|
|
+ // Section 3.2: Transform view direction to hemisphere configuration
|
|
|
+ vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z));
|
|
|
+
|
|
|
+ // Section 4.1: Orthonormal basis
|
|
|
+ float lensq = Vh.x * Vh.x + Vh.y * Vh.y;
|
|
|
+ vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0);
|
|
|
+ vec3 T2 = cross(Vh, T1);
|
|
|
+
|
|
|
+ // Section 4.2: Parameterization of projected area
|
|
|
+ float r = sqrt(Xi.x);
|
|
|
+ float phi = 2.0 * PI * Xi.y;
|
|
|
+ float t1 = r * cos(phi);
|
|
|
+ float t2 = r * sin(phi);
|
|
|
+ float s = 0.5 * (1.0 + Vh.z);
|
|
|
+ t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
|
|
|
+
|
|
|
+ // Section 4.3: Reprojection onto hemisphere
|
|
|
+ vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh;
|
|
|
+
|
|
|
+ // Section 3.4: Transform back to ellipsoid configuration
|
|
|
+ return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
|
|
|
+ }
|
|
|
+
|
|
|
+ void main() {
|
|
|
+ vec3 N = normalize(vOutputDirection);
|
|
|
+ vec3 V = N; // Assume view direction equals normal for pre-filtering
|
|
|
+
|
|
|
+ vec3 prefilteredColor = vec3(0.0);
|
|
|
+ float totalWeight = 0.0;
|
|
|
+
|
|
|
+ // For very low roughness, just sample the environment directly
|
|
|
+ if (roughness < 0.001) {
|
|
|
+ gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Tangent space basis for VNDF sampling
|
|
|
+ vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
|
|
|
+ vec3 tangent = normalize(cross(up, N));
|
|
|
+ vec3 bitangent = cross(N, tangent);
|
|
|
+
|
|
|
+ for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
|
|
|
+ vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
|
|
|
+
|
|
|
+ // Transform V to tangent space for VNDF sampling
|
|
|
+ vec3 V_tangent = vec3(
|
|
|
+ dot(V, tangent),
|
|
|
+ dot(V, bitangent),
|
|
|
+ dot(V, N)
|
|
|
+ );
|
|
|
+
|
|
|
+ // Sample VNDF in tangent space
|
|
|
+ vec3 H_tangent = importanceSampleGGX_VNDF(Xi, V_tangent, roughness);
|
|
|
+
|
|
|
+ // Transform H back to world space
|
|
|
+ vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
|
|
|
+ vec3 L = normalize(2.0 * dot(V, H) * H - V);
|
|
|
+
|
|
|
+ float NdotL = max(dot(N, L), 0.0);
|
|
|
+
|
|
|
+ if(NdotL > 0.0) {
|
|
|
+ // Sample environment at fixed mip level
|
|
|
+ // VNDF importance sampling handles the distribution filtering
|
|
|
+ vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
|
|
|
+
|
|
|
+ // Weight by NdotL for the split-sum approximation
|
|
|
+ // VNDF PDF naturally accounts for the visible microfacet distribution
|
|
|
+ prefilteredColor += sampleColor * NdotL;
|
|
|
+ totalWeight += NdotL;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (totalWeight > 0.0) {
|
|
|
+ prefilteredColor = prefilteredColor / totalWeight;
|
|
|
+ }
|
|
|
+
|
|
|
+ gl_FragColor = vec4(prefilteredColor, 1.0);
|
|
|
+ }
|
|
|
+ `,
|
|
|
+
|
|
|
+ blending: NoBlending,
|
|
|
+ depthTest: false,
|
|
|
+ depthWrite: false
|
|
|
+
|
|
|
+ } );
|
|
|
+
|
|
|
+ return shaderMaterial;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
function _getBlurShader( lodMax, width, height ) {
|
|
|
|
|
|
const weights = new Float32Array( MAX_SAMPLES );
|