@babylonjs/serializers 8.33.4 → 8.34.1
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/glTF/2.0/Extensions/EXT_lights_area.d.ts +39 -0
- package/glTF/2.0/Extensions/EXT_lights_area.js +133 -0
- package/glTF/2.0/Extensions/EXT_lights_area.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js +32 -105
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +8 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +136 -13
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
- package/glTF/2.0/Extensions/{KHR_materials_clearcoat_darkening.d.ts → KHR_materials_coat.d.ts} +10 -2
- package/glTF/2.0/Extensions/KHR_materials_coat.js +383 -0
- package/glTF/2.0/Extensions/KHR_materials_coat.js.map +1 -0
- package/glTF/2.0/Extensions/{KHR_materials_clearcoat_color.d.ts → KHR_materials_fuzz.d.ts} +13 -5
- package/glTF/2.0/Extensions/KHR_materials_fuzz.js +194 -0
- package/glTF/2.0/Extensions/KHR_materials_fuzz.js.map +1 -0
- package/glTF/2.0/Extensions/index.d.ts +3 -4
- package/glTF/2.0/Extensions/index.js +3 -4
- package/glTF/2.0/Extensions/index.js.map +1 -1
- package/glTF/2.0/glTFAnimation.js +2 -2
- package/glTF/2.0/glTFAnimation.js.map +1 -1
- package/glTF/2.0/glTFMaterialExporter.d.ts +2 -2
- package/glTF/2.0/glTFMaterialExporter.js +85 -14
- package/glTF/2.0/glTFMaterialExporter.js.map +1 -1
- package/glTF/2.0/glTFUtilities.d.ts +2 -1
- package/glTF/2.0/glTFUtilities.js.map +1 -1
- package/package.json +3 -3
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_anisotropy.d.ts +0 -32
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_anisotropy.js +0 -231
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_anisotropy.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_color.js +0 -101
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_color.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_darkening.js +0 -70
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_darkening.js.map +0 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_ior.d.ts +0 -26
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_ior.js +0 -60
- package/glTF/2.0/Extensions/KHR_materials_clearcoat_ior.js.map +0 -1
|
@@ -2,7 +2,64 @@ import { GLTFExporter } from "../glTFExporter.js";
|
|
|
2
2
|
import { PBRBaseMaterial } from "@babylonjs/core/Materials/PBR/pbrBaseMaterial.js";
|
|
3
3
|
import { Tools } from "@babylonjs/core/Misc/tools.js";
|
|
4
4
|
import { OpenPBRMaterial } from "@babylonjs/core/Materials/PBR/openpbrMaterial.js";
|
|
5
|
+
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
6
|
+
import { MergeTexturesAsync, CreateRGBAConfiguration, CreateTextureInput, CreateConstantInput } from "@babylonjs/core/Materials/Textures/textureMerger.js";
|
|
5
7
|
const NAME = "KHR_materials_clearcoat";
|
|
8
|
+
/**
|
|
9
|
+
* Generate a unique ID for the merged coat textures based on the internal texture data.
|
|
10
|
+
* This is used for caching merged textures.
|
|
11
|
+
* @param babylonMaterial Source OpenPBR material
|
|
12
|
+
* @returns A unique ID string for the merged coat textures
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
function GetCoatTextureId(babylonMaterial) {
|
|
16
|
+
const coatTexture = babylonMaterial.coatWeightTexture;
|
|
17
|
+
const coatId = coatTexture && coatTexture.getInternalTexture() ? coatTexture.getInternalTexture().uniqueId : "NoCoat";
|
|
18
|
+
const coatRoughnessTexture = babylonMaterial.coatRoughnessTexture;
|
|
19
|
+
const roughnessId = coatRoughnessTexture && coatRoughnessTexture.getInternalTexture() ? coatRoughnessTexture.getInternalTexture().uniqueId : "NoRoughness";
|
|
20
|
+
return `${coatId}_${roughnessId}`;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Using the coat weight and coat roughness textures, create a merged internal texture that can be used
|
|
24
|
+
* for multiple textures (with potentially different transforms) on export.
|
|
25
|
+
* @param babylonMaterial The source OpenPBR material
|
|
26
|
+
* @returns A new, internal texture with the coat weight in the red channel and coat roughness in the green channel
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
async function CreateMergedCoatInternalTextureAsync(babylonMaterial) {
|
|
30
|
+
const scene = babylonMaterial.getScene();
|
|
31
|
+
const coatTexture = babylonMaterial.coatWeightTexture;
|
|
32
|
+
const coatRoughnessTexture = babylonMaterial.coatRoughnessTexture;
|
|
33
|
+
// If we don't have any textures, we don't need to generate anything.
|
|
34
|
+
if (!(coatTexture || coatRoughnessTexture)) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const texture = await MergeTexturesAsync("CoatTexture", CreateRGBAConfiguration(coatTexture ? CreateTextureInput(coatTexture, 0) : CreateConstantInput(1.0), // coat weight from red channel
|
|
38
|
+
// coat roughness goes in the green channel but may come from red or green channels in the source
|
|
39
|
+
coatRoughnessTexture ? CreateTextureInput(coatRoughnessTexture, babylonMaterial._useCoatRoughnessFromGreenChannel ? 1 : 0) : CreateConstantInput(1.0)), scene);
|
|
40
|
+
return texture.getInternalTexture();
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Creates a temporary texture based on the source texture.
|
|
44
|
+
* @param internalTexture The source internal texture
|
|
45
|
+
* @param sourceTexture The source of the new texture's name, and sampler info
|
|
46
|
+
* @returns The new texture
|
|
47
|
+
*/
|
|
48
|
+
function CreateTempTexture(internalTexture, sourceTexture) {
|
|
49
|
+
const tempTexture = new Texture(sourceTexture.name, sourceTexture.getScene());
|
|
50
|
+
tempTexture._texture = internalTexture;
|
|
51
|
+
tempTexture.coordinatesIndex = sourceTexture.coordinatesIndex;
|
|
52
|
+
if (sourceTexture instanceof Texture) {
|
|
53
|
+
tempTexture.uOffset = sourceTexture.uOffset;
|
|
54
|
+
tempTexture.vOffset = sourceTexture.vOffset;
|
|
55
|
+
tempTexture.uScale = sourceTexture.uScale;
|
|
56
|
+
tempTexture.vScale = sourceTexture.vScale;
|
|
57
|
+
tempTexture.wAng = sourceTexture.wAng;
|
|
58
|
+
}
|
|
59
|
+
tempTexture.wrapU = sourceTexture.wrapU;
|
|
60
|
+
tempTexture.wrapV = sourceTexture.wrapV;
|
|
61
|
+
return tempTexture;
|
|
62
|
+
}
|
|
6
63
|
/**
|
|
7
64
|
* @internal
|
|
8
65
|
*/
|
|
@@ -16,9 +73,28 @@ export class KHR_materials_clearcoat {
|
|
|
16
73
|
/** Defines whether this extension is required */
|
|
17
74
|
this.required = false;
|
|
18
75
|
this._wasUsed = false;
|
|
76
|
+
/**
|
|
77
|
+
* Cache that holds temporary merged textures created during export
|
|
78
|
+
*/
|
|
79
|
+
this._mergedTexturesMap = {};
|
|
80
|
+
/**
|
|
81
|
+
* Cache that holds internal textures of merged textures created during export
|
|
82
|
+
*/
|
|
83
|
+
this._cachedInternalTexturesMap = {};
|
|
19
84
|
this._exporter = exporter;
|
|
20
85
|
}
|
|
21
|
-
dispose() {
|
|
86
|
+
dispose() {
|
|
87
|
+
for (const key of Object.keys(this._mergedTexturesMap)) {
|
|
88
|
+
const texture = this._mergedTexturesMap[key];
|
|
89
|
+
texture.dispose();
|
|
90
|
+
}
|
|
91
|
+
this._mergedTexturesMap = {};
|
|
92
|
+
for (const key of Object.keys(this._cachedInternalTexturesMap)) {
|
|
93
|
+
const internalTexture = this._cachedInternalTexturesMap[key];
|
|
94
|
+
internalTexture.dispose();
|
|
95
|
+
}
|
|
96
|
+
this._cachedInternalTexturesMap = {};
|
|
97
|
+
}
|
|
22
98
|
/** @internal */
|
|
23
99
|
get wasUsed() {
|
|
24
100
|
return this._wasUsed;
|
|
@@ -41,15 +117,58 @@ export class KHR_materials_clearcoat {
|
|
|
41
117
|
}
|
|
42
118
|
else if (babylonMaterial instanceof OpenPBRMaterial) {
|
|
43
119
|
if (babylonMaterial.coatWeight > 0) {
|
|
120
|
+
// We will merge the coat_weight and coat_roughness textures, if needed.
|
|
121
|
+
// However, we want to retain the original texture's transforms and sampling info.
|
|
122
|
+
let coatNeedsMerge = false;
|
|
44
123
|
if (babylonMaterial.coatWeightTexture) {
|
|
45
|
-
|
|
124
|
+
// If we don't have a coat_roughness texture or if the coat_weight and coat_roughness
|
|
125
|
+
// textures are already merged, export them as-is.
|
|
126
|
+
if (!babylonMaterial.coatRoughnessTexture) {
|
|
127
|
+
additionalTextures.push(babylonMaterial.coatWeightTexture);
|
|
128
|
+
}
|
|
129
|
+
else if (babylonMaterial._useCoatRoughnessFromGreenChannel &&
|
|
130
|
+
babylonMaterial.coatWeightTexture.getInternalTexture() === babylonMaterial.coatRoughnessTexture.getInternalTexture()) {
|
|
131
|
+
additionalTextures.push(babylonMaterial.coatWeightTexture);
|
|
132
|
+
additionalTextures.push(babylonMaterial.coatRoughnessTexture);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
coatNeedsMerge = true;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else if (babylonMaterial.coatRoughnessTexture) {
|
|
139
|
+
if (babylonMaterial._useCoatRoughnessFromGreenChannel) {
|
|
140
|
+
additionalTextures.push(babylonMaterial.coatRoughnessTexture);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
coatNeedsMerge = true;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (coatNeedsMerge) {
|
|
147
|
+
// Merge the two textures together but retain the transforms for each.
|
|
148
|
+
// We do this by caching the internal texture that is created during the merge,
|
|
149
|
+
// and then creating temporary textures that use that internal texture but
|
|
150
|
+
// have the original texture's transforms/sampling info.
|
|
151
|
+
const texId = GetCoatTextureId(babylonMaterial);
|
|
152
|
+
if (!this._cachedInternalTexturesMap[texId]) {
|
|
153
|
+
const internalTexture = await CreateMergedCoatInternalTextureAsync(babylonMaterial);
|
|
154
|
+
if (internalTexture) {
|
|
155
|
+
this._cachedInternalTexturesMap[texId] = internalTexture;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (this._cachedInternalTexturesMap[texId]) {
|
|
159
|
+
if (babylonMaterial.coatWeightTexture) {
|
|
160
|
+
this._mergedTexturesMap[babylonMaterial.coatWeightTexture.uniqueId] = CreateTempTexture(this._cachedInternalTexturesMap[texId], babylonMaterial.coatWeightTexture);
|
|
161
|
+
additionalTextures.push(this._mergedTexturesMap[babylonMaterial.coatWeightTexture.uniqueId]);
|
|
162
|
+
}
|
|
163
|
+
if (babylonMaterial.coatRoughnessTexture) {
|
|
164
|
+
this._mergedTexturesMap[babylonMaterial.coatRoughnessTexture.uniqueId] = CreateTempTexture(this._cachedInternalTexturesMap[texId], babylonMaterial.coatRoughnessTexture);
|
|
165
|
+
additionalTextures.push(this._mergedTexturesMap[babylonMaterial.coatRoughnessTexture.uniqueId]);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
46
168
|
}
|
|
47
169
|
if (babylonMaterial.geometryCoatNormalTexture) {
|
|
48
170
|
additionalTextures.push(babylonMaterial.geometryCoatNormalTexture);
|
|
49
171
|
}
|
|
50
|
-
if (babylonMaterial.coatRoughnessTexture) {
|
|
51
|
-
additionalTextures.push(babylonMaterial.coatRoughnessTexture);
|
|
52
|
-
}
|
|
53
172
|
return additionalTextures;
|
|
54
173
|
}
|
|
55
174
|
}
|
|
@@ -99,13 +218,17 @@ export class KHR_materials_clearcoat {
|
|
|
99
218
|
}
|
|
100
219
|
this._wasUsed = true;
|
|
101
220
|
node.extensions = node.extensions || {};
|
|
102
|
-
|
|
103
|
-
let
|
|
104
|
-
if (babylonMaterial.
|
|
105
|
-
|
|
221
|
+
let coatWeightTexture = null;
|
|
222
|
+
let coatTextureInfo;
|
|
223
|
+
if (babylonMaterial.coatWeightTexture) {
|
|
224
|
+
coatWeightTexture = this._mergedTexturesMap[babylonMaterial.coatWeightTexture.uniqueId];
|
|
225
|
+
coatTextureInfo = this._exporter._materialExporter.getTextureInfo(coatWeightTexture);
|
|
106
226
|
}
|
|
107
|
-
|
|
108
|
-
|
|
227
|
+
let coatRoughnessTexture = null;
|
|
228
|
+
let coatRoughnessTextureInfo;
|
|
229
|
+
if (babylonMaterial.coatRoughnessTexture) {
|
|
230
|
+
coatRoughnessTexture = this._mergedTexturesMap[babylonMaterial.coatRoughnessTexture.uniqueId];
|
|
231
|
+
coatRoughnessTextureInfo = this._exporter._materialExporter.getTextureInfo(coatRoughnessTexture);
|
|
109
232
|
}
|
|
110
233
|
if (babylonMaterial.coatColorTexture) {
|
|
111
234
|
Tools.Warn(`Clear Color tint is not supported for glTF export. Ignoring for: ${babylonMaterial.name}`);
|
|
@@ -113,9 +236,9 @@ export class KHR_materials_clearcoat {
|
|
|
113
236
|
const clearCoatNormalTextureInfo = this._exporter._materialExporter.getTextureInfo(babylonMaterial.geometryCoatNormalTexture);
|
|
114
237
|
const clearCoatInfo = {
|
|
115
238
|
clearcoatFactor: babylonMaterial.coatWeight,
|
|
116
|
-
clearcoatTexture:
|
|
239
|
+
clearcoatTexture: coatTextureInfo ?? undefined,
|
|
117
240
|
clearcoatRoughnessFactor: babylonMaterial.coatRoughness,
|
|
118
|
-
clearcoatRoughnessTexture:
|
|
241
|
+
clearcoatRoughnessTexture: coatRoughnessTextureInfo ?? undefined,
|
|
119
242
|
clearcoatNormalTexture: clearCoatNormalTextureInfo ?? undefined,
|
|
120
243
|
};
|
|
121
244
|
if (clearCoatInfo.clearcoatTexture !== null || clearCoatInfo.clearcoatRoughnessTexture !== null || clearCoatInfo.clearcoatRoughnessTexture !== null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KHR_materials_clearcoat.js","sourceRoot":"","sources":["../../../../../../dev/serializers/src/glTF/2.0/Extensions/KHR_mater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BACrE,sBAAsB,EAAE,0BAA0B,IAAI,SAAS;iBAClE,CAAC;gBAEF,IAAI,aAAa,CAAC,gBAAgB,KAAK,IAAI,IAAI,aAAa,CAAC,yBAAyB,KAAK,IAAI,IAAI,aAAa,CAAC,yBAAyB,KAAK,IAAI,EAAE,CAAC;oBAClJ,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;gBAC7D,CAAC;gBAED,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC;YAC1C,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,YAAY,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,uBAAuB,CAAC,QAAQ,CAAC,CAAC,CAAC","sourcesContent":["import type { IMaterial, IKHRMaterialsClearcoat } from \"babylonjs-gltf2interface\";\r\nimport type { IGLTFExporterExtensionV2 } from \"../glTFExporterExtension\";\r\nimport { GLTFExporter } from \"../glTFExporter\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport { PBRBaseMaterial } from \"core/Materials/PBR/pbrBaseMaterial\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\n\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { OpenPBRMaterial } from \"core/Materials/PBR/openpbrMaterial\";\r\n\r\nconst NAME = \"KHR_materials_clearcoat\";\r\n\r\n/**\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class KHR_materials_clearcoat implements IGLTFExporterExtensionV2 {\r\n /** Name of this extension */\r\n public readonly name = NAME;\r\n\r\n /** Defines whether this extension is enabled */\r\n public enabled = true;\r\n\r\n /** Defines whether this extension is required */\r\n public required = false;\r\n\r\n private _exporter: GLTFExporter;\r\n\r\n private _wasUsed = false;\r\n\r\n constructor(exporter: GLTFExporter) {\r\n this._exporter = exporter;\r\n }\r\n\r\n public dispose() {}\r\n\r\n /** @internal */\r\n public get wasUsed() {\r\n return this._wasUsed;\r\n }\r\n\r\n public async postExportMaterialAdditionalTexturesAsync?(context: string, node: IMaterial, babylonMaterial: Material): Promise<BaseTexture[]> {\r\n const additionalTextures: BaseTexture[] = [];\r\n if (babylonMaterial instanceof PBRBaseMaterial) {\r\n if (babylonMaterial.clearCoat.isEnabled) {\r\n if (babylonMaterial.clearCoat.texture) {\r\n additionalTextures.push(babylonMaterial.clearCoat.texture);\r\n }\r\n if (!babylonMaterial.clearCoat.useRoughnessFromMainTexture && babylonMaterial.clearCoat.textureRoughness) {\r\n additionalTextures.push(babylonMaterial.clearCoat.textureRoughness);\r\n }\r\n if (babylonMaterial.clearCoat.bumpTexture) {\r\n additionalTextures.push(babylonMaterial.clearCoat.bumpTexture);\r\n }\r\n return additionalTextures;\r\n }\r\n } else if (babylonMaterial instanceof OpenPBRMaterial) {\r\n if (babylonMaterial.coatWeight > 0) {\r\n if (babylonMaterial.coatWeightTexture) {\r\n additionalTextures.push(babylonMaterial.coatWeightTexture);\r\n }\r\n if (babylonMaterial.geometryCoatNormalTexture) {\r\n additionalTextures.push(babylonMaterial.geometryCoatNormalTexture);\r\n }\r\n if (babylonMaterial.coatRoughnessTexture) {\r\n additionalTextures.push(babylonMaterial.coatRoughnessTexture);\r\n }\r\n return additionalTextures;\r\n }\r\n }\r\n\r\n return [];\r\n }\r\n\r\n // eslint-disable-next-line no-restricted-syntax\r\n public postExportMaterialAsync?(context: string, node: IMaterial, babylonMaterial: Material): Promise<IMaterial> {\r\n return new Promise((resolve) => {\r\n if (babylonMaterial instanceof PBRBaseMaterial) {\r\n if (!babylonMaterial.clearCoat.isEnabled) {\r\n resolve(node);\r\n return;\r\n }\r\n\r\n this._wasUsed = true;\r\n\r\n node.extensions = node.extensions || {};\r\n\r\n const clearCoatTextureInfo = this._exporter._materialExporter.getTextureInfo(babylonMaterial.clearCoat.texture);\r\n let clearCoatTextureRoughnessInfo;\r\n if (babylonMaterial.clearCoat.useRoughnessFromMainTexture) {\r\n clearCoatTextureRoughnessInfo = this._exporter._materialExporter.getTextureInfo(babylonMaterial.clearCoat.texture);\r\n } else {\r\n clearCoatTextureRoughnessInfo = this._exporter._materialExporter.getTextureInfo(babylonMaterial.clearCoat.textureRoughness);\r\n }\r\n\r\n if (babylonMaterial.clearCoat.isTintEnabled) {\r\n Tools.Warn(`Clear Color tint is not supported for glTF export. Ignoring for: ${babylonMaterial.name}`);\r\n }\r\n\r\n if (babylonMaterial.clearCoat.remapF0OnInterfaceChange) {\r\n Tools.Warn(`Clear Color F0 remapping is not supported for glTF export. Ignoring for: ${babylonMaterial.name}`);\r\n }\r\n\r\n const clearCoatNormalTextureInfo = this._exporter._materialExporter.getTextureInfo(babylonMaterial.clearCoat.bumpTexture);\r\n\r\n const clearCoatInfo: IKHRMaterialsClearcoat = {\r\n clearcoatFactor: babylonMaterial.clearCoat.intensity,\r\n clearcoatTexture: clearCoatTextureInfo ?? undefined,\r\n clearcoatRoughnessFactor: babylonMaterial.clearCoat.roughness,\r\n clearcoatRoughnessTexture: clearCoatTextureRoughnessInfo ?? undefined,\r\n clearcoatNormalTexture: clearCoatNormalTextureInfo ?? undefined,\r\n };\r\n\r\n if (clearCoatInfo.clearcoatTexture !== null || clearCoatInfo.clearcoatRoughnessTexture !== null || clearCoatInfo.clearcoatRoughnessTexture !== null) {\r\n this._exporter._materialNeedsUVsSet.add(babylonMaterial);\r\n }\r\n\r\n node.extensions[NAME] = clearCoatInfo;\r\n } else if (babylonMaterial instanceof OpenPBRMaterial) {\r\n if (babylonMaterial.coatWeight == 0.0) {\r\n resolve(node);\r\n return;\r\n }\r\n\r\n this._wasUsed = true;\r\n\r\n node.extensions = node.extensions || {};\r\n\r\n const clearCoatTextureInfo = this._exporter._materialExporter.getTextureInfo(babylonMaterial.coatWeightTexture);\r\n let clearCoatTextureRoughnessInfo;\r\n if (babylonMaterial.useCoatRoughnessFromWeightTexture) {\r\n clearCoatTextureRoughnessInfo = this._exporter._materialExporter.getTextureInfo(babylonMaterial.coatWeightTexture);\r\n } else {\r\n clearCoatTextureRoughnessInfo = this._exporter._materialExporter.getTextureInfo(babylonMaterial.coatRoughnessTexture);\r\n }\r\n\r\n if (babylonMaterial.coatColorTexture) {\r\n Tools.Warn(`Clear Color tint is not supported for glTF export. Ignoring for: ${babylonMaterial.name}`);\r\n }\r\n\r\n const clearCoatNormalTextureInfo = this._exporter._materialExporter.getTextureInfo(babylonMaterial.geometryCoatNormalTexture);\r\n\r\n const clearCoatInfo: IKHRMaterialsClearcoat = {\r\n clearcoatFactor: babylonMaterial.coatWeight,\r\n clearcoatTexture: clearCoatTextureInfo ?? undefined,\r\n clearcoatRoughnessFactor: babylonMaterial.coatRoughness,\r\n clearcoatRoughnessTexture: clearCoatTextureRoughnessInfo ?? undefined,\r\n clearcoatNormalTexture: clearCoatNormalTextureInfo ?? undefined,\r\n };\r\n\r\n if (clearCoatInfo.clearcoatTexture !== null || clearCoatInfo.clearcoatRoughnessTexture !== null || clearCoatInfo.clearcoatRoughnessTexture !== null) {\r\n this._exporter._materialNeedsUVsSet.add(babylonMaterial);\r\n }\r\n\r\n node.extensions[NAME] = clearCoatInfo;\r\n }\r\n resolve(node);\r\n });\r\n }\r\n}\r\n\r\nGLTFExporter.RegisterExtension(NAME, (exporter) => new KHR_materials_clearcoat(exporter));\r\n"]}
|
|
1
|
+
{"version":3,"file":"KHR_materials_clearcoat.js","sourceRoot":"","sources":["../../../../../../dev/serializers/src/glTF/2.0/Extensions/KHR_materials_clearcoat.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,yDAA2C;AAGrE,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,eAAe,EAAE,yDAA2C;AAErE,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAC1D,OAAO,EAAE,kBAAkB,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C,CAAC,CAAC;IACP,CAAC;CACJ;AAED,YAAY,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,uBAAuB,CAAC,QAAQ,CAAC,CAAC,CAAC","sourcesContent":["import type { IMaterial, IKHRMaterialsClearcoat } from \"babylonjs-gltf2interface\";\r\nimport type { IGLTFExporterExtensionV2 } from \"../glTFExporterExtension\";\r\nimport { GLTFExporter } from \"../glTFExporter\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport { PBRBaseMaterial } from \"core/Materials/PBR/pbrBaseMaterial\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\n\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { OpenPBRMaterial } from \"core/Materials/PBR/openpbrMaterial\";\r\nimport type { InternalTexture } from \"core/Materials/Textures/internalTexture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { MergeTexturesAsync, CreateRGBAConfiguration, CreateTextureInput, CreateConstantInput } from \"core/Materials/Textures/textureMerger\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nconst NAME = \"KHR_materials_clearcoat\";\r\n\r\n/**\r\n * Generate a unique ID for the merged coat textures based on the internal texture data.\r\n * This is used for caching merged textures.\r\n * @param babylonMaterial Source OpenPBR material\r\n * @returns A unique ID string for the merged coat textures\r\n * @internal\r\n */\r\nfunction GetCoatTextureId(babylonMaterial: OpenPBRMaterial): string {\r\n const coatTexture: Nullable<BaseTexture> = babylonMaterial.coatWeightTexture;\r\n const coatId = coatTexture && coatTexture.getInternalTexture() ? coatTexture!.getInternalTexture()!.uniqueId : \"NoCoat\";\r\n const coatRoughnessTexture: Nullable<BaseTexture> = babylonMaterial.coatRoughnessTexture;\r\n const roughnessId = coatRoughnessTexture && coatRoughnessTexture.getInternalTexture() ? coatRoughnessTexture!.getInternalTexture()!.uniqueId : \"NoRoughness\";\r\n return `${coatId}_${roughnessId}`;\r\n}\r\n\r\n/**\r\n * Using the coat weight and coat roughness textures, create a merged internal texture that can be used\r\n * for multiple textures (with potentially different transforms) on export.\r\n * @param babylonMaterial The source OpenPBR material\r\n * @returns A new, internal texture with the coat weight in the red channel and coat roughness in the green channel\r\n * @internal\r\n */\r\nasync function CreateMergedCoatInternalTextureAsync(babylonMaterial: OpenPBRMaterial): Promise<Nullable<InternalTexture>> {\r\n const scene = babylonMaterial.getScene();\r\n const coatTexture: Nullable<BaseTexture> = babylonMaterial.coatWeightTexture;\r\n const coatRoughnessTexture: Nullable<BaseTexture> = babylonMaterial.coatRoughnessTexture;\r\n // If we don't have any textures, we don't need to generate anything.\r\n if (!(coatTexture || coatRoughnessTexture)) {\r\n return null;\r\n }\r\n\r\n const texture = await MergeTexturesAsync(\r\n \"CoatTexture\",\r\n CreateRGBAConfiguration(\r\n coatTexture ? CreateTextureInput(coatTexture, 0) : CreateConstantInput(1.0), // coat weight from red channel\r\n // coat roughness goes in the green channel but may come from red or green channels in the source\r\n coatRoughnessTexture ? CreateTextureInput(coatRoughnessTexture, babylonMaterial._useCoatRoughnessFromGreenChannel ? 1 : 0) : CreateConstantInput(1.0)\r\n ),\r\n scene\r\n );\r\n\r\n return texture.getInternalTexture();\r\n}\r\n\r\n/**\r\n * Creates a temporary texture based on the source texture.\r\n * @param internalTexture The source internal texture\r\n * @param sourceTexture The source of the new texture's name, and sampler info\r\n * @returns The new texture\r\n */\r\nfunction CreateTempTexture(internalTexture: InternalTexture, sourceTexture: BaseTexture): Texture {\r\n const tempTexture = new Texture(sourceTexture.name, sourceTexture.getScene());\r\n tempTexture._texture = internalTexture;\r\n tempTexture.coordinatesIndex = sourceTexture.coordinatesIndex;\r\n if (sourceTexture instanceof Texture) {\r\n tempTexture.uOffset = sourceTexture.uOffset;\r\n tempTexture.vOffset = sourceTexture.vOffset;\r\n tempTexture.uScale = sourceTexture.uScale;\r\n tempTexture.vScale = sourceTexture.vScale;\r\n tempTexture.wAng = sourceTexture.wAng;\r\n }\r\n tempTexture.wrapU = sourceTexture.wrapU;\r\n tempTexture.wrapV = sourceTexture.wrapV;\r\n return tempTexture;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class KHR_materials_clearcoat implements IGLTFExporterExtensionV2 {\r\n /** Name of this extension */\r\n public readonly name = NAME;\r\n\r\n /** Defines whether this extension is enabled */\r\n public enabled = true;\r\n\r\n /** Defines whether this extension is required */\r\n public required = false;\r\n\r\n private _exporter: GLTFExporter;\r\n\r\n private _wasUsed = false;\r\n\r\n constructor(exporter: GLTFExporter) {\r\n this._exporter = exporter;\r\n }\r\n\r\n /**\r\n * Cache that holds temporary merged textures created during export\r\n */\r\n private _mergedTexturesMap: Record<string, BaseTexture> = {};\r\n\r\n /**\r\n * Cache that holds internal textures of merged textures created during export\r\n */\r\n private _cachedInternalTexturesMap: Record<string, InternalTexture> = {};\r\n\r\n public dispose() {\r\n for (const key of Object.keys(this._mergedTexturesMap)) {\r\n const texture = this._mergedTexturesMap[key];\r\n texture.dispose();\r\n }\r\n this._mergedTexturesMap = {};\r\n for (const key of Object.keys(this._cachedInternalTexturesMap)) {\r\n const internalTexture = this._cachedInternalTexturesMap[key];\r\n internalTexture.dispose();\r\n }\r\n this._cachedInternalTexturesMap = {};\r\n }\r\n\r\n /** @internal */\r\n public get wasUsed() {\r\n return this._wasUsed;\r\n }\r\n\r\n public async postExportMaterialAdditionalTexturesAsync?(context: string, node: IMaterial, babylonMaterial: Material): Promise<BaseTexture[]> {\r\n const additionalTextures: BaseTexture[] = [];\r\n if (babylonMaterial instanceof PBRBaseMaterial) {\r\n if (babylonMaterial.clearCoat.isEnabled) {\r\n if (babylonMaterial.clearCoat.texture) {\r\n additionalTextures.push(babylonMaterial.clearCoat.texture);\r\n }\r\n if (!babylonMaterial.clearCoat.useRoughnessFromMainTexture && babylonMaterial.clearCoat.textureRoughness) {\r\n additionalTextures.push(babylonMaterial.clearCoat.textureRoughness);\r\n }\r\n if (babylonMaterial.clearCoat.bumpTexture) {\r\n additionalTextures.push(babylonMaterial.clearCoat.bumpTexture);\r\n }\r\n return additionalTextures;\r\n }\r\n } else if (babylonMaterial instanceof OpenPBRMaterial) {\r\n if (babylonMaterial.coatWeight > 0) {\r\n // We will merge the coat_weight and coat_roughness textures, if needed.\r\n // However, we want to retain the original texture's transforms and sampling info.\r\n let coatNeedsMerge = false;\r\n if (babylonMaterial.coatWeightTexture) {\r\n // If we don't have a coat_roughness texture or if the coat_weight and coat_roughness\r\n // textures are already merged, export them as-is.\r\n if (!babylonMaterial.coatRoughnessTexture) {\r\n additionalTextures.push(babylonMaterial.coatWeightTexture);\r\n } else if (\r\n babylonMaterial._useCoatRoughnessFromGreenChannel &&\r\n babylonMaterial.coatWeightTexture.getInternalTexture() === babylonMaterial.coatRoughnessTexture.getInternalTexture()\r\n ) {\r\n additionalTextures.push(babylonMaterial.coatWeightTexture);\r\n additionalTextures.push(babylonMaterial.coatRoughnessTexture);\r\n } else {\r\n coatNeedsMerge = true;\r\n }\r\n } else if (babylonMaterial.coatRoughnessTexture) {\r\n if (babylonMaterial._useCoatRoughnessFromGreenChannel) {\r\n additionalTextures.push(babylonMaterial.coatRoughnessTexture);\r\n } else {\r\n coatNeedsMerge = true;\r\n }\r\n }\r\n if (coatNeedsMerge) {\r\n // Merge the two textures together but retain the transforms for each.\r\n // We do this by caching the internal texture that is created during the merge,\r\n // and then creating temporary textures that use that internal texture but\r\n // have the original texture's transforms/sampling info.\r\n const texId = GetCoatTextureId(babylonMaterial);\r\n if (!this._cachedInternalTexturesMap[texId]) {\r\n const internalTexture = await CreateMergedCoatInternalTextureAsync(babylonMaterial);\r\n if (internalTexture) {\r\n this._cachedInternalTexturesMap[texId] = internalTexture;\r\n }\r\n }\r\n if (this._cachedInternalTexturesMap[texId]) {\r\n if (babylonMaterial.coatWeightTexture) {\r\n this._mergedTexturesMap[babylonMaterial.coatWeightTexture.uniqueId] = CreateTempTexture(\r\n this._cachedInternalTexturesMap[texId],\r\n babylonMaterial.coatWeightTexture\r\n );\r\n additionalTextures.push(this._mergedTexturesMap[babylonMaterial.coatWeightTexture.uniqueId]);\r\n }\r\n if (babylonMaterial.coatRoughnessTexture) {\r\n this._mergedTexturesMap[babylonMaterial.coatRoughnessTexture.uniqueId] = CreateTempTexture(\r\n this._cachedInternalTexturesMap[texId],\r\n babylonMaterial.coatRoughnessTexture\r\n );\r\n additionalTextures.push(this._mergedTexturesMap[babylonMaterial.coatRoughnessTexture.uniqueId]);\r\n }\r\n }\r\n }\r\n\r\n if (babylonMaterial.geometryCoatNormalTexture) {\r\n additionalTextures.push(babylonMaterial.geometryCoatNormalTexture);\r\n }\r\n\r\n return additionalTextures;\r\n }\r\n }\r\n\r\n return [];\r\n }\r\n\r\n // eslint-disable-next-line no-restricted-syntax\r\n public postExportMaterialAsync?(context: string, node: IMaterial, babylonMaterial: Material): Promise<IMaterial> {\r\n return new Promise((resolve) => {\r\n if (babylonMaterial instanceof PBRBaseMaterial) {\r\n if (!babylonMaterial.clearCoat.isEnabled) {\r\n resolve(node);\r\n return;\r\n }\r\n\r\n this._wasUsed = true;\r\n\r\n node.extensions = node.extensions || {};\r\n\r\n const clearCoatTextureInfo = this._exporter._materialExporter.getTextureInfo(babylonMaterial.clearCoat.texture);\r\n let clearCoatTextureRoughnessInfo;\r\n if (babylonMaterial.clearCoat.useRoughnessFromMainTexture) {\r\n clearCoatTextureRoughnessInfo = this._exporter._materialExporter.getTextureInfo(babylonMaterial.clearCoat.texture);\r\n } else {\r\n clearCoatTextureRoughnessInfo = this._exporter._materialExporter.getTextureInfo(babylonMaterial.clearCoat.textureRoughness);\r\n }\r\n\r\n if (babylonMaterial.clearCoat.isTintEnabled) {\r\n Tools.Warn(`Clear Color tint is not supported for glTF export. Ignoring for: ${babylonMaterial.name}`);\r\n }\r\n\r\n if (babylonMaterial.clearCoat.remapF0OnInterfaceChange) {\r\n Tools.Warn(`Clear Color F0 remapping is not supported for glTF export. Ignoring for: ${babylonMaterial.name}`);\r\n }\r\n\r\n const clearCoatNormalTextureInfo = this._exporter._materialExporter.getTextureInfo(babylonMaterial.clearCoat.bumpTexture);\r\n\r\n const clearCoatInfo: IKHRMaterialsClearcoat = {\r\n clearcoatFactor: babylonMaterial.clearCoat.intensity,\r\n clearcoatTexture: clearCoatTextureInfo ?? undefined,\r\n clearcoatRoughnessFactor: babylonMaterial.clearCoat.roughness,\r\n clearcoatRoughnessTexture: clearCoatTextureRoughnessInfo ?? undefined,\r\n clearcoatNormalTexture: clearCoatNormalTextureInfo ?? undefined,\r\n };\r\n\r\n if (clearCoatInfo.clearcoatTexture !== null || clearCoatInfo.clearcoatRoughnessTexture !== null || clearCoatInfo.clearcoatRoughnessTexture !== null) {\r\n this._exporter._materialNeedsUVsSet.add(babylonMaterial);\r\n }\r\n\r\n node.extensions[NAME] = clearCoatInfo;\r\n } else if (babylonMaterial instanceof OpenPBRMaterial) {\r\n if (babylonMaterial.coatWeight == 0.0) {\r\n resolve(node);\r\n return;\r\n }\r\n\r\n this._wasUsed = true;\r\n\r\n node.extensions = node.extensions || {};\r\n\r\n let coatWeightTexture: Nullable<BaseTexture> = null;\r\n let coatTextureInfo;\r\n if (babylonMaterial.coatWeightTexture) {\r\n coatWeightTexture = this._mergedTexturesMap[babylonMaterial.coatWeightTexture.uniqueId];\r\n coatTextureInfo = this._exporter._materialExporter.getTextureInfo(coatWeightTexture);\r\n }\r\n\r\n let coatRoughnessTexture: Nullable<BaseTexture> = null;\r\n let coatRoughnessTextureInfo;\r\n if (babylonMaterial.coatRoughnessTexture) {\r\n coatRoughnessTexture = this._mergedTexturesMap[babylonMaterial.coatRoughnessTexture.uniqueId];\r\n coatRoughnessTextureInfo = this._exporter._materialExporter.getTextureInfo(coatRoughnessTexture);\r\n }\r\n\r\n if (babylonMaterial.coatColorTexture) {\r\n Tools.Warn(`Clear Color tint is not supported for glTF export. Ignoring for: ${babylonMaterial.name}`);\r\n }\r\n\r\n const clearCoatNormalTextureInfo = this._exporter._materialExporter.getTextureInfo(babylonMaterial.geometryCoatNormalTexture);\r\n\r\n const clearCoatInfo: IKHRMaterialsClearcoat = {\r\n clearcoatFactor: babylonMaterial.coatWeight,\r\n clearcoatTexture: coatTextureInfo ?? undefined,\r\n clearcoatRoughnessFactor: babylonMaterial.coatRoughness,\r\n clearcoatRoughnessTexture: coatRoughnessTextureInfo ?? undefined,\r\n clearcoatNormalTexture: clearCoatNormalTextureInfo ?? undefined,\r\n };\r\n\r\n if (clearCoatInfo.clearcoatTexture !== null || clearCoatInfo.clearcoatRoughnessTexture !== null || clearCoatInfo.clearcoatRoughnessTexture !== null) {\r\n this._exporter._materialNeedsUVsSet.add(babylonMaterial);\r\n }\r\n\r\n node.extensions[NAME] = clearCoatInfo;\r\n }\r\n resolve(node);\r\n });\r\n }\r\n}\r\n\r\nGLTFExporter.RegisterExtension(NAME, (exporter) => new KHR_materials_clearcoat(exporter));\r\n"]}
|
package/glTF/2.0/Extensions/{KHR_materials_clearcoat_darkening.d.ts → KHR_materials_coat.d.ts}
RENAMED
|
@@ -6,9 +6,9 @@ import type { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture
|
|
|
6
6
|
/**
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
|
-
export declare class
|
|
9
|
+
export declare class KHR_materials_coat implements IGLTFExporterExtensionV2 {
|
|
10
10
|
/** Name of this extension */
|
|
11
|
-
readonly name = "
|
|
11
|
+
readonly name = "KHR_materials_coat";
|
|
12
12
|
/** Defines whether this extension is enabled */
|
|
13
13
|
enabled: boolean;
|
|
14
14
|
/** Defines whether this extension is required */
|
|
@@ -16,6 +16,14 @@ export declare class KHR_materials_clearcoat_darkening implements IGLTFExporterE
|
|
|
16
16
|
private _exporter;
|
|
17
17
|
private _wasUsed;
|
|
18
18
|
constructor(exporter: GLTFExporter);
|
|
19
|
+
/**
|
|
20
|
+
* Cache that holds temporary merged textures created during export
|
|
21
|
+
*/
|
|
22
|
+
private _mergedTexturesMap;
|
|
23
|
+
/**
|
|
24
|
+
* Cache that holds internal textures of merged textures created during export
|
|
25
|
+
*/
|
|
26
|
+
private _cachedInternalTexturesMap;
|
|
19
27
|
dispose(): void;
|
|
20
28
|
/** @internal */
|
|
21
29
|
get wasUsed(): boolean;
|