@babylonjs/loaders 9.0.0 → 9.2.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.
Files changed (181) hide show
  1. package/BVH/bvhFileLoader.d.ts +3 -3
  2. package/BVH/bvhFileLoader.js +1 -1
  3. package/BVH/bvhFileLoader.js.map +1 -1
  4. package/BVH/bvhFileLoader.metadata.js.map +1 -1
  5. package/BVH/bvhLoader.d.ts +4 -4
  6. package/BVH/bvhLoader.js.map +1 -1
  7. package/OBJ/mtlFileLoader.d.ts +3 -3
  8. package/OBJ/mtlFileLoader.js.map +1 -1
  9. package/OBJ/objFileLoader.d.ts +3 -3
  10. package/OBJ/objFileLoader.js +1 -1
  11. package/OBJ/objFileLoader.js.map +1 -1
  12. package/OBJ/objFileLoader.metadata.js.map +1 -1
  13. package/OBJ/objLoadingOptions.d.ts +1 -1
  14. package/OBJ/objLoadingOptions.js.map +1 -1
  15. package/OBJ/solidParser.d.ts +4 -4
  16. package/OBJ/solidParser.js.map +1 -1
  17. package/SPLAT/sog.d.ts +2 -2
  18. package/SPLAT/sog.js.map +1 -1
  19. package/SPLAT/splatFileLoader.d.ts +3 -3
  20. package/SPLAT/splatFileLoader.js +3 -1
  21. package/SPLAT/splatFileLoader.js.map +1 -1
  22. package/SPLAT/splatFileLoader.metadata.js.map +1 -1
  23. package/SPLAT/splatLoadingOptions.d.ts +1 -1
  24. package/SPLAT/splatLoadingOptions.js.map +1 -1
  25. package/SPLAT/spz.d.ts +3 -3
  26. package/SPLAT/spz.js.map +1 -1
  27. package/STL/stlFileLoader.d.ts +4 -4
  28. package/STL/stlFileLoader.js.map +1 -1
  29. package/STL/stlFileLoader.metadata.js.map +1 -1
  30. package/dynamic.js.map +1 -1
  31. package/glTF/1.0/glTFBinaryExtension.d.ts +3 -3
  32. package/glTF/1.0/glTFBinaryExtension.js.map +1 -1
  33. package/glTF/1.0/glTFLoader.d.ts +6 -6
  34. package/glTF/1.0/glTFLoader.js +2 -1
  35. package/glTF/1.0/glTFLoader.js.map +1 -1
  36. package/glTF/1.0/glTFLoaderInterfaces.d.ts +7 -7
  37. package/glTF/1.0/glTFLoaderInterfaces.js.map +1 -1
  38. package/glTF/1.0/glTFLoaderUtils.d.ts +3 -4
  39. package/glTF/1.0/glTFLoaderUtils.js +1 -1
  40. package/glTF/1.0/glTFLoaderUtils.js.map +1 -1
  41. package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +1 -1
  42. package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -1
  43. package/glTF/2.0/Extensions/EXT_lights_area.d.ts +4 -4
  44. package/glTF/2.0/Extensions/EXT_lights_area.js.map +1 -1
  45. package/glTF/2.0/Extensions/EXT_lights_ies.d.ts +4 -4
  46. package/glTF/2.0/Extensions/EXT_lights_ies.js.map +1 -1
  47. package/glTF/2.0/Extensions/EXT_lights_image_based.d.ts +4 -4
  48. package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
  49. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +4 -4
  50. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
  51. package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +3 -3
  52. package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
  53. package/glTF/2.0/Extensions/EXT_texture_avif.d.ts +4 -4
  54. package/glTF/2.0/Extensions/EXT_texture_avif.js.map +1 -1
  55. package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +4 -4
  56. package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -1
  57. package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +8 -8
  58. package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -1
  59. package/glTF/2.0/Extensions/KHR_animation_pointer.d.ts +6 -6
  60. package/glTF/2.0/Extensions/KHR_animation_pointer.data.js.map +1 -1
  61. package/glTF/2.0/Extensions/KHR_animation_pointer.js.map +1 -1
  62. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +5 -5
  63. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
  64. package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.d.ts +4 -4
  65. package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.js.map +1 -1
  66. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.d.ts +5 -6
  67. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.js.map +1 -1
  68. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.d.ts +4 -4
  69. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js.map +1 -1
  70. package/glTF/2.0/Extensions/KHR_interactivity.d.ts +3 -3
  71. package/glTF/2.0/Extensions/KHR_interactivity.js.map +1 -1
  72. package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +4 -4
  73. package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
  74. package/glTF/2.0/Extensions/KHR_materials_anisotropy.d.ts +4 -4
  75. package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -1
  76. package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +4 -4
  77. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
  78. package/glTF/2.0/Extensions/KHR_materials_coat.d.ts +4 -4
  79. package/glTF/2.0/Extensions/KHR_materials_coat.js.map +1 -1
  80. package/glTF/2.0/Extensions/KHR_materials_diffuse_roughness.d.ts +4 -4
  81. package/glTF/2.0/Extensions/KHR_materials_diffuse_roughness.js.map +1 -1
  82. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.d.ts +4 -4
  83. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js +2 -2
  84. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js.map +1 -1
  85. package/glTF/2.0/Extensions/KHR_materials_dispersion.d.ts +4 -4
  86. package/glTF/2.0/Extensions/KHR_materials_dispersion.js.map +1 -1
  87. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +4 -4
  88. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
  89. package/glTF/2.0/Extensions/KHR_materials_fuzz.d.ts +4 -4
  90. package/glTF/2.0/Extensions/KHR_materials_fuzz.js.map +1 -1
  91. package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +4 -4
  92. package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
  93. package/glTF/2.0/Extensions/KHR_materials_iridescence.d.ts +4 -4
  94. package/glTF/2.0/Extensions/KHR_materials_iridescence.js.map +1 -1
  95. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts +4 -4
  96. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
  97. package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +4 -4
  98. package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
  99. package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +4 -4
  100. package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
  101. package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +4 -4
  102. package/glTF/2.0/Extensions/KHR_materials_transmission.js +119 -24
  103. package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
  104. package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +4 -4
  105. package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
  106. package/glTF/2.0/Extensions/KHR_materials_variants.d.ts +6 -6
  107. package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
  108. package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +4 -4
  109. package/glTF/2.0/Extensions/KHR_materials_volume.js +3 -6
  110. package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
  111. package/glTF/2.0/Extensions/KHR_materials_volume_scatter.d.ts +4 -4
  112. package/glTF/2.0/Extensions/KHR_materials_volume_scatter.js +25 -19
  113. package/glTF/2.0/Extensions/KHR_materials_volume_scatter.js.map +1 -1
  114. package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +2 -2
  115. package/glTF/2.0/Extensions/KHR_mesh_quantization.js.map +1 -1
  116. package/glTF/2.0/Extensions/KHR_node_hoverability.d.ts +2 -2
  117. package/glTF/2.0/Extensions/KHR_node_hoverability.js.map +1 -1
  118. package/glTF/2.0/Extensions/KHR_node_selectability.d.ts +2 -2
  119. package/glTF/2.0/Extensions/KHR_node_selectability.js.map +1 -1
  120. package/glTF/2.0/Extensions/KHR_node_visibility.d.ts +2 -2
  121. package/glTF/2.0/Extensions/KHR_node_visibility.js.map +1 -1
  122. package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +4 -4
  123. package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -1
  124. package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +4 -4
  125. package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
  126. package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +2 -2
  127. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
  128. package/glTF/2.0/Extensions/MSFT_audio_emitter.d.ts +5 -5
  129. package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
  130. package/glTF/2.0/Extensions/MSFT_lod.d.ts +7 -7
  131. package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
  132. package/glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts +4 -4
  133. package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -1
  134. package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +4 -4
  135. package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -1
  136. package/glTF/2.0/Extensions/gltfPathToObjectConverter.d.ts +3 -3
  137. package/glTF/2.0/Extensions/gltfPathToObjectConverter.js.map +1 -1
  138. package/glTF/2.0/Extensions/objectModelMapping.d.ts +12 -14
  139. package/glTF/2.0/Extensions/objectModelMapping.js +2 -2
  140. package/glTF/2.0/Extensions/objectModelMapping.js.map +1 -1
  141. package/glTF/2.0/glTFLoader.d.ts +19 -19
  142. package/glTF/2.0/glTFLoader.js +10 -28
  143. package/glTF/2.0/glTFLoader.js.map +1 -1
  144. package/glTF/2.0/glTFLoaderAnimation.d.ts +2 -2
  145. package/glTF/2.0/glTFLoaderAnimation.js.map +1 -1
  146. package/glTF/2.0/glTFLoaderExtension.d.ts +15 -15
  147. package/glTF/2.0/glTFLoaderExtension.js.map +1 -1
  148. package/glTF/2.0/glTFLoaderExtensionRegistry.d.ts +2 -2
  149. package/glTF/2.0/glTFLoaderExtensionRegistry.js.map +1 -1
  150. package/glTF/2.0/glTFLoaderInterfaces.d.ts +9 -9
  151. package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -1
  152. package/glTF/2.0/materialLoadingAdapter.d.ts +25 -14
  153. package/glTF/2.0/materialLoadingAdapter.js.map +1 -1
  154. package/glTF/2.0/openpbrMaterialLoadingAdapter.d.ts +36 -22
  155. package/glTF/2.0/openpbrMaterialLoadingAdapter.js +106 -48
  156. package/glTF/2.0/openpbrMaterialLoadingAdapter.js.map +1 -1
  157. package/glTF/2.0/pbrMaterialLoadingAdapter.d.ts +23 -19
  158. package/glTF/2.0/pbrMaterialLoadingAdapter.js +26 -19
  159. package/glTF/2.0/pbrMaterialLoadingAdapter.js.map +1 -1
  160. package/glTF/glTFFileLoader.d.ts +12 -12
  161. package/glTF/glTFFileLoader.js +1 -1
  162. package/glTF/glTFFileLoader.js.map +1 -1
  163. package/glTF/glTFFileLoader.metadata.js.map +1 -1
  164. package/glTF/glTFValidation.d.ts +1 -1
  165. package/glTF/glTFValidation.js.map +1 -1
  166. package/legacy/legacy-bvhFileLoader.js.map +1 -1
  167. package/legacy/legacy-dynamic.js.map +1 -1
  168. package/legacy/legacy-glTF.js.map +1 -1
  169. package/legacy/legacy-glTF1.js.map +1 -1
  170. package/legacy/legacy-glTF1FileLoader.js +0 -1
  171. package/legacy/legacy-glTF1FileLoader.js.map +1 -1
  172. package/legacy/legacy-glTF2.js.map +1 -1
  173. package/legacy/legacy-glTF2FileLoader.js +0 -1
  174. package/legacy/legacy-glTF2FileLoader.js.map +1 -1
  175. package/legacy/legacy-glTFFileLoader.js +0 -1
  176. package/legacy/legacy-glTFFileLoader.js.map +1 -1
  177. package/legacy/legacy-objFileLoader.js.map +1 -1
  178. package/legacy/legacy-stlFileLoader.js.map +1 -1
  179. package/legacy/legacy.js +0 -1
  180. package/legacy/legacy.js.map +1 -1
  181. package/package.json +6 -6
@@ -1,5 +1,4 @@
1
1
  import { Color3 } from "@babylonjs/core/Maths/math.color.js";
