@onerjs/loaders 8.46.6 → 8.46.9

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.
@@ -2,7 +2,6 @@ import { type Material } from "@onerjs/core/Materials/material.js";
2
2
  import { type BaseTexture } from "@onerjs/core/Materials/Textures/baseTexture.js";
3
3
  import { type Nullable } from "@onerjs/core/types.js";
4
4
  import { type Color3 } from "@onerjs/core/Maths/math.color.js";
5
- import { type Vector3 } from "@onerjs/core/Maths/math.vector.js";
6
5
  /**
7
6
  * Interface for material loading adapters that provides a unified OpenPBR-like interface
8
7
  * for both OpenPBR and PBR materials, eliminating conditional branches in extensions.
@@ -12,6 +11,10 @@ export interface IMaterialLoadingAdapter {
12
11
  * Gets the underlying material
13
12
  */
14
13
  readonly material: Material;
14
+ /**
15
+ * Finalizes material properties after loading is complete.
16
+ */
17
+ finalize?(): void;
15
18
  /**
16
19
  * Whether the material should be treated as unlit
17
20
  */
@@ -193,6 +196,10 @@ export interface IMaterialLoadingAdapter {
193
196
  * Sets the scattering coefficient
194
197
  */
195
198
  transmissionScatter: Color3;
199
+ /**
200
+ * Sets the transmission scatter texture
201
+ */
202
+ transmissionScatterTexture: Nullable<BaseTexture>;
196
203
  /**
197
204
  * Sets the scattering anisotropy (-1 to 1)
198
205
  */
@@ -213,6 +220,11 @@ export interface IMaterialLoadingAdapter {
213
220
  * Configures transmission for thin-surface transmission (KHR_materials_transmission)
214
221
  */
215
222
  configureTransmission(): void;
223
+ configureVolume(): void;
224
+ /**
225
+ * Sets whether the material is thin-walled (i.e. non-volumetric) or not.
226
+ */
227
+ geometryThinWalled: boolean;
216
228
  /**
217
229
  * Sets the thickness texture
218
230
  */
@@ -225,11 +237,6 @@ export interface IMaterialLoadingAdapter {
225
237
  * Configures subsurface properties
226
238
  */
227
239
  configureSubsurface(): void;
228
- /**
229
- * @internal
230
- * Sets/gets the extinction coefficient
231
- */
232
- extinctionCoefficient: Vector3;
233
240
  /**
234
241
  * Sets/gets the subsurface weight
235
242
  */
@@ -247,13 +254,13 @@ export interface IMaterialLoadingAdapter {
247
254
  */
248
255
  subsurfaceColorTexture: Nullable<BaseTexture>;
249
256
  /**
250
- * Sets/gets the surface tint of the material (when using subsurface scattering)
257
+ * Sets/gets the diffuse transmission tint of the material
251
258
  */
252
- subsurfaceConstantTint: Color3;
259
+ diffuseTransmissionTint: Color3;
253
260
  /**
254
- * Sets/gets the surface tint texture of the material (when using subsurface scattering)
261
+ * Sets/gets the diffuse transmission tint texture of the material
255
262
  */
256
- subsurfaceConstantTintTexture: Nullable<BaseTexture>;
263
+ diffuseTransmissionTintTexture: Nullable<BaseTexture>;
257
264
  /**
258
265
  * Sets/gets the subsurface radius (used for subsurface scattering)
259
266
  */
@@ -266,6 +273,10 @@ export interface IMaterialLoadingAdapter {
266
273
  * Sets/gets the subsurface scattering anisotropy
267
274
  */
268
275
  subsurfaceScatterAnisotropy: number;
276
+ /**
277
+ * Does this material have a translucent surface (i.e. either transmission or subsurface)?
278
+ */
279
+ isTranslucent(): boolean;
269
280
  /**
270
281
  * Configures initial settings for fuzz for material.
271
282
  */
@@ -1 +1 @@
1
- {"version":3,"file":"materialLoadingAdapter.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/2.0/materialLoadingAdapter.ts"],"names":[],"mappings":"","sourcesContent":["import { type Material } from \"core/Materials/material\";\r\nimport { type BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { type Nullable } from \"core/types\";\r\nimport { type Color3 } from \"core/Maths/math.color\";\r\nimport { type Vector3 } from \"core/Maths/math.vector\";\r\n\r\n/**\r\n * Interface for material loading adapters that provides a unified OpenPBR-like interface\r\n * for both OpenPBR and PBR materials, eliminating conditional branches in extensions.\r\n */\r\nexport interface IMaterialLoadingAdapter {\r\n /**\r\n * Gets the underlying material\r\n */\r\n readonly material: Material;\r\n\r\n /**\r\n * Whether the material should be treated as unlit\r\n */\r\n isUnlit: boolean;\r\n\r\n // ========================================\r\n // CULLING PROPERTIES\r\n // ========================================\r\n\r\n /**\r\n * Sets/gets the back face culling\r\n */\r\n backFaceCulling: boolean;\r\n\r\n /**\r\n * Sets/gets the two sided lighting\r\n */\r\n twoSidedLighting: boolean;\r\n\r\n // ========================================\r\n // ALPHA PROPERTIES\r\n // ========================================\r\n\r\n /**\r\n * Sets/gets the alpha cutoff value (used for alpha test mode)\r\n */\r\n alphaCutOff: number;\r\n\r\n /**\r\n * Sets/gets whether to use alpha from albedo/base color texture\r\n */\r\n useAlphaFromBaseColorTexture: boolean;\r\n\r\n /**\r\n * Sets/Gets whether the transparency is treated as alpha coverage\r\n */\r\n transparencyAsAlphaCoverage: boolean;\r\n\r\n // ========================================\r\n // BASE PARAMETERS\r\n // ========================================\r\n\r\n /**\r\n * Sets/gets the base color\r\n */\r\n baseColor: Color3;\r\n\r\n /**\r\n * Sets/gets the base color texture\r\n */\r\n baseColorTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the base diffuse roughness\r\n */\r\n baseDiffuseRoughness: number;\r\n\r\n /**\r\n * Sets/gets the base diffuse roughness texture\r\n */\r\n baseDiffuseRoughnessTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the base metalness\r\n */\r\n baseMetalness: number;\r\n\r\n /**\r\n * Sets/gets the base metalness texture\r\n */\r\n baseMetalnessTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets whether to use roughness from metallic texture green channel\r\n */\r\n useRoughnessFromMetallicTextureGreen: boolean;\r\n\r\n /**\r\n * Sets whether to use metallic from metallic texture blue channel\r\n */\r\n useMetallicFromMetallicTextureBlue: boolean;\r\n\r\n // ========================================\r\n // SPECULAR PARAMETERS\r\n // ========================================\r\n\r\n /**\r\n * Configures specular properties and enables OpenPBR BRDF model for edge color support\r\n * @param enableEdgeColor - Whether to enable edge color support\r\n */\r\n enableSpecularEdgeColor(enableEdgeColor?: boolean): void;\r\n\r\n /**\r\n * Sets/gets the specular weight\r\n */\r\n specularWeight: number;\r\n\r\n /**\r\n * Sets/gets the specular weight texture\r\n */\r\n specularWeightTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the specular color\r\n */\r\n specularColor: Color3;\r\n\r\n /**\r\n * Sets/gets the specular color texture\r\n */\r\n specularColorTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the specular roughness\r\n */\r\n specularRoughness: number;\r\n\r\n /**\r\n * Sets/gets the specular roughness texture\r\n */\r\n specularRoughnessTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the specular IOR\r\n */\r\n specularIor: number;\r\n\r\n // ========================================\r\n // EMISSION PARAMETERS\r\n // ========================================\r\n\r\n /**\r\n * Sets/gets the emissive color\r\n */\r\n emissionColor: Color3;\r\n\r\n /**\r\n * Sets/gets the emissive luminance\r\n */\r\n emissionLuminance: number;\r\n\r\n /**\r\n * Sets/gets the emissive texture\r\n */\r\n emissionColorTexture: Nullable<BaseTexture>;\r\n\r\n // ========================================\r\n // AMBIENT OCCLUSION\r\n // ========================================\r\n\r\n /**\r\n * Sets/gets the ambient occlusion texture\r\n */\r\n ambientOcclusionTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the ambient occlusion texture strength/level\r\n */\r\n ambientOcclusionTextureStrength: number;\r\n\r\n // ========================================\r\n // COAT PARAMETERS\r\n // ========================================\r\n\r\n /**\r\n * Configures clear coat for PBR material\r\n */\r\n configureCoat(): void;\r\n\r\n /**\r\n * Sets/gets the coat weight\r\n */\r\n coatWeight: number;\r\n\r\n /**\r\n * Sets/gets the coat weight texture\r\n */\r\n coatWeightTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets the coat color\r\n */\r\n coatColor: Color3;\r\n\r\n /**\r\n * Sets the coat color texture\r\n */\r\n coatColorTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the coat roughness\r\n */\r\n coatRoughness: number;\r\n\r\n /**\r\n * Sets/gets the coat roughness texture\r\n */\r\n coatRoughnessTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets the coat index of refraction (IOR)\r\n */\r\n coatIor: number;\r\n\r\n /**\r\n * Sets the coat darkening\r\n */\r\n coatDarkening: number;\r\n\r\n /**\r\n * Sets the coat darkening texture\r\n */\r\n coatDarkeningTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the coat roughness anisotropy\r\n */\r\n coatRoughnessAnisotropy: number;\r\n\r\n /**\r\n * Sets the coat tangent angle for anisotropy\r\n */\r\n geometryCoatTangentAngle: number;\r\n\r\n /**\r\n * Sets the coat tangent texture for anisotropy\r\n */\r\n geometryCoatTangentTexture: Nullable<BaseTexture>;\r\n\r\n // ========================================\r\n // TRANSMISSION LAYER\r\n // ========================================\r\n\r\n /**\r\n * Sets the transmission weight\r\n */\r\n transmissionWeight: number;\r\n\r\n /**\r\n * Sets the transmission weight texture\r\n */\r\n transmissionWeightTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets the attenuation distance\r\n */\r\n transmissionDepth: number;\r\n\r\n /**\r\n * Sets the attenuation color\r\n */\r\n transmissionColor: Color3;\r\n\r\n /**\r\n * Sets the scattering coefficient\r\n */\r\n transmissionScatter: Color3;\r\n\r\n /**\r\n * Sets the scattering anisotropy (-1 to 1)\r\n */\r\n transmissionScatterAnisotropy: number;\r\n\r\n /**\r\n * Sets the dispersion Abbe number\r\n */\r\n transmissionDispersionAbbeNumber: number;\r\n\r\n /**\r\n * Sets the dispersion scale\r\n */\r\n transmissionDispersionScale: number;\r\n\r\n /**\r\n * The refraction background texture\r\n */\r\n refractionBackgroundTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Configures transmission for thin-surface transmission (KHR_materials_transmission)\r\n */\r\n configureTransmission(): void;\r\n\r\n // ========================================\r\n // VOLUME PROPERTIES\r\n // ========================================\r\n\r\n /**\r\n * Sets the thickness texture\r\n */\r\n volumeThicknessTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets the thickness factor\r\n */\r\n volumeThickness: number;\r\n\r\n // ========================================\r\n // SUBSURFACE PROPERTIES (Subsurface Scattering)\r\n // ========================================\r\n\r\n /**\r\n * Configures subsurface properties\r\n */\r\n configureSubsurface(): void;\r\n\r\n /**\r\n * @internal\r\n * Sets/gets the extinction coefficient\r\n */\r\n extinctionCoefficient: Vector3;\r\n\r\n /**\r\n * Sets/gets the subsurface weight\r\n */\r\n subsurfaceWeight: number;\r\n\r\n /**\r\n * Sets/gets the subsurface weight texture\r\n */\r\n subsurfaceWeightTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the subsurface color\r\n */\r\n subsurfaceColor: Color3;\r\n\r\n /**\r\n * Sets/gets the subsurface color texture\r\n */\r\n subsurfaceColorTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the surface tint of the material (when using subsurface scattering)\r\n */\r\n subsurfaceConstantTint: Color3;\r\n\r\n /**\r\n * Sets/gets the surface tint texture of the material (when using subsurface scattering)\r\n */\r\n subsurfaceConstantTintTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the subsurface radius (used for subsurface scattering)\r\n */\r\n subsurfaceRadius: number;\r\n\r\n /**\r\n * Sets/gets the subsurface radius scale (used for subsurface scattering)\r\n */\r\n subsurfaceRadiusScale: Color3;\r\n\r\n /**\r\n * Sets/gets the subsurface scattering anisotropy\r\n */\r\n subsurfaceScatterAnisotropy: number;\r\n\r\n // ========================================\r\n // FUZZ LAYER (Sheen)\r\n // ========================================\r\n\r\n /**\r\n * Configures initial settings for fuzz for material.\r\n */\r\n configureFuzz(): void;\r\n\r\n /**\r\n * Sets the fuzz weight\r\n */\r\n fuzzWeight: number;\r\n\r\n /**\r\n * Sets the fuzz weight texture\r\n */\r\n fuzzWeightTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets the fuzz color\r\n */\r\n fuzzColor: Color3;\r\n\r\n /**\r\n * Sets the fuzz color texture\r\n */\r\n fuzzColorTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets the fuzz roughness\r\n */\r\n fuzzRoughness: number;\r\n\r\n /**\r\n * Sets the fuzz roughness texture\r\n */\r\n fuzzRoughnessTexture: Nullable<BaseTexture>;\r\n\r\n // ========================================\r\n // ANISOTROPY\r\n // ========================================\r\n\r\n /**\r\n * Sets/gets the specular roughness anisotropy\r\n */\r\n specularRoughnessAnisotropy: number;\r\n\r\n /**\r\n * Sets the anisotropy rotation\r\n */\r\n geometryTangentAngle: number;\r\n\r\n /**\r\n * Sets/gets the anisotropy texture\r\n */\r\n geometryTangentTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Configures glTF-style anisotropy for OpenPBR materials\r\n * @param useGltfStyle - Whether to use glTF-style anisotropy (default: true)\r\n */\r\n configureGltfStyleAnisotropy(useGltfStyle?: boolean): void;\r\n\r\n // ========================================\r\n // THIN FILM IRIDESCENCE\r\n // ========================================\r\n\r\n /**\r\n * Sets the thin film weight\r\n */\r\n thinFilmWeight: number;\r\n\r\n /**\r\n * Sets the thin film IOR\r\n */\r\n thinFilmIor: number;\r\n\r\n /**\r\n * Sets the thin film thickness minimum\r\n */\r\n thinFilmThicknessMinimum: number;\r\n\r\n /**\r\n * Sets the thin film thickness maximum\r\n */\r\n thinFilmThicknessMaximum: number;\r\n\r\n /**\r\n * Sets the thin film iridescence texture\r\n */\r\n thinFilmWeightTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets the thin film thickness texture\r\n */\r\n thinFilmThicknessTexture: Nullable<BaseTexture>;\r\n\r\n // ========================================\r\n // UNLIT MATERIALS\r\n // ========================================\r\n\r\n /**\r\n * Sets the unlit flag\r\n */\r\n unlit: boolean;\r\n\r\n // ========================================\r\n // GEOMETRY PARAMETERS\r\n // ========================================\r\n\r\n /**\r\n * Sets/gets the geometry opacity\r\n */\r\n geometryOpacity: number;\r\n\r\n /**\r\n * Sets/gets the geometry normal texture\r\n */\r\n geometryNormalTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets the normal map inversions for PBR material only\r\n * @param invertX - Whether to invert the normal map on the X axis\r\n * @param invertY - Whether to invert the normal map on the Y axis\r\n */\r\n setNormalMapInversions(invertX: boolean, invertY: boolean): void;\r\n\r\n /**\r\n * Sets/gets the coat normal texture\r\n */\r\n geometryCoatNormalTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets the coat normal texture scale\r\n */\r\n geometryCoatNormalTextureScale: number;\r\n}\r\n"]}
1
+ {"version":3,"file":"materialLoadingAdapter.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/2.0/materialLoadingAdapter.ts"],"names":[],"mappings":"","sourcesContent":["import { type Material } from \"core/Materials/material\";\r\nimport { type BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { type Nullable } from \"core/types\";\r\nimport { type Color3 } from \"core/Maths/math.color\";\r\n\r\n/**\r\n * Interface for material loading adapters that provides a unified OpenPBR-like interface\r\n * for both OpenPBR and PBR materials, eliminating conditional branches in extensions.\r\n */\r\nexport interface IMaterialLoadingAdapter {\r\n /**\r\n * Gets the underlying material\r\n */\r\n readonly material: Material;\r\n\r\n /**\r\n * Finalizes material properties after loading is complete.\r\n */\r\n finalize?(): void;\r\n\r\n /**\r\n * Whether the material should be treated as unlit\r\n */\r\n isUnlit: boolean;\r\n\r\n // ========================================\r\n // CULLING PROPERTIES\r\n // ========================================\r\n\r\n /**\r\n * Sets/gets the back face culling\r\n */\r\n backFaceCulling: boolean;\r\n\r\n /**\r\n * Sets/gets the two sided lighting\r\n */\r\n twoSidedLighting: boolean;\r\n\r\n // ========================================\r\n // ALPHA PROPERTIES\r\n // ========================================\r\n\r\n /**\r\n * Sets/gets the alpha cutoff value (used for alpha test mode)\r\n */\r\n alphaCutOff: number;\r\n\r\n /**\r\n * Sets/gets whether to use alpha from albedo/base color texture\r\n */\r\n useAlphaFromBaseColorTexture: boolean;\r\n\r\n /**\r\n * Sets/Gets whether the transparency is treated as alpha coverage\r\n */\r\n transparencyAsAlphaCoverage: boolean;\r\n\r\n // ========================================\r\n // BASE PARAMETERS\r\n // ========================================\r\n\r\n /**\r\n * Sets/gets the base color\r\n */\r\n baseColor: Color3;\r\n\r\n /**\r\n * Sets/gets the base color texture\r\n */\r\n baseColorTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the base diffuse roughness\r\n */\r\n baseDiffuseRoughness: number;\r\n\r\n /**\r\n * Sets/gets the base diffuse roughness texture\r\n */\r\n baseDiffuseRoughnessTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the base metalness\r\n */\r\n baseMetalness: number;\r\n\r\n /**\r\n * Sets/gets the base metalness texture\r\n */\r\n baseMetalnessTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets whether to use roughness from metallic texture green channel\r\n */\r\n useRoughnessFromMetallicTextureGreen: boolean;\r\n\r\n /**\r\n * Sets whether to use metallic from metallic texture blue channel\r\n */\r\n useMetallicFromMetallicTextureBlue: boolean;\r\n\r\n // ========================================\r\n // SPECULAR PARAMETERS\r\n // ========================================\r\n\r\n /**\r\n * Configures specular properties and enables OpenPBR BRDF model for edge color support\r\n * @param enableEdgeColor - Whether to enable edge color support\r\n */\r\n enableSpecularEdgeColor(enableEdgeColor?: boolean): void;\r\n\r\n /**\r\n * Sets/gets the specular weight\r\n */\r\n specularWeight: number;\r\n\r\n /**\r\n * Sets/gets the specular weight texture\r\n */\r\n specularWeightTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the specular color\r\n */\r\n specularColor: Color3;\r\n\r\n /**\r\n * Sets/gets the specular color texture\r\n */\r\n specularColorTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the specular roughness\r\n */\r\n specularRoughness: number;\r\n\r\n /**\r\n * Sets/gets the specular roughness texture\r\n */\r\n specularRoughnessTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the specular IOR\r\n */\r\n specularIor: number;\r\n\r\n // ========================================\r\n // EMISSION PARAMETERS\r\n // ========================================\r\n\r\n /**\r\n * Sets/gets the emissive color\r\n */\r\n emissionColor: Color3;\r\n\r\n /**\r\n * Sets/gets the emissive luminance\r\n */\r\n emissionLuminance: number;\r\n\r\n /**\r\n * Sets/gets the emissive texture\r\n */\r\n emissionColorTexture: Nullable<BaseTexture>;\r\n\r\n // ========================================\r\n // AMBIENT OCCLUSION\r\n // ========================================\r\n\r\n /**\r\n * Sets/gets the ambient occlusion texture\r\n */\r\n ambientOcclusionTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the ambient occlusion texture strength/level\r\n */\r\n ambientOcclusionTextureStrength: number;\r\n\r\n // ========================================\r\n // COAT PARAMETERS\r\n // ========================================\r\n\r\n /**\r\n * Configures clear coat for PBR material\r\n */\r\n configureCoat(): void;\r\n\r\n /**\r\n * Sets/gets the coat weight\r\n */\r\n coatWeight: number;\r\n\r\n /**\r\n * Sets/gets the coat weight texture\r\n */\r\n coatWeightTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets the coat color\r\n */\r\n coatColor: Color3;\r\n\r\n /**\r\n * Sets the coat color texture\r\n */\r\n coatColorTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the coat roughness\r\n */\r\n coatRoughness: number;\r\n\r\n /**\r\n * Sets/gets the coat roughness texture\r\n */\r\n coatRoughnessTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets the coat index of refraction (IOR)\r\n */\r\n coatIor: number;\r\n\r\n /**\r\n * Sets the coat darkening\r\n */\r\n coatDarkening: number;\r\n\r\n /**\r\n * Sets the coat darkening texture\r\n */\r\n coatDarkeningTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the coat roughness anisotropy\r\n */\r\n coatRoughnessAnisotropy: number;\r\n\r\n /**\r\n * Sets the coat tangent angle for anisotropy\r\n */\r\n geometryCoatTangentAngle: number;\r\n\r\n /**\r\n * Sets the coat tangent texture for anisotropy\r\n */\r\n geometryCoatTangentTexture: Nullable<BaseTexture>;\r\n\r\n // ========================================\r\n // TRANSMISSION LAYER\r\n // ========================================\r\n\r\n /**\r\n * Sets the transmission weight\r\n */\r\n transmissionWeight: number;\r\n\r\n /**\r\n * Sets the transmission weight texture\r\n */\r\n transmissionWeightTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets the attenuation distance\r\n */\r\n transmissionDepth: number;\r\n\r\n /**\r\n * Sets the attenuation color\r\n */\r\n transmissionColor: Color3;\r\n\r\n /**\r\n * Sets the scattering coefficient\r\n */\r\n transmissionScatter: Color3;\r\n\r\n /**\r\n * Sets the transmission scatter texture\r\n */\r\n transmissionScatterTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets the scattering anisotropy (-1 to 1)\r\n */\r\n transmissionScatterAnisotropy: number;\r\n\r\n /**\r\n * Sets the dispersion Abbe number\r\n */\r\n transmissionDispersionAbbeNumber: number;\r\n\r\n /**\r\n * Sets the dispersion scale\r\n */\r\n transmissionDispersionScale: number;\r\n\r\n /**\r\n * The refraction background texture\r\n */\r\n refractionBackgroundTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Configures transmission for thin-surface transmission (KHR_materials_transmission)\r\n */\r\n configureTransmission(): void;\r\n\r\n // ========================================\r\n // VOLUME PROPERTIES\r\n // ========================================\r\n\r\n configureVolume(): void;\r\n\r\n /**\r\n * Sets whether the material is thin-walled (i.e. non-volumetric) or not.\r\n */\r\n geometryThinWalled: boolean;\r\n\r\n /**\r\n * Sets the thickness texture\r\n */\r\n volumeThicknessTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets the thickness factor\r\n */\r\n volumeThickness: number;\r\n\r\n // ========================================\r\n // SUBSURFACE PROPERTIES (Subsurface Scattering)\r\n // ========================================\r\n\r\n /**\r\n * Configures subsurface properties\r\n */\r\n configureSubsurface(): void;\r\n\r\n /**\r\n * Sets/gets the subsurface weight\r\n */\r\n subsurfaceWeight: number;\r\n\r\n /**\r\n * Sets/gets the subsurface weight texture\r\n */\r\n subsurfaceWeightTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the subsurface color\r\n */\r\n subsurfaceColor: Color3;\r\n\r\n /**\r\n * Sets/gets the subsurface color texture\r\n */\r\n subsurfaceColorTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the diffuse transmission tint of the material\r\n */\r\n diffuseTransmissionTint: Color3;\r\n\r\n /**\r\n * Sets/gets the diffuse transmission tint texture of the material\r\n */\r\n diffuseTransmissionTintTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets/gets the subsurface radius (used for subsurface scattering)\r\n */\r\n subsurfaceRadius: number;\r\n\r\n /**\r\n * Sets/gets the subsurface radius scale (used for subsurface scattering)\r\n */\r\n subsurfaceRadiusScale: Color3;\r\n\r\n /**\r\n * Sets/gets the subsurface scattering anisotropy\r\n */\r\n subsurfaceScatterAnisotropy: number;\r\n\r\n /**\r\n * Does this material have a translucent surface (i.e. either transmission or subsurface)?\r\n */\r\n isTranslucent(): boolean;\r\n\r\n // ========================================\r\n // FUZZ LAYER (Sheen)\r\n // ========================================\r\n\r\n /**\r\n * Configures initial settings for fuzz for material.\r\n */\r\n configureFuzz(): void;\r\n\r\n /**\r\n * Sets the fuzz weight\r\n */\r\n fuzzWeight: number;\r\n\r\n /**\r\n * Sets the fuzz weight texture\r\n */\r\n fuzzWeightTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets the fuzz color\r\n */\r\n fuzzColor: Color3;\r\n\r\n /**\r\n * Sets the fuzz color texture\r\n */\r\n fuzzColorTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets the fuzz roughness\r\n */\r\n fuzzRoughness: number;\r\n\r\n /**\r\n * Sets the fuzz roughness texture\r\n */\r\n fuzzRoughnessTexture: Nullable<BaseTexture>;\r\n\r\n // ========================================\r\n // ANISOTROPY\r\n // ========================================\r\n\r\n /**\r\n * Sets/gets the specular roughness anisotropy\r\n */\r\n specularRoughnessAnisotropy: number;\r\n\r\n /**\r\n * Sets the anisotropy rotation\r\n */\r\n geometryTangentAngle: number;\r\n\r\n /**\r\n * Sets/gets the anisotropy texture\r\n */\r\n geometryTangentTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Configures glTF-style anisotropy for OpenPBR materials\r\n * @param useGltfStyle - Whether to use glTF-style anisotropy (default: true)\r\n */\r\n configureGltfStyleAnisotropy(useGltfStyle?: boolean): void;\r\n\r\n // ========================================\r\n // THIN FILM IRIDESCENCE\r\n // ========================================\r\n\r\n /**\r\n * Sets the thin film weight\r\n */\r\n thinFilmWeight: number;\r\n\r\n /**\r\n * Sets the thin film IOR\r\n */\r\n thinFilmIor: number;\r\n\r\n /**\r\n * Sets the thin film thickness minimum\r\n */\r\n thinFilmThicknessMinimum: number;\r\n\r\n /**\r\n * Sets the thin film thickness maximum\r\n */\r\n thinFilmThicknessMaximum: number;\r\n\r\n /**\r\n * Sets the thin film iridescence texture\r\n */\r\n thinFilmWeightTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets the thin film thickness texture\r\n */\r\n thinFilmThicknessTexture: Nullable<BaseTexture>;\r\n\r\n // ========================================\r\n // UNLIT MATERIALS\r\n // ========================================\r\n\r\n /**\r\n * Sets the unlit flag\r\n */\r\n unlit: boolean;\r\n\r\n // ========================================\r\n // GEOMETRY PARAMETERS\r\n // ========================================\r\n\r\n /**\r\n * Sets/gets the geometry opacity\r\n */\r\n geometryOpacity: number;\r\n\r\n /**\r\n * Sets/gets the geometry normal texture\r\n */\r\n geometryNormalTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets the normal map inversions for PBR material only\r\n * @param invertX - Whether to invert the normal map on the X axis\r\n * @param invertY - Whether to invert the normal map on the Y axis\r\n */\r\n setNormalMapInversions(invertX: boolean, invertY: boolean): void;\r\n\r\n /**\r\n * Sets/gets the coat normal texture\r\n */\r\n geometryCoatNormalTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Sets the coat normal texture scale\r\n */\r\n geometryCoatNormalTextureScale: number;\r\n}\r\n"]}
@@ -4,13 +4,11 @@ import { type BaseTexture } from "@onerjs/core/Materials/Textures/baseTexture.js
4
4
  import { type Nullable } from "@onerjs/core/types.js";
5
5
  import { Color3 } from "@onerjs/core/Maths/math.color.js";
6
6
  import { type IMaterialLoadingAdapter } from "./materialLoadingAdapter.js";
7
- import { Vector3 } from "@onerjs/core/Maths/math.vector.js";
8
7
  /**
9
8
  * Material Loading Adapter for OpenPBR materials that provides a unified OpenPBR-like interface.
10
9
  */
11
10
  export declare class OpenPBRMaterialLoadingAdapter implements IMaterialLoadingAdapter {
12
11
  private _material;
13
- private _extinctionCoefficient;
14
12
  /**
15
13
  * Creates a new instance of the OpenPBRMaterialLoadingAdapter.
16
14
  * @param material - The OpenPBR material to adapt.
@@ -402,7 +400,15 @@ export declare class OpenPBRMaterialLoadingAdapter implements IMaterialLoadingAd
402
400
  * @returns The scatter coefficient as a Vector3
403
401
  */
404
402
  get transmissionScatter(): Color3;
403
+ /**
404
+ * Sets the transmission scatter texture.
405
+ * @param value The transmission scatter texture or null
406
+ */
405
407
  set transmissionScatterTexture(value: Nullable<BaseTexture>);
408
+ /**
409
+ * Gets the transmission scatter texture.
410
+ * @returns The transmission scatter texture or null
411
+ */
406
412
  get transmissionScatterTexture(): Nullable<BaseTexture>;
407
413
  /**
408
414
  * Sets the transmission scattering anisotropy.
@@ -447,6 +453,15 @@ export declare class OpenPBRMaterialLoadingAdapter implements IMaterialLoadingAd
447
453
  * @param value The refraction background texture or null
448
454
  */
449
455
  set refractionBackgroundTexture(value: Nullable<BaseTexture>);
456
+ configureVolume(): void;
457
+ /**
458
+ * Sets whether the material is thin-walled (i.e. non-volumetric) or not.
459
+ */
460
+ set geometryThinWalled(value: boolean);
461
+ /**
462
+ * Gets whether the material is thin-walled (i.e. non-volumetric) or not.
463
+ */
464
+ get geometryThinWalled(): boolean;
450
465
  /**
451
466
  * Sets the thickness texture.
452
467
  * @param value The thickness texture or null
@@ -461,15 +476,6 @@ export declare class OpenPBRMaterialLoadingAdapter implements IMaterialLoadingAd
461
476
  * Configures subsurface properties for PBR material
462
477
  */
463
478
  configureSubsurface(): void;
464
- /**
465
- * Sets the extinction coefficient of the volume.
466
- * @param value The extinction coefficient as a Vector3
467
- */
468
- set extinctionCoefficient(value: Vector3);
469
- /**
470
- * Gets the extinction coefficient of the volume.
471
- */
472
- get extinctionCoefficient(): Vector3;
473
479
  /**
474
480
  * Sets the subsurface weight
475
481
  */
@@ -489,18 +495,20 @@ export declare class OpenPBRMaterialLoadingAdapter implements IMaterialLoadingAd
489
495
  * @param value The subsurface tint texture or null
490
496
  */
491
497
  set subsurfaceColorTexture(value: Nullable<BaseTexture>);
498
+ private _diffuseTransmissionTint;
499
+ private _diffuseTransmissionTintTexture;
492
500
  /**
493
- * Sets the surface tint of the material (when using subsurface scattering)
501
+ * Sets the diffuse transmission tint of the material
494
502
  */
495
- set subsurfaceConstantTint(value: Color3);
503
+ set diffuseTransmissionTint(value: Color3);
496
504
  /**
497
- * Gets the surface tint of the material (when using subsurface scattering)
505
+ * Gets the diffuse transmission tint of the material
498
506
  */
499
- get subsurfaceConstantTint(): Color3;
507
+ get diffuseTransmissionTint(): Color3;
500
508
  /**
501
- * Sets the surface tint texture of the material (when using subsurface scattering)
509
+ * Sets the diffuse transmission tint texture of the material
502
510
  */
503
- set subsurfaceConstantTintTexture(value: Nullable<BaseTexture>);
511
+ set diffuseTransmissionTintTexture(value: Nullable<BaseTexture>);
504
512
  /**
505
513
  * Gets the subsurface radius for subsurface scattering.
506
514
  * subsurfaceRadiusScale * subsurfaceRadius gives the mean free path per color channel.
@@ -528,6 +536,11 @@ export declare class OpenPBRMaterialLoadingAdapter implements IMaterialLoadingAd
528
536
  * @param value The anisotropy intensity value
529
537
  */
530
538
  set subsurfaceScatterAnisotropy(value: number);
539
+ /**
540
+ * Does this material have a translucent surface (i.e. either transmission or subsurface)?
541
+ * @returns True if the material is translucent, false otherwise
542
+ */
543
+ isTranslucent(): boolean;
531
544
  /**
532
545
  * Configures fuzz for OpenPBR.
533
546
  * Enables fuzz and sets up proper configuration.
@@ -671,4 +684,5 @@ export declare class OpenPBRMaterialLoadingAdapter implements IMaterialLoadingAd
671
684
  * @param value The scale value for the coat normal texture
672
685
  */
673
686
  set geometryCoatNormalTextureScale(value: number);
687
+ finalize(): void;
674
688
  }
@@ -1,5 +1,4 @@
1
1
  import { Color3 } from "@onerjs/core/Maths/math.color.js";
2
- import { Vector3 } from "@onerjs/core/Maths/math.vector.js";
3
2
  /**
4
3
  * Material Loading Adapter for OpenPBR materials that provides a unified OpenPBR-like interface.
5
4
  */
@@ -9,7 +8,8 @@ export class OpenPBRMaterialLoadingAdapter {
9
8
  * @param material - The OpenPBR material to adapt.
10
9
  */
11
10
  constructor(material) {
12
- this._extinctionCoefficient = Vector3.Zero();
11
+ this._diffuseTransmissionTint = Color3.White();
12
+ this._diffuseTransmissionTintTexture = null;
13
13
  this._material = material;
14
14
  }
15
15
  /**
@@ -562,7 +562,9 @@ export class OpenPBRMaterialLoadingAdapter {
562
562
  * Configures transmission for OpenPBR material.
563
563
  */
564
564
  configureTransmission() {
565
- // OpenPBR transmission will be configured differently when available
565
+ // Material is thin-walled until otherwise specified by the glTF volume extension.
566
+ this._material.geometryThinWalled = 1.0;
567
+ this._material.transmissionDepth = 0.0;
566
568
  }
567
569
  /**
568
570
  * Sets the transmission weight.
@@ -570,13 +572,6 @@ export class OpenPBRMaterialLoadingAdapter {
570
572
  */
571
573
  set transmissionWeight(value) {
572
574
  this._material.transmissionWeight = value;
573
- // If the transmission weight is greater than 0, let's check if the base color
574
- // is set and use that for a surface tint in OpenPBR. This may later be
575
- // overridden by the volume properties but, without volume, this will give us
576
- // glTF compatibility in OpenPBR.
577
- this._material.transmissionColor = this._material.baseColor;
578
- this._material.transmissionColorTexture = this._material.baseColorTexture;
579
- this._material.transmissionDepth = 0.0;
580
575
  }
581
576
  /**
582
577
  * Sets the transmission weight texture.
@@ -606,9 +601,17 @@ export class OpenPBRMaterialLoadingAdapter {
606
601
  get transmissionScatter() {
607
602
  return this._material.transmissionScatter;
608
603
  }
604
+ /**
605
+ * Sets the transmission scatter texture.
606
+ * @param value The transmission scatter texture or null
607
+ */
609
608
  set transmissionScatterTexture(value) {
610
609
  this._material.transmissionScatterTexture = value;
611
610
  }
611
+ /**
612
+ * Gets the transmission scatter texture.
613
+ * @returns The transmission scatter texture or null
614
+ */
612
615
  get transmissionScatterTexture() {
613
616
  return this._material.transmissionScatterTexture;
614
617
  }
@@ -686,6 +689,25 @@ export class OpenPBRMaterialLoadingAdapter {
686
689
  set refractionBackgroundTexture(value) {
687
690
  this._material.backgroundRefractionTexture = value;
688
691
  }
692
+ // ========================================
693
+ // VOLUME PROPERTIES
694
+ // ========================================
695
+ configureVolume() {
696
+ // If we're configuring volume, we assume the material is not thin-walled (i.e. it's volumetric).
697
+ this._material.geometryThinWalled = 0.0;
698
+ }
699
+ /**
700
+ * Sets whether the material is thin-walled (i.e. non-volumetric) or not.
701
+ */
702
+ set geometryThinWalled(value) {
703
+ this._material.geometryThinWalled = value ? 1.0 : 0.0;
704
+ }
705
+ /**
706
+ * Gets whether the material is thin-walled (i.e. non-volumetric) or not.
707
+ */
708
+ get geometryThinWalled() {
709
+ return this._material.geometryThinWalled ? true : false;
710
+ }
689
711
  /**
690
712
  * Sets the thickness texture.
691
713
  * @param value The thickness texture or null
@@ -708,78 +730,63 @@ export class OpenPBRMaterialLoadingAdapter {
708
730
  * Configures subsurface properties for PBR material
709
731
  */
710
732
  configureSubsurface() {
711
- // TODO
712
- }
713
- /**
714
- * Sets the extinction coefficient of the volume.
715
- * @param value The extinction coefficient as a Vector3
716
- */
717
- set extinctionCoefficient(value) {
718
- this._extinctionCoefficient = value;
719
- }
720
- /**
721
- * Gets the extinction coefficient of the volume.
722
- */
723
- get extinctionCoefficient() {
724
- return this._extinctionCoefficient;
733
+ // glTF diffuse transmission is thin-walled (before volume extension is applied) will map to the subsurface slab and, without a
734
+ this._material.geometryThinWalled = 1.0;
735
+ this._material.subsurfaceScatterAnisotropy = 1.0;
725
736
  }
726
737
  /**
727
738
  * Sets the subsurface weight
728
739
  */
729
740
  set subsurfaceWeight(value) {
730
- // TODO
741
+ this._material.subsurfaceWeight = value;
731
742
  }
732
743
  get subsurfaceWeight() {
733
- // TODO
734
- return 0;
744
+ return this._material.subsurfaceWeight;
735
745
  }
736
746
  /**
737
747
  * Sets the subsurface weight texture
738
748
  */
739
749
  set subsurfaceWeightTexture(value) {
740
- // TODO
750
+ this._material.subsurfaceWeightTexture = value;
741
751
  }
742
752
  /**
743
753
  * Sets the subsurface color.
744
754
  * @param value The subsurface tint color as a Color3
745
755
  */
746
756
  set subsurfaceColor(value) {
747
- // TODO
757
+ this._material.subsurfaceColor = value;
748
758
  }
749
759
  /**
750
760
  * Sets the subsurface color texture.
751
761
  * @param value The subsurface tint texture or null
752
762
  */
753
763
  set subsurfaceColorTexture(value) {
754
- // TODO
764
+ this._material.subsurfaceColorTexture = value;
755
765
  }
756
766
  /**
757
- * Sets the surface tint of the material (when using subsurface scattering)
767
+ * Sets the diffuse transmission tint of the material
758
768
  */
759
- set subsurfaceConstantTint(value) {
760
- // There is no equivalent in OpenPBR
761
- // Maybe multiply this by subsurfaceColor?
769
+ set diffuseTransmissionTint(value) {
770
+ this._diffuseTransmissionTint = value;
762
771
  }
763
772
  /**
764
- * Gets the surface tint of the material (when using subsurface scattering)
773
+ * Gets the diffuse transmission tint of the material
765
774
  */
766
- get subsurfaceConstantTint() {
767
- return Color3.White();
775
+ get diffuseTransmissionTint() {
776
+ return this._diffuseTransmissionTint;
768
777
  }
769
778
  /**
770
- * Sets the surface tint texture of the material (when using subsurface scattering)
779
+ * Sets the diffuse transmission tint texture of the material
771
780
  */
772
- set subsurfaceConstantTintTexture(value) {
773
- // There is no equivalent in OpenPBR
774
- // Maybe multiply this by subsurfaceColorTexture?
781
+ set diffuseTransmissionTintTexture(value) {
782
+ this._diffuseTransmissionTintTexture = value;
775
783
  }
776
784
  /**
777
785
  * Gets the subsurface radius for subsurface scattering.
778
786
  * subsurfaceRadiusScale * subsurfaceRadius gives the mean free path per color channel.
779
787
  */
780
788
  get subsurfaceRadius() {
781
- // TODO
782
- return 0;
789
+ return this._material.subsurfaceRadius;
783
790
  }
784
791
  /**
785
792
  * Sets the subsurface radius for subsurface scattering.
@@ -787,15 +794,14 @@ export class OpenPBRMaterialLoadingAdapter {
787
794
  * @param value The subsurface radius value
788
795
  */
789
796
  set subsurfaceRadius(value) {
790
- // TODO
797
+ this._material.subsurfaceRadius = value;
791
798
  }
792
799
  /**
793
800
  * Gets the subsurface radius scale for subsurface scattering.
794
801
  * subsurfaceRadiusScale * subsurfaceRadius gives the mean free path per color channel.
795
802
  */
796
803
  get subsurfaceRadiusScale() {
797
- // TODO
798
- return Color3.White();
804
+ return this._material.subsurfaceRadiusScale;
799
805
  }
800
806
  /**
801
807
  * Sets the subsurface radius scale for subsurface scattering.
@@ -803,14 +809,21 @@ export class OpenPBRMaterialLoadingAdapter {
803
809
  * @param value The subsurface radius scale as a Color3
804
810
  */
805
811
  set subsurfaceRadiusScale(value) {
806
- // TODO
812
+ this._material.subsurfaceRadiusScale = value;
807
813
  }
808
814
  /**
809
815
  * Sets the subsurface scattering anisotropy.
810
816
  * @param value The anisotropy intensity value
811
817
  */
812
818
  set subsurfaceScatterAnisotropy(value) {
813
- // TODO
819
+ this._material.subsurfaceScatterAnisotropy = value;
820
+ }
821
+ /**
822
+ * Does this material have a translucent surface (i.e. either transmission or subsurface)?
823
+ * @returns True if the material is translucent, false otherwise
824
+ */
825
+ isTranslucent() {
826
+ return this.transmissionWeight > 0 || this.subsurfaceWeight > 0;
814
827
  }
815
828
  // ========================================
816
829
  // FUZZ LAYER (Sheen)
@@ -1031,5 +1044,50 @@ export class OpenPBRMaterialLoadingAdapter {
1031
1044
  this._material.geometryCoatNormalTexture.level = value;
1032
1045
  }
1033
1046
  }
1047
+ finalize() {
1048
+ // Do final configuration for the material to handle any interactions/dependencies between properties that we had to defer until all properties were loaded.
1049
+ // If the material is volumetric, we may need to create a coat layer to handle the surface tint.
1050
+ if ((this._diffuseTransmissionTint && !this._diffuseTransmissionTint.equals(Color3.White())) || this._diffuseTransmissionTintTexture) {
1051
+ if (this._material.geometryThinWalled) {
1052
+ // Use the subsurface slab for surface tinting.
1053
+ this.subsurfaceColor = this._diffuseTransmissionTint;
1054
+ this.subsurfaceColorTexture = this._diffuseTransmissionTintTexture;
1055
+ }
1056
+ else {
1057
+ // The material is volumetric and we have surface tinting, so we need to move that tinting to the coat layer to preserve it.
1058
+ // TODO: If we already have a coat slab, we'll have to merge the two.
1059
+ if (this._material.coatWeight == 0 && (!this.baseColor.equals(Color3.White()) || this.baseColorTexture)) {
1060
+ this._material.coatWeight = this.subsurfaceWeight;
1061
+ this._material.coatWeightTexture = this.subsurfaceWeightTexture;
1062
+ this._material.coatColor = this._diffuseTransmissionTint;
1063
+ this._material.coatColorTexture = this._diffuseTransmissionTintTexture;
1064
+ this._material.coatIor = this._material.specularIor; // Use the same IOR for the coat as the specular layer to try to match the original reflection as closely as possible.
1065
+ this._material.coatDarkening = 0.0;
1066
+ this._material.coatRoughness = this._material.specularRoughness;
1067
+ this._material.coatRoughnessTexture = this._material.specularRoughnessTexture;
1068
+ }
1069
+ }
1070
+ }
1071
+ // If the material has transmission, we need to use the base color to tint the transmission.
1072
+ if (this.transmissionWeight > 0) {
1073
+ if (this._material.geometryThinWalled || this._material.transmissionDepth === 0) {
1074
+ // If the material is thin-walled or has no attenuation depth, we can use the base color as the transmission color directly.
1075
+ this._material.transmissionColor = this._material.baseColor;
1076
+ this._material.transmissionColorTexture = this._material.baseColorTexture;
1077
+ }
1078
+ else if (this._material.coatWeight == 0 && (!this.baseColor.equals(Color3.White()) || this.baseColorTexture !== null)) {
1079
+ // Otherwise, we have volumetric attenuation so we need to use the coat layer to preserve the base color tinting of glTF.
1080
+ // TODO: If we already have a coat slab, we'll have to merge the two.
1081
+ this._material.coatWeight = this.transmissionWeight;
1082
+ this._material.coatWeightTexture = this.transmissionWeightTexture;
1083
+ this._material.coatColor = this.baseColor;
1084
+ this._material.coatColorTexture = this.baseColorTexture;
1085
+ this._material.coatIor = this._material.specularIor; // Use the same IOR for the coat as the specular layer to try to match the original reflection as closely as possible.
1086
+ this._material.coatDarkening = 0.0;
1087
+ this._material.coatRoughness = this._material.specularRoughness;
1088
+ this._material.coatRoughnessTexture = this._material.specularRoughnessTexture;
1089
+ }
1090
+ }
1091
+ }
1034
1092
  }
1035
1093
  //# sourceMappingURL=openpbrMaterialLoadingAdapter.js.map