@babylonjs/core 8.32.3 → 8.33.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.
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Materials/PBR/index.d.ts +1 -1
- package/Materials/PBR/index.js +1 -1
- package/Materials/PBR/index.js.map +1 -1
- package/Materials/PBR/{openPbrMaterial.d.ts → openpbrMaterial.d.ts} +77 -0
- package/Materials/PBR/{openPbrMaterial.js → openpbrMaterial.js} +128 -10
- package/Materials/PBR/openpbrMaterial.js.map +1 -0
- package/Misc/brdfTextureTools.d.ts +12 -0
- package/Misc/brdfTextureTools.js +36 -6
- package/Misc/brdfTextureTools.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.d.ts +1 -1
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.js +1 -1
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrBaseLayerData.js +1 -1
- package/Shaders/ShadersInclude/openpbrBaseLayerData.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrDirectLighting.js +10 -2
- package/Shaders/ShadersInclude/openpbrDirectLighting.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +24 -2
- package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrFragmentDeclaration.js +10 -1
- package/Shaders/ShadersInclude/openpbrFragmentDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrFragmentSamplersDeclaration.js +8 -2
- package/Shaders/ShadersInclude/openpbrFragmentSamplersDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrFuzzLayerData.d.ts +5 -0
- package/Shaders/ShadersInclude/openpbrFuzzLayerData.js +40 -0
- package/Shaders/ShadersInclude/openpbrFuzzLayerData.js.map +1 -0
- package/Shaders/ShadersInclude/openpbrGeometryInfo.js +2 -8
- package/Shaders/ShadersInclude/openpbrGeometryInfo.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrNormalMapFragment.js +1 -1
- package/Shaders/ShadersInclude/openpbrNormalMapFragment.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrNormalMapFragmentMainFunctions.js +1 -1
- package/Shaders/ShadersInclude/openpbrNormalMapFragmentMainFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrNormalMapVertex.js +1 -1
- package/Shaders/ShadersInclude/openpbrNormalMapVertex.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrNormalMapVertexDeclaration.js +1 -1
- package/Shaders/ShadersInclude/openpbrNormalMapVertexDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrUboDeclaration.js +1 -1
- package/Shaders/ShadersInclude/openpbrUboDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrVertexDeclaration.js +9 -0
- package/Shaders/ShadersInclude/openpbrVertexDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBRDFFunctions.js +3 -0
- package/Shaders/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +9 -0
- package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/Shaders/openpbr.fragment.d.ts +1 -0
- package/Shaders/openpbr.fragment.js +8 -1
- package/Shaders/openpbr.fragment.js.map +1 -1
- package/Shaders/openpbr.vertex.js +6 -0
- package/Shaders/openpbr.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrBaseLayerData.js +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrBaseLayerData.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js +10 -2
- package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +25 -2
- package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrFragmentSamplersDeclaration.js +7 -1
- package/ShadersWGSL/ShadersInclude/openpbrFragmentSamplersDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrFuzzLayerData.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/openpbrFuzzLayerData.js +40 -0
- package/ShadersWGSL/ShadersInclude/openpbrFuzzLayerData.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/openpbrGeometryInfo.js +2 -8
- package/ShadersWGSL/ShadersInclude/openpbrGeometryInfo.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrNormalMapFragment.js +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrNormalMapFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrNormalMapFragmentMainFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrNormalMapFragmentMainFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrNormalMapVertex.js +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrNormalMapVertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrNormalMapVertexDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrNormalMapVertexDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrUboDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js +3 -0
- package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +9 -0
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/ShadersWGSL/openpbr.fragment.d.ts +1 -0
- package/ShadersWGSL/openpbr.fragment.js +8 -1
- package/ShadersWGSL/openpbr.fragment.js.map +1 -1
- package/ShadersWGSL/openpbr.vertex.js +6 -0
- package/ShadersWGSL/openpbr.vertex.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +4 -0
- package/scene.js.map +1 -1
- package/Materials/PBR/openPbrMaterial.js.map +0 -1
package/Materials/PBR/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export * from "./pbrBRDFConfiguration.js";
|
|
|
5
5
|
export * from "./pbrClearCoatConfiguration.js";
|
|
6
6
|
export * from "./pbrIridescenceConfiguration.js";
|
|
7
7
|
export * from "./pbrMaterial.js";
|
|
8
|
-
export * from "./
|
|
8
|
+
export * from "./openpbrMaterial.js";
|
|
9
9
|
export * from "./pbrMetallicRoughnessMaterial.js";
|
|
10
10
|
export * from "./pbrSpecularGlossinessMaterial.js";
|
|
11
11
|
export * from "./pbrSheenConfiguration.js";
|
package/Materials/PBR/index.js
CHANGED
|
@@ -5,7 +5,7 @@ export * from "./pbrBRDFConfiguration.js";
|
|
|
5
5
|
export * from "./pbrClearCoatConfiguration.js";
|
|
6
6
|
export * from "./pbrIridescenceConfiguration.js";
|
|
7
7
|
export * from "./pbrMaterial.js";
|
|
8
|
-
export * from "./
|
|
8
|
+
export * from "./openpbrMaterial.js";
|
|
9
9
|
export * from "./pbrMetallicRoughnessMaterial.js";
|
|
10
10
|
export * from "./pbrSpecularGlossinessMaterial.js";
|
|
11
11
|
export * from "./pbrSheenConfiguration.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/PBR/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAE7C,uBAAuB;AACvB,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC","sourcesContent":["export * from \"./pbrAnisotropicConfiguration\";\r\nexport * from \"./pbrBaseMaterial\";\r\nexport * from \"./pbrBaseSimpleMaterial\";\r\nexport * from \"./pbrBRDFConfiguration\";\r\nexport * from \"./pbrClearCoatConfiguration\";\r\nexport * from \"./pbrIridescenceConfiguration\";\r\nexport * from \"./pbrMaterial\";\r\nexport * from \"./
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/PBR/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAE7C,uBAAuB;AACvB,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC","sourcesContent":["export * from \"./pbrAnisotropicConfiguration\";\r\nexport * from \"./pbrBaseMaterial\";\r\nexport * from \"./pbrBaseSimpleMaterial\";\r\nexport * from \"./pbrBRDFConfiguration\";\r\nexport * from \"./pbrClearCoatConfiguration\";\r\nexport * from \"./pbrIridescenceConfiguration\";\r\nexport * from \"./pbrMaterial\";\r\nexport * from \"./openpbrMaterial\";\r\nexport * from \"./pbrMetallicRoughnessMaterial\";\r\nexport * from \"./pbrSpecularGlossinessMaterial\";\r\nexport * from \"./pbrSheenConfiguration\";\r\nexport * from \"./pbrSubSurfaceConfiguration\";\r\n\r\n// async-loaded shaders\r\nexport * from \"../../ShadersWGSL/pbr.vertex\";\r\nexport * from \"../../ShadersWGSL/pbr.fragment\";\r\nexport * from \"../../Shaders/pbr.vertex\";\r\nexport * from \"../../Shaders/pbr.fragment\";\r\nexport * from \"../../ShadersWGSL/openpbr.vertex\";\r\nexport * from \"../../ShadersWGSL/openpbr.fragment\";\r\nexport * from \"../../Shaders/openpbr.vertex\";\r\nexport * from \"../../Shaders/openpbr.fragment\";\r\n"]}
|
|
@@ -85,6 +85,7 @@ export declare class OpenPBRMaterialDefines extends OpenPBRMaterialDefines_base
|
|
|
85
85
|
THIN_FILM_THICKNESS_FROM_THIN_FILM_TEXTURE: boolean;
|
|
86
86
|
ENVIRONMENTBRDF: boolean;
|
|
87
87
|
ENVIRONMENTBRDF_RGBD: boolean;
|
|
88
|
+
FUZZENVIRONMENTBRDF: boolean;
|
|
88
89
|
NORMAL: boolean;
|
|
89
90
|
TANGENT: boolean;
|
|
90
91
|
OBJECTSPACE_NORMALMAP: boolean;
|
|
@@ -92,11 +93,38 @@ export declare class OpenPBRMaterialDefines extends OpenPBRMaterialDefines_base
|
|
|
92
93
|
PARALLAX_RHS: boolean;
|
|
93
94
|
PARALLAXOCCLUSION: boolean;
|
|
94
95
|
NORMALXYSCALE: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Enables anisotropic logic. Still needed because it's used in pbrHelperFunctions
|
|
98
|
+
*/
|
|
95
99
|
ANISOTROPIC: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Tells the shader to use OpenPBR's anisotropic roughness remapping
|
|
102
|
+
*/
|
|
96
103
|
ANISOTROPIC_OPENPBR: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Tells the shader to apply anisotropy to the base layer
|
|
106
|
+
*/
|
|
97
107
|
ANISOTROPIC_BASE: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Tells the shader to apply anisotropy to the coat layer
|
|
110
|
+
*/
|
|
98
111
|
ANISOTROPIC_COAT: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Number of samples to use for the fuzz IBL lighting calculations
|
|
114
|
+
*/
|
|
115
|
+
FUZZ_IBL_SAMPLES: number;
|
|
116
|
+
/**
|
|
117
|
+
* Tells the shader to enable the fuzz layer
|
|
118
|
+
*/
|
|
119
|
+
FUZZ: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Tells the shader to enable the thin film layer
|
|
122
|
+
*/
|
|
99
123
|
THIN_FILM: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Tells the shader to enable the legacy iridescence code
|
|
126
|
+
* Iridescence is the name of thin film interference in the PBR material.
|
|
127
|
+
*/
|
|
100
128
|
IRIDESCENCE: boolean;
|
|
101
129
|
REFLECTION: boolean;
|
|
102
130
|
REFLECTIONMAP_3D: boolean;
|
|
@@ -424,6 +452,42 @@ export declare class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
424
452
|
* same texture as the coat_weight.
|
|
425
453
|
*/
|
|
426
454
|
useCoatRoughnessFromWeightTexture: boolean;
|
|
455
|
+
/**
|
|
456
|
+
* Defines the weight of the fuzz layer on the surface.
|
|
457
|
+
* See OpenPBR's specs for fuzz_weight
|
|
458
|
+
*/
|
|
459
|
+
fuzzWeight: number;
|
|
460
|
+
private _fuzzWeight;
|
|
461
|
+
/**
|
|
462
|
+
* Weight texture of the fuzz layer.
|
|
463
|
+
* See OpenPBR's specs for fuzz_weight
|
|
464
|
+
*/
|
|
465
|
+
fuzzWeightTexture: Nullable<BaseTexture>;
|
|
466
|
+
private _fuzzWeightTexture;
|
|
467
|
+
/**
|
|
468
|
+
* Defines the color of the fuzz layer on the surface.
|
|
469
|
+
* See OpenPBR's specs for fuzz_color
|
|
470
|
+
*/
|
|
471
|
+
fuzzColor: Color3;
|
|
472
|
+
private _fuzzColor;
|
|
473
|
+
/**
|
|
474
|
+
* Color texture of the fuzz layer.
|
|
475
|
+
* See OpenPBR's specs for fuzz_color
|
|
476
|
+
*/
|
|
477
|
+
fuzzColorTexture: Nullable<BaseTexture>;
|
|
478
|
+
private _fuzzColorTexture;
|
|
479
|
+
/**
|
|
480
|
+
* Defines the roughness of the fuzz layer on the surface.
|
|
481
|
+
* See OpenPBR's specs for fuzz_roughness
|
|
482
|
+
*/
|
|
483
|
+
fuzzRoughness: number;
|
|
484
|
+
private _fuzzRoughness;
|
|
485
|
+
/**
|
|
486
|
+
* Roughness texture of the fuzz layer.
|
|
487
|
+
* See OpenPBR's specs for fuzz_roughness
|
|
488
|
+
*/
|
|
489
|
+
fuzzRoughnessTexture: Nullable<BaseTexture>;
|
|
490
|
+
private _fuzzRoughnessTexture;
|
|
427
491
|
/**
|
|
428
492
|
* Defines the normal of the material's geometry.
|
|
429
493
|
* See OpenPBR's specs for geometry_normal
|
|
@@ -844,6 +908,13 @@ export declare class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
844
908
|
* @internal
|
|
845
909
|
*/
|
|
846
910
|
_environmentBRDFTexture: Nullable<BaseTexture>;
|
|
911
|
+
/**
|
|
912
|
+
* Specifies the environment BRDF texture used to compute the scale and offset roughness values
|
|
913
|
+
* from cos theta and roughness for the fuzz layer:
|
|
914
|
+
* https://github.com/tizian/ltc-sheen?tab=readme-ov-file
|
|
915
|
+
* @internal
|
|
916
|
+
*/
|
|
917
|
+
_environmentFuzzBRDFTexture: Nullable<BaseTexture>;
|
|
847
918
|
/**
|
|
848
919
|
* Force the shader to compute irradiance in the fragment shader in order to take normal mapping into account.
|
|
849
920
|
* @internal
|
|
@@ -861,6 +932,12 @@ export declare class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
861
932
|
*/
|
|
862
933
|
get realTimeFilteringQuality(): number;
|
|
863
934
|
set realTimeFilteringQuality(n: number);
|
|
935
|
+
private _fuzzSampleNumber;
|
|
936
|
+
/**
|
|
937
|
+
* The number of samples used to compute the fuzz IBL lighting.
|
|
938
|
+
*/
|
|
939
|
+
get fuzzSampleNumber(): number;
|
|
940
|
+
set fuzzSampleNumber(n: number);
|
|
864
941
|
/**
|
|
865
942
|
* Can this material render to several textures at once
|
|
866
943
|
*/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __decorate } from "../../tslib.es6.js";
|
|
2
2
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
3
|
import { serialize, expandToProperty, addAccessorsForMaterialProperty } from "../../Misc/decorators.js";
|
|
4
|
-
import { GetEnvironmentBRDFTexture } from "../../Misc/brdfTextureTools.js";
|
|
4
|
+
import { GetEnvironmentBRDFTexture, GetEnvironmentFuzzBRDFTexture } from "../../Misc/brdfTextureTools.js";
|
|
5
5
|
import { Scene } from "../../scene.js";
|
|
6
6
|
import { Color3 } from "../../Maths/math.color.js";
|
|
7
7
|
import { ImageProcessingConfiguration } from "../imageProcessingConfiguration.js";
|
|
8
|
-
import { Texture } from "
|
|
8
|
+
import { Texture } from "../Textures/texture.js";
|
|
9
9
|
import { RegisterClass } from "../../Misc/typeStore.js";
|
|
10
10
|
import { Material } from "../material.js";
|
|
11
11
|
import { SerializationHelper } from "../../Misc/decorators.serialization.js";
|
|
@@ -181,6 +181,7 @@ export class OpenPBRMaterialDefines extends ImageProcessingDefinesMixin(OpenPBRM
|
|
|
181
181
|
this.THIN_FILM_THICKNESS_FROM_THIN_FILM_TEXTURE = false;
|
|
182
182
|
this.ENVIRONMENTBRDF = false;
|
|
183
183
|
this.ENVIRONMENTBRDF_RGBD = false;
|
|
184
|
+
this.FUZZENVIRONMENTBRDF = false;
|
|
184
185
|
this.NORMAL = false;
|
|
185
186
|
this.TANGENT = false;
|
|
186
187
|
this.OBJECTSPACE_NORMALMAP = false;
|
|
@@ -188,12 +189,39 @@ export class OpenPBRMaterialDefines extends ImageProcessingDefinesMixin(OpenPBRM
|
|
|
188
189
|
this.PARALLAX_RHS = false;
|
|
189
190
|
this.PARALLAXOCCLUSION = false;
|
|
190
191
|
this.NORMALXYSCALE = true;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
this.
|
|
195
|
-
|
|
196
|
-
|
|
192
|
+
/**
|
|
193
|
+
* Enables anisotropic logic. Still needed because it's used in pbrHelperFunctions
|
|
194
|
+
*/
|
|
195
|
+
this.ANISOTROPIC = false;
|
|
196
|
+
/**
|
|
197
|
+
* Tells the shader to use OpenPBR's anisotropic roughness remapping
|
|
198
|
+
*/
|
|
199
|
+
this.ANISOTROPIC_OPENPBR = true;
|
|
200
|
+
/**
|
|
201
|
+
* Tells the shader to apply anisotropy to the base layer
|
|
202
|
+
*/
|
|
203
|
+
this.ANISOTROPIC_BASE = false;
|
|
204
|
+
/**
|
|
205
|
+
* Tells the shader to apply anisotropy to the coat layer
|
|
206
|
+
*/
|
|
207
|
+
this.ANISOTROPIC_COAT = false;
|
|
208
|
+
/**
|
|
209
|
+
* Number of samples to use for the fuzz IBL lighting calculations
|
|
210
|
+
*/
|
|
211
|
+
this.FUZZ_IBL_SAMPLES = 6;
|
|
212
|
+
/**
|
|
213
|
+
* Tells the shader to enable the fuzz layer
|
|
214
|
+
*/
|
|
215
|
+
this.FUZZ = false;
|
|
216
|
+
/**
|
|
217
|
+
* Tells the shader to enable the thin film layer
|
|
218
|
+
*/
|
|
219
|
+
this.THIN_FILM = false;
|
|
220
|
+
/**
|
|
221
|
+
* Tells the shader to enable the legacy iridescence code
|
|
222
|
+
* Iridescence is the name of thin film interference in the PBR material.
|
|
223
|
+
*/
|
|
224
|
+
this.IRIDESCENCE = false;
|
|
197
225
|
this.REFLECTION = false;
|
|
198
226
|
this.REFLECTIONMAP_3D = false;
|
|
199
227
|
this.REFLECTIONMAP_SPHERICAL = false;
|
|
@@ -415,6 +443,16 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
415
443
|
this._realTimeFilteringQuality = n;
|
|
416
444
|
this.markAsDirty(1);
|
|
417
445
|
}
|
|
446
|
+
/**
|
|
447
|
+
* The number of samples used to compute the fuzz IBL lighting.
|
|
448
|
+
*/
|
|
449
|
+
get fuzzSampleNumber() {
|
|
450
|
+
return this._fuzzSampleNumber;
|
|
451
|
+
}
|
|
452
|
+
set fuzzSampleNumber(n) {
|
|
453
|
+
this._fuzzSampleNumber = n;
|
|
454
|
+
this.markAsDirty(1);
|
|
455
|
+
}
|
|
418
456
|
/**
|
|
419
457
|
* Can this material render to several textures at once
|
|
420
458
|
*/
|
|
@@ -463,6 +501,12 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
463
501
|
* same texture as the coat_weight.
|
|
464
502
|
*/
|
|
465
503
|
this.useCoatRoughnessFromWeightTexture = false;
|
|
504
|
+
this._fuzzWeight = new Property("fuzz_weight", 0.0, "vFuzzWeight", 1, 0);
|
|
505
|
+
this._fuzzWeightTexture = new Sampler("fuzz_weight", "fuzzWeight", "FUZZ_WEIGHT");
|
|
506
|
+
this._fuzzColor = new Property("fuzz_color", Color3.White(), "vFuzzColor", 3, 0);
|
|
507
|
+
this._fuzzColorTexture = new Sampler("fuzz_color", "fuzzColor", "FUZZ_COLOR");
|
|
508
|
+
this._fuzzRoughness = new Property("fuzz_roughness", 0.5, "vFuzzRoughness", 1, 0);
|
|
509
|
+
this._fuzzRoughnessTexture = new Sampler("fuzz_roughness", "fuzzRoughness", "FUZZ_ROUGHNESS");
|
|
466
510
|
this._geometryNormalTexture = new Sampler("geometry_normal", "geometryNormal", "GEOMETRY_NORMAL");
|
|
467
511
|
this._geometryTangent = new Property("geometry_tangent", new Vector2(1, 0), "vSpecularAnisotropy", 3, 0);
|
|
468
512
|
this._geometryTangentTexture = new Sampler("geometry_tangent", "geometryTangent", "GEOMETRY_TANGENT");
|
|
@@ -755,6 +799,13 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
755
799
|
* @internal
|
|
756
800
|
*/
|
|
757
801
|
this._environmentBRDFTexture = null;
|
|
802
|
+
/**
|
|
803
|
+
* Specifies the environment BRDF texture used to compute the scale and offset roughness values
|
|
804
|
+
* from cos theta and roughness for the fuzz layer:
|
|
805
|
+
* https://github.com/tizian/ltc-sheen?tab=readme-ov-file
|
|
806
|
+
* @internal
|
|
807
|
+
*/
|
|
808
|
+
this._environmentFuzzBRDFTexture = null;
|
|
758
809
|
/**
|
|
759
810
|
* Force the shader to compute irradiance in the fragment shader in order to take normal mapping into account.
|
|
760
811
|
* @internal
|
|
@@ -762,6 +813,7 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
762
813
|
this._forceIrradianceInFragment = false;
|
|
763
814
|
this._realTimeFiltering = false;
|
|
764
815
|
this._realTimeFilteringQuality = 8;
|
|
816
|
+
this._fuzzSampleNumber = 4;
|
|
765
817
|
/**
|
|
766
818
|
* Force normal to face away from face.
|
|
767
819
|
* @internal
|
|
@@ -837,6 +889,7 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
837
889
|
return this._renderTargets;
|
|
838
890
|
};
|
|
839
891
|
this._environmentBRDFTexture = GetEnvironmentBRDFTexture(this.getScene());
|
|
892
|
+
this._environmentFuzzBRDFTexture = GetEnvironmentFuzzBRDFTexture(this.getScene());
|
|
840
893
|
this.prePassConfiguration = new PrePassConfiguration();
|
|
841
894
|
// Build the internal property list that can be used to generate and update the uniform buffer
|
|
842
895
|
this._propertyList = {};
|
|
@@ -906,6 +959,12 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
906
959
|
this._coatIor;
|
|
907
960
|
this._coatDarkening;
|
|
908
961
|
this._coatDarkeningTexture;
|
|
962
|
+
this._fuzzWeight;
|
|
963
|
+
this._fuzzWeightTexture;
|
|
964
|
+
this._fuzzColor;
|
|
965
|
+
this._fuzzColorTexture;
|
|
966
|
+
this._fuzzRoughness;
|
|
967
|
+
this._fuzzRoughnessTexture;
|
|
909
968
|
this._geometryNormalTexture;
|
|
910
969
|
this._geometryTangent;
|
|
911
970
|
this._geometryTangentTexture;
|
|
@@ -1120,6 +1179,12 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
1120
1179
|
return false;
|
|
1121
1180
|
}
|
|
1122
1181
|
}
|
|
1182
|
+
if (this._environmentFuzzBRDFTexture && MaterialFlags.ReflectionTextureEnabled) {
|
|
1183
|
+
// This is blocking.
|
|
1184
|
+
if (!this._environmentFuzzBRDFTexture.isReady()) {
|
|
1185
|
+
return false;
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1123
1188
|
if (OpenPBRMaterial._noiseTextures[scene.uniqueId]) {
|
|
1124
1189
|
if (!OpenPBRMaterial._noiseTextures[scene.uniqueId].isReady()) {
|
|
1125
1190
|
return false;
|
|
@@ -1318,7 +1383,10 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
1318
1383
|
if (defines.ENVIRONMENTBRDF) {
|
|
1319
1384
|
ubo.setTexture("environmentBrdfSampler", this._environmentBRDFTexture);
|
|
1320
1385
|
}
|
|
1321
|
-
if (defines.
|
|
1386
|
+
if (defines.FUZZENVIRONMENTBRDF) {
|
|
1387
|
+
ubo.setTexture("environmentFuzzBrdfSampler", this._environmentFuzzBRDFTexture);
|
|
1388
|
+
}
|
|
1389
|
+
if (defines.ANISOTROPIC || defines.FUZZ) {
|
|
1322
1390
|
ubo.setTexture("blueNoiseSampler", OpenPBRMaterial._noiseTextures[this.getScene().uniqueId]);
|
|
1323
1391
|
}
|
|
1324
1392
|
}
|
|
@@ -1439,6 +1507,9 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
1439
1507
|
if (this._environmentBRDFTexture && this.getScene().environmentBRDFTexture !== this._environmentBRDFTexture) {
|
|
1440
1508
|
this._environmentBRDFTexture.dispose();
|
|
1441
1509
|
}
|
|
1510
|
+
if (this._environmentFuzzBRDFTexture && this.getScene().environmentFuzzBRDFTexture !== this._environmentFuzzBRDFTexture) {
|
|
1511
|
+
this._environmentFuzzBRDFTexture.dispose();
|
|
1512
|
+
}
|
|
1442
1513
|
// Loop through samplers and dispose the textures
|
|
1443
1514
|
for (const key in this._samplersList) {
|
|
1444
1515
|
const sampler = this._samplersList[key];
|
|
@@ -1580,6 +1651,9 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
1580
1651
|
"areaLightsLTC1Sampler",
|
|
1581
1652
|
"areaLightsLTC2Sampler",
|
|
1582
1653
|
];
|
|
1654
|
+
if (defines.FUZZENVIRONMENTBRDF) {
|
|
1655
|
+
samplers.push("environmentFuzzBrdfSampler");
|
|
1656
|
+
}
|
|
1583
1657
|
for (const key in this._samplersList) {
|
|
1584
1658
|
const sampler = this._samplersList[key];
|
|
1585
1659
|
samplers.push(sampler.samplerName);
|
|
@@ -1726,6 +1800,12 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
1726
1800
|
defines.ENVIRONMENTBRDF = false;
|
|
1727
1801
|
defines.ENVIRONMENTBRDF_RGBD = false;
|
|
1728
1802
|
}
|
|
1803
|
+
if (this._environmentFuzzBRDFTexture) {
|
|
1804
|
+
defines.FUZZENVIRONMENTBRDF = true;
|
|
1805
|
+
}
|
|
1806
|
+
else {
|
|
1807
|
+
defines.FUZZENVIRONMENTBRDF = false;
|
|
1808
|
+
}
|
|
1729
1809
|
if (this._shouldUseAlphaFromBaseColorTexture()) {
|
|
1730
1810
|
defines.ALPHA_FROM_BASE_COLOR_TEXTURE = true;
|
|
1731
1811
|
}
|
|
@@ -1791,6 +1871,20 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
1791
1871
|
}
|
|
1792
1872
|
defines.THIN_FILM = this.thinFilmWeight > 0.0;
|
|
1793
1873
|
defines.IRIDESCENCE = this.thinFilmWeight > 0.0;
|
|
1874
|
+
defines.FUZZ = this.fuzzWeight > 0 && MaterialFlags.ReflectionTextureEnabled;
|
|
1875
|
+
if (defines.FUZZ) {
|
|
1876
|
+
if (!mesh.isVerticesDataPresent(VertexBuffer.TangentKind)) {
|
|
1877
|
+
defines._needUVs = true;
|
|
1878
|
+
defines.MAINUV1 = true;
|
|
1879
|
+
}
|
|
1880
|
+
this._environmentFuzzBRDFTexture = GetEnvironmentFuzzBRDFTexture(this.getScene());
|
|
1881
|
+
defines.FUZZ_IBL_SAMPLES = this.fuzzSampleNumber;
|
|
1882
|
+
}
|
|
1883
|
+
else {
|
|
1884
|
+
this._environmentFuzzBRDFTexture = null;
|
|
1885
|
+
defines.FUZZENVIRONMENTBRDF = false;
|
|
1886
|
+
defines.FUZZ_IBL_SAMPLES = 0;
|
|
1887
|
+
}
|
|
1794
1888
|
// Misc.
|
|
1795
1889
|
if (defines._areMiscDirty) {
|
|
1796
1890
|
PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this.needAlphaTestingForMesh(mesh), defines, this._applyDecalMapAfterDetailMap, this._useVertexPulling, renderingMesh, this._isVertexOutputInvariant);
|
|
@@ -1927,6 +2021,30 @@ __decorate([
|
|
|
1927
2021
|
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatDarkeningTexture")
|
|
1928
2022
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1929
2023
|
], OpenPBRMaterial.prototype, "_coatDarkeningTexture", void 0);
|
|
2024
|
+
__decorate([
|
|
2025
|
+
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "fuzzWeight")
|
|
2026
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2027
|
+
], OpenPBRMaterial.prototype, "_fuzzWeight", void 0);
|
|
2028
|
+
__decorate([
|
|
2029
|
+
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "fuzzWeightTexture")
|
|
2030
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2031
|
+
], OpenPBRMaterial.prototype, "_fuzzWeightTexture", void 0);
|
|
2032
|
+
__decorate([
|
|
2033
|
+
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "fuzzColor")
|
|
2034
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2035
|
+
], OpenPBRMaterial.prototype, "_fuzzColor", void 0);
|
|
2036
|
+
__decorate([
|
|
2037
|
+
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "fuzzColorTexture")
|
|
2038
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2039
|
+
], OpenPBRMaterial.prototype, "_fuzzColorTexture", void 0);
|
|
2040
|
+
__decorate([
|
|
2041
|
+
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "fuzzRoughness")
|
|
2042
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2043
|
+
], OpenPBRMaterial.prototype, "_fuzzRoughness", void 0);
|
|
2044
|
+
__decorate([
|
|
2045
|
+
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "fuzzRoughnessTexture")
|
|
2046
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2047
|
+
], OpenPBRMaterial.prototype, "_fuzzRoughnessTexture", void 0);
|
|
1930
2048
|
__decorate([
|
|
1931
2049
|
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryNormalTexture")
|
|
1932
2050
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -2115,4 +2233,4 @@ __decorate([
|
|
|
2115
2233
|
serialize()
|
|
2116
2234
|
], OpenPBRMaterial.prototype, "transparencyMode", null);
|
|
2117
2235
|
RegisterClass("BABYLON.OpenPBRMaterial", OpenPBRMaterial);
|
|
2118
|
-
//# sourceMappingURL=
|
|
2236
|
+
//# sourceMappingURL=openpbrMaterial.js.map
|