2
- import { Vector3 } from "@babylonjs/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
@@ -1 +1 @@
1
- {"version":3,"file":"openpbrMaterialLoadingAdapter.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/2.0/openpbrMaterialLoadingAdapter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAEjD;;GAEG;AACH,MAAM,OAAO,6BAA6B;IAItC;;;OAGG;IACH,YAAY,QAAkB;QANtB,2BAAsB,GAAY,OAAO,CAAC,IAAI,EAAE,CAAC;QAOrD,IAAI,CAAC,SAAS,GAAG,QAA2B,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,IAAW,OAAO,CAAC,KAAc;QAC7B,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC;IACjC,CAAC;IAED,2CAA2C;IAC3C,qBAAqB;IACrB,2CAA2C;IAE3C;;;OAGG;I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GG;IACH,IAAW,eAAe;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACH,IAAW,qBAAqB,CAAC,KAA4B;QACzD,IAAI,CAAC,SAAS,CAAC,qBAAqB,GAAG,KAAK,CAAC;IACjD,CAAC;IAED;;;OAGG;IACH,IAAW,qBAAqB;QAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC;IAChD,CAAC;IAED;;;;;OAKG;IACI,sBAAsB,CAAC,OAAgB,EAAE,OAAgB;QAC5D,yEAAyE;IAC7E,CAAC;IAED;;;OAGG;IACH,IAAW,yBAAyB,CAAC,KAA4B;QAC7D,IAAI,CAAC,SAAS,CAAC,yBAAyB,GAAG,KAAK,CAAC;IACrD,CAAC;IAED;;;OAGG;IACH,IAAW,yBAAyB;QAChC,OAAO,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC;IACpD,CAAC;IAED;;;OAGG;IACH,IAAW,8BAA8B,CAAC,KAAa;QACnD,IAAI,IAAI,CAAC,SAAS,CAAC,yBAAyB,EAAE,CAAC;YAC3C,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,KAAK,GAAG,KAAK,CAAC;QAC3D,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type { OpenPBRMaterial } from \"core/Materials/PBR/openpbrMaterial\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { IMaterialLoadingAdapter } from \"./materialLoadingAdapter\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\n\r\n/**\r\n * Material Loading Adapter for OpenPBR materials that provides a unified OpenPBR-like interface.\r\n */\r\nexport class OpenPBRMaterialLoadingAdapter implements IMaterialLoadingAdapter {\r\n private _material: OpenPBRMaterial;\r\n private _extinctionCoefficient: Vector3 = Vector3.Zero();\r\n\r\n /**\r\n * Creates a new instance of the OpenPBRMaterialLoadingAdapter.\r\n * @param material - The OpenPBR material to adapt.\r\n */\r\n constructor(material: Material) {\r\n this._material = material as OpenPBRMaterial;\r\n }\r\n\r\n /**\r\n * Gets the underlying material\r\n */\r\n public get material(): OpenPBRMaterial {\r\n return this._material;\r\n }\r\n\r\n /**\r\n * Whether the material should be treated as unlit\r\n */\r\n public get isUnlit(): boolean {\r\n return this._material.unlit;\r\n }\r\n\r\n /**\r\n * Sets whether the material should be treated as unlit\r\n */\r\n public set isUnlit(value: boolean) {\r\n this._material.unlit = value;\r\n }\r\n\r\n // ========================================\r\n // CULLING PROPERTIES\r\n // ========================================\r\n\r\n /**\r\n * Sets whether back face culling is enabled.\r\n * @param value True to enable back face culling\r\n */\r\n public set backFaceCulling(value: boolean) {\r\n this._material.backFaceCulling = value;\r\n }\r\n\r\n /**\r\n * Gets whether back face culling is enabled.\r\n * @returns True if back face culling is enabled\r\n */\r\n public get backFaceCulling(): boolean {\r\n return this._material.backFaceCulling;\r\n }\r\n\r\n /**\r\n * Sets whether two-sided lighting is enabled.\r\n * @param value True to enable two-sided lighting\r\n */\r\n public set twoSidedLighting(value: boolean) {\r\n this._material.twoSidedLighting = value;\r\n }\r\n\r\n /**\r\n * Gets whether two-sided lighting is enabled.\r\n * @returns True if two-sided lighting is enabled\r\n */\r\n public get twoSidedLighting(): boolean {\r\n return this._material.twoSidedLighting;\r\n }\r\n\r\n // ========================================\r\n // ALPHA PROPERTIES\r\n // ========================================\r\n\r\n /**\r\n * Sets the alpha cutoff value for alpha testing.\r\n * Note: OpenPBR doesn't have a direct equivalent, so this is a no-op.\r\n * @param value The alpha cutoff threshold (ignored for OpenPBR)\r\n */\r\n public set alphaCutOff(value: number) {\r\n // OpenPBR doesn't have a direct equivalent, but could be implemented if needed\r\n }\r\n\r\n /**\r\n * Gets the alpha cutoff value.\r\n * @returns Default value of 0.5 (OpenPBR doesn't support this directly)\r\n */\r\n public get alphaCutOff(): number {\r\n return 0.5; // Default value\r\n }\r\n\r\n /**\r\n * Sets whether to use alpha from the base color texture.\r\n * Note: OpenPBR handles this differently through the baseColorTexture alpha channel.\r\n * @param value True to use alpha from base color texture (handled automatically in OpenPBR)\r\n */\r\n public set useAlphaFromBaseColorTexture(value: boolean) {\r\n this._material._useAlphaFromBaseColorTexture = value;\r\n }\r\n\r\n /**\r\n * Gets whether alpha is used from the base color texture.\r\n * @returns Always false for OpenPBR as it's handled automatically\r\n */\r\n public get useAlphaFromBaseColorTexture(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Gets whether the transparency is treated as alpha coverage.\r\n */\r\n public get transparencyAsAlphaCoverage(): boolean {\r\n // OpenPBR doesn't support treating transparency as alpha coverage.\r\n return false;\r\n }\r\n\r\n /**\r\n * Sets/Gets whether the transparency is treated as alpha coverage\r\n */\r\n public set transparencyAsAlphaCoverage(value: boolean) {\r\n // OpenPBR doesn't support treating transparency as alpha coverage.\r\n }\r\n\r\n // ========================================\r\n // BASE PARAMETERS\r\n // ========================================\r\n\r\n /**\r\n * Sets the base color of the OpenPBR material.\r\n * @param value The base color as a Color3\r\n */\r\n public set baseColor(value: Color3) {\r\n this._material.baseColor = value;\r\n }\r\n\r\n /**\r\n * Gets the base color of the OpenPBR material.\r\n * @returns The base color as a Color3\r\n */\r\n public get baseColor(): Color3 {\r\n return this._material.baseColor;\r\n }\r\n\r\n /**\r\n * Sets the base color texture of the OpenPBR material.\r\n * @param value The base color texture or null\r\n */\r\n public set baseColorTexture(value: Nullable<BaseTexture>) {\r\n this._material.baseColorTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the base color texture of the OpenPBR material.\r\n * @returns The base color texture or null\r\n */\r\n public get baseColorTexture(): Nullable<BaseTexture> {\r\n return this._material.baseColorTexture;\r\n }\r\n\r\n /**\r\n * Sets the base diffuse roughness of the OpenPBR material.\r\n * @param value The diffuse roughness value (0-1)\r\n */\r\n public set baseDiffuseRoughness(value: number) {\r\n this._material.baseDiffuseRoughness = value;\r\n }\r\n\r\n /**\r\n * Gets the base diffuse roughness of the OpenPBR material.\r\n * @returns The diffuse roughness value (0-1)\r\n */\r\n public get baseDiffuseRoughness(): number {\r\n return this._material.baseDiffuseRoughness;\r\n }\r\n\r\n /**\r\n * Sets the base diffuse roughness texture of the OpenPBR material.\r\n * @param value The diffuse roughness texture or null\r\n */\r\n public set baseDiffuseRoughnessTexture(value: Nullable<BaseTexture>) {\r\n this._material.baseDiffuseRoughnessTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the base diffuse roughness texture of the OpenPBR material.\r\n * @returns The diffuse roughness texture or null\r\n */\r\n public get baseDiffuseRoughnessTexture(): Nullable<BaseTexture> {\r\n return this._material.baseDiffuseRoughnessTexture;\r\n }\r\n\r\n /**\r\n * Sets the base metalness value of the OpenPBR material.\r\n * @param value The metalness value (0-1)\r\n */\r\n public set baseMetalness(value: number) {\r\n this._material.baseMetalness = value;\r\n }\r\n\r\n /**\r\n * Gets the base metalness value of the OpenPBR material.\r\n * @returns The metalness value (0-1)\r\n */\r\n public get baseMetalness(): number {\r\n return this._material.baseMetalness;\r\n }\r\n\r\n /**\r\n * Sets the base metalness texture of the OpenPBR material.\r\n * @param value The metalness texture or null\r\n */\r\n public set baseMetalnessTexture(value: Nullable<BaseTexture>) {\r\n this._material.baseMetalnessTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the base metalness texture of the OpenPBR material.\r\n * @returns The metalness texture or null\r\n */\r\n public get baseMetalnessTexture(): Nullable<BaseTexture> {\r\n return this._material.baseMetalnessTexture;\r\n }\r\n\r\n /**\r\n * Sets whether to use roughness from the metallic texture's green channel.\r\n * @param value True to use green channel for roughness\r\n */\r\n public set useRoughnessFromMetallicTextureGreen(value: boolean) {\r\n this._material._useRoughnessFromMetallicTextureGreen = value;\r\n }\r\n\r\n /**\r\n * Sets whether to use metalness from the metallic texture's blue channel.\r\n * @param value True to use blue channel for metalness\r\n */\r\n public set useMetallicFromMetallicTextureBlue(value: boolean) {\r\n this._material._useMetallicFromMetallicTextureBlue = value;\r\n }\r\n\r\n // ========================================\r\n // SPECULAR PARAMETERS\r\n // ========================================\r\n\r\n /**\r\n * Configures specular properties for OpenPBR material.\r\n * @param _enableEdgeColor Whether to enable edge color support (ignored for OpenPBR)\r\n */\r\n public enableSpecularEdgeColor(_enableEdgeColor: boolean = false): void {\r\n // OpenPBR already supports edge color natively, no configuration needed\r\n }\r\n\r\n /**\r\n * Sets the specular weight of the OpenPBR material.\r\n * @param value The specular weight value (0-1)\r\n */\r\n public set specularWeight(value: number) {\r\n this._material.specularWeight = value;\r\n }\r\n\r\n /**\r\n * Gets the specular weight of the OpenPBR material.\r\n * @returns The specular weight value (0-1)\r\n */\r\n public get specularWeight(): number {\r\n return this._material.specularWeight;\r\n }\r\n\r\n /**\r\n * Sets the specular weight texture of the OpenPBR material.\r\n * If the same texture is used for specular color, optimizes by using alpha channel for weight.\r\n * @param value The specular weight texture or null\r\n */\r\n public set specularWeightTexture(value: Nullable<BaseTexture>) {\r\n if (this._material.specularColorTexture === value) {\r\n this._material.specularWeightTexture = null;\r\n this._material._useSpecularWeightFromSpecularColorTexture = true;\r\n this._material._useSpecularWeightFromAlpha = true;\r\n } else {\r\n this._material.specularWeightTexture = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the specular weight texture of the OpenPBR material.\r\n * @returns The specular weight texture or null\r\n */\r\n public get specularWeightTexture(): Nullable<BaseTexture> {\r\n return this._material.specularWeightTexture;\r\n }\r\n\r\n /**\r\n * Sets the specular color of the OpenPBR material.\r\n * @param value The specular color as a Color3\r\n */\r\n public set specularColor(value: Color3) {\r\n this._material.specularColor = value;\r\n }\r\n\r\n /**\r\n * Gets the specular color of the OpenPBR material.\r\n * @returns The specular color as a Color3\r\n */\r\n public get specularColor(): Color3 {\r\n return this._material.specularColor;\r\n }\r\n\r\n /**\r\n * Sets the specular color texture of the OpenPBR material.\r\n * If the same texture is used for specular weight, optimizes by using alpha channel for weight.\r\n * @param value The specular color texture or null\r\n */\r\n public set specularColorTexture(value: Nullable<BaseTexture>) {\r\n this._material.specularColorTexture = value;\r\n if (this._material.specularWeightTexture === this._material.specularColorTexture) {\r\n this._material.specularWeightTexture = null;\r\n this._material._useSpecularWeightFromSpecularColorTexture = true;\r\n this._material._useSpecularWeightFromAlpha = true;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the specular color texture of the OpenPBR material.\r\n * @returns The specular color texture or null\r\n */\r\n public get specularColorTexture(): Nullable<BaseTexture> {\r\n return this._material.specularColorTexture;\r\n }\r\n\r\n /**\r\n * Sets the specular roughness of the OpenPBR material.\r\n * @param value The roughness value (0-1)\r\n */\r\n public set specularRoughness(value: number) {\r\n this._material.specularRoughness = value;\r\n }\r\n\r\n /**\r\n * Gets the specular roughness of the OpenPBR material.\r\n * @returns The roughness value (0-1)\r\n */\r\n public get specularRoughness(): number {\r\n return this._material.specularRoughness;\r\n }\r\n\r\n /**\r\n * Sets the specular roughness texture of the OpenPBR material.\r\n * @param value The roughness texture or null\r\n */\r\n public set specularRoughnessTexture(value: Nullable<BaseTexture>) {\r\n this._material.specularRoughnessTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the specular roughness texture of the OpenPBR material.\r\n * @returns The roughness texture or null\r\n */\r\n public get specularRoughnessTexture(): Nullable<BaseTexture> {\r\n return this._material.specularRoughnessTexture;\r\n }\r\n\r\n /**\r\n * Sets the specular index of refraction (IOR) of the OpenPBR material.\r\n * @param value The IOR value\r\n */\r\n public set specularIor(value: number) {\r\n this._material.specularIor = value;\r\n }\r\n\r\n /**\r\n * Gets the specular index of refraction (IOR) of the OpenPBR material.\r\n * @returns The IOR value\r\n */\r\n public get specularIor(): number {\r\n return this._material.specularIor;\r\n }\r\n\r\n // ========================================\r\n // EMISSION PARAMETERS\r\n // ========================================\r\n\r\n /**\r\n * Sets the emission color of the OpenPBR material.\r\n * @param value The emission color as a Color3\r\n */\r\n public set emissionColor(value: Color3) {\r\n this._material.emissionColor = value;\r\n }\r\n\r\n /**\r\n * Gets the emission color of the OpenPBR material.\r\n * @returns The emission color as a Color3\r\n */\r\n public get emissionColor(): Color3 {\r\n return this._material.emissionColor;\r\n }\r\n\r\n /**\r\n * Sets the emission luminance of the OpenPBR material.\r\n * @param value The emission luminance value\r\n */\r\n public set emissionLuminance(value: number) {\r\n this._material.emissionLuminance = value;\r\n }\r\n\r\n /**\r\n * Gets the emission luminance of the OpenPBR material.\r\n * @returns The emission luminance value\r\n */\r\n public get emissionLuminance(): number {\r\n return this._material.emissionLuminance;\r\n }\r\n\r\n /**\r\n * Sets the emission color texture of the OpenPBR material.\r\n * @param value The emission texture or null\r\n */\r\n public set emissionColorTexture(value: Nullable<BaseTexture>) {\r\n this._material.emissionColorTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the emission color texture of the OpenPBR material.\r\n * @returns The emission texture or null\r\n */\r\n public get emissionColorTexture(): Nullable<BaseTexture> {\r\n return this._material.emissionColorTexture;\r\n }\r\n\r\n // ========================================\r\n // AMBIENT OCCLUSION\r\n // ========================================\r\n\r\n /**\r\n * Sets the ambient occlusion texture of the OpenPBR material.\r\n * @param value The ambient occlusion texture or null\r\n */\r\n public set ambientOcclusionTexture(value: Nullable<BaseTexture>) {\r\n this._material.ambientOcclusionTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the ambient occlusion texture of the OpenPBR material.\r\n * @returns The ambient occlusion texture or null\r\n */\r\n public get ambientOcclusionTexture(): Nullable<BaseTexture> {\r\n return this._material.ambientOcclusionTexture;\r\n }\r\n\r\n /**\r\n * Sets the ambient occlusion texture strength by modifying the texture's level.\r\n * @param value The strength value (typically 0-1)\r\n */\r\n public set ambientOcclusionTextureStrength(value: number) {\r\n const texture = this._material.ambientOcclusionTexture;\r\n if (texture) {\r\n texture.level = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the ambient occlusion texture strength from the texture's level property.\r\n * @returns The strength value, defaults to 1.0 if no texture or level is set\r\n */\r\n public get ambientOcclusionTextureStrength(): number {\r\n const texture = this._material.ambientOcclusionTexture;\r\n return texture?.level ?? 1.0;\r\n }\r\n\r\n // ========================================\r\n // COAT PARAMETERS\r\n // ========================================\r\n\r\n /**\r\n * Configures coat parameters for OpenPBR material.\r\n * OpenPBR coat is already built-in, so no configuration is needed.\r\n */\r\n public configureCoat(): void {\r\n // OpenPBR coat is already built-in, no configuration needed\r\n }\r\n\r\n /**\r\n * Sets the coat weight of the OpenPBR material.\r\n * @param value The coat weight value (0-1)\r\n */\r\n public set coatWeight(value: number) {\r\n this._material.coatWeight = value;\r\n }\r\n\r\n /**\r\n * Gets the coat weight of the OpenPBR material.\r\n * @returns The coat weight value (0-1)\r\n */\r\n public get coatWeight(): number {\r\n return this._material.coatWeight;\r\n }\r\n\r\n /**\r\n * Sets the coat weight texture of the OpenPBR material.\r\n * @param value The coat weight texture or null\r\n */\r\n public set coatWeightTexture(value: Nullable<BaseTexture>) {\r\n this._material.coatWeightTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the coat weight texture of the OpenPBR material.\r\n * @returns The coat weight texture or null\r\n */\r\n public get coatWeightTexture(): Nullable<BaseTexture> {\r\n return this._material.coatWeightTexture;\r\n }\r\n\r\n /**\r\n * Sets the coat color of the OpenPBR material.\r\n * @param value The coat color as a Color3\r\n */\r\n public set coatColor(value: Color3) {\r\n this._material.coatColor = value;\r\n }\r\n\r\n /**\r\n * Sets the coat color texture of the OpenPBR material.\r\n * @param value The coat color texture or null\r\n */\r\n public set coatColorTexture(value: Nullable<BaseTexture>) {\r\n this._material.coatColorTexture = value;\r\n }\r\n\r\n /**\r\n * Sets the coat roughness of the OpenPBR material.\r\n * @param value The coat roughness value (0-1)\r\n */\r\n public set coatRoughness(value: number) {\r\n this._material.coatRoughness = value;\r\n }\r\n\r\n /**\r\n * Gets the coat roughness of the OpenPBR material.\r\n * @returns The coat roughness value (0-1)\r\n */\r\n public get coatRoughness(): number {\r\n return this._material.coatRoughness;\r\n }\r\n\r\n /**\r\n * Sets the coat roughness texture of the OpenPBR material.\r\n * @param value The coat roughness texture or null\r\n */\r\n public set coatRoughnessTexture(value: Nullable<BaseTexture>) {\r\n this._material.coatRoughnessTexture = value;\r\n if (value) {\r\n this._material._useCoatRoughnessFromGreenChannel = true;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the coat roughness texture of the OpenPBR material.\r\n * @returns The coat roughness texture or null\r\n */\r\n public get coatRoughnessTexture(): Nullable<BaseTexture> {\r\n return this._material.coatRoughnessTexture;\r\n }\r\n\r\n /**\r\n * Sets the coat index of refraction (IOR) of the OpenPBR material.\r\n */\r\n public set coatIor(value: number) {\r\n this._material.coatIor = value;\r\n }\r\n\r\n /**\r\n * Sets the coat darkening value of the OpenPBR material.\r\n * @param value The coat darkening value\r\n */\r\n public set coatDarkening(value: number) {\r\n this._material.coatDarkening = value;\r\n }\r\n\r\n /**\r\n * Sets the coat darkening texture (OpenPBR: coatDarkeningTexture, no PBR equivalent)\r\n */\r\n public set coatDarkeningTexture(value: Nullable<BaseTexture>) {\r\n this._material.coatDarkeningTexture = value;\r\n }\r\n\r\n /**\r\n * Sets the coat roughness anisotropy.\r\n * TODO: Implementation pending OpenPBR coat anisotropy feature availability.\r\n * @param value The coat anisotropy intensity value\r\n */\r\n public set coatRoughnessAnisotropy(value: number) {\r\n this._material.coatRoughnessAnisotropy = value;\r\n }\r\n\r\n /**\r\n * Gets the coat roughness anisotropy.\r\n * TODO: Implementation pending OpenPBR coat anisotropy feature availability.\r\n * @returns Currently returns 0 as coat anisotropy is not yet available\r\n */\r\n public get coatRoughnessAnisotropy(): number {\r\n return this._material.coatRoughnessAnisotropy;\r\n }\r\n\r\n /**\r\n * Sets the coat tangent angle for anisotropy.\r\n * TODO: Implementation pending OpenPBR coat anisotropy feature availability.\r\n * @param value The coat anisotropy rotation angle in radians\r\n */\r\n public set geometryCoatTangentAngle(value: number) {\r\n this._material.geometryCoatTangentAngle = value;\r\n }\r\n\r\n /**\r\n * Sets the coat tangent texture for anisotropy.\r\n * TODO: Implementation pending OpenPBR coat anisotropy feature availability.\r\n * @param value The coat anisotropy texture or null\r\n */\r\n public set geometryCoatTangentTexture(value: Nullable<BaseTexture>) {\r\n this._material.geometryCoatTangentTexture = value;\r\n if (value) {\r\n this._material._useCoatRoughnessAnisotropyFromTangentTexture = true;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the coat tangent texture for anisotropy.\r\n * TODO: Implementation pending OpenPBR coat anisotropy feature availability.\r\n * @returns Currently returns null as coat anisotropy is not yet available\r\n */\r\n public get geometryCoatTangentTexture(): Nullable<BaseTexture> {\r\n return this._material.geometryCoatTangentTexture;\r\n }\r\n\r\n // ========================================\r\n // TRANSMISSION LAYER\r\n // ========================================\r\n\r\n /**\r\n * Configures transmission for OpenPBR material.\r\n */\r\n public configureTransmission(): void {\r\n // OpenPBR transmission will be configured differently when available\r\n }\r\n\r\n /**\r\n * Sets the transmission weight.\r\n * @param value The transmission weight value (0-1)\r\n */\r\n public set transmissionWeight(value: number) {\r\n this._material.transmissionWeight = value;\r\n // If the transmission weight is greater than 0, let's check if the base color\r\n // is set and use that for a surface tint in OpenPBR. This may later be\r\n // overridden by the volume properties but, without volume, this will give us\r\n // glTF compatibility in OpenPBR.\r\n this._material.transmissionColor = this._material.baseColor;\r\n this._material.transmissionColorTexture = this._material.baseColorTexture;\r\n this._material.transmissionDepth = 0.0;\r\n }\r\n\r\n /**\r\n * Sets the transmission weight texture.\r\n * @param value The transmission weight texture or null\r\n */\r\n public set transmissionWeightTexture(value: Nullable<BaseTexture>) {\r\n this._material.transmissionWeightTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the transmission weight.\r\n * @returns Currently returns 0 as transmission is not yet available\r\n */\r\n public get transmissionWeight(): number {\r\n return this._material.transmissionWeight;\r\n }\r\n\r\n /**\r\n * Sets the transmission scatter coefficient.\r\n * @param value The scatter coefficient as a Vector3\r\n */\r\n public set transmissionScatter(value: Color3) {\r\n this._material.transmissionScatter = value;\r\n }\r\n\r\n /**\r\n * Gets the transmission scatter coefficient.\r\n * @returns The scatter coefficient as a Vector3\r\n */\r\n public get transmissionScatter(): Color3 {\r\n return this._material.transmissionScatter;\r\n }\r\n\r\n public set transmissionScatterTexture(value: Nullable<BaseTexture>) {\r\n this._material.transmissionScatterTexture = value;\r\n }\r\n\r\n public get transmissionScatterTexture(): Nullable<BaseTexture> {\r\n return this._material.transmissionScatterTexture;\r\n }\r\n\r\n /**\r\n * Sets the transmission scattering anisotropy.\r\n * @param value The anisotropy intensity value (-1 to 1)\r\n */\r\n public set transmissionScatterAnisotropy(value: number) {\r\n this._material.transmissionScatterAnisotropy = value;\r\n }\r\n\r\n /**\r\n * Sets the transmission dispersion Abbe number.\r\n * @param value The Abbe number value\r\n */\r\n public set transmissionDispersionAbbeNumber(value: number) {\r\n this._material.transmissionDispersionAbbeNumber = value;\r\n }\r\n\r\n /**\r\n * Sets the transmission dispersion scale.\r\n * @param value The dispersion scale value\r\n */\r\n public set transmissionDispersionScale(value: number) {\r\n this._material.transmissionDispersionScale = value;\r\n }\r\n\r\n /**\r\n * Sets the attenuation distance.\r\n * @param value The attenuation distance value\r\n */\r\n public set transmissionDepth(value: number) {\r\n // If the value is being set to the default max value, and the current transmission depth is 0,\r\n // we assume that attenuation color isn't used and keep it at 0 to allow\r\n // us to use constant transmission color to handle glTF's surface tint from base color.\r\n if (value !== Number.MAX_VALUE || this._material.transmissionDepth !== 0) {\r\n this._material.transmissionDepth = value;\r\n } else {\r\n this._material.transmissionDepth = 0;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the attenuation distance.\r\n */\r\n public get transmissionDepth(): number {\r\n return this._material.transmissionDepth;\r\n }\r\n\r\n /**\r\n * Sets the attenuation color.\r\n * @param value The attenuation color as a Color3\r\n */\r\n public set transmissionColor(value: Color3) {\r\n // Only set the transmission color if it's not white (default)\r\n // This allows us to retain the base color as the transmission color,\r\n // if that was previously set.\r\n if (!value.equals(Color3.White())) {\r\n this._material.transmissionColor = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the attenuation color.\r\n */\r\n public get transmissionColor(): Color3 {\r\n return this._material.transmissionColor;\r\n }\r\n\r\n /**\r\n * Gets the refraction background texture\r\n * @returns The refraction background texture or null\r\n */\r\n public get refractionBackgroundTexture(): Nullable<BaseTexture> {\r\n return this._material.backgroundRefractionTexture;\r\n }\r\n\r\n /**\r\n * Sets the refraction background texture\r\n * @param value The refraction background texture or null\r\n */\r\n public set refractionBackgroundTexture(value: Nullable<BaseTexture>) {\r\n this._material.backgroundRefractionTexture = value;\r\n }\r\n\r\n /**\r\n * Sets the thickness texture.\r\n * @param value The thickness texture or null\r\n */\r\n public set volumeThicknessTexture(value: Nullable<BaseTexture>) {\r\n this._material.geometryThicknessTexture = value;\r\n this._material._useGeometryThicknessFromGreenChannel = true;\r\n }\r\n\r\n /**\r\n * Sets the thickness factor.\r\n * @param value The thickness value\r\n */\r\n public set volumeThickness(value: number) {\r\n this._material.geometryThickness = value;\r\n }\r\n\r\n // ========================================\r\n // SUBSURFACE PROPERTIES (Subsurface Scattering)\r\n // ========================================\r\n\r\n /**\r\n * Configures subsurface properties for PBR material\r\n */\r\n public configureSubsurface(): void {\r\n // TODO\r\n }\r\n\r\n /**\r\n * Sets the extinction coefficient of the volume.\r\n * @param value The extinction coefficient as a Vector3\r\n */\r\n public set extinctionCoefficient(value: Vector3) {\r\n this._extinctionCoefficient = value;\r\n }\r\n\r\n /**\r\n * Gets the extinction coefficient of the volume.\r\n */\r\n public get extinctionCoefficient(): Vector3 {\r\n return this._extinctionCoefficient;\r\n }\r\n\r\n /**\r\n * Sets the subsurface weight\r\n */\r\n public set subsurfaceWeight(value: number) {\r\n // TODO\r\n }\r\n\r\n public get subsurfaceWeight(): number {\r\n // TODO\r\n return 0;\r\n }\r\n\r\n /**\r\n * Sets the subsurface weight texture\r\n */\r\n public set subsurfaceWeightTexture(value: Nullable<BaseTexture>) {\r\n // TODO\r\n }\r\n\r\n /**\r\n * Sets the subsurface color.\r\n * @param value The subsurface tint color as a Color3\r\n */\r\n public set subsurfaceColor(value: Color3) {\r\n // TODO\r\n }\r\n\r\n /**\r\n * Sets the subsurface color texture.\r\n * @param value The subsurface tint texture or null\r\n */\r\n public set subsurfaceColorTexture(value: Nullable<BaseTexture>) {\r\n // TODO\r\n }\r\n\r\n /**\r\n * Sets the surface tint of the material (when using subsurface scattering)\r\n */\r\n public set subsurfaceConstantTint(value: Color3) {\r\n // There is no equivalent in OpenPBR\r\n // Maybe multiply this by subsurfaceColor?\r\n }\r\n\r\n /**\r\n * Gets the surface tint of the material (when using subsurface scattering)\r\n */\r\n public get subsurfaceConstantTint(): Color3 {\r\n return Color3.White();\r\n }\r\n\r\n /**\r\n * Sets the surface tint texture of the material (when using subsurface scattering)\r\n */\r\n public set subsurfaceConstantTintTexture(value: Nullable<BaseTexture>) {\r\n // There is no equivalent in OpenPBR\r\n // Maybe multiply this by subsurfaceColorTexture?\r\n }\r\n\r\n /**\r\n * Gets the subsurface radius for subsurface scattering.\r\n * subsurfaceRadiusScale * subsurfaceRadius gives the mean free path per color channel.\r\n */\r\n public get subsurfaceRadius(): number {\r\n // TODO\r\n return 0;\r\n }\r\n\r\n /**\r\n * Sets the subsurface radius for subsurface scattering.\r\n * subsurfaceRadiusScale * subsurfaceRadius gives the mean free path per color channel.\r\n * @param value The subsurface radius value\r\n */\r\n public set subsurfaceRadius(value: number) {\r\n // TODO\r\n }\r\n\r\n /**\r\n * Gets the subsurface radius scale for subsurface scattering.\r\n * subsurfaceRadiusScale * subsurfaceRadius gives the mean free path per color channel.\r\n */\r\n public get subsurfaceRadiusScale(): Color3 {\r\n // TODO\r\n return Color3.White();\r\n }\r\n\r\n /**\r\n * Sets the subsurface radius scale for subsurface scattering.\r\n * subsurfaceRadiusScale * subsurfaceRadius gives the mean free path per color channel.\r\n * @param value The subsurface radius scale as a Color3\r\n */\r\n public set subsurfaceRadiusScale(value: Color3) {\r\n // TODO\r\n }\r\n\r\n /**\r\n * Sets the subsurface scattering anisotropy.\r\n * @param value The anisotropy intensity value\r\n */\r\n public set subsurfaceScatterAnisotropy(value: number) {\r\n // TODO\r\n }\r\n\r\n // ========================================\r\n // FUZZ LAYER (Sheen)\r\n // ========================================\r\n\r\n /**\r\n * Configures fuzz for OpenPBR.\r\n * Enables fuzz and sets up proper configuration.\r\n */\r\n public configureFuzz(): void {\r\n // Currently no setup to do for OpenPBR\r\n }\r\n\r\n /**\r\n * Sets the fuzz weight.\r\n * @param value The fuzz weight value\r\n */\r\n public set fuzzWeight(value: number) {\r\n this._material.fuzzWeight = value;\r\n }\r\n\r\n /**\r\n * Sets the fuzz weight texture.\r\n * @param value The fuzz weight texture or null\r\n */\r\n public set fuzzWeightTexture(value: Nullable<BaseTexture>) {\r\n this._material.fuzzWeightTexture = value;\r\n }\r\n\r\n /**\r\n * Sets the fuzz color.\r\n * @param value The fuzz color as a Color3\r\n */\r\n public set fuzzColor(value: Color3) {\r\n this._material.fuzzColor = value;\r\n }\r\n\r\n /**\r\n * Sets the fuzz color texture.\r\n * @param value The fuzz color texture or null\r\n */\r\n public set fuzzColorTexture(value: Nullable<BaseTexture>) {\r\n this._material.fuzzColorTexture = value;\r\n }\r\n\r\n /**\r\n * Sets the fuzz roughness.\r\n * @param value The fuzz roughness value (0-1)\r\n */\r\n public set fuzzRoughness(value: number) {\r\n this._material.fuzzRoughness = value;\r\n }\r\n\r\n /**\r\n * Sets the fuzz roughness texture.\r\n * @param value The fuzz roughness texture or null\r\n */\r\n public set fuzzRoughnessTexture(value: Nullable<BaseTexture>) {\r\n this._material.fuzzRoughnessTexture = value;\r\n this._material._useFuzzRoughnessFromTextureAlpha = true;\r\n }\r\n\r\n // ========================================\r\n // ANISOTROPY\r\n // ========================================\r\n\r\n /**\r\n * Sets the specular roughness anisotropy of the OpenPBR material.\r\n * @param value The anisotropy intensity value\r\n */\r\n public set specularRoughnessAnisotropy(value: number) {\r\n this._material.specularRoughnessAnisotropy = value;\r\n }\r\n\r\n /**\r\n * Gets the specular roughness anisotropy of the OpenPBR material.\r\n * @returns The anisotropy intensity value\r\n */\r\n public get specularRoughnessAnisotropy(): number {\r\n return this._material.specularRoughnessAnisotropy;\r\n }\r\n\r\n /**\r\n * Sets the anisotropy rotation angle.\r\n * @param value The anisotropy rotation angle in radians\r\n */\r\n public set geometryTangentAngle(value: number) {\r\n this._material.geometryTangentAngle = value;\r\n }\r\n\r\n /**\r\n * Sets the geometry tangent texture for anisotropy.\r\n * Automatically enables using anisotropy from the tangent texture.\r\n * @param value The anisotropy texture or null\r\n */\r\n public set geometryTangentTexture(value: Nullable<BaseTexture>) {\r\n this._material.geometryTangentTexture = value;\r\n this._material._useSpecularRoughnessAnisotropyFromTangentTexture = true;\r\n }\r\n\r\n /**\r\n * Gets the geometry tangent texture for anisotropy.\r\n * @returns The anisotropy texture or null\r\n */\r\n public get geometryTangentTexture(): Nullable<BaseTexture> {\r\n return this._material.geometryTangentTexture;\r\n }\r\n\r\n /**\r\n * Configures glTF-style anisotropy for the OpenPBR material.\r\n * @param useGltfStyle Whether to use glTF-style anisotropy\r\n */\r\n public configureGltfStyleAnisotropy(useGltfStyle: boolean = true): void {\r\n this._material._useGltfStyleAnisotropy = useGltfStyle;\r\n }\r\n\r\n // ========================================\r\n // THIN FILM IRIDESCENCE\r\n // ========================================\r\n\r\n /**\r\n * Sets the thin film weight.\r\n * @param value The thin film weight value\r\n */\r\n public set thinFilmWeight(value: number) {\r\n this._material.thinFilmWeight = value;\r\n }\r\n\r\n /**\r\n * Sets the thin film IOR.\r\n * @param value The thin film IOR value\r\n */\r\n public set thinFilmIor(value: number) {\r\n this._material.thinFilmIor = value;\r\n }\r\n\r\n /**\r\n * Sets the thin film thickness minimum.\r\n * @param value The minimum thickness value in nanometers\r\n */\r\n public set thinFilmThicknessMinimum(value: number) {\r\n this._material.thinFilmThicknessMin = value / 1000.0; // Convert to micrometers for OpenPBR\r\n }\r\n\r\n /**\r\n * Sets the thin film thickness maximum.\r\n * @param value The maximum thickness value in nanometers\r\n */\r\n public set thinFilmThicknessMaximum(value: number) {\r\n this._material.thinFilmThickness = value / 1000.0; // Convert to micrometers for OpenPBR\r\n }\r\n\r\n /**\r\n * Sets the thin film weight texture.\r\n * @param value The thin film weight texture or null\r\n */\r\n public set thinFilmWeightTexture(value: Nullable<BaseTexture>) {\r\n this._material.thinFilmWeightTexture = value;\r\n }\r\n\r\n /**\r\n * Sets the thin film thickness texture.\r\n * @param value The thin film thickness texture or null\r\n */\r\n public set thinFilmThicknessTexture(value: Nullable<BaseTexture>) {\r\n this._material.thinFilmThicknessTexture = value;\r\n this._material._useThinFilmThicknessFromTextureGreen = true;\r\n }\r\n\r\n // ========================================\r\n // UNLIT MATERIALS\r\n // ========================================\r\n\r\n /**\r\n * Sets whether the OpenPBR material is unlit.\r\n * @param value True to make the material unlit\r\n */\r\n public set unlit(value: boolean) {\r\n this._material.unlit = value;\r\n }\r\n\r\n // ========================================\r\n // GEOMETRY PARAMETERS\r\n // ========================================\r\n\r\n /**\r\n * Sets the geometry opacity of the OpenPBR material.\r\n * @param value The opacity value (0-1)\r\n */\r\n public set geometryOpacity(value: number) {\r\n this._material.geometryOpacity = value;\r\n }\r\n\r\n /**\r\n * Gets the geometry opacity of the OpenPBR material.\r\n * @returns The opacity value (0-1)\r\n */\r\n public get geometryOpacity(): number {\r\n return this._material.geometryOpacity;\r\n }\r\n\r\n /**\r\n * Sets the geometry normal texture of the OpenPBR material.\r\n * @param value The normal texture or null\r\n */\r\n public set geometryNormalTexture(value: Nullable<BaseTexture>) {\r\n this._material.geometryNormalTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the geometry normal texture of the OpenPBR material.\r\n * @returns The normal texture or null\r\n */\r\n public get geometryNormalTexture(): Nullable<BaseTexture> {\r\n return this._material.geometryNormalTexture;\r\n }\r\n\r\n /**\r\n * Sets the normal map inversions for the OpenPBR material.\r\n * Note: OpenPBR may handle normal map inversions differently or may not need them.\r\n * @param invertX Whether to invert the normal map on the X axis (may be ignored)\r\n * @param invertY Whether to invert the normal map on the Y axis (may be ignored)\r\n */\r\n public setNormalMapInversions(invertX: boolean, invertY: boolean): void {\r\n // OpenPBR handles normal map inversions differently or may not need them\r\n }\r\n\r\n /**\r\n * Sets the geometry coat normal texture of the OpenPBR material.\r\n * @param value The coat normal texture or null\r\n */\r\n public set geometryCoatNormalTexture(value: Nullable<BaseTexture>) {\r\n this._material.geometryCoatNormalTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the geometry coat normal texture of the OpenPBR material.\r\n * @returns The coat normal texture or null\r\n */\r\n public get geometryCoatNormalTexture(): Nullable<BaseTexture> {\r\n return this._material.geometryCoatNormalTexture;\r\n }\r\n\r\n /**\r\n * Sets the geometry coat normal texture scale.\r\n * @param value The scale value for the coat normal texture\r\n */\r\n public set geometryCoatNormalTextureScale(value: number) {\r\n if (this._material.geometryCoatNormalTexture) {\r\n this._material.geometryCoatNormalTexture.level = value;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"openpbrMaterialLoadingAdapter.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/glTF/2.0/openpbrMaterialLoadingAdapter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG/C;;GAEG;AACH,MAAM,OAAO,6BAA6B;IAGtC;;;OAGG;IACH,YAAY,QAAkB;QA81BtB,6BAAwB,GAAW,MAAM,CAAC,KAAK,EAAE,CAAC;QAClD,oCAA+B,GAA0B,IAAI,CAAC;QA91BlE,IAAI,CAAC,SAAS,GAAG,QAA2B,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,IAAW,OAAO,CAAC,KAAc;QAC7B,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC;IACjC,CAAC;IAED,2CAA2C;IAC3C,qBAA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AI,CAAC,gBAAgB,CAAC;gBACxD,IAAI,CAAC,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,sHAAsH;gBAC3K,IAAI,CAAC,SAAS,CAAC,aAAa,GAAG,GAAG,CAAC;gBACnC,IAAI,CAAC,SAAS,CAAC,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC;gBAChE,IAAI,CAAC,SAAS,CAAC,oBAAoB,GAAG,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC;YAClF,CAAC;QACL,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { type OpenPBRMaterial } from \"core/Materials/PBR/openpbrMaterial\";\r\nimport { type Material } from \"core/Materials/material\";\r\nimport { type BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { type Nullable } from \"core/types\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { type IMaterialLoadingAdapter } from \"./materialLoadingAdapter\";\r\n\r\n/**\r\n * Material Loading Adapter for OpenPBR materials that provides a unified OpenPBR-like interface.\r\n */\r\nexport class OpenPBRMaterialLoadingAdapter implements IMaterialLoadingAdapter {\r\n private _material: OpenPBRMaterial;\r\n\r\n /**\r\n * Creates a new instance of the OpenPBRMaterialLoadingAdapter.\r\n * @param material - The OpenPBR material to adapt.\r\n */\r\n constructor(material: Material) {\r\n this._material = material as OpenPBRMaterial;\r\n }\r\n\r\n /**\r\n * Gets the underlying material\r\n */\r\n public get material(): OpenPBRMaterial {\r\n return this._material;\r\n }\r\n\r\n /**\r\n * Whether the material should be treated as unlit\r\n */\r\n public get isUnlit(): boolean {\r\n return this._material.unlit;\r\n }\r\n\r\n /**\r\n * Sets whether the material should be treated as unlit\r\n */\r\n public set isUnlit(value: boolean) {\r\n this._material.unlit = value;\r\n }\r\n\r\n // ========================================\r\n // CULLING PROPERTIES\r\n // ========================================\r\n\r\n /**\r\n * Sets whether back face culling is enabled.\r\n * @param value True to enable back face culling\r\n */\r\n public set backFaceCulling(value: boolean) {\r\n this._material.backFaceCulling = value;\r\n }\r\n\r\n /**\r\n * Gets whether back face culling is enabled.\r\n * @returns True if back face culling is enabled\r\n */\r\n public get backFaceCulling(): boolean {\r\n return this._material.backFaceCulling;\r\n }\r\n\r\n /**\r\n * Sets whether two-sided lighting is enabled.\r\n * @param value True to enable two-sided lighting\r\n */\r\n public set twoSidedLighting(value: boolean) {\r\n this._material.twoSidedLighting = value;\r\n }\r\n\r\n /**\r\n * Gets whether two-sided lighting is enabled.\r\n * @returns True if two-sided lighting is enabled\r\n */\r\n public get twoSidedLighting(): boolean {\r\n return this._material.twoSidedLighting;\r\n }\r\n\r\n // ========================================\r\n // ALPHA PROPERTIES\r\n // ========================================\r\n\r\n /**\r\n * Sets the alpha cutoff value for alpha testing.\r\n * Note: OpenPBR doesn't have a direct equivalent, so this is a no-op.\r\n * @param value The alpha cutoff threshold (ignored for OpenPBR)\r\n */\r\n public set alphaCutOff(value: number) {\r\n // OpenPBR doesn't have a direct equivalent, but could be implemented if needed\r\n }\r\n\r\n /**\r\n * Gets the alpha cutoff value.\r\n * @returns Default value of 0.5 (OpenPBR doesn't support this directly)\r\n */\r\n public get alphaCutOff(): number {\r\n return 0.5; // Default value\r\n }\r\n\r\n /**\r\n * Sets whether to use alpha from the base color texture.\r\n * Note: OpenPBR handles this differently through the baseColorTexture alpha channel.\r\n * @param value True to use alpha from base color texture (handled automatically in OpenPBR)\r\n */\r\n public set useAlphaFromBaseColorTexture(value: boolean) {\r\n this._material._useAlphaFromBaseColorTexture = value;\r\n }\r\n\r\n /**\r\n * Gets whether alpha is used from the base color texture.\r\n * @returns Always false for OpenPBR as it's handled automatically\r\n */\r\n public get useAlphaFromBaseColorTexture(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Gets whether the transparency is treated as alpha coverage.\r\n */\r\n public get transparencyAsAlphaCoverage(): boolean {\r\n // OpenPBR doesn't support treating transparency as alpha coverage.\r\n return false;\r\n }\r\n\r\n /**\r\n * Sets/Gets whether the transparency is treated as alpha coverage\r\n */\r\n public set transparencyAsAlphaCoverage(value: boolean) {\r\n // OpenPBR doesn't support treating transparency as alpha coverage.\r\n }\r\n\r\n // ========================================\r\n // BASE PARAMETERS\r\n // ========================================\r\n\r\n /**\r\n * Sets the base color of the OpenPBR material.\r\n * @param value The base color as a Color3\r\n */\r\n public set baseColor(value: Color3) {\r\n this._material.baseColor = value;\r\n }\r\n\r\n /**\r\n * Gets the base color of the OpenPBR material.\r\n * @returns The base color as a Color3\r\n */\r\n public get baseColor(): Color3 {\r\n return this._material.baseColor;\r\n }\r\n\r\n /**\r\n * Sets the base color texture of the OpenPBR material.\r\n * @param value The base color texture or null\r\n */\r\n public set baseColorTexture(value: Nullable<BaseTexture>) {\r\n this._material.baseColorTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the base color texture of the OpenPBR material.\r\n * @returns The base color texture or null\r\n */\r\n public get baseColorTexture(): Nullable<BaseTexture> {\r\n return this._material.baseColorTexture;\r\n }\r\n\r\n /**\r\n * Sets the base diffuse roughness of the OpenPBR material.\r\n * @param value The diffuse roughness value (0-1)\r\n */\r\n public set baseDiffuseRoughness(value: number) {\r\n this._material.baseDiffuseRoughness = value;\r\n }\r\n\r\n /**\r\n * Gets the base diffuse roughness of the OpenPBR material.\r\n * @returns The diffuse roughness value (0-1)\r\n */\r\n public get baseDiffuseRoughness(): number {\r\n return this._material.baseDiffuseRoughness;\r\n }\r\n\r\n /**\r\n * Sets the base diffuse roughness texture of the OpenPBR material.\r\n * @param value The diffuse roughness texture or null\r\n */\r\n public set baseDiffuseRoughnessTexture(value: Nullable<BaseTexture>) {\r\n this._material.baseDiffuseRoughnessTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the base diffuse roughness texture of the OpenPBR material.\r\n * @returns The diffuse roughness texture or null\r\n */\r\n public get baseDiffuseRoughnessTexture(): Nullable<BaseTexture> {\r\n return this._material.baseDiffuseRoughnessTexture;\r\n }\r\n\r\n /**\r\n * Sets the base metalness value of the OpenPBR material.\r\n * @param value The metalness value (0-1)\r\n */\r\n public set baseMetalness(value: number) {\r\n this._material.baseMetalness = value;\r\n }\r\n\r\n /**\r\n * Gets the base metalness value of the OpenPBR material.\r\n * @returns The metalness value (0-1)\r\n */\r\n public get baseMetalness(): number {\r\n return this._material.baseMetalness;\r\n }\r\n\r\n /**\r\n * Sets the base metalness texture of the OpenPBR material.\r\n * @param value The metalness texture or null\r\n */\r\n public set baseMetalnessTexture(value: Nullable<BaseTexture>) {\r\n this._material.baseMetalnessTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the base metalness texture of the OpenPBR material.\r\n * @returns The metalness texture or null\r\n */\r\n public get baseMetalnessTexture(): Nullable<BaseTexture> {\r\n return this._material.baseMetalnessTexture;\r\n }\r\n\r\n /**\r\n * Sets whether to use roughness from the metallic texture's green channel.\r\n * @param value True to use green channel for roughness\r\n */\r\n public set useRoughnessFromMetallicTextureGreen(value: boolean) {\r\n this._material._useRoughnessFromMetallicTextureGreen = value;\r\n }\r\n\r\n /**\r\n * Sets whether to use metalness from the metallic texture's blue channel.\r\n * @param value True to use blue channel for metalness\r\n */\r\n public set useMetallicFromMetallicTextureBlue(value: boolean) {\r\n this._material._useMetallicFromMetallicTextureBlue = value;\r\n }\r\n\r\n // ========================================\r\n // SPECULAR PARAMETERS\r\n // ========================================\r\n\r\n /**\r\n * Configures specular properties for OpenPBR material.\r\n * @param _enableEdgeColor Whether to enable edge color support (ignored for OpenPBR)\r\n */\r\n public enableSpecularEdgeColor(_enableEdgeColor: boolean = false): void {\r\n // OpenPBR already supports edge color natively, no configuration needed\r\n }\r\n\r\n /**\r\n * Sets the specular weight of the OpenPBR material.\r\n * @param value The specular weight value (0-1)\r\n */\r\n public set specularWeight(value: number) {\r\n this._material.specularWeight = value;\r\n }\r\n\r\n /**\r\n * Gets the specular weight of the OpenPBR material.\r\n * @returns The specular weight value (0-1)\r\n */\r\n public get specularWeight(): number {\r\n return this._material.specularWeight;\r\n }\r\n\r\n /**\r\n * Sets the specular weight texture of the OpenPBR material.\r\n * If the same texture is used for specular color, optimizes by using alpha channel for weight.\r\n * @param value The specular weight texture or null\r\n */\r\n public set specularWeightTexture(value: Nullable<BaseTexture>) {\r\n if (this._material.specularColorTexture === value) {\r\n this._material.specularWeightTexture = null;\r\n this._material._useSpecularWeightFromSpecularColorTexture = true;\r\n this._material._useSpecularWeightFromAlpha = true;\r\n } else {\r\n this._material.specularWeightTexture = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the specular weight texture of the OpenPBR material.\r\n * @returns The specular weight texture or null\r\n */\r\n public get specularWeightTexture(): Nullable<BaseTexture> {\r\n return this._material.specularWeightTexture;\r\n }\r\n\r\n /**\r\n * Sets the specular color of the OpenPBR material.\r\n * @param value The specular color as a Color3\r\n */\r\n public set specularColor(value: Color3) {\r\n this._material.specularColor = value;\r\n }\r\n\r\n /**\r\n * Gets the specular color of the OpenPBR material.\r\n * @returns The specular color as a Color3\r\n */\r\n public get specularColor(): Color3 {\r\n return this._material.specularColor;\r\n }\r\n\r\n /**\r\n * Sets the specular color texture of the OpenPBR material.\r\n * If the same texture is used for specular weight, optimizes by using alpha channel for weight.\r\n * @param value The specular color texture or null\r\n */\r\n public set specularColorTexture(value: Nullable<BaseTexture>) {\r\n this._material.specularColorTexture = value;\r\n if (this._material.specularWeightTexture === this._material.specularColorTexture) {\r\n this._material.specularWeightTexture = null;\r\n this._material._useSpecularWeightFromSpecularColorTexture = true;\r\n this._material._useSpecularWeightFromAlpha = true;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the specular color texture of the OpenPBR material.\r\n * @returns The specular color texture or null\r\n */\r\n public get specularColorTexture(): Nullable<BaseTexture> {\r\n return this._material.specularColorTexture;\r\n }\r\n\r\n /**\r\n * Sets the specular roughness of the OpenPBR material.\r\n * @param value The roughness value (0-1)\r\n */\r\n public set specularRoughness(value: number) {\r\n this._material.specularRoughness = value;\r\n }\r\n\r\n /**\r\n * Gets the specular roughness of the OpenPBR material.\r\n * @returns The roughness value (0-1)\r\n */\r\n public get specularRoughness(): number {\r\n return this._material.specularRoughness;\r\n }\r\n\r\n /**\r\n * Sets the specular roughness texture of the OpenPBR material.\r\n * @param value The roughness texture or null\r\n */\r\n public set specularRoughnessTexture(value: Nullable<BaseTexture>) {\r\n this._material.specularRoughnessTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the specular roughness texture of the OpenPBR material.\r\n * @returns The roughness texture or null\r\n */\r\n public get specularRoughnessTexture(): Nullable<BaseTexture> {\r\n return this._material.specularRoughnessTexture;\r\n }\r\n\r\n /**\r\n * Sets the specular index of refraction (IOR) of the OpenPBR material.\r\n * @param value The IOR value\r\n */\r\n public set specularIor(value: number) {\r\n this._material.specularIor = value;\r\n }\r\n\r\n /**\r\n * Gets the specular index of refraction (IOR) of the OpenPBR material.\r\n * @returns The IOR value\r\n */\r\n public get specularIor(): number {\r\n return this._material.specularIor;\r\n }\r\n\r\n // ========================================\r\n // EMISSION PARAMETERS\r\n // ========================================\r\n\r\n /**\r\n * Sets the emission color of the OpenPBR material.\r\n * @param value The emission color as a Color3\r\n */\r\n public set emissionColor(value: Color3) {\r\n this._material.emissionColor = value;\r\n }\r\n\r\n /**\r\n * Gets the emission color of the OpenPBR material.\r\n * @returns The emission color as a Color3\r\n */\r\n public get emissionColor(): Color3 {\r\n return this._material.emissionColor;\r\n }\r\n\r\n /**\r\n * Sets the emission luminance of the OpenPBR material.\r\n * @param value The emission luminance value\r\n */\r\n public set emissionLuminance(value: number) {\r\n this._material.emissionLuminance = value;\r\n }\r\n\r\n /**\r\n * Gets the emission luminance of the OpenPBR material.\r\n * @returns The emission luminance value\r\n */\r\n public get emissionLuminance(): number {\r\n return this._material.emissionLuminance;\r\n }\r\n\r\n /**\r\n * Sets the emission color texture of the OpenPBR material.\r\n * @param value The emission texture or null\r\n */\r\n public set emissionColorTexture(value: Nullable<BaseTexture>) {\r\n this._material.emissionColorTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the emission color texture of the OpenPBR material.\r\n * @returns The emission texture or null\r\n */\r\n public get emissionColorTexture(): Nullable<BaseTexture> {\r\n return this._material.emissionColorTexture;\r\n }\r\n\r\n // ========================================\r\n // AMBIENT OCCLUSION\r\n // ========================================\r\n\r\n /**\r\n * Sets the ambient occlusion texture of the OpenPBR material.\r\n * @param value The ambient occlusion texture or null\r\n */\r\n public set ambientOcclusionTexture(value: Nullable<BaseTexture>) {\r\n this._material.ambientOcclusionTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the ambient occlusion texture of the OpenPBR material.\r\n * @returns The ambient occlusion texture or null\r\n */\r\n public get ambientOcclusionTexture(): Nullable<BaseTexture> {\r\n return this._material.ambientOcclusionTexture;\r\n }\r\n\r\n /**\r\n * Sets the ambient occlusion texture strength by modifying the texture's level.\r\n * @param value The strength value (typically 0-1)\r\n */\r\n public set ambientOcclusionTextureStrength(value: number) {\r\n const texture = this._material.ambientOcclusionTexture;\r\n if (texture) {\r\n texture.level = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the ambient occlusion texture strength from the texture's level property.\r\n * @returns The strength value, defaults to 1.0 if no texture or level is set\r\n */\r\n public get ambientOcclusionTextureStrength(): number {\r\n const texture = this._material.ambientOcclusionTexture;\r\n return texture?.level ?? 1.0;\r\n }\r\n\r\n // ========================================\r\n // COAT PARAMETERS\r\n // ========================================\r\n\r\n /**\r\n * Configures coat parameters for OpenPBR material.\r\n * OpenPBR coat is already built-in, so no configuration is needed.\r\n */\r\n public configureCoat(): void {\r\n // OpenPBR coat is already built-in, no configuration needed\r\n }\r\n\r\n /**\r\n * Sets the coat weight of the OpenPBR material.\r\n * @param value The coat weight value (0-1)\r\n */\r\n public set coatWeight(value: number) {\r\n this._material.coatWeight = value;\r\n }\r\n\r\n /**\r\n * Gets the coat weight of the OpenPBR material.\r\n * @returns The coat weight value (0-1)\r\n */\r\n public get coatWeight(): number {\r\n return this._material.coatWeight;\r\n }\r\n\r\n /**\r\n * Sets the coat weight texture of the OpenPBR material.\r\n * @param value The coat weight texture or null\r\n */\r\n public set coatWeightTexture(value: Nullable<BaseTexture>) {\r\n this._material.coatWeightTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the coat weight texture of the OpenPBR material.\r\n * @returns The coat weight texture or null\r\n */\r\n public get coatWeightTexture(): Nullable<BaseTexture> {\r\n return this._material.coatWeightTexture;\r\n }\r\n\r\n /**\r\n * Sets the coat color of the OpenPBR material.\r\n * @param value The coat color as a Color3\r\n */\r\n public set coatColor(value: Color3) {\r\n this._material.coatColor = value;\r\n }\r\n\r\n /**\r\n * Sets the coat color texture of the OpenPBR material.\r\n * @param value The coat color texture or null\r\n */\r\n public set coatColorTexture(value: Nullable<BaseTexture>) {\r\n this._material.coatColorTexture = value;\r\n }\r\n\r\n /**\r\n * Sets the coat roughness of the OpenPBR material.\r\n * @param value The coat roughness value (0-1)\r\n */\r\n public set coatRoughness(value: number) {\r\n this._material.coatRoughness = value;\r\n }\r\n\r\n /**\r\n * Gets the coat roughness of the OpenPBR material.\r\n * @returns The coat roughness value (0-1)\r\n */\r\n public get coatRoughness(): number {\r\n return this._material.coatRoughness;\r\n }\r\n\r\n /**\r\n * Sets the coat roughness texture of the OpenPBR material.\r\n * @param value The coat roughness texture or null\r\n */\r\n public set coatRoughnessTexture(value: Nullable<BaseTexture>) {\r\n this._material.coatRoughnessTexture = value;\r\n if (value) {\r\n this._material._useCoatRoughnessFromGreenChannel = true;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the coat roughness texture of the OpenPBR material.\r\n * @returns The coat roughness texture or null\r\n */\r\n public get coatRoughnessTexture(): Nullable<BaseTexture> {\r\n return this._material.coatRoughnessTexture;\r\n }\r\n\r\n /**\r\n * Sets the coat index of refraction (IOR) of the OpenPBR material.\r\n */\r\n public set coatIor(value: number) {\r\n this._material.coatIor = value;\r\n }\r\n\r\n /**\r\n * Sets the coat darkening value of the OpenPBR material.\r\n * @param value The coat darkening value\r\n */\r\n public set coatDarkening(value: number) {\r\n this._material.coatDarkening = value;\r\n }\r\n\r\n /**\r\n * Sets the coat darkening texture (OpenPBR: coatDarkeningTexture, no PBR equivalent)\r\n */\r\n public set coatDarkeningTexture(value: Nullable<BaseTexture>) {\r\n this._material.coatDarkeningTexture = value;\r\n }\r\n\r\n /**\r\n * Sets the coat roughness anisotropy.\r\n * TODO: Implementation pending OpenPBR coat anisotropy feature availability.\r\n * @param value The coat anisotropy intensity value\r\n */\r\n public set coatRoughnessAnisotropy(value: number) {\r\n this._material.coatRoughnessAnisotropy = value;\r\n }\r\n\r\n /**\r\n * Gets the coat roughness anisotropy.\r\n * TODO: Implementation pending OpenPBR coat anisotropy feature availability.\r\n * @returns Currently returns 0 as coat anisotropy is not yet available\r\n */\r\n public get coatRoughnessAnisotropy(): number {\r\n return this._material.coatRoughnessAnisotropy;\r\n }\r\n\r\n /**\r\n * Sets the coat tangent angle for anisotropy.\r\n * TODO: Implementation pending OpenPBR coat anisotropy feature availability.\r\n * @param value The coat anisotropy rotation angle in radians\r\n */\r\n public set geometryCoatTangentAngle(value: number) {\r\n this._material.geometryCoatTangentAngle = value;\r\n }\r\n\r\n /**\r\n * Sets the coat tangent texture for anisotropy.\r\n * TODO: Implementation pending OpenPBR coat anisotropy feature availability.\r\n * @param value The coat anisotropy texture or null\r\n */\r\n public set geometryCoatTangentTexture(value: Nullable<BaseTexture>) {\r\n this._material.geometryCoatTangentTexture = value;\r\n if (value) {\r\n this._material._useCoatRoughnessAnisotropyFromTangentTexture = true;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the coat tangent texture for anisotropy.\r\n * TODO: Implementation pending OpenPBR coat anisotropy feature availability.\r\n * @returns Currently returns null as coat anisotropy is not yet available\r\n */\r\n public get geometryCoatTangentTexture(): Nullable<BaseTexture> {\r\n return this._material.geometryCoatTangentTexture;\r\n }\r\n\r\n // ========================================\r\n // TRANSMISSION LAYER\r\n // ========================================\r\n\r\n /**\r\n * Configures transmission for OpenPBR material.\r\n */\r\n public configureTransmission(): void {\r\n // Material is thin-walled until otherwise specified by the glTF volume extension.\r\n this._material.geometryThinWalled = 1.0;\r\n this._material.transmissionDepth = 0.0;\r\n }\r\n\r\n /**\r\n * Sets the transmission weight.\r\n * @param value The transmission weight value (0-1)\r\n */\r\n public set transmissionWeight(value: number) {\r\n this._material.transmissionWeight = value;\r\n }\r\n\r\n /**\r\n * Sets the transmission weight texture.\r\n * @param value The transmission weight texture or null\r\n */\r\n public set transmissionWeightTexture(value: Nullable<BaseTexture>) {\r\n this._material.transmissionWeightTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the transmission weight.\r\n * @returns Currently returns 0 as transmission is not yet available\r\n */\r\n public get transmissionWeight(): number {\r\n return this._material.transmissionWeight;\r\n }\r\n\r\n /**\r\n * Sets the transmission scatter coefficient.\r\n * @param value The scatter coefficient as a Vector3\r\n */\r\n public set transmissionScatter(value: Color3) {\r\n this._material.transmissionScatter = value;\r\n }\r\n\r\n /**\r\n * Gets the transmission scatter coefficient.\r\n * @returns The scatter coefficient as a Vector3\r\n */\r\n public get transmissionScatter(): Color3 {\r\n return this._material.transmissionScatter;\r\n }\r\n\r\n /**\r\n * Sets the transmission scatter texture.\r\n * @param value The transmission scatter texture or null\r\n */\r\n public set transmissionScatterTexture(value: Nullable<BaseTexture>) {\r\n this._material.transmissionScatterTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the transmission scatter texture.\r\n * @returns The transmission scatter texture or null\r\n */\r\n public get transmissionScatterTexture(): Nullable<BaseTexture> {\r\n return this._material.transmissionScatterTexture;\r\n }\r\n\r\n /**\r\n * Sets the transmission scattering anisotropy.\r\n * @param value The anisotropy intensity value (-1 to 1)\r\n */\r\n public set transmissionScatterAnisotropy(value: number) {\r\n this._material.transmissionScatterAnisotropy = value;\r\n }\r\n\r\n /**\r\n * Sets the transmission dispersion Abbe number.\r\n * @param value The Abbe number value\r\n */\r\n public set transmissionDispersionAbbeNumber(value: number) {\r\n this._material.transmissionDispersionAbbeNumber = value;\r\n }\r\n\r\n /**\r\n * Sets the transmission dispersion scale.\r\n * @param value The dispersion scale value\r\n */\r\n public set transmissionDispersionScale(value: number) {\r\n this._material.transmissionDispersionScale = value;\r\n }\r\n\r\n /**\r\n * Sets the attenuation distance.\r\n * @param value The attenuation distance value\r\n */\r\n public set transmissionDepth(value: number) {\r\n // If the value is being set to the default max value, and the current transmission depth is 0,\r\n // we assume that attenuation color isn't used and keep it at 0 to allow\r\n // us to use constant transmission color to handle glTF's surface tint from base color.\r\n if (value !== Number.MAX_VALUE || this._material.transmissionDepth !== 0) {\r\n this._material.transmissionDepth = value;\r\n } else {\r\n this._material.transmissionDepth = 0;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the attenuation distance.\r\n */\r\n public get transmissionDepth(): number {\r\n return this._material.transmissionDepth;\r\n }\r\n\r\n /**\r\n * Sets the attenuation color.\r\n * @param value The attenuation color as a Color3\r\n */\r\n public set transmissionColor(value: Color3) {\r\n // Only set the transmission color if it's not white (default)\r\n // This allows us to retain the base color as the transmission color,\r\n // if that was previously set.\r\n if (!value.equals(Color3.White())) {\r\n this._material.transmissionColor = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the attenuation color.\r\n */\r\n public get transmissionColor(): Color3 {\r\n return this._material.transmissionColor;\r\n }\r\n\r\n /**\r\n * Gets the refraction background texture\r\n * @returns The refraction background texture or null\r\n */\r\n public get refractionBackgroundTexture(): Nullable<BaseTexture> {\r\n return this._material.backgroundRefractionTexture;\r\n }\r\n\r\n /**\r\n * Sets the refraction background texture\r\n * @param value The refraction background texture or null\r\n */\r\n public set refractionBackgroundTexture(value: Nullable<BaseTexture>) {\r\n this._material.backgroundRefractionTexture = value;\r\n }\r\n\r\n // ========================================\r\n // VOLUME PROPERTIES\r\n // ========================================\r\n\r\n public configureVolume(): void {\r\n // If we're configuring volume, we assume the material is not thin-walled (i.e. it's volumetric).\r\n this._material.geometryThinWalled = 0.0;\r\n }\r\n\r\n /**\r\n * Sets whether the material is thin-walled (i.e. non-volumetric) or not.\r\n */\r\n public set geometryThinWalled(value: boolean) {\r\n this._material.geometryThinWalled = value ? 1.0 : 0.0;\r\n }\r\n\r\n /**\r\n * Gets whether the material is thin-walled (i.e. non-volumetric) or not.\r\n */\r\n public get geometryThinWalled(): boolean {\r\n return this._material.geometryThinWalled ? true : false;\r\n }\r\n\r\n /**\r\n * Sets the thickness texture.\r\n * @param value The thickness texture or null\r\n */\r\n public set volumeThicknessTexture(value: Nullable<BaseTexture>) {\r\n this._material.geometryThicknessTexture = value;\r\n this._material._useGeometryThicknessFromGreenChannel = true;\r\n }\r\n\r\n /**\r\n * Sets the thickness factor.\r\n * @param value The thickness value\r\n */\r\n public set volumeThickness(value: number) {\r\n this._material.geometryThickness = value;\r\n }\r\n\r\n // ========================================\r\n // SUBSURFACE PROPERTIES (Subsurface Scattering)\r\n // ========================================\r\n\r\n /**\r\n * Configures subsurface properties for PBR material\r\n */\r\n public configureSubsurface(): void {\r\n // glTF diffuse transmission is thin-walled (before volume extension is applied) will map to the subsurface slab and, without a\r\n this._material.geometryThinWalled = 1.0;\r\n this._material.subsurfaceScatterAnisotropy = 1.0;\r\n }\r\n\r\n /**\r\n * Sets the subsurface weight\r\n */\r\n public set subsurfaceWeight(value: number) {\r\n this._material.subsurfaceWeight = value;\r\n }\r\n\r\n public get subsurfaceWeight(): number {\r\n return this._material.subsurfaceWeight;\r\n }\r\n\r\n /**\r\n * Sets the subsurface weight texture\r\n */\r\n public set subsurfaceWeightTexture(value: Nullable<BaseTexture>) {\r\n this._material.subsurfaceWeightTexture = value;\r\n }\r\n\r\n /**\r\n * Sets the subsurface color.\r\n * @param value The subsurface tint color as a Color3\r\n */\r\n public set subsurfaceColor(value: Color3) {\r\n this._material.subsurfaceColor = value;\r\n }\r\n\r\n /**\r\n * Sets the subsurface color texture.\r\n * @param value The subsurface tint texture or null\r\n */\r\n public set subsurfaceColorTexture(value: Nullable<BaseTexture>) {\r\n this._material.subsurfaceColorTexture = value;\r\n }\r\n\r\n private _diffuseTransmissionTint: Color3 = Color3.White();\r\n private _diffuseTransmissionTintTexture: Nullable<BaseTexture> = null;\r\n\r\n /**\r\n * Sets the diffuse transmission tint of the material\r\n */\r\n public set diffuseTransmissionTint(value: Color3) {\r\n this._diffuseTransmissionTint = value;\r\n }\r\n\r\n /**\r\n * Gets the diffuse transmission tint of the material\r\n */\r\n public get diffuseTransmissionTint(): Color3 {\r\n return this._diffuseTransmissionTint;\r\n }\r\n\r\n /**\r\n * Sets the diffuse transmission tint texture of the material\r\n */\r\n public set diffuseTransmissionTintTexture(value: Nullable<BaseTexture>) {\r\n this._diffuseTransmissionTintTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the subsurface radius for subsurface scattering.\r\n * subsurfaceRadiusScale * subsurfaceRadius gives the mean free path per color channel.\r\n */\r\n public get subsurfaceRadius(): number {\r\n return this._material.subsurfaceRadius;\r\n }\r\n\r\n /**\r\n * Sets the subsurface radius for subsurface scattering.\r\n * subsurfaceRadiusScale * subsurfaceRadius gives the mean free path per color channel.\r\n * @param value The subsurface radius value\r\n */\r\n public set subsurfaceRadius(value: number) {\r\n this._material.subsurfaceRadius = value;\r\n }\r\n\r\n /**\r\n * Gets the subsurface radius scale for subsurface scattering.\r\n * subsurfaceRadiusScale * subsurfaceRadius gives the mean free path per color channel.\r\n */\r\n public get subsurfaceRadiusScale(): Color3 {\r\n return this._material.subsurfaceRadiusScale;\r\n }\r\n\r\n /**\r\n * Sets the subsurface radius scale for subsurface scattering.\r\n * subsurfaceRadiusScale * subsurfaceRadius gives the mean free path per color channel.\r\n * @param value The subsurface radius scale as a Color3\r\n */\r\n public set subsurfaceRadiusScale(value: Color3) {\r\n this._material.subsurfaceRadiusScale = value;\r\n }\r\n\r\n /**\r\n * Sets the subsurface scattering anisotropy.\r\n * @param value The anisotropy intensity value\r\n */\r\n public set subsurfaceScatterAnisotropy(value: number) {\r\n this._material.subsurfaceScatterAnisotropy = value;\r\n }\r\n\r\n /**\r\n * Does this material have a translucent surface (i.e. either transmission or subsurface)?\r\n * @returns True if the material is translucent, false otherwise\r\n */\r\n public isTranslucent(): boolean {\r\n return this.transmissionWeight > 0 || this.subsurfaceWeight > 0;\r\n }\r\n\r\n // ========================================\r\n // FUZZ LAYER (Sheen)\r\n // ========================================\r\n\r\n /**\r\n * Configures fuzz for OpenPBR.\r\n * Enables fuzz and sets up proper configuration.\r\n */\r\n public configureFuzz(): void {\r\n // Currently no setup to do for OpenPBR\r\n }\r\n\r\n /**\r\n * Sets the fuzz weight.\r\n * @param value The fuzz weight value\r\n */\r\n public set fuzzWeight(value: number) {\r\n this._material.fuzzWeight = value;\r\n }\r\n\r\n /**\r\n * Sets the fuzz weight texture.\r\n * @param value The fuzz weight texture or null\r\n */\r\n public set fuzzWeightTexture(value: Nullable<BaseTexture>) {\r\n this._material.fuzzWeightTexture = value;\r\n }\r\n\r\n /**\r\n * Sets the fuzz color.\r\n * @param value The fuzz color as a Color3\r\n */\r\n public set fuzzColor(value: Color3) {\r\n this._material.fuzzColor = value;\r\n }\r\n\r\n /**\r\n * Sets the fuzz color texture.\r\n * @param value The fuzz color texture or null\r\n */\r\n public set fuzzColorTexture(value: Nullable<BaseTexture>) {\r\n this._material.fuzzColorTexture = value;\r\n }\r\n\r\n /**\r\n * Sets the fuzz roughness.\r\n * @param value The fuzz roughness value (0-1)\r\n */\r\n public set fuzzRoughness(value: number) {\r\n this._material.fuzzRoughness = value;\r\n }\r\n\r\n /**\r\n * Sets the fuzz roughness texture.\r\n * @param value The fuzz roughness texture or null\r\n */\r\n public set fuzzRoughnessTexture(value: Nullable<BaseTexture>) {\r\n this._material.fuzzRoughnessTexture = value;\r\n this._material._useFuzzRoughnessFromTextureAlpha = true;\r\n }\r\n\r\n // ========================================\r\n // ANISOTROPY\r\n // ========================================\r\n\r\n /**\r\n * Sets the specular roughness anisotropy of the OpenPBR material.\r\n * @param value The anisotropy intensity value\r\n */\r\n public set specularRoughnessAnisotropy(value: number) {\r\n this._material.specularRoughnessAnisotropy = value;\r\n }\r\n\r\n /**\r\n * Gets the specular roughness anisotropy of the OpenPBR material.\r\n * @returns The anisotropy intensity value\r\n */\r\n public get specularRoughnessAnisotropy(): number {\r\n return this._material.specularRoughnessAnisotropy;\r\n }\r\n\r\n /**\r\n * Sets the anisotropy rotation angle.\r\n * @param value The anisotropy rotation angle in radians\r\n */\r\n public set geometryTangentAngle(value: number) {\r\n this._material.geometryTangentAngle = value;\r\n }\r\n\r\n /**\r\n * Sets the geometry tangent texture for anisotropy.\r\n * Automatically enables using anisotropy from the tangent texture.\r\n * @param value The anisotropy texture or null\r\n */\r\n public set geometryTangentTexture(value: Nullable<BaseTexture>) {\r\n this._material.geometryTangentTexture = value;\r\n this._material._useSpecularRoughnessAnisotropyFromTangentTexture = true;\r\n }\r\n\r\n /**\r\n * Gets the geometry tangent texture for anisotropy.\r\n * @returns The anisotropy texture or null\r\n */\r\n public get geometryTangentTexture(): Nullable<BaseTexture> {\r\n return this._material.geometryTangentTexture;\r\n }\r\n\r\n /**\r\n * Configures glTF-style anisotropy for the OpenPBR material.\r\n * @param useGltfStyle Whether to use glTF-style anisotropy\r\n */\r\n public configureGltfStyleAnisotropy(useGltfStyle: boolean = true): void {\r\n this._material._useGltfStyleAnisotropy = useGltfStyle;\r\n }\r\n\r\n // ========================================\r\n // THIN FILM IRIDESCENCE\r\n // ========================================\r\n\r\n /**\r\n * Sets the thin film weight.\r\n * @param value The thin film weight value\r\n */\r\n public set thinFilmWeight(value: number) {\r\n this._material.thinFilmWeight = value;\r\n }\r\n\r\n /**\r\n * Sets the thin film IOR.\r\n * @param value The thin film IOR value\r\n */\r\n public set thinFilmIor(value: number) {\r\n this._material.thinFilmIor = value;\r\n }\r\n\r\n /**\r\n * Sets the thin film thickness minimum.\r\n * @param value The minimum thickness value in nanometers\r\n */\r\n public set thinFilmThicknessMinimum(value: number) {\r\n this._material.thinFilmThicknessMin = value / 1000.0; // Convert to micrometers for OpenPBR\r\n }\r\n\r\n /**\r\n * Sets the thin film thickness maximum.\r\n * @param value The maximum thickness value in nanometers\r\n */\r\n public set thinFilmThicknessMaximum(value: number) {\r\n this._material.thinFilmThickness = value / 1000.0; // Convert to micrometers for OpenPBR\r\n }\r\n\r\n /**\r\n * Sets the thin film weight texture.\r\n * @param value The thin film weight texture or null\r\n */\r\n public set thinFilmWeightTexture(value: Nullable<BaseTexture>) {\r\n this._material.thinFilmWeightTexture = value;\r\n }\r\n\r\n /**\r\n * Sets the thin film thickness texture.\r\n * @param value The thin film thickness texture or null\r\n */\r\n public set thinFilmThicknessTexture(value: Nullable<BaseTexture>) {\r\n this._material.thinFilmThicknessTexture = value;\r\n this._material._useThinFilmThicknessFromTextureGreen = true;\r\n }\r\n\r\n // ========================================\r\n // UNLIT MATERIALS\r\n // ========================================\r\n\r\n /**\r\n * Sets whether the OpenPBR material is unlit.\r\n * @param value True to make the material unlit\r\n */\r\n public set unlit(value: boolean) {\r\n this._material.unlit = value;\r\n }\r\n\r\n // ========================================\r\n // GEOMETRY PARAMETERS\r\n // ========================================\r\n\r\n /**\r\n * Sets the geometry opacity of the OpenPBR material.\r\n * @param value The opacity value (0-1)\r\n */\r\n public set geometryOpacity(value: number) {\r\n this._material.geometryOpacity = value;\r\n }\r\n\r\n /**\r\n * Gets the geometry opacity of the OpenPBR material.\r\n * @returns The opacity value (0-1)\r\n */\r\n public get geometryOpacity(): number {\r\n return this._material.geometryOpacity;\r\n }\r\n\r\n /**\r\n * Sets the geometry normal texture of the OpenPBR material.\r\n * @param value The normal texture or null\r\n */\r\n public set geometryNormalTexture(value: Nullable<BaseTexture>) {\r\n this._material.geometryNormalTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the geometry normal texture of the OpenPBR material.\r\n * @returns The normal texture or null\r\n */\r\n public get geometryNormalTexture(): Nullable<BaseTexture> {\r\n return this._material.geometryNormalTexture;\r\n }\r\n\r\n /**\r\n * Sets the normal map inversions for the OpenPBR material.\r\n * Note: OpenPBR may handle normal map inversions differently or may not need them.\r\n * @param invertX Whether to invert the normal map on the X axis (may be ignored)\r\n * @param invertY Whether to invert the normal map on the Y axis (may be ignored)\r\n */\r\n public setNormalMapInversions(invertX: boolean, invertY: boolean): void {\r\n // OpenPBR handles normal map inversions differently or may not need them\r\n }\r\n\r\n /**\r\n * Sets the geometry coat normal texture of the OpenPBR material.\r\n * @param value The coat normal texture or null\r\n */\r\n public set geometryCoatNormalTexture(value: Nullable<BaseTexture>) {\r\n this._material.geometryCoatNormalTexture = value;\r\n }\r\n\r\n /**\r\n * Gets the geometry coat normal texture of the OpenPBR material.\r\n * @returns The coat normal texture or null\r\n */\r\n public get geometryCoatNormalTexture(): Nullable<BaseTexture> {\r\n return this._material.geometryCoatNormalTexture;\r\n }\r\n\r\n /**\r\n * Sets the geometry coat normal texture scale.\r\n * @param value The scale value for the coat normal texture\r\n */\r\n public set geometryCoatNormalTextureScale(value: number) {\r\n if (this._material.geometryCoatNormalTexture) {\r\n this._material.geometryCoatNormalTexture.level = value;\r\n }\r\n }\r\n\r\n public finalize(): void {\r\n // Do final configuration for the material to handle any interactions/dependencies between properties that we had to defer until all properties were loaded.\r\n\r\n // If the material is volumetric, we may need to create a coat layer to handle the surface tint.\r\n if ((this._diffuseTransmissionTint && !this._diffuseTransmissionTint.equals(Color3.White())) || this._diffuseTransmissionTintTexture) {\r\n if (this._material.geometryThinWalled) {\r\n // Use the subsurface slab for surface tinting.\r\n this.subsurfaceColor = this._diffuseTransmissionTint;\r\n this.subsurfaceColorTexture = this._diffuseTransmissionTintTexture;\r\n } else {\r\n // The material is volumetric and we have surface tinting, so we need to move that tinting to the coat layer to preserve it.\r\n // TODO: If we already have a coat slab, we'll have to merge the two.\r\n if (this._material.coatWeight == 0 && (!this.baseColor.equals(Color3.White()) || this.baseColorTexture)) {\r\n this._material.coatWeight = this.subsurfaceWeight;\r\n this._material.coatWeightTexture = this.subsurfaceWeightTexture;\r\n this._material.coatColor = this._diffuseTransmissionTint;\r\n this._material.coatColorTexture = this._diffuseTransmissionTintTexture;\r\n 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.\r\n this._material.coatDarkening = 0.0;\r\n this._material.coatRoughness = this._material.specularRoughness;\r\n this._material.coatRoughnessTexture = this._material.specularRoughnessTexture;\r\n }\r\n }\r\n }\r\n // If the material has transmission, we need to use the base color to tint the transmission.\r\n if (this.transmissionWeight > 0) {\r\n if (this._material.geometryThinWalled || this._material.transmissionDepth === 0) {\r\n // If the material is thin-walled or has no attenuation depth, we can use the base color as the transmission color directly.\r\n this._material.transmissionColor = this._material.baseColor;\r\n this._material.transmissionColorTexture = this._material.baseColorTexture;\r\n } else if (this._material.coatWeight == 0 && (!this.baseColor.equals(Color3.White()) || this.baseColorTexture !== null)) {\r\n // Otherwise, we have volumetric attenuation so we need to use the coat layer to preserve the base color tinting of glTF.\r\n // TODO: If we already have a coat slab, we'll have to merge the two.\r\n this._material.coatWeight = this.transmissionWeight;\r\n this._material.coatWeightTexture = this.transmissionWeightTexture;\r\n this._material.coatColor = this.baseColor;\r\n this._material.coatColorTexture = this.baseColorTexture;\r\n 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.\r\n this._material.coatDarkening = 0.0;\r\n this._material.coatRoughness = this._material.specularRoughness;\r\n this._material.coatRoughnessTexture = this._material.specularRoughnessTexture;\r\n }\r\n }\r\n }\r\n}\r\n"]}