@webxr-jp/mtoon-atlas 0.3.2 → 0.4.0

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.
@@ -0,0 +1,421 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/nodes/index.ts
21
+ var nodes_exports = {};
22
+ __export(nodes_exports, {
23
+ MToonAtlasLightingModel: () => MToonAtlasLightingModel,
24
+ MToonAtlasNodeMaterial: () => MToonAtlasNodeMaterial
25
+ });
26
+ module.exports = __toCommonJS(nodes_exports);
27
+
28
+ // src/nodes/MToonAtlasNodeMaterial.ts
29
+ var import_tsl2 = require("three/tsl");
30
+ var import_webgpu2 = require("three/webgpu");
31
+
32
+ // src/nodes/MToonAtlasLightingModel.ts
33
+ var import_tsl = require("three/tsl");
34
+ var import_webgpu = require("three/webgpu");
35
+ var shadeColor = (0, import_tsl.property)("vec3").toVar("MToonAtlasShadeColor");
36
+ var shadingShift = (0, import_tsl.property)("float").toVar("MToonAtlasShadingShift");
37
+ var shadingToony = (0, import_tsl.property)("float").toVar("MToonAtlasShadingToony");
38
+ var rim = (0, import_tsl.property)("vec3").toVar("MToonAtlasRim");
39
+ function splitShadow(lightColor, lightNode) {
40
+ const node = lightNode;
41
+ if (node.light?.isDirectionalLight && node.shadowNode && node.baseColorNode) {
42
+ return { color: node.baseColorNode, shadow: node.shadowNode };
43
+ }
44
+ return { color: lightColor, shadow: (0, import_tsl.float)(1) };
45
+ }
46
+ function lambert(diffuse) {
47
+ return (0, import_tsl.BRDF_Lambert)({ diffuseColor: diffuse });
48
+ }
49
+ var MToonAtlasLightingModel = class extends import_webgpu.LightingModel {
50
+ direct({ lightDirection, lightColor, lightNode, reflectedLight }) {
51
+ const { color, shadow } = splitShadow(lightColor, lightNode);
52
+ const out = reflectedLight;
53
+ const dotNL = import_tsl.normalView.dot(lightDirection).clamp(-1, 1);
54
+ const a = (0, import_tsl.float)(-1).add(shadingToony);
55
+ const b = (0, import_tsl.float)(1).sub(shadingToony);
56
+ const shading = dotNL.add(shadingShift).sub(a).div(b.sub(a)).clamp().mul(shadow);
57
+ const feathered = (0, import_tsl.mix)(shadeColor, import_tsl.diffuseColor.rgb, shading);
58
+ out.directDiffuse.addAssign(color.mul(lambert(feathered)));
59
+ out.directSpecular.addAssign(color.mul(lambert(rim)));
60
+ }
61
+ indirect(builder) {
62
+ const context = builder.context;
63
+ const { irradiance, reflectedLight } = context;
64
+ reflectedLight.indirectDiffuse.addAssign(irradiance.mul(lambert(import_tsl.diffuseColor.rgb)));
65
+ reflectedLight.indirectSpecular.addAssign(irradiance.mul(lambert(rim)));
66
+ }
67
+ };
68
+
69
+ // src/nodes/MToonAtlasNodeMaterial.ts
70
+ var DEFAULT_SLOT_ATTRIBUTE_NAME = "mtoonMaterialSlot";
71
+ var MToonAtlasNodeMaterial = class extends import_webgpu2.NodeMaterial {
72
+ /**
73
+ * コンストラクタ
74
+ *
75
+ * @param parameters - オプション
76
+ */
77
+ constructor(parameters = {}) {
78
+ super();
79
+ /** マテリアル識別フラグ(GLSL 版と共通。エクスポーターが参照する) */
80
+ this.isMToonAtlasMaterial = true;
81
+ /** TSL 版であることを示すフラグ */
82
+ this.isMToonAtlasNodeMaterial = true;
83
+ // ---- シェーダーから参照されるテクスチャ・パラメータ ----
84
+ // 自前のプロパティは three がキャッシュキーに含めるため、
85
+ // テクスチャの有無が変わるとシェーダーが作り直される
86
+ /** パラメータテクスチャ(スロット × テクセル) */
87
+ this.parameterTextureMap = null;
88
+ /** パラメータテクスチャの大きさ(x = テクセル数/スロット、y = スロット数) */
89
+ this.parameterTextureSize = new import_webgpu2.Vector2(1, 1);
90
+ /** ベースカラーアトラス */
91
+ this.map = null;
92
+ /** ノーマルマップアトラス */
93
+ this.normalMap = null;
94
+ /** エミッシブアトラス */
95
+ this.emissiveMap = null;
96
+ /** 影色乗算アトラス */
97
+ this.shadeMultiplyTexture = null;
98
+ /** シェーディングシフトアトラス */
99
+ this.shadingShiftTexture = null;
100
+ /** matcap テクスチャ */
101
+ this.matcapTexture = null;
102
+ /** リム乗算アトラス */
103
+ this.rimMultiplyTexture = null;
104
+ /** UV アニメーションマスクアトラス */
105
+ this.uvAnimationMaskTexture = null;
106
+ /**
107
+ * エミッシブを差し替えるノード(NodeMaterial.setupLighting が参照する)。
108
+ * 通常は null のままで、パラメータテクスチャから求めた値が使われる
109
+ */
110
+ this.emissiveNode = null;
111
+ this._slotAttribute = { name: DEFAULT_SLOT_ATTRIBUTE_NAME };
112
+ this._isOutline = false;
113
+ this._outlineWidthMode = "none";
114
+ // シェーダー構築中に使うテクスチャノード(構築ごとに作り直す)
115
+ this._textureNodes = /* @__PURE__ */ new Map();
116
+ this._parameterTextureSizeNode = null;
117
+ this.lights = true;
118
+ const { parameterTexture, slotAttribute, ...rest } = parameters;
119
+ this.setValues(rest);
120
+ if (parameterTexture) {
121
+ this.setParameterTexture(parameterTexture);
122
+ }
123
+ if (slotAttribute) {
124
+ this.setSlotAttribute(slotAttribute);
125
+ }
126
+ }
127
+ /**
128
+ * パラメータテクスチャを設定する
129
+ *
130
+ * atlasedTextures を含む場合は各アトラステクスチャも設定する。
131
+ *
132
+ * @param descriptor - パラメータテクスチャディスクリプタ。null で解除
133
+ * @returns this
134
+ */
135
+ setParameterTexture(descriptor) {
136
+ this._parameterTexture = descriptor ?? void 0;
137
+ if (descriptor) {
138
+ this.parameterTextureMap = descriptor.texture;
139
+ this.parameterTextureSize.set(descriptor.texelsPerSlot, descriptor.slotCount);
140
+ if (descriptor.atlasedTextures) {
141
+ this._setAtlasedTextures(descriptor.atlasedTextures);
142
+ }
143
+ } else {
144
+ this.parameterTextureMap = null;
145
+ this.parameterTextureSize.set(1, 1);
146
+ }
147
+ this.needsUpdate = true;
148
+ return this;
149
+ }
150
+ /**
151
+ * スロット属性を設定する
152
+ *
153
+ * @param config - スロット属性設定
154
+ * @returns this
155
+ */
156
+ setSlotAttribute(config) {
157
+ if (config.name !== this._slotAttribute.name) {
158
+ this.needsUpdate = true;
159
+ }
160
+ this._slotAttribute = { ...config };
161
+ return this;
162
+ }
163
+ /** パラメータテクスチャディスクリプタ */
164
+ get parameterTexture() {
165
+ return this._parameterTexture;
166
+ }
167
+ /** スロット属性設定 */
168
+ get slotAttribute() {
169
+ return this._slotAttribute;
170
+ }
171
+ /** アウトライン用マテリアルかどうか。true にすると裏面を描画する */
172
+ get isOutline() {
173
+ return this._isOutline;
174
+ }
175
+ set isOutline(value) {
176
+ if (this._isOutline === value) return;
177
+ this._isOutline = value;
178
+ this.side = value ? import_webgpu2.BackSide : import_webgpu2.FrontSide;
179
+ this.needsUpdate = true;
180
+ }
181
+ /** アウトライン幅の計算方式 */
182
+ get outlineWidthMode() {
183
+ return this._outlineWidthMode;
184
+ }
185
+ set outlineWidthMode(value) {
186
+ if (this._outlineWidthMode === value) return;
187
+ this._outlineWidthMode = value;
188
+ this.needsUpdate = true;
189
+ }
190
+ /**
191
+ * このマテリアルを元にアウトライン用マテリアルを作る
192
+ *
193
+ * @param widthMode - アウトライン幅の計算方式
194
+ * @returns アウトライン用マテリアル
195
+ */
196
+ createOutlineMaterial(widthMode = "worldCoordinates") {
197
+ const outline = this.clone();
198
+ outline.outlineWidthMode = widthMode;
199
+ outline.isOutline = true;
200
+ outline.polygonOffset = true;
201
+ outline.polygonOffsetFactor = 1;
202
+ outline.polygonOffsetUnits = 1;
203
+ return outline;
204
+ }
205
+ /**
206
+ * UV アニメーションの更新(GLSL 版と同じく現状は何もしない)
207
+ *
208
+ * パラメータテクスチャのオフセット値をそのまま使うため、時間経過による
209
+ * 更新は行わない。three-vrm の VRM.update() から呼ばれる。
210
+ */
211
+ update(_deltaTime) {
212
+ }
213
+ customProgramCacheKey() {
214
+ return super.customProgramCacheKey() + `mtoonAtlas:${this.uuid},${this._isOutline},${this._outlineWidthMode},${this._slotAttribute.name},`;
215
+ }
216
+ copy(source) {
217
+ super.copy(source);
218
+ this.parameterTextureMap = source.parameterTextureMap;
219
+ this.parameterTextureSize.copy(source.parameterTextureSize);
220
+ this.map = source.map;
221
+ this.normalMap = source.normalMap;
222
+ this.emissiveMap = source.emissiveMap;
223
+ this.shadeMultiplyTexture = source.shadeMultiplyTexture;
224
+ this.shadingShiftTexture = source.shadingShiftTexture;
225
+ this.matcapTexture = source.matcapTexture;
226
+ this.rimMultiplyTexture = source.rimMultiplyTexture;
227
+ this.uvAnimationMaskTexture = source.uvAnimationMaskTexture;
228
+ this._parameterTexture = source._parameterTexture ? { ...source._parameterTexture } : void 0;
229
+ this._slotAttribute = { ...source._slotAttribute };
230
+ this._isOutline = source._isOutline;
231
+ this._outlineWidthMode = source._outlineWidthMode;
232
+ return this;
233
+ }
234
+ // ---- ノード構築 ----
235
+ setup(builder) {
236
+ this._textureNodes = /* @__PURE__ */ new Map();
237
+ this._parameterTextureSizeNode = (0, import_tsl2.uniform)(this.parameterTextureSize);
238
+ super.setup(builder);
239
+ }
240
+ /**
241
+ * テクスチャプロパティを指定 UV でサンプリングする
242
+ *
243
+ * 同じテクスチャは 1 つの TextureNode を元に sample() するので、
244
+ * 何回読んでもバインディングは 1 つで済む。
245
+ *
246
+ * @param property - 読むテクスチャのプロパティ名(null でないこと)
247
+ * @param uvNode - サンプリングする UV
248
+ */
249
+ _sample(property2, uvNode) {
250
+ let base = this._textureNodes.get(property2);
251
+ if (!base) {
252
+ base = (0, import_tsl2.texture)(this[property2]);
253
+ this._textureNodes.set(property2, base);
254
+ }
255
+ return base.sample(uvNode);
256
+ }
257
+ /** 現在のフラグメント / 頂点のスロット番号 */
258
+ _slot() {
259
+ return (0, import_tsl2.attribute)(this._slotAttribute.name, "float");
260
+ }
261
+ /**
262
+ * パラメータテクスチャの 1 テクセルを読む
263
+ *
264
+ * GLSL 版の sampleParameter と同じく、テクセル中心の UV で読む。
265
+ * float テクスチャ(NearestFilter)は three が textureLoad に変換する。
266
+ *
267
+ * @param texel - スロット内のテクセル番号
268
+ */
269
+ _param(texel) {
270
+ const size = this._parameterTextureSizeNode ?? (0, import_tsl2.uniform)(this.parameterTextureSize);
271
+ const texelUV = (0, import_tsl2.vec2)((0, import_tsl2.float)(texel).add(0.5), this._slot().add(0.5)).div(size);
272
+ return this._sample("parameterTextureMap", texelUV);
273
+ }
274
+ /**
275
+ * UV アニメーション(回転 → スクロール)を適用した UV
276
+ *
277
+ * GLSL 版と同じく、マスクは B チャンネル、回転は (0.5, 0.5) 中心。
278
+ */
279
+ _animatedUV() {
280
+ const p6 = this._param(6);
281
+ const p7 = this._param(7);
282
+ const mask = this.uvAnimationMaskTexture ? this._sample("uvAnimationMaskTexture", (0, import_tsl2.uv)()).b : (0, import_tsl2.float)(1);
283
+ const phase = p6.a.mul(mask);
284
+ const c = (0, import_tsl2.cos)(phase);
285
+ const s = (0, import_tsl2.sin)(phase);
286
+ const centered = (0, import_tsl2.uv)().sub(0.5);
287
+ const rotated = (0, import_tsl2.vec2)(
288
+ c.mul(centered.x).add(s.mul(centered.y)),
289
+ s.negate().mul(centered.x).add(c.mul(centered.y))
290
+ ).add(0.5);
291
+ return rotated.add((0, import_tsl2.vec2)(p7.b, p7.a).mul(mask));
292
+ }
293
+ setupLightingModel() {
294
+ return new MToonAtlasLightingModel();
295
+ }
296
+ setupDiffuseColor(builder) {
297
+ const p0 = this._param(0);
298
+ let color = (0, import_tsl2.vec4)(p0.rgb, 1);
299
+ if (this.map) {
300
+ color = color.mul(this._sample("map", this._animatedUV()));
301
+ }
302
+ const prevColor = this.colorNode;
303
+ const prevOpacity = this.opacityNode;
304
+ this.colorNode = color;
305
+ this.opacityNode = p0.a;
306
+ super.setupDiffuseColor(builder);
307
+ this.colorNode = prevColor;
308
+ this.opacityNode = prevOpacity;
309
+ }
310
+ setupVariants() {
311
+ const animatedUV = this._animatedUV();
312
+ let shade = this._param(1).rgb;
313
+ if (this.shadeMultiplyTexture) {
314
+ shade = shade.mul(this._sample("shadeMultiplyTexture", animatedUV).rgb);
315
+ }
316
+ shadeColor.assign(shade);
317
+ let shift = this._param(8).r.mul(2).sub(1);
318
+ if (this.shadingShiftTexture) {
319
+ shift = shift.add(this._sample("shadingShiftTexture", animatedUV).r.mul(this._param(1).a));
320
+ }
321
+ shadingShift.assign(shift);
322
+ shadingToony.assign(this._param(6).g);
323
+ rim.assign(this._rimNode(animatedUV));
324
+ }
325
+ /**
326
+ * パラメトリックリム + matcap に rimMultiplyTexture を掛けたもの
327
+ *
328
+ * @param animatedUV - UV アニメーション適用済みの UV
329
+ */
330
+ _rimNode(animatedUV) {
331
+ const p3 = this._param(3);
332
+ const p5 = this._param(5);
333
+ const p6 = this._param(6);
334
+ const viewDir = import_tsl2.positionViewDirection;
335
+ let rimColor = p5.rgb.mul(
336
+ (0, import_tsl2.float)(1).sub(viewDir.dot(import_tsl2.normalView)).add(p5.a).clamp().pow(p6.r)
337
+ );
338
+ if (this.matcapTexture) {
339
+ const x = (0, import_tsl2.vec3)(viewDir.z, 0, viewDir.x.negate()).normalize();
340
+ const y = viewDir.cross(x);
341
+ const sphereUV = (0, import_tsl2.vec2)(x.dot(import_tsl2.normalView), y.dot(import_tsl2.normalView).negate()).mul(0.5).add(0.5);
342
+ rimColor = rimColor.add(p3.rgb.mul(this._sample("matcapTexture", sphereUV).rgb));
343
+ }
344
+ if (this.rimMultiplyTexture) {
345
+ rimColor = rimColor.mul(this._sample("rimMultiplyTexture", animatedUV).rgb);
346
+ }
347
+ return rimColor;
348
+ }
349
+ setupNormal() {
350
+ let normal = import_tsl2.materialNormal;
351
+ if (this.normalMap) {
352
+ const normalScale = this._param(7).xy;
353
+ normal = (0, import_tsl2.normalMap)(this._sample("normalMap", this._animatedUV()), normalScale);
354
+ }
355
+ if (this._isOutline) {
356
+ normal = normal.negate();
357
+ }
358
+ return normal;
359
+ }
360
+ setupLighting(builder) {
361
+ const p2 = this._param(2);
362
+ let emissive = p2.rgb.mul(p2.a);
363
+ if (this.emissiveMap) {
364
+ emissive = emissive.mul(this._sample("emissiveMap", this._animatedUV()).rgb);
365
+ }
366
+ const prevEmissive = this.emissiveNode;
367
+ this.emissiveNode = emissive;
368
+ const result = super.setupLighting(builder);
369
+ this.emissiveNode = prevEmissive;
370
+ return result;
371
+ }
372
+ setupPosition(builder) {
373
+ if (!this._hasOutlineWidth()) {
374
+ return super.setupPosition(builder);
375
+ }
376
+ const normalLocalNormalized = import_tsl2.normalLocal.normalize();
377
+ const width = this._param(3).a;
378
+ const worldNormalLength = (0, import_tsl2.length)(import_tsl2.modelNormalMatrix.mul(normalLocalNormalized));
379
+ let offset = width.mul(worldNormalLength).mul(normalLocalNormalized);
380
+ if (this._outlineWidthMode === "screenCoordinates") {
381
+ const projection = import_tsl2.cameraProjectionMatrix;
382
+ const clipScale = projection.element((0, import_tsl2.int)(1)).y;
383
+ const viewZ = import_tsl2.modelViewMatrix.mul((0, import_tsl2.vec4)(import_tsl2.positionLocal, 1)).z;
384
+ offset = offset.div(clipScale).mul(viewZ.negate());
385
+ }
386
+ const prevPosition = this.positionNode;
387
+ this.positionNode = (prevPosition ?? import_tsl2.positionLocal).add(offset);
388
+ const result = super.setupPosition(builder);
389
+ this.positionNode = prevPosition;
390
+ return result;
391
+ }
392
+ setupOutput(builder, outputNode) {
393
+ let output = outputNode;
394
+ if (this._hasOutlineWidth()) {
395
+ const p4 = this._param(4);
396
+ const color = outputNode;
397
+ output = (0, import_tsl2.vec4)(p4.rgb.mul((0, import_tsl2.mix)((0, import_tsl2.vec3)(1), color.xyz, p4.a)), color.w);
398
+ }
399
+ return super.setupOutput(builder, output);
400
+ }
401
+ /** アウトラインとして押し出し・着色するかどうか */
402
+ _hasOutlineWidth() {
403
+ return this._isOutline && this._outlineWidthMode !== "none";
404
+ }
405
+ _setAtlasedTextures(atlases) {
406
+ if (atlases.baseColor) this.map = atlases.baseColor;
407
+ if (atlases.shade) this.shadeMultiplyTexture = atlases.shade;
408
+ if (atlases.shadingShift) this.shadingShiftTexture = atlases.shadingShift;
409
+ if (atlases.normal) this.normalMap = atlases.normal;
410
+ if (atlases.emissive) this.emissiveMap = atlases.emissive;
411
+ if (atlases.matcap) this.matcapTexture = atlases.matcap;
412
+ if (atlases.rim) this.rimMultiplyTexture = atlases.rim;
413
+ if (atlases.uvAnimationMask) this.uvAnimationMaskTexture = atlases.uvAnimationMask;
414
+ }
415
+ };
416
+ // Annotate the CommonJS export names for ESM import in node:
417
+ 0 && (module.exports = {
418
+ MToonAtlasLightingModel,
419
+ MToonAtlasNodeMaterial
420
+ });
421
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/nodes/index.ts","../../src/nodes/MToonAtlasNodeMaterial.ts","../../src/nodes/MToonAtlasLightingModel.ts"],"sourcesContent":["/**\n * @webxr-jp/mtoon-atlas/nodes\n *\n * WebGPURenderer 向けの TSL 版マテリアル。\n * `three/webgpu` に依存するため、WebGL 専用のメインエントリとは分けて公開する。\n */\n\nexport { MToonAtlasNodeMaterial } from './MToonAtlasNodeMaterial'\nexport type { MToonAtlasNodeOptions } from './MToonAtlasNodeMaterial'\nexport { MToonAtlasLightingModel } from './MToonAtlasLightingModel'\n","/**\n * MToonAtlasNodeMaterial\n *\n * MToonAtlasMaterial(GLSL / WebGLRenderer 専用)の TSL 版。\n * WebGPURenderer(WebGPU / WebGL2 バックエンドの両方)で描画できる。\n *\n * avatar-optimizer が生成したアトラステクスチャとパラメータテクスチャを読み、\n * 頂点属性(既定 `mtoonMaterialSlot`)で指定されたスロットの MToon パラメータを\n * フラグメントごとに復元する。計算内容は GLSL 版と同じにしてある\n * (ライティングは MToonAtlasLightingModel を参照)。\n *\n * テクスチャノードはマテリアルごとに作り、同じテクスチャを複数回読む場合は\n * `texture().sample(uv)` で 1 つのバインディングを共有する。\n * (materialReference を UV コンテキストだけ変えて複数回使うと、TSL が\n * 最初のサンプリング結果を使い回してしまい、パラメータが全てテクセル 0 になる)\n * テクスチャをノードに直接持たせるため、マテリアル間でシェーダーを共有しない\n * よう customProgramCacheKey にマテリアル ID を含めている。\n */\n\nimport {\n attribute,\n cameraProjectionMatrix,\n cos,\n float,\n int,\n length,\n materialNormal,\n mix,\n modelNormalMatrix,\n modelViewMatrix,\n normalLocal,\n normalMap,\n normalView,\n positionLocal,\n positionViewDirection,\n sin,\n texture,\n uniform,\n uv,\n vec2,\n vec3,\n vec4,\n} from 'three/tsl'\nimport { BackSide, FrontSide, NodeMaterial, Vector2 } from 'three/webgpu'\nimport type { Node, NodeBuilder, NodeMaterialParameters, Texture, TextureNode } from 'three/webgpu'\nimport type {\n AtlasedTextureSet,\n MaterialSlotAttributeConfig,\n OutlineWidthMode,\n ParameterTextureDescriptor,\n} from '../types'\nimport {\n MToonAtlasLightingModel,\n rim,\n shadeColor,\n shadingShift,\n shadingToony,\n} from './MToonAtlasLightingModel'\n\n/**\n * MToonAtlasNodeMaterial のコンストラクタオプション\n */\nexport interface MToonAtlasNodeOptions extends NodeMaterialParameters\n{\n /** パラメータテクスチャディスクリプタ(アトラステクスチャを含む) */\n parameterTexture?: ParameterTextureDescriptor\n\n /** スロット属性設定 */\n slotAttribute?: MaterialSlotAttributeConfig\n}\n\nconst DEFAULT_SLOT_ATTRIBUTE_NAME = 'mtoonMaterialSlot'\n\n/** サンプリング対象になるテクスチャプロパティ */\ntype TextureProperty =\n | 'parameterTextureMap'\n | 'map'\n | 'normalMap'\n | 'emissiveMap'\n | 'shadeMultiplyTexture'\n | 'shadingShiftTexture'\n | 'matcapTexture'\n | 'rimMultiplyTexture'\n | 'uvAnimationMaskTexture'\n\n/**\n * MToon のパラメータテクスチャとアトラスを使う統合マテリアル(TSL 版)\n */\nexport class MToonAtlasNodeMaterial extends NodeMaterial\n{\n /** マテリアル識別フラグ(GLSL 版と共通。エクスポーターが参照する) */\n readonly isMToonAtlasMaterial = true as const\n\n /** TSL 版であることを示すフラグ */\n readonly isMToonAtlasNodeMaterial = true as const\n\n // ---- シェーダーから参照されるテクスチャ・パラメータ ----\n // 自前のプロパティは three がキャッシュキーに含めるため、\n // テクスチャの有無が変わるとシェーダーが作り直される\n\n /** パラメータテクスチャ(スロット × テクセル) */\n parameterTextureMap: Texture | null = null\n /** パラメータテクスチャの大きさ(x = テクセル数/スロット、y = スロット数) */\n parameterTextureSize = new Vector2(1, 1)\n /** ベースカラーアトラス */\n map: Texture | null = null\n /** ノーマルマップアトラス */\n normalMap: Texture | null = null\n /** エミッシブアトラス */\n emissiveMap: Texture | null = null\n /** 影色乗算アトラス */\n shadeMultiplyTexture: Texture | null = null\n /** シェーディングシフトアトラス */\n shadingShiftTexture: Texture | null = null\n /** matcap テクスチャ */\n matcapTexture: Texture | null = null\n /** リム乗算アトラス */\n rimMultiplyTexture: Texture | null = null\n /** UV アニメーションマスクアトラス */\n uvAnimationMaskTexture: Texture | null = null\n\n /**\n * エミッシブを差し替えるノード(NodeMaterial.setupLighting が参照する)。\n * 通常は null のままで、パラメータテクスチャから求めた値が使われる\n */\n emissiveNode: Node | null = null\n\n private _parameterTexture: ParameterTextureDescriptor | undefined\n private _slotAttribute: MaterialSlotAttributeConfig = { name: DEFAULT_SLOT_ATTRIBUTE_NAME }\n private _isOutline = false\n private _outlineWidthMode: OutlineWidthMode = 'none'\n\n // シェーダー構築中に使うテクスチャノード(構築ごとに作り直す)\n private _textureNodes = new Map<TextureProperty, TextureNode>()\n private _parameterTextureSizeNode: Node<'vec2'> | null = null\n\n /**\n * コンストラクタ\n *\n * @param parameters - オプション\n */\n constructor(parameters: MToonAtlasNodeOptions = {})\n {\n super()\n this.lights = true\n\n const { parameterTexture, slotAttribute, ...rest } = parameters\n this.setValues(rest)\n\n if (parameterTexture)\n {\n this.setParameterTexture(parameterTexture)\n }\n if (slotAttribute)\n {\n this.setSlotAttribute(slotAttribute)\n }\n }\n\n /**\n * パラメータテクスチャを設定する\n *\n * atlasedTextures を含む場合は各アトラステクスチャも設定する。\n *\n * @param descriptor - パラメータテクスチャディスクリプタ。null で解除\n * @returns this\n */\n setParameterTexture(descriptor: ParameterTextureDescriptor | null): this\n {\n this._parameterTexture = descriptor ?? undefined\n\n if (descriptor)\n {\n this.parameterTextureMap = descriptor.texture\n this.parameterTextureSize.set(descriptor.texelsPerSlot, descriptor.slotCount)\n if (descriptor.atlasedTextures)\n {\n this._setAtlasedTextures(descriptor.atlasedTextures)\n }\n }\n else\n {\n this.parameterTextureMap = null\n this.parameterTextureSize.set(1, 1)\n }\n\n this.needsUpdate = true\n return this\n }\n\n /**\n * スロット属性を設定する\n *\n * @param config - スロット属性設定\n * @returns this\n */\n setSlotAttribute(config: MaterialSlotAttributeConfig): this\n {\n if (config.name !== this._slotAttribute.name)\n {\n this.needsUpdate = true\n }\n this._slotAttribute = { ...config }\n return this\n }\n\n /** パラメータテクスチャディスクリプタ */\n get parameterTexture(): ParameterTextureDescriptor | undefined\n {\n return this._parameterTexture\n }\n\n /** スロット属性設定 */\n get slotAttribute(): MaterialSlotAttributeConfig\n {\n return this._slotAttribute\n }\n\n /** アウトライン用マテリアルかどうか。true にすると裏面を描画する */\n get isOutline(): boolean\n {\n return this._isOutline\n }\n\n set isOutline(value: boolean)\n {\n if (this._isOutline === value) return\n this._isOutline = value\n this.side = value ? BackSide : FrontSide\n this.needsUpdate = true\n }\n\n /** アウトライン幅の計算方式 */\n get outlineWidthMode(): OutlineWidthMode\n {\n return this._outlineWidthMode\n }\n\n set outlineWidthMode(value: OutlineWidthMode)\n {\n if (this._outlineWidthMode === value) return\n this._outlineWidthMode = value\n this.needsUpdate = true\n }\n\n /**\n * このマテリアルを元にアウトライン用マテリアルを作る\n *\n * @param widthMode - アウトライン幅の計算方式\n * @returns アウトライン用マテリアル\n */\n createOutlineMaterial(widthMode: Exclude<OutlineWidthMode, 'none'> = 'worldCoordinates'): MToonAtlasNodeMaterial\n {\n const outline = this.clone()\n outline.outlineWidthMode = widthMode\n outline.isOutline = true\n outline.polygonOffset = true\n outline.polygonOffsetFactor = 1\n outline.polygonOffsetUnits = 1\n return outline\n }\n\n /**\n * UV アニメーションの更新(GLSL 版と同じく現状は何もしない)\n *\n * パラメータテクスチャのオフセット値をそのまま使うため、時間経過による\n * 更新は行わない。three-vrm の VRM.update() から呼ばれる。\n */\n update(_deltaTime: number): void\n {\n // 意図的に何もしない\n }\n\n customProgramCacheKey(): string\n {\n // is〜 で始まるプロパティと _ で始まるプロパティは three のキャッシュキーに\n // 含まれないため、シェーダー構成に影響するものをここで加える\n // テクスチャをノードに直接持たせているため、マテリアル ID も含めて\n // 別マテリアルとシェーダー(バインディング)を共有しないようにする\n return (\n super.customProgramCacheKey() +\n `mtoonAtlas:${this.uuid},${this._isOutline},${this._outlineWidthMode},${this._slotAttribute.name},`\n )\n }\n\n copy(source: MToonAtlasNodeMaterial): this\n {\n super.copy(source)\n\n this.parameterTextureMap = source.parameterTextureMap\n this.parameterTextureSize.copy(source.parameterTextureSize)\n this.map = source.map\n this.normalMap = source.normalMap\n this.emissiveMap = source.emissiveMap\n this.shadeMultiplyTexture = source.shadeMultiplyTexture\n this.shadingShiftTexture = source.shadingShiftTexture\n this.matcapTexture = source.matcapTexture\n this.rimMultiplyTexture = source.rimMultiplyTexture\n this.uvAnimationMaskTexture = source.uvAnimationMaskTexture\n\n this._parameterTexture = source._parameterTexture ? { ...source._parameterTexture } : undefined\n this._slotAttribute = { ...source._slotAttribute }\n this._isOutline = source._isOutline\n this._outlineWidthMode = source._outlineWidthMode\n\n return this\n }\n\n // ---- ノード構築 ----\n\n setup(builder: NodeBuilder): void\n {\n this._textureNodes = new Map()\n this._parameterTextureSizeNode = uniform(this.parameterTextureSize)\n super.setup(builder)\n }\n\n /**\n * テクスチャプロパティを指定 UV でサンプリングする\n *\n * 同じテクスチャは 1 つの TextureNode を元に sample() するので、\n * 何回読んでもバインディングは 1 つで済む。\n *\n * @param property - 読むテクスチャのプロパティ名(null でないこと)\n * @param uvNode - サンプリングする UV\n */\n private _sample(property: TextureProperty, uvNode: Node<'vec2'>): Node<'vec4'>\n {\n let base = this._textureNodes.get(property)\n if (!base)\n {\n base = texture(this[property] as Texture)\n this._textureNodes.set(property, base)\n }\n return base.sample(uvNode)\n }\n\n /** 現在のフラグメント / 頂点のスロット番号 */\n private _slot(): Node<'float'>\n {\n return attribute(this._slotAttribute.name, 'float')\n }\n\n /**\n * パラメータテクスチャの 1 テクセルを読む\n *\n * GLSL 版の sampleParameter と同じく、テクセル中心の UV で読む。\n * float テクスチャ(NearestFilter)は three が textureLoad に変換する。\n *\n * @param texel - スロット内のテクセル番号\n */\n private _param(texel: number): Node<'vec4'>\n {\n const size = this._parameterTextureSizeNode ?? uniform(this.parameterTextureSize)\n const texelUV = vec2(float(texel).add(0.5), this._slot().add(0.5)).div(size)\n return this._sample('parameterTextureMap', texelUV)\n }\n\n /**\n * UV アニメーション(回転 → スクロール)を適用した UV\n *\n * GLSL 版と同じく、マスクは B チャンネル、回転は (0.5, 0.5) 中心。\n */\n private _animatedUV(): Node<'vec2'>\n {\n const p6 = this._param(6)\n const p7 = this._param(7)\n const mask = this.uvAnimationMaskTexture\n ? this._sample('uvAnimationMaskTexture', uv()).b\n : float(1)\n\n const phase = p6.a.mul(mask)\n const c = cos(phase)\n const s = sin(phase)\n const centered = uv().sub(0.5)\n // mat2( c, -s, s, c ) * centered(GLSL は列優先)\n const rotated = vec2(\n c.mul(centered.x).add(s.mul(centered.y)),\n s.negate().mul(centered.x).add(c.mul(centered.y)),\n ).add(0.5)\n return rotated.add(vec2(p7.b, p7.a).mul(mask))\n }\n\n setupLightingModel(): MToonAtlasLightingModel\n {\n return new MToonAtlasLightingModel()\n }\n\n setupDiffuseColor(builder: NodeBuilder): void\n {\n const p0 = this._param(0)\n let color: Node<'vec4'> = vec4(p0.rgb, 1)\n if (this.map)\n {\n color = color.mul(this._sample('map', this._animatedUV()))\n }\n\n const prevColor = this.colorNode\n const prevOpacity = this.opacityNode\n this.colorNode = color\n this.opacityNode = p0.a\n super.setupDiffuseColor(builder)\n this.colorNode = prevColor\n this.opacityNode = prevOpacity\n }\n\n setupVariants(): void\n {\n const animatedUV = this._animatedUV()\n\n // 影色\n let shade: Node<'vec3'> = this._param(1).rgb\n if (this.shadeMultiplyTexture)\n {\n shade = shade.mul(this._sample('shadeMultiplyTexture', animatedUV).rgb)\n }\n shadeColor.assign(shade)\n\n // シェーディングシフト(0〜1 で保存されているので -1〜1 に戻す)\n let shift: Node<'float'> = this._param(8).r.mul(2).sub(1)\n if (this.shadingShiftTexture)\n {\n shift = shift.add(this._sample('shadingShiftTexture', animatedUV).r.mul(this._param(1).a))\n }\n shadingShift.assign(shift)\n\n shadingToony.assign(this._param(6).g)\n\n rim.assign(this._rimNode(animatedUV))\n }\n\n /**\n * パラメトリックリム + matcap に rimMultiplyTexture を掛けたもの\n *\n * @param animatedUV - UV アニメーション適用済みの UV\n */\n private _rimNode(animatedUV: Node<'vec2'>): Node<'vec3'>\n {\n const p3 = this._param(3)\n const p5 = this._param(5)\n const p6 = this._param(6)\n const viewDir = positionViewDirection\n\n // parametricRimColor × pow( saturate( 1 - dot( viewDir, normal ) + lift ), fresnelPower )\n let rimColor: Node<'vec3'> = p5.rgb.mul(\n float(1).sub(viewDir.dot(normalView)).add(p5.a).clamp().pow(p6.r),\n )\n\n if (this.matcapTexture)\n {\n // GLSL 版と同じ球面 UV\n const x = vec3(viewDir.z, 0, viewDir.x.negate()).normalize()\n const y = viewDir.cross(x)\n const sphereUV = vec2(x.dot(normalView), y.dot(normalView).negate()).mul(0.5).add(0.5)\n rimColor = rimColor.add(p3.rgb.mul(this._sample('matcapTexture', sphereUV).rgb))\n }\n\n if (this.rimMultiplyTexture)\n {\n rimColor = rimColor.mul(this._sample('rimMultiplyTexture', animatedUV).rgb)\n }\n\n return rimColor\n }\n\n setupNormal(): Node\n {\n let normal: Node<'vec3'> = materialNormal\n if (this.normalMap)\n {\n const normalScale = this._param(7).xy\n normal = normalMap(this._sample('normalMap', this._animatedUV()), normalScale)\n }\n if (this._isOutline)\n {\n normal = normal.negate()\n }\n return normal\n }\n\n setupLighting(builder: NodeBuilder): Node\n {\n const p2 = this._param(2)\n let emissive: Node<'vec3'> = p2.rgb.mul(p2.a)\n if (this.emissiveMap)\n {\n emissive = emissive.mul(this._sample('emissiveMap', this._animatedUV()).rgb)\n }\n\n const prevEmissive = this.emissiveNode\n this.emissiveNode = emissive\n const result = super.setupLighting(builder)\n this.emissiveNode = prevEmissive\n return result\n }\n\n setupPosition(builder: NodeBuilder): Node\n {\n if (!this._hasOutlineWidth())\n {\n return super.setupPosition(builder)\n }\n\n // GLSL 版と同じく、法線方向に outlineWidthFactor × ワールド法線長だけ押し出す\n const normalLocalNormalized = normalLocal.normalize()\n const width = this._param(3).a\n const worldNormalLength = length(modelNormalMatrix.mul(normalLocalNormalized))\n let offset: Node<'vec3'> = width.mul(worldNormalLength).mul(normalLocalNormalized)\n\n if (this._outlineWidthMode === 'screenCoordinates')\n {\n // 画面上で一定幅にするため、視点距離 / 投影スケールを掛ける\n // projectionMatrix[1][1]。@types/three は mat4 の element() を宣言していないため型を付け直す\n const projection = cameraProjectionMatrix as unknown as { element: (index: Node) => Node<'vec4'> }\n const clipScale = projection.element(int(1)).y\n const viewZ = modelViewMatrix.mul(vec4(positionLocal, 1)).z\n offset = offset.div(clipScale).mul(viewZ.negate())\n }\n\n const prevPosition = this.positionNode\n this.positionNode = ((prevPosition as Node<'vec3'> | null) ?? positionLocal).add(offset)\n const result = super.setupPosition(builder)\n this.positionNode = prevPosition\n return result\n }\n\n setupOutput(builder: NodeBuilder, outputNode: Node): Node\n {\n let output = outputNode\n if (this._hasOutlineWidth())\n {\n // outlineColor × mix( 1, 陰影込みの色, outlineLightingMix )\n const p4 = this._param(4)\n const color = outputNode as Node<'vec4'>\n output = vec4(p4.rgb.mul(mix(vec3(1), color.xyz, p4.a)), color.w)\n }\n return super.setupOutput(builder, output)\n }\n\n /** アウトラインとして押し出し・着色するかどうか */\n private _hasOutlineWidth(): boolean\n {\n return this._isOutline && this._outlineWidthMode !== 'none'\n }\n\n private _setAtlasedTextures(atlases: AtlasedTextureSet): void\n {\n if (atlases.baseColor) this.map = atlases.baseColor\n if (atlases.shade) this.shadeMultiplyTexture = atlases.shade\n if (atlases.shadingShift) this.shadingShiftTexture = atlases.shadingShift\n if (atlases.normal) this.normalMap = atlases.normal\n if (atlases.emissive) this.emissiveMap = atlases.emissive\n if (atlases.matcap) this.matcapTexture = atlases.matcap\n if (atlases.rim) this.rimMultiplyTexture = atlases.rim\n if (atlases.uvAnimationMask) this.uvAnimationMaskTexture = atlases.uvAnimationMask\n }\n}\n","/**\n * MToonAtlasNodeMaterial 用のライティングモデル(TSL)\n *\n * GLSL 版(shaders/mtoon.frag の RE_Direct_MToon / RE_IndirectDiffuse_MToon)と\n * 同じ計算を行う。three-vrm の MToonLightingModel とは次の点で異なる。\n *\n * - 影はライト色ではなくシェーディング係数に掛ける。影の中は黒ではなく\n * shadeColor になる(WebGL 版 MToon と同じ見た目)\n * - リムの乗算値は rimLightingMix を使わず、常に「直接光 + 環境光」を使う\n * (WebGL 版 MToon の `mix( vec3( 1.0 ), directSpecular, 1.0 )` に合わせる)\n *\n * マテリアル側で計算した値は、setupVariants で下記の PropertyNode に代入され、\n * このモデルから参照される。\n */\n\nimport {\n BRDF_Lambert,\n diffuseColor,\n float,\n mix,\n normalView,\n property,\n} from 'three/tsl'\nimport { LightingModel } from 'three/webgpu'\nimport type { Node, NodeBuilder } from 'three/webgpu'\nimport type { LightingModelDirectInput } from 'three/src/nodes/core/LightingModel.js'\n\n/**\n * LightingModel に渡される反射光の出力先\n *\n * @types/three では型パラメータなしの Node として宣言されており、\n * そのままでは addAssign / mul などの演算メソッドが型の上で使えない。\n * three 側の実体は vec3 なので、型だけ付け直して扱う。\n */\ninterface ReflectedLight\n{\n directDiffuse: Node<'vec3'>\n directSpecular: Node<'vec3'>\n indirectDiffuse: Node<'vec3'>\n indirectSpecular: Node<'vec3'>\n}\n\n/** 影色(shadeColorFactor × shadeMultiplyTexture) */\nexport const shadeColor = property('vec3').toVar('MToonAtlasShadeColor')\n/** シェーディングシフト(shadingShiftFactor + shadingShiftTexture × scale) */\nexport const shadingShift = property('float').toVar('MToonAtlasShadingShift')\n/** トゥーン度(shadingToonyFactor) */\nexport const shadingToony = property('float').toVar('MToonAtlasShadingToony')\n/** リム(パラメトリックリム + matcap)× rimMultiplyTexture */\nexport const rim = property('vec3').toVar('MToonAtlasRim')\n\n/**\n * three のライトノードのうち、影の分離に使うプロパティ\n *\n * AnalyticLightNode.setupShadow は影ありの色で colorNode を置き換え、\n * 元の色を baseColorNode に退避する。\n */\ninterface ShadowedLightNode\n{\n light?: { isDirectionalLight?: boolean }\n shadowNode?: Node | null\n baseColorNode?: Node | null\n}\n\n/**\n * 影を除いたライト色と影の係数を求める\n *\n * 平行光源は lightColor = baseColorNode × shadowNode なので分離できる。\n * 点光源・スポットライトは減衰も掛かった値しか渡されないため分離せず、\n * three 既定の「ライト色に影を掛ける」挙動のままにする。\n */\nfunction splitShadow(lightColor: Node, lightNode: Node): { color: Node<'vec3'>, shadow: Node<'float'> }\n{\n const node = lightNode as unknown as ShadowedLightNode\n if (node.light?.isDirectionalLight && node.shadowNode && node.baseColorNode)\n {\n return { color: node.baseColorNode as Node<'vec3'>, shadow: node.shadowNode as Node<'float'> }\n }\n return { color: lightColor as Node<'vec3'>, shadow: float(1) }\n}\n\n/**\n * Lambert BRDF(diffuseColor / PI)\n *\n * @types/three の BRDF_Lambert は戻り値が型パラメータなしの OperatorNode のため、\n * vec3 として型を付け直す。\n */\nfunction lambert(diffuse: Node<'vec3'>): Node<'vec3'>\n{\n return BRDF_Lambert({ diffuseColor: diffuse }) as unknown as Node<'vec3'>\n}\n\n/**\n * MToon のトゥーンシェーディングを行うライティングモデル\n */\nexport class MToonAtlasLightingModel extends LightingModel\n{\n direct({ lightDirection, lightColor, lightNode, reflectedLight }: LightingModelDirectInput): void\n {\n const { color, shadow } = splitShadow(lightColor, lightNode)\n const out = reflectedLight as ReflectedLight\n\n const dotNL = normalView.dot(lightDirection as Node<'vec3'>).clamp(-1, 1)\n // linearstep( -1 + toony, 1 - toony, dotNL + shift ) × shadow\n const a = float(-1).add(shadingToony)\n const b = float(1).sub(shadingToony)\n const shading = dotNL.add(shadingShift).sub(a).div(b.sub(a)).clamp().mul(shadow)\n\n const feathered = mix(shadeColor, diffuseColor.rgb, shading)\n out.directDiffuse.addAssign(color.mul(lambert(feathered)))\n\n // directSpecular はリムに使う(GLSL 版では Σライト色 / PI を rim に掛ける)\n out.directSpecular.addAssign(color.mul(lambert(rim)))\n }\n\n indirect(builder: NodeBuilder): void\n {\n const context = (builder as unknown as { context: { irradiance: Node<'vec3'>, reflectedLight: ReflectedLight } }).context\n const { irradiance, reflectedLight } = context\n\n // 環境光は shadeColor を使わず diffuseColor のみ\n reflectedLight.indirectDiffuse.addAssign(irradiance.mul(lambert(diffuseColor.rgb)))\n reflectedLight.indirectSpecular.addAssign(irradiance.mul(lambert(rim)))\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBA,IAAAA,cAuBO;AACP,IAAAC,iBAA2D;;;AC5B3D,iBAOO;AACP,oBAA8B;AAoBvB,IAAM,iBAAa,qBAAS,MAAM,EAAE,MAAM,sBAAsB;AAEhE,IAAM,mBAAe,qBAAS,OAAO,EAAE,MAAM,wBAAwB;AAErE,IAAM,mBAAe,qBAAS,OAAO,EA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AEA,UAAM,eAAe,KAAK;AAC1B,SAAK,gBAAiB,gBAAwC,2BAAe,IAAI,MAAM;AACvF,UAAM,SAAS,MAAM,cAAc,OAAO;AAC1C,SAAK,eAAe;AACpB,WAAO;AAAA,EACT;AAAA,EAEA,YAAY,SAAsB,YAClC;AACE,QAAI,SAAS;AACb,QAAI,KAAK,iBAAiB,GAC1B;AAEE,YAAM,KAAK,KAAK,OAAO,CAAC;AACxB,YAAM,QAAQ;AACd,mBAAS,kBAAK,GAAG,IAAI,QAAI,qBAAI,kBAAK,CAAC,GAAG,MAAM,KAAK,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;AAAA,IAClE;AACA,WAAO,MAAM,YAAY,SAAS,MAAM;AAAA,EAC1C;AAAA;AAAA,EAGQ,mBACR;AACE,WAAO,KAAK,cAAc,KAAK,sBAAsB;AAAA,EACvD;AAAA,EAEQ,oBAAoB,SAC5B;AACE,QAAI,QAAQ,UAAW,MAAK,MAAM,QAAQ;AAC1C,QAAI,QAAQ,MAAO,MAAK,uBAAuB,QAAQ;AACvD,QAAI,QAAQ,aAAc,MAAK,sBAAsB,QAAQ;AAC7D,QAAI,QAAQ,OAAQ,MAAK,YAAY,QAAQ;AAC7C,QAAI,QAAQ,SAAU,MAAK,cAAc,QAAQ;AACjD,QAAI,QAAQ,OAAQ,MAAK,gBAAgB,QAAQ;AACjD,QAAI,QAAQ,IAAK,MAAK,qBAAqB,QAAQ;AACnD,QAAI,QAAQ,gBAAiB,MAAK,yBAAyB,QAAQ;AAAA,EACrE;AACF;","names":["import_tsl","import_webgpu","property"]}
@@ -0,0 +1,175 @@
1
+ import { LightingModel, NodeBuilder, NodeMaterial, Texture, Vector2, Node, NodeMaterialParameters } from 'three/webgpu';
2
+ import { P as ParameterTextureDescriptor, a as MaterialSlotAttributeConfig, O as OutlineWidthMode } from '../types-CLtJAPmH.cjs';
3
+ import { LightingModelDirectInput } from 'three/src/nodes/core/LightingModel.js';
4
+ import 'three';
5
+
6
+ /**
7
+ * MToon のトゥーンシェーディングを行うライティングモデル
8
+ */
9
+ declare class MToonAtlasLightingModel extends LightingModel {
10
+ direct({ lightDirection, lightColor, lightNode, reflectedLight }: LightingModelDirectInput): void;
11
+ indirect(builder: NodeBuilder): void;
12
+ }
13
+
14
+ /**
15
+ * MToonAtlasNodeMaterial
16
+ *
17
+ * MToonAtlasMaterial(GLSL / WebGLRenderer 専用)の TSL 版。
18
+ * WebGPURenderer(WebGPU / WebGL2 バックエンドの両方)で描画できる。
19
+ *
20
+ * avatar-optimizer が生成したアトラステクスチャとパラメータテクスチャを読み、
21
+ * 頂点属性(既定 `mtoonMaterialSlot`)で指定されたスロットの MToon パラメータを
22
+ * フラグメントごとに復元する。計算内容は GLSL 版と同じにしてある
23
+ * (ライティングは MToonAtlasLightingModel を参照)。
24
+ *
25
+ * テクスチャノードはマテリアルごとに作り、同じテクスチャを複数回読む場合は
26
+ * `texture().sample(uv)` で 1 つのバインディングを共有する。
27
+ * (materialReference を UV コンテキストだけ変えて複数回使うと、TSL が
28
+ * 最初のサンプリング結果を使い回してしまい、パラメータが全てテクセル 0 になる)
29
+ * テクスチャをノードに直接持たせるため、マテリアル間でシェーダーを共有しない
30
+ * よう customProgramCacheKey にマテリアル ID を含めている。
31
+ */
32
+
33
+ /**
34
+ * MToonAtlasNodeMaterial のコンストラクタオプション
35
+ */
36
+ interface MToonAtlasNodeOptions extends NodeMaterialParameters {
37
+ /** パラメータテクスチャディスクリプタ(アトラステクスチャを含む) */
38
+ parameterTexture?: ParameterTextureDescriptor;
39
+ /** スロット属性設定 */
40
+ slotAttribute?: MaterialSlotAttributeConfig;
41
+ }
42
+ /**
43
+ * MToon のパラメータテクスチャとアトラスを使う統合マテリアル(TSL 版)
44
+ */
45
+ declare class MToonAtlasNodeMaterial extends NodeMaterial {
46
+ /** マテリアル識別フラグ(GLSL 版と共通。エクスポーターが参照する) */
47
+ readonly isMToonAtlasMaterial: true;
48
+ /** TSL 版であることを示すフラグ */
49
+ readonly isMToonAtlasNodeMaterial: true;
50
+ /** パラメータテクスチャ(スロット × テクセル) */
51
+ parameterTextureMap: Texture | null;
52
+ /** パラメータテクスチャの大きさ(x = テクセル数/スロット、y = スロット数) */
53
+ parameterTextureSize: Vector2;
54
+ /** ベースカラーアトラス */
55
+ map: Texture | null;
56
+ /** ノーマルマップアトラス */
57
+ normalMap: Texture | null;
58
+ /** エミッシブアトラス */
59
+ emissiveMap: Texture | null;
60
+ /** 影色乗算アトラス */
61
+ shadeMultiplyTexture: Texture | null;
62
+ /** シェーディングシフトアトラス */
63
+ shadingShiftTexture: Texture | null;
64
+ /** matcap テクスチャ */
65
+ matcapTexture: Texture | null;
66
+ /** リム乗算アトラス */
67
+ rimMultiplyTexture: Texture | null;
68
+ /** UV アニメーションマスクアトラス */
69
+ uvAnimationMaskTexture: Texture | null;
70
+ /**
71
+ * エミッシブを差し替えるノード(NodeMaterial.setupLighting が参照する)。
72
+ * 通常は null のままで、パラメータテクスチャから求めた値が使われる
73
+ */
74
+ emissiveNode: Node | null;
75
+ private _parameterTexture;
76
+ private _slotAttribute;
77
+ private _isOutline;
78
+ private _outlineWidthMode;
79
+ private _textureNodes;
80
+ private _parameterTextureSizeNode;
81
+ /**
82
+ * コンストラクタ
83
+ *
84
+ * @param parameters - オプション
85
+ */
86
+ constructor(parameters?: MToonAtlasNodeOptions);
87
+ /**
88
+ * パラメータテクスチャを設定する
89
+ *
90
+ * atlasedTextures を含む場合は各アトラステクスチャも設定する。
91
+ *
92
+ * @param descriptor - パラメータテクスチャディスクリプタ。null で解除
93
+ * @returns this
94
+ */
95
+ setParameterTexture(descriptor: ParameterTextureDescriptor | null): this;
96
+ /**
97
+ * スロット属性を設定する
98
+ *
99
+ * @param config - スロット属性設定
100
+ * @returns this
101
+ */
102
+ setSlotAttribute(config: MaterialSlotAttributeConfig): this;
103
+ /** パラメータテクスチャディスクリプタ */
104
+ get parameterTexture(): ParameterTextureDescriptor | undefined;
105
+ /** スロット属性設定 */
106
+ get slotAttribute(): MaterialSlotAttributeConfig;
107
+ /** アウトライン用マテリアルかどうか。true にすると裏面を描画する */
108
+ get isOutline(): boolean;
109
+ set isOutline(value: boolean);
110
+ /** アウトライン幅の計算方式 */
111
+ get outlineWidthMode(): OutlineWidthMode;
112
+ set outlineWidthMode(value: OutlineWidthMode);
113
+ /**
114
+ * このマテリアルを元にアウトライン用マテリアルを作る
115
+ *
116
+ * @param widthMode - アウトライン幅の計算方式
117
+ * @returns アウトライン用マテリアル
118
+ */
119
+ createOutlineMaterial(widthMode?: Exclude<OutlineWidthMode, 'none'>): MToonAtlasNodeMaterial;
120
+ /**
121
+ * UV アニメーションの更新(GLSL 版と同じく現状は何もしない)
122
+ *
123
+ * パラメータテクスチャのオフセット値をそのまま使うため、時間経過による
124
+ * 更新は行わない。three-vrm の VRM.update() から呼ばれる。
125
+ */
126
+ update(_deltaTime: number): void;
127
+ customProgramCacheKey(): string;
128
+ copy(source: MToonAtlasNodeMaterial): this;
129
+ setup(builder: NodeBuilder): void;
130
+ /**
131
+ * テクスチャプロパティを指定 UV でサンプリングする
132
+ *
133
+ * 同じテクスチャは 1 つの TextureNode を元に sample() するので、
134
+ * 何回読んでもバインディングは 1 つで済む。
135
+ *
136
+ * @param property - 読むテクスチャのプロパティ名(null でないこと)
137
+ * @param uvNode - サンプリングする UV
138
+ */
139
+ private _sample;
140
+ /** 現在のフラグメント / 頂点のスロット番号 */
141
+ private _slot;
142
+ /**
143
+ * パラメータテクスチャの 1 テクセルを読む
144
+ *
145
+ * GLSL 版の sampleParameter と同じく、テクセル中心の UV で読む。
146
+ * float テクスチャ(NearestFilter)は three が textureLoad に変換する。
147
+ *
148
+ * @param texel - スロット内のテクセル番号
149
+ */
150
+ private _param;
151
+ /**
152
+ * UV アニメーション(回転 → スクロール)を適用した UV
153
+ *
154
+ * GLSL 版と同じく、マスクは B チャンネル、回転は (0.5, 0.5) 中心。
155
+ */
156
+ private _animatedUV;
157
+ setupLightingModel(): MToonAtlasLightingModel;
158
+ setupDiffuseColor(builder: NodeBuilder): void;
159
+ setupVariants(): void;
160
+ /**
161
+ * パラメトリックリム + matcap に rimMultiplyTexture を掛けたもの
162
+ *
163
+ * @param animatedUV - UV アニメーション適用済みの UV
164
+ */
165
+ private _rimNode;
166
+ setupNormal(): Node;
167
+ setupLighting(builder: NodeBuilder): Node;
168
+ setupPosition(builder: NodeBuilder): Node;
169
+ setupOutput(builder: NodeBuilder, outputNode: Node): Node;
170
+ /** アウトラインとして押し出し・着色するかどうか */
171
+ private _hasOutlineWidth;
172
+ private _setAtlasedTextures;
173
+ }
174
+
175
+ export { MToonAtlasLightingModel, MToonAtlasNodeMaterial, type MToonAtlasNodeOptions };