@needle-tools/materialx 1.7.0-next.0d06218 → 1.7.0-next.8333b4d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -0
- package/LICENSE.txt +131 -0
- package/package.json +5 -1
- package/src/constants.js +3 -4
- package/src/materialx.helper.d.ts +1 -1
- package/src/materialx.helper.js +1 -1
- package/src/materialx.js +5 -5
- package/src/materialx.material.js +113 -35
- package/src/utils.texture.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
15
15
|
- Improved texture sampling, alpha-mode render state, environment rotation, and PMREM handling for Three.js integration.
|
|
16
16
|
|
|
17
17
|
### Fixed
|
|
18
|
+
- Removed browser-hostile runtime imports of `three/src`, `UniformsLib`, and WebGL-only Three.js exports so the package can share the host application's Three.js import map in WebGL and WebGPU contexts.
|
|
18
19
|
- Corrected material parameter editing for color values, environment controls, and graph-loaded materials in the viewer examples.
|
|
19
20
|
- Kept viewer debug panels and camera controls consistent across the material library, graph, shadows, and complex scenes.
|
|
20
21
|
|
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# PolyForm Noncommercial License 1.0.0
|
|
2
|
+
|
|
3
|
+
<https://polyformproject.org/licenses/noncommercial/1.0.0>
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
In order to get any license under these terms, you must agree
|
|
8
|
+
to them as both strict obligations and conditions to all
|
|
9
|
+
your licenses.
|
|
10
|
+
|
|
11
|
+
## Copyright License
|
|
12
|
+
|
|
13
|
+
The licensor grants you a copyright license for the
|
|
14
|
+
software to do everything you might do with the software
|
|
15
|
+
that would otherwise infringe the licensor's copyright
|
|
16
|
+
in it for any permitted purpose. However, you may
|
|
17
|
+
only distribute the software according to [Distribution
|
|
18
|
+
License](#distribution-license) and make changes or new works
|
|
19
|
+
based on the software according to [Changes and New Works
|
|
20
|
+
License](#changes-and-new-works-license).
|
|
21
|
+
|
|
22
|
+
## Distribution License
|
|
23
|
+
|
|
24
|
+
The licensor grants you an additional copyright license
|
|
25
|
+
to distribute copies of the software. Your license
|
|
26
|
+
to distribute covers distributing the software with
|
|
27
|
+
changes and new works permitted by [Changes and New Works
|
|
28
|
+
License](#changes-and-new-works-license).
|
|
29
|
+
|
|
30
|
+
## Notices
|
|
31
|
+
|
|
32
|
+
You must ensure that anyone who gets a copy of any part of
|
|
33
|
+
the software from you also gets a copy of these terms or the
|
|
34
|
+
URL for them above, as well as copies of any plain-text lines
|
|
35
|
+
beginning with `Required Notice:` that the licensor provided
|
|
36
|
+
with the software. For example:
|
|
37
|
+
|
|
38
|
+
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
|
|
39
|
+
|
|
40
|
+
## Changes and New Works License
|
|
41
|
+
|
|
42
|
+
The licensor grants you an additional copyright license to
|
|
43
|
+
make changes and new works based on the software for any
|
|
44
|
+
permitted purpose.
|
|
45
|
+
|
|
46
|
+
## Patent License
|
|
47
|
+
|
|
48
|
+
The licensor grants you a patent license for the software that
|
|
49
|
+
covers patent claims the licensor can license, or becomes able
|
|
50
|
+
to license, that you would infringe by using the software.
|
|
51
|
+
|
|
52
|
+
## Noncommercial Purposes
|
|
53
|
+
|
|
54
|
+
Any noncommercial purpose is a permitted purpose.
|
|
55
|
+
|
|
56
|
+
## Personal Uses
|
|
57
|
+
|
|
58
|
+
Personal use for research, experiment, and testing for
|
|
59
|
+
the benefit of public knowledge, personal study, private
|
|
60
|
+
entertainment, hobby projects, amateur pursuits, or religious
|
|
61
|
+
observance, without any anticipated commercial application,
|
|
62
|
+
is use for a permitted purpose.
|
|
63
|
+
|
|
64
|
+
## Noncommercial Organizations
|
|
65
|
+
|
|
66
|
+
Use by any charitable organization, educational institution,
|
|
67
|
+
public research organization, public safety or health
|
|
68
|
+
organization, environmental protection organization,
|
|
69
|
+
or government institution is use for a permitted purpose
|
|
70
|
+
regardless of the source of funding or obligations resulting
|
|
71
|
+
from the funding.
|
|
72
|
+
|
|
73
|
+
## Fair Use
|
|
74
|
+
|
|
75
|
+
You may have "fair use" rights for the software under the
|
|
76
|
+
law. These terms do not limit them.
|
|
77
|
+
|
|
78
|
+
## No Other Rights
|
|
79
|
+
|
|
80
|
+
These terms do not allow you to sublicense or transfer any of
|
|
81
|
+
your licenses to anyone else, or prevent the licensor from
|
|
82
|
+
granting licenses to anyone else. These terms do not imply
|
|
83
|
+
any other licenses.
|
|
84
|
+
|
|
85
|
+
## Patent Defense
|
|
86
|
+
|
|
87
|
+
If you make any written claim that the software infringes or
|
|
88
|
+
contributes to infringement of any patent, your patent license
|
|
89
|
+
for the software granted under these terms ends immediately. If
|
|
90
|
+
your company makes such a claim, your patent license ends
|
|
91
|
+
immediately for work on behalf of your company.
|
|
92
|
+
|
|
93
|
+
## Violations
|
|
94
|
+
|
|
95
|
+
The first time you are notified in writing that you have
|
|
96
|
+
violated any of these terms, or done anything with the software
|
|
97
|
+
not covered by your licenses, your licenses can nonetheless
|
|
98
|
+
continue if you come into full compliance with these terms,
|
|
99
|
+
and take practical steps to correct past violations, within
|
|
100
|
+
32 days of receiving notice. Otherwise, all your licenses
|
|
101
|
+
end immediately.
|
|
102
|
+
|
|
103
|
+
## No Liability
|
|
104
|
+
|
|
105
|
+
***As far as the law allows, the software comes as is, without
|
|
106
|
+
any warranty or condition, and the licensor will not be liable
|
|
107
|
+
to you for any damages arising out of these terms or the use
|
|
108
|
+
or nature of the software, under any kind of legal claim.***
|
|
109
|
+
|
|
110
|
+
## Definitions
|
|
111
|
+
|
|
112
|
+
The **licensor** is the individual or entity offering these
|
|
113
|
+
terms, and the **software** is the software the licensor makes
|
|
114
|
+
available under these terms.
|
|
115
|
+
|
|
116
|
+
**You** refers to the individual or entity agreeing to these
|
|
117
|
+
terms.
|
|
118
|
+
|
|
119
|
+
**Your company** is any legal entity, sole proprietorship,
|
|
120
|
+
or other kind of organization that you work for, plus all
|
|
121
|
+
organizations that have control over, are under the control of,
|
|
122
|
+
or are under common control with that organization. **Control**
|
|
123
|
+
means ownership of substantially all the assets of an entity,
|
|
124
|
+
or the power to direct its management and policies by vote,
|
|
125
|
+
contract, or otherwise. Control can be direct or indirect.
|
|
126
|
+
|
|
127
|
+
**Your licenses** are all the licenses granted to you for the
|
|
128
|
+
software under these terms.
|
|
129
|
+
|
|
130
|
+
**Use** means anything you do with the software requiring one
|
|
131
|
+
of your licenses.
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/materialx",
|
|
3
3
|
"description": "MaterialX material support for three.js and Needle Engine – render physically based MaterialX shaders in the browser via WebAssembly",
|
|
4
|
-
"version": "1.7.0-next.
|
|
4
|
+
"version": "1.7.0-next.8333b4d",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"license": "PolyForm-Noncommercial-1.0.0",
|
|
6
7
|
"main": "index.js",
|
|
7
8
|
"types": "index.d.ts",
|
|
8
9
|
"exports": {
|
|
@@ -35,6 +36,9 @@
|
|
|
35
36
|
"jsdom": "^29.0.1",
|
|
36
37
|
"three": "npm:@needle-tools/three@^0.169.5"
|
|
37
38
|
},
|
|
39
|
+
"overrides": {
|
|
40
|
+
"@needle-tools/gltf-progressive": "3.6.0-beta.2"
|
|
41
|
+
},
|
|
38
42
|
"files": [
|
|
39
43
|
"index.js",
|
|
40
44
|
"index.d.ts",
|
package/src/constants.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// Bare JSON import works in
|
|
2
|
-
// Node.js 22+ requires
|
|
3
|
-
//
|
|
4
|
-
// Unit tests that run under Node.js use the --import flag in package.json.
|
|
1
|
+
// Bare JSON import works in bundlers (Vite, Webpack, Rollup) and keeps the
|
|
2
|
+
// runtime version tied to package.json. Node.js 22+ requires JSON import
|
|
3
|
+
// attributes, so unit tests use tests/unit/register-json-loader.js.
|
|
5
4
|
import pkg from '../package.json';
|
|
6
5
|
export const VERSION = pkg.version;
|
|
@@ -16,7 +16,7 @@ export interface LightData {
|
|
|
16
16
|
outer_angle: number;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export function prepareEnvTexture(texture: THREE.Texture, capabilities
|
|
19
|
+
export function prepareEnvTexture(texture: THREE.Texture, capabilities?: any): THREE.Texture;
|
|
20
20
|
|
|
21
21
|
export function getLightRotation(): THREE.Matrix4;
|
|
22
22
|
|
package/src/materialx.helper.js
CHANGED
|
@@ -21,7 +21,7 @@ const IMAGE_PATH_SEPARATOR = "/";
|
|
|
21
21
|
export function prepareEnvTexture(texture, capabilities) {
|
|
22
22
|
const newTexture = new THREE.DataTexture(texture.image.data, texture.image.width, texture.image.height, /** @type {any} */(texture.format), texture.type);
|
|
23
23
|
newTexture.wrapS = THREE.RepeatWrapping;
|
|
24
|
-
newTexture.anisotropy = capabilities
|
|
24
|
+
newTexture.anisotropy = capabilities?.getMaxAnisotropy?.() ?? 1;
|
|
25
25
|
newTexture.minFilter = THREE.LinearMipmapLinearFilter;
|
|
26
26
|
newTexture.magFilter = THREE.LinearFilter;
|
|
27
27
|
newTexture.generateMipmaps = true;
|
package/src/materialx.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import MaterialX from "../bin/JsMaterialXGenShader.js";
|
|
2
2
|
import { debug, waitForNetworkIdle } from "./utils.js";
|
|
3
3
|
import { renderPMREMToEquirect, renderPMREMToPrefilteredEquirect } from "./utils.texture.js";
|
|
4
|
-
import { CubeUVReflectionMapping, Light, Mesh, MeshBasicMaterial, Object3D, PlaneGeometry, PMREMGenerator, Scene, Texture
|
|
4
|
+
import { CubeUVReflectionMapping, Light, Mesh, MeshBasicMaterial, Object3D, PlaneGeometry, PMREMGenerator, Scene, Texture } from "three";
|
|
5
5
|
import { registerLights, getLightData } from "./materialx.helper.js";
|
|
6
6
|
import { whiteTexture } from "./utils.texture.js";
|
|
7
7
|
import { VERSION } from "./constants.js";
|
|
@@ -229,7 +229,7 @@ export class MaterialXEnvironment {
|
|
|
229
229
|
|
|
230
230
|
/**
|
|
231
231
|
* Initialize with Needle Engine context
|
|
232
|
-
* @param {WebGLRenderer} renderer
|
|
232
|
+
* @param {import("three").WebGLRenderer} renderer
|
|
233
233
|
* @returns {Promise<boolean>}
|
|
234
234
|
*/
|
|
235
235
|
async initialize(renderer) {
|
|
@@ -243,7 +243,7 @@ export class MaterialXEnvironment {
|
|
|
243
243
|
/**
|
|
244
244
|
* @param {number} frame
|
|
245
245
|
* @param {Scene} scene
|
|
246
|
-
* @param {WebGLRenderer} renderer
|
|
246
|
+
* @param {import("three").WebGLRenderer} renderer
|
|
247
247
|
*/
|
|
248
248
|
update(frame, scene, renderer) {
|
|
249
249
|
if (!this._initializePromise) {
|
|
@@ -334,13 +334,13 @@ export class MaterialXEnvironment {
|
|
|
334
334
|
|
|
335
335
|
/** @type {PMREMGenerator | null} */
|
|
336
336
|
_pmremGenerator = null;
|
|
337
|
-
/** @type {WebGLRenderer | null} */
|
|
337
|
+
/** @type {import("three").WebGLRenderer | null} */
|
|
338
338
|
_renderer = null;
|
|
339
339
|
/** @type {Map<Texture | null, Map<string, EnvironmentTextureSet>>} */
|
|
340
340
|
_texturesCache = new Map();
|
|
341
341
|
|
|
342
342
|
/**
|
|
343
|
-
* @param {WebGLRenderer} renderer
|
|
343
|
+
* @param {import("three").WebGLRenderer} renderer
|
|
344
344
|
* @returns {Promise<boolean>}
|
|
345
345
|
*/
|
|
346
346
|
async _initialize(renderer) {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { BufferGeometry, Camera, Euler, FrontSide, GLSL3, Group, Matrix4, Object3D, Scene, ShaderMaterial, Texture,
|
|
1
|
+
import { BufferGeometry, Camera, Euler, FrontSide, GLSL3, Group, Matrix4, Object3D, Scene, ShaderMaterial, Texture, Vector3 } from "three";
|
|
2
2
|
import { debug, getFrame, getTime } from "./utils.js";
|
|
3
3
|
import { MaterialXEnvironment } from "./materialx.js";
|
|
4
4
|
import { generateMaterialPropertiesForUniforms, getUniformValues, getLightTypeIds } from "./materialx.helper.js";
|
|
5
|
-
import { cloneUniforms, cloneUniformsGroups, mergeUniforms } from "three/src/renderers/shaders/UniformsUtils.js";
|
|
6
5
|
|
|
7
6
|
export const DEFAULT_ENVIRONMENT_RADIANCE_MODE = "three-pmrem";
|
|
8
7
|
|
|
@@ -15,6 +14,83 @@ const worldViewProjectionMat = new Matrix4();
|
|
|
15
14
|
const envMat = new Matrix4();
|
|
16
15
|
const envRotation = new Euler();
|
|
17
16
|
|
|
17
|
+
// Local copy of Three.js UniformsUtils.cloneUniforms from
|
|
18
|
+
// three/src/renderers/shaders/UniformsUtils.js. Keep this in sync with the
|
|
19
|
+
// minimum supported Three.js version when Three changes uniform cloning.
|
|
20
|
+
function cloneUniforms(src) {
|
|
21
|
+
const dst = {};
|
|
22
|
+
for (const uniformName in src) {
|
|
23
|
+
dst[uniformName] = {};
|
|
24
|
+
for (const propertyName in src[uniformName]) {
|
|
25
|
+
const property = src[uniformName][propertyName];
|
|
26
|
+
if (property && (
|
|
27
|
+
property.isColor ||
|
|
28
|
+
property.isMatrix3 || property.isMatrix4 ||
|
|
29
|
+
property.isVector2 || property.isVector3 || property.isVector4 ||
|
|
30
|
+
property.isTexture || property.isQuaternion
|
|
31
|
+
)) {
|
|
32
|
+
dst[uniformName][propertyName] = property.isRenderTargetTexture ? null : property.clone();
|
|
33
|
+
}
|
|
34
|
+
else if (Array.isArray(property)) {
|
|
35
|
+
dst[uniformName][propertyName] = property.slice();
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
dst[uniformName][propertyName] = property;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return dst;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Local copy of Three.js UniformsUtils.mergeUniforms from
|
|
46
|
+
// three/src/renderers/shaders/UniformsUtils.js. Copied to avoid importing from
|
|
47
|
+
// three/src, which breaks package consumers using Three's public ESM surface.
|
|
48
|
+
function mergeUniforms(uniforms) {
|
|
49
|
+
const merged = {};
|
|
50
|
+
for (const uniformSet of uniforms) {
|
|
51
|
+
const tmp = cloneUniforms(uniformSet);
|
|
52
|
+
for (const propertyName in tmp) {
|
|
53
|
+
merged[propertyName] = tmp[propertyName];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return merged;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Local copy of Three.js UniformsUtils.cloneUniformsGroups from
|
|
60
|
+
// three/src/renderers/shaders/UniformsUtils.js. Keep alongside cloneUniforms
|
|
61
|
+
// and mergeUniforms so ShaderMaterial.clone() stays behavior-compatible.
|
|
62
|
+
function cloneUniformsGroups(src) {
|
|
63
|
+
return src.map(group => group.clone());
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function createThreeLightUniforms() {
|
|
67
|
+
return {
|
|
68
|
+
ambientLightColor: { value: [] },
|
|
69
|
+
lightProbe: { value: [] },
|
|
70
|
+
directionalLights: { value: [], properties: { direction: {}, color: {} } },
|
|
71
|
+
directionalLightShadows: { value: [], properties: { shadowIntensity: 1, shadowBias: {}, shadowNormalBias: {}, shadowRadius: {}, shadowMapSize: {} } },
|
|
72
|
+
directionalShadowMap: { value: [] },
|
|
73
|
+
directionalShadowMatrix: { value: [] },
|
|
74
|
+
spotLights: { value: [], properties: { color: {}, position: {}, direction: {}, distance: {}, coneCos: {}, penumbraCos: {}, decay: {} } },
|
|
75
|
+
spotLightShadows: { value: [], properties: { shadowIntensity: 1, shadowBias: {}, shadowNormalBias: {}, shadowRadius: {}, shadowMapSize: {} } },
|
|
76
|
+
spotLightMap: { value: [] },
|
|
77
|
+
spotShadowMap: { value: [] },
|
|
78
|
+
spotLightMatrix: { value: [] },
|
|
79
|
+
pointLights: { value: [], properties: { color: {}, position: {}, decay: {}, distance: {} } },
|
|
80
|
+
pointLightShadows: { value: [], properties: { shadowIntensity: 1, shadowBias: {}, shadowNormalBias: {}, shadowRadius: {}, shadowMapSize: {}, shadowCameraNear: {}, shadowCameraFar: {} } },
|
|
81
|
+
pointShadowMap: { value: [] },
|
|
82
|
+
pointShadowMatrix: { value: [] },
|
|
83
|
+
hemisphereLights: { value: [], properties: { direction: {}, skyColor: {}, groundColor: {} } },
|
|
84
|
+
rectAreaLights: { value: [], properties: { color: {}, position: {}, width: {}, height: {} } },
|
|
85
|
+
ltc_1: { value: null },
|
|
86
|
+
ltc_2: { value: null },
|
|
87
|
+
probesSH: { value: null },
|
|
88
|
+
probesMin: { value: new Vector3() },
|
|
89
|
+
probesMax: { value: new Vector3() },
|
|
90
|
+
probesResolution: { value: new Vector3() },
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
18
94
|
const CUBE_UV_REFLECTION_FUNCTIONS = `
|
|
19
95
|
float mx_cubeuv_getFace(vec3 direction) {
|
|
20
96
|
vec3 absDirection = abs(direction);
|
|
@@ -623,37 +699,39 @@ $2`
|
|
|
623
699
|
this.environmentRadianceMode = environmentRadianceMode;
|
|
624
700
|
this.specularAntialiasing = specularAntialiasing;
|
|
625
701
|
|
|
626
|
-
Object.assign(this.uniforms,
|
|
627
|
-
// Three.js light uniforms (required when lights: true)
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
702
|
+
Object.assign(this.uniforms,
|
|
703
|
+
// Three.js light uniforms (required when lights: true). These use
|
|
704
|
+
// Three's merge/clone semantics; generated MaterialX texture
|
|
705
|
+
// uniforms below must keep their original object identity so async
|
|
706
|
+
// texture resolution updates the same uniform object.
|
|
707
|
+
mergeUniforms([createThreeLightUniforms()]),
|
|
708
|
+
getUniformValues(init.shader.getStage('vertex'), init.loaders, searchPath, pendingTextureLoads),
|
|
709
|
+
getUniformValues(init.shader.getStage('pixel'), init.loaders, searchPath, pendingTextureLoads),
|
|
710
|
+
{
|
|
711
|
+
u_worldMatrix: { value: new Matrix4() },
|
|
712
|
+
u_worldInverseMatrix: { value: new Matrix4() },
|
|
713
|
+
u_worldTransposeMatrix: { value: new Matrix4() },
|
|
714
|
+
u_worldInverseTransposeMatrix: { value: new Matrix4() },
|
|
715
|
+
u_worldViewMatrix: { value: new Matrix4() },
|
|
716
|
+
u_viewProjectionMatrix: { value: new Matrix4() },
|
|
717
|
+
u_worldViewProjectionMatrix: { value: new Matrix4() },
|
|
718
|
+
u_viewPosition: { value: new Vector3() },
|
|
719
|
+
|
|
720
|
+
u_envMatrix: { value: new Matrix4() },
|
|
721
|
+
u_envRadiance: { value: null, type: 't' },
|
|
722
|
+
u_envRadianceMips: { value: 8, type: 'i' },
|
|
723
|
+
u_envRadianceCubeUVTexelWidth: { value: 1 / 768 },
|
|
724
|
+
u_envRadianceCubeUVTexelHeight: { value: 1 / 1024 },
|
|
725
|
+
u_envRadianceCubeUVMaxMip: { value: 8 },
|
|
726
|
+
// TODO we need to figure out how we can set a PMREM here... doing many texture samples is prohibitively expensive
|
|
727
|
+
u_envRadianceSamples: { value: 8, type: 'i' },
|
|
728
|
+
u_envIrradiance: { value: null, type: 't' },
|
|
729
|
+
envMapIntensity: { value: 1.0 },
|
|
730
|
+
u_refractionEnv: { value: true },
|
|
731
|
+
u_refractionTwoSided: { value: false },
|
|
732
|
+
u_numActiveLightSources: { value: 0 },
|
|
733
|
+
u_lightData: { value: [], needsUpdate: false }, // Array of light data. We need to set needsUpdate to false until we actually update it
|
|
734
|
+
});
|
|
657
735
|
this.ready = Promise.all(pendingTextureLoads).then(() => undefined);
|
|
658
736
|
|
|
659
737
|
generateMaterialPropertiesForUniforms(this, init.shader.getStage('pixel'));
|
|
@@ -673,7 +751,7 @@ $2`
|
|
|
673
751
|
_missingTangentsWarned = false;
|
|
674
752
|
|
|
675
753
|
/**
|
|
676
|
-
* @param {WebGLRenderer} renderer
|
|
754
|
+
* @param {import("three").WebGLRenderer} renderer
|
|
677
755
|
* @param {Scene} _scene
|
|
678
756
|
* @param {Camera} camera
|
|
679
757
|
* @param {BufferGeometry} geometry
|
|
@@ -710,7 +788,7 @@ $2`
|
|
|
710
788
|
specularAntialiasing = true;
|
|
711
789
|
|
|
712
790
|
/**
|
|
713
|
-
* @param {WebGLRenderer} _renderer
|
|
791
|
+
* @param {import("three").WebGLRenderer} _renderer
|
|
714
792
|
* @param {Object3D} object
|
|
715
793
|
* @param {Camera} camera
|
|
716
794
|
* @param {number} [time]
|
package/src/utils.texture.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Scene, WebGLRenderTarget, PlaneGeometry, OrthographicCamera, ShaderMaterial, RGBAFormat, FloatType, LinearFilter, Mesh, EquirectangularReflectionMapping, RepeatWrapping, LinearMipMapLinearFilter, DataTexture, UnsignedByteType, Vector4 } from 'three';
|
|
2
2
|
import { getParam } from './utils.js';
|
|
3
3
|
|
|
4
4
|
const debug = getParam("debugmaterialx");
|
|
@@ -96,7 +96,7 @@ function createPrefilteredEquirectMaterial(pmremTexture, cubeUVSize) {
|
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
98
|
* Renders a PMREM environment map to an equirectangular texture with specified roughness
|
|
99
|
-
* @param {WebGLRenderer} renderer - Three.js WebGL renderer
|
|
99
|
+
* @param {import("three").WebGLRenderer} renderer - Three.js WebGL renderer
|
|
100
100
|
* @param {Texture} pmremTexture - PMREM texture (2D CubeUV layout) to convert
|
|
101
101
|
* @param {number} [roughness=0.0] - Roughness value (0.0 to 1.0)
|
|
102
102
|
* @param {number} [width=1024] - Output texture width
|
|
@@ -249,7 +249,7 @@ export function renderPMREMToEquirect(renderer, pmremTexture, roughness = 0.0, w
|
|
|
249
249
|
/**
|
|
250
250
|
* Renders a Three.js PMREM CubeUV texture to an equirectangular texture whose mip
|
|
251
251
|
* levels encode increasing roughness for MaterialX SPECULAR_ENVIRONMENT_PREFILTER.
|
|
252
|
-
* @param {WebGLRenderer} renderer
|
|
252
|
+
* @param {import("three").WebGLRenderer} renderer
|
|
253
253
|
* @param {Texture} pmremTexture
|
|
254
254
|
* @param {number} [width=2048]
|
|
255
255
|
* @param {number} [height=1024]
|