@needle-tools/materialx 1.6.0-next.2af5fc1 → 1.7.0-next.043f0c6
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 +19 -1
- package/LICENSE.txt +131 -0
- package/README.md +33 -1
- package/bin/JsMaterialXCore.js +5 -13
- package/bin/JsMaterialXCore.wasm +0 -0
- package/bin/JsMaterialXGenShader.data.txt +2127 -2453
- package/bin/JsMaterialXGenShader.js +5 -13
- package/bin/JsMaterialXGenShader.wasm +0 -0
- package/bin/revision.json +3 -3
- package/package.json +18 -7
- package/src/constants.js +4 -5
- package/src/index.d.ts +1 -2
- package/src/loader/loader.three.d.ts +10 -1
- package/src/loader/loader.three.js +26 -19
- package/src/materialx.d.ts +9 -5
- package/src/materialx.helper.d.ts +2 -2
- package/src/materialx.helper.js +113 -47
- package/src/materialx.js +106 -29
- package/src/materialx.material.d.ts +11 -2
- package/src/materialx.material.js +614 -34
- package/src/materialx.types.d.ts +65 -10
- package/src/utils.js +16 -9
- package/src/utils.texture.d.ts +11 -0
- package/src/utils.texture.js +195 -38
- /package/bin/{SHA_0e7685f37737511f2816949b9486d511a5fa71bd → SHA_ab218c56f016a9a2d398e8d306f3aeb439ae9e9e} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,24 @@ All notable changes to this package will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [1.7.0] - 2026-05-21
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- Runtime environment radiance modes for fast Three.js PMREM sampling, MaterialX prefiltered latlong sampling, and MaterialX filtered importance sampling.
|
|
11
|
+
- MaterialX viewer examples for material library inspection, PMREM comparison, shaderball previews, configurable environments, and graph-driven material loading.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
- Rebuilt the bundled MaterialX runtime to 1.39.5.
|
|
15
|
+
- Improved texture sampling, alpha-mode render state, environment rotation, and PMREM handling for Three.js integration.
|
|
16
|
+
|
|
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.
|
|
19
|
+
- Added the JSON module import attribute for `package.json` so raw browser ESM imports can read the package version without MIME errors.
|
|
20
|
+
- Made Node ESM imports browser-global safe and load the bundled MaterialX WASM/data files from the installed package when `ready()` runs under Node.
|
|
21
|
+
- Switched bundled MaterialX Emscripten loaders to `node:module` builtin imports for Deno compatibility, and added runtime smoke scripts for Node, Deno, and Bun.
|
|
22
|
+
- Corrected material parameter editing for color values, environment controls, and graph-loaded materials in the viewer examples.
|
|
23
|
+
- Kept viewer debug panels and camera controls consistent across the material library, graph, shadows, and complex scenes.
|
|
24
|
+
|
|
7
25
|
## [1.6.0] – 2026-04-01
|
|
8
26
|
|
|
9
27
|
### Added
|
|
@@ -108,4 +126,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
108
126
|
- Fix: Texture loading and glTF texture index resolution
|
|
109
127
|
|
|
110
128
|
## [1.0.1] - 2025-07-08
|
|
111
|
-
- Initial release
|
|
129
|
+
- Initial release
|
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/README.md
CHANGED
|
@@ -43,6 +43,39 @@ MaterialX shaders will create `MaterialXMaterial` materials at runtime. These ar
|
|
|
43
43
|
|
|
44
44
|
[Learn more in the Needle Engine documentation](https://engine.needle.tools/docs/how-to-guides/export/materialx.html)
|
|
45
45
|
|
|
46
|
+
## Notes
|
|
47
|
+
|
|
48
|
+
### Anisotropy and environment lighting
|
|
49
|
+
|
|
50
|
+
The public `environmentRadianceMode` option is a string enum with three modes:
|
|
51
|
+
|
|
52
|
+
- `three-pmrem` is the default. It samples a prefiltered three.js CubeUV PMREM directly. This is the fast path and is the recommended default for runtime use, but prefiltered environment lookup is scalar-roughness based and does not preserve full anisotropic specular environment reflections. Direct lighting and the rest of the generated MaterialX shader still run normally.
|
|
53
|
+
- `materialx-prefiltered` uses MaterialX's stock prefiltered latlong environment shader path. It is useful for parity checks and exported MaterialX-style prefiltered maps, but it is still a prefiltered lookup.
|
|
54
|
+
- `materialx-fis` enables MaterialX filtered importance sampling. This path is slower, but it preserves anisotropic specular environment reflections.
|
|
55
|
+
|
|
56
|
+
For anisotropic specular environment reflection checks, opt into `materialx-fis`:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import { useNeedleMaterialX } from "@needle-tools/materialx";
|
|
60
|
+
|
|
61
|
+
useNeedleMaterialX(gltfLoader, {
|
|
62
|
+
environmentRadianceMode: "materialx-fis",
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The same option is available when creating a raw MaterialX material:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import { Experimental_API } from "@needle-tools/materialx";
|
|
70
|
+
|
|
71
|
+
const material = await Experimental_API.createMaterialXMaterial(
|
|
72
|
+
mtlxSource,
|
|
73
|
+
0,
|
|
74
|
+
undefined,
|
|
75
|
+
{ environmentRadianceMode: "materialx-fis" },
|
|
76
|
+
);
|
|
77
|
+
```
|
|
78
|
+
|
|
46
79
|
## WASM
|
|
47
80
|
|
|
48
81
|
### Default (CDN)
|
|
@@ -143,4 +176,3 @@ Materials can also contain the `NEEDLE_materials_mtlx` extension, which referenc
|
|
|
143
176
|
[Discord](https://discord.needle.tools) •
|
|
144
177
|
[Forum](https://forum.needle.tools) •
|
|
145
178
|
[Youtube](https://www.youtube.com/@needle-tools)
|
|
146
|
-
|