@onerjs/core 8.46.6 → 8.46.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Engines/Extensions/engine.multiview.js +6 -0
- package/Engines/Extensions/engine.multiview.js.map +1 -1
- package/Engines/constants.d.ts +9 -4
- package/Engines/constants.js +9 -4
- package/Engines/constants.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.d.ts +6 -0
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +38 -11
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +4 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +4 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
- package/Materials/PBR/openpbrMaterial.d.ts +155 -53
- package/Materials/PBR/openpbrMaterial.js +149 -61
- package/Materials/PBR/openpbrMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +36 -31
- package/Materials/PBR/pbrBaseMaterial.js +4 -34
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/environmentLighting.defines.d.ts +31 -0
- package/Materials/environmentLighting.defines.js +33 -0
- package/Materials/environmentLighting.defines.js.map +1 -0
- package/Materials/material.js +1 -0
- package/Materials/material.js.map +1 -1
- package/Materials/materialHelper.functions.js +8 -2
- package/Materials/materialHelper.functions.js.map +1 -1
- package/Materials/materialHelper.geometryrendering.js +10 -3
- package/Materials/materialHelper.geometryrendering.js.map +1 -1
- package/Materials/prepass.defines.d.ts +43 -0
- package/Materials/prepass.defines.js +45 -0
- package/Materials/prepass.defines.js.map +1 -0
- package/Materials/standardMaterial.d.ts +36 -31
- package/Materials/standardMaterial.js +2 -32
- package/Materials/standardMaterial.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.js +12 -4
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Physics/v2/physicsConstraint.js +1 -0
- package/Physics/v2/physicsConstraint.js.map +1 -1
- package/PostProcesses/subSurfaceScatteringPostProcess.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.d.ts +3 -9
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.js +35 -12
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.js.map +1 -1
- package/Rendering/geometryBufferRenderer.d.ts +20 -0
- package/Rendering/geometryBufferRenderer.js +203 -14
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/objectRenderer.js +1 -0
- package/Rendering/objectRenderer.js.map +1 -1
- package/Rendering/prePassRenderer.js +7 -1
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Rendering/subSurfaceConfiguration.js.map +1 -1
- package/Shaders/ShadersInclude/helperFunctions.js +5 -0
- package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrBaseLayerData.js +1 -1
- package/Shaders/ShadersInclude/openpbrBaseLayerData.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrBlockPrePass.d.ts +5 -0
- package/Shaders/ShadersInclude/openpbrBlockPrePass.js +77 -0
- package/Shaders/ShadersInclude/openpbrBlockPrePass.js.map +1 -0
- package/Shaders/ShadersInclude/openpbrDirectLighting.js +37 -17
- package/Shaders/ShadersInclude/openpbrDirectLighting.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +43 -17
- 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.d.ts +1 -0
- package/Shaders/ShadersInclude/openpbrFragmentSamplersDeclaration.js +14 -38
- package/Shaders/ShadersInclude/openpbrFragmentSamplersDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrIblFunctions.js +4 -2
- package/Shaders/ShadersInclude/openpbrIblFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrSubsurfaceLayerData.d.ts +5 -0
- package/Shaders/ShadersInclude/openpbrSubsurfaceLayerData.js +35 -0
- package/Shaders/ShadersInclude/openpbrSubsurfaceLayerData.js.map +1 -0
- package/Shaders/ShadersInclude/openpbrTransmissionLayerData.js +1 -1
- package/Shaders/ShadersInclude/openpbrTransmissionLayerData.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/openpbrVolumeFunctions.d.ts +5 -0
- package/Shaders/ShadersInclude/openpbrVolumeFunctions.js +67 -0
- package/Shaders/ShadersInclude/openpbrVolumeFunctions.js.map +1 -0
- package/Shaders/ShadersInclude/pbrBlockPrePass.js +14 -3
- package/Shaders/ShadersInclude/pbrBlockPrePass.js.map +1 -1
- package/Shaders/ShadersInclude/pbrFragmentReflectionDeclaration.d.ts +5 -0
- package/Shaders/ShadersInclude/pbrFragmentReflectionDeclaration.js +43 -0
- package/Shaders/ShadersInclude/pbrFragmentReflectionDeclaration.js.map +1 -0
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.d.ts +1 -0
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js +2 -32
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/sceneFragmentDeclaration.js +1 -1
- package/Shaders/ShadersInclude/sceneFragmentDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/sceneUboDeclaration.js +1 -1
- package/Shaders/ShadersInclude/sceneUboDeclaration.js.map +1 -1
- package/Shaders/geometry.fragment.d.ts +12 -0
- package/Shaders/geometry.fragment.js +102 -1
- package/Shaders/geometry.fragment.js.map +1 -1
- package/Shaders/geometry.vertex.d.ts +1 -0
- package/Shaders/geometry.vertex.js +46 -2
- package/Shaders/geometry.vertex.js.map +1 -1
- package/Shaders/iblShadowVoxelTracing.fragment.d.ts +1 -0
- package/Shaders/iblShadowVoxelTracing.fragment.js +2 -5
- package/Shaders/iblShadowVoxelTracing.fragment.js.map +1 -1
- package/Shaders/openpbr.fragment.d.ts +3 -1
- package/Shaders/openpbr.fragment.js +69 -8
- package/Shaders/openpbr.fragment.js.map +1 -1
- package/Shaders/openpbr.vertex.js +11 -5
- package/Shaders/openpbr.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/helperFunctions.js +5 -0
- package/ShadersWGSL/ShadersInclude/helperFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrBackgroundTransmission.js +3 -2
- package/ShadersWGSL/ShadersInclude/openpbrBackgroundTransmission.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrBaseLayerData.js +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrBaseLayerData.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrBlockPrePass.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/openpbrBlockPrePass.js +101 -0
- package/ShadersWGSL/ShadersInclude/openpbrBlockPrePass.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js +39 -19
- package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +39 -13
- package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrFragmentSamplersDeclaration.d.ts +1 -0
- package/ShadersWGSL/ShadersInclude/openpbrFragmentSamplersDeclaration.js +14 -34
- package/ShadersWGSL/ShadersInclude/openpbrFragmentSamplersDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js +5 -3
- package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrSubsurfaceLayerData.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/openpbrSubsurfaceLayerData.js +35 -0
- package/ShadersWGSL/ShadersInclude/openpbrSubsurfaceLayerData.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/openpbrTransmissionLayerData.js +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrTransmissionLayerData.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrUboDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrVolumeFunctions.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/openpbrVolumeFunctions.js +68 -0
- package/ShadersWGSL/ShadersInclude/openpbrVolumeFunctions.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js +15 -4
- package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js +2 -2
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrFragmentReflectionDeclaration.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/pbrFragmentReflectionDeclaration.js +39 -0
- package/ShadersWGSL/ShadersInclude/pbrFragmentReflectionDeclaration.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.d.ts +1 -0
- package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js +2 -28
- package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/sceneUboDeclaration.js +2 -1
- package/ShadersWGSL/ShadersInclude/sceneUboDeclaration.js.map +1 -1
- package/ShadersWGSL/geometry.fragment.d.ts +11 -0
- package/ShadersWGSL/geometry.fragment.js +103 -1
- package/ShadersWGSL/geometry.fragment.js.map +1 -1
- package/ShadersWGSL/geometry.vertex.d.ts +1 -0
- package/ShadersWGSL/geometry.vertex.js +47 -3
- package/ShadersWGSL/geometry.vertex.js.map +1 -1
- package/ShadersWGSL/iblShadowVoxelTracing.fragment.d.ts +1 -0
- package/ShadersWGSL/iblShadowVoxelTracing.fragment.js +3 -7
- package/ShadersWGSL/iblShadowVoxelTracing.fragment.js.map +1 -1
- package/ShadersWGSL/openpbr.fragment.d.ts +3 -1
- package/ShadersWGSL/openpbr.fragment.js +70 -9
- 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 +7 -0
- package/scene.js +13 -0
- package/scene.js.map +1 -1
|
@@ -16,6 +16,42 @@ import { PushMaterial } from "../pushMaterial.js";
|
|
|
16
16
|
import { type IAnimatable } from "../../Animations/animatable.interface.js";
|
|
17
17
|
import { type UniformBuffer } from "../../Materials/uniformBuffer.js";
|
|
18
18
|
declare const OpenPBRMaterialDefinesBase_base: {
|
|
19
|
+
new (...args: any[]): {
|
|
20
|
+
PREPASS: boolean;
|
|
21
|
+
PREPASS_COLOR: boolean;
|
|
22
|
+
PREPASS_COLOR_INDEX: number;
|
|
23
|
+
PREPASS_IRRADIANCE_LEGACY: boolean;
|
|
24
|
+
PREPASS_IRRADIANCE_LEGACY_INDEX: number;
|
|
25
|
+
PREPASS_IRRADIANCE: boolean;
|
|
26
|
+
PREPASS_IRRADIANCE_INDEX: number;
|
|
27
|
+
PREPASS_ALBEDO: boolean;
|
|
28
|
+
PREPASS_ALBEDO_INDEX: number;
|
|
29
|
+
PREPASS_ALBEDO_SQRT: boolean;
|
|
30
|
+
PREPASS_ALBEDO_SQRT_INDEX: number;
|
|
31
|
+
PREPASS_DEPTH: boolean;
|
|
32
|
+
PREPASS_DEPTH_INDEX: number;
|
|
33
|
+
PREPASS_SCREENSPACE_DEPTH: boolean;
|
|
34
|
+
PREPASS_SCREENSPACE_DEPTH_INDEX: number;
|
|
35
|
+
PREPASS_NORMALIZED_VIEW_DEPTH: boolean;
|
|
36
|
+
PREPASS_NORMALIZED_VIEW_DEPTH_INDEX: number;
|
|
37
|
+
PREPASS_NORMAL: boolean;
|
|
38
|
+
PREPASS_NORMAL_INDEX: number;
|
|
39
|
+
PREPASS_NORMAL_WORLDSPACE: boolean;
|
|
40
|
+
PREPASS_WORLD_NORMAL: boolean;
|
|
41
|
+
PREPASS_WORLD_NORMAL_INDEX: number;
|
|
42
|
+
PREPASS_POSITION: boolean;
|
|
43
|
+
PREPASS_POSITION_INDEX: number;
|
|
44
|
+
PREPASS_LOCAL_POSITION: boolean;
|
|
45
|
+
PREPASS_LOCAL_POSITION_INDEX: number;
|
|
46
|
+
PREPASS_VELOCITY: boolean;
|
|
47
|
+
PREPASS_VELOCITY_INDEX: number;
|
|
48
|
+
PREPASS_VELOCITY_LINEAR: boolean;
|
|
49
|
+
PREPASS_VELOCITY_LINEAR_INDEX: number;
|
|
50
|
+
PREPASS_REFLECTIVITY: boolean;
|
|
51
|
+
PREPASS_REFLECTIVITY_INDEX: number;
|
|
52
|
+
SCENE_MRT_COUNT: number;
|
|
53
|
+
};
|
|
54
|
+
} & {
|
|
19
55
|
new (...args: any[]): {
|
|
20
56
|
MAINUV1: boolean;
|
|
21
57
|
MAINUV2: boolean;
|
|
@@ -33,6 +69,33 @@ declare const OpenPBRMaterialDefinesBase_base: {
|
|
|
33
69
|
} & typeof MaterialDefines;
|
|
34
70
|
declare class OpenPBRMaterialDefinesBase extends OpenPBRMaterialDefinesBase_base {
|
|
35
71
|
}
|
|
72
|
+
declare const OpenPBRMaterialDefinesWithEnvLighting_base: {
|
|
73
|
+
new (...args: any[]): {
|
|
74
|
+
REFLECTION: boolean;
|
|
75
|
+
REFLECTIONMAP_3D: boolean;
|
|
76
|
+
REFLECTIONMAP_SPHERICAL: boolean;
|
|
77
|
+
REFLECTIONMAP_PLANAR: boolean;
|
|
78
|
+
REFLECTIONMAP_CUBIC: boolean;
|
|
79
|
+
USE_LOCAL_REFLECTIONMAP_CUBIC: boolean;
|
|
80
|
+
REFLECTIONMAP_PROJECTION: boolean;
|
|
81
|
+
REFLECTIONMAP_SKYBOX: boolean;
|
|
82
|
+
REFLECTIONMAP_EXPLICIT: boolean;
|
|
83
|
+
REFLECTIONMAP_EQUIRECTANGULAR: boolean;
|
|
84
|
+
REFLECTIONMAP_EQUIRECTANGULAR_FIXED: boolean;
|
|
85
|
+
REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED: boolean;
|
|
86
|
+
INVERTCUBICMAP: boolean;
|
|
87
|
+
USESPHERICALFROMREFLECTIONMAP: boolean;
|
|
88
|
+
USEIRRADIANCEMAP: boolean;
|
|
89
|
+
USE_IRRADIANCE_DOMINANT_DIRECTION: boolean;
|
|
90
|
+
USESPHERICALINVERTEX: boolean;
|
|
91
|
+
REFLECTIONMAP_OPPOSITEZ: boolean;
|
|
92
|
+
LODINREFLECTIONALPHA: boolean;
|
|
93
|
+
GAMMAREFLECTION: boolean;
|
|
94
|
+
RGBDREFLECTION: boolean;
|
|
95
|
+
};
|
|
96
|
+
} & typeof OpenPBRMaterialDefinesBase;
|
|
97
|
+
declare class OpenPBRMaterialDefinesWithEnvLighting extends OpenPBRMaterialDefinesWithEnvLighting_base {
|
|
98
|
+
}
|
|
36
99
|
declare const OpenPBRMaterialDefines_base: {
|
|
37
100
|
new (...args: any[]): {
|
|
38
101
|
IMAGEPROCESSING: boolean;
|
|
@@ -51,7 +114,7 @@ declare const OpenPBRMaterialDefines_base: {
|
|
|
51
114
|
SKIPFINALCOLORCLAMP: boolean;
|
|
52
115
|
EXPOSURE: boolean;
|
|
53
116
|
};
|
|
54
|
-
} & typeof
|
|
117
|
+
} & typeof OpenPBRMaterialDefinesWithEnvLighting;
|
|
55
118
|
/**
|
|
56
119
|
* Manages the defines for the PBR Material.
|
|
57
120
|
* @internal
|
|
@@ -60,6 +123,7 @@ export declare class OpenPBRMaterialDefines extends OpenPBRMaterialDefines_base
|
|
|
60
123
|
NUM_SAMPLES: string;
|
|
61
124
|
REALTIME_FILTERING: boolean;
|
|
62
125
|
IBL_CDF_FILTERING: boolean;
|
|
126
|
+
LIGHTCOUNT: number;
|
|
63
127
|
VERTEXCOLOR: boolean;
|
|
64
128
|
BAKED_VERTEX_ANIMATION_TEXTURE: boolean;
|
|
65
129
|
VERTEXALPHA: boolean;
|
|
@@ -136,6 +200,26 @@ export declare class OpenPBRMaterialDefines extends OpenPBRMaterialDefines_base
|
|
|
136
200
|
* Enables subsurface scattering
|
|
137
201
|
*/
|
|
138
202
|
SCATTERING: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* Enables the use of screen-space irradiance texture for scattering
|
|
205
|
+
*/
|
|
206
|
+
USE_IRRADIANCE_TEXTURE_FOR_SCATTERING: boolean;
|
|
207
|
+
/**
|
|
208
|
+
* Enables transmission slab
|
|
209
|
+
*/
|
|
210
|
+
TRANSMISSION_SLAB: boolean;
|
|
211
|
+
/**
|
|
212
|
+
* Enables transmission slab with volume
|
|
213
|
+
*/
|
|
214
|
+
TRANSMISSION_SLAB_VOLUME: boolean;
|
|
215
|
+
/**
|
|
216
|
+
* Enables subsurface slab
|
|
217
|
+
*/
|
|
218
|
+
SUBSURFACE_SLAB: boolean;
|
|
219
|
+
/**
|
|
220
|
+
* Enables thin-walled geometry
|
|
221
|
+
*/
|
|
222
|
+
GEOMETRY_THIN_WALLED: boolean;
|
|
139
223
|
/**
|
|
140
224
|
* Refraction of the 2D background texture. Might include the rest of the scene or just the background.
|
|
141
225
|
*/
|
|
@@ -150,63 +234,11 @@ export declare class OpenPBRMaterialDefines extends OpenPBRMaterialDefines_base
|
|
|
150
234
|
REFRACTED_ENVIRONMENT: boolean;
|
|
151
235
|
REFRACTED_ENVIRONMENT_OPPOSITEZ: boolean;
|
|
152
236
|
REFRACTED_ENVIRONMENT_LOCAL_CUBE: boolean;
|
|
153
|
-
REFLECTION: boolean;
|
|
154
|
-
REFLECTIONMAP_3D: boolean;
|
|
155
|
-
REFLECTIONMAP_SPHERICAL: boolean;
|
|
156
|
-
REFLECTIONMAP_PLANAR: boolean;
|
|
157
|
-
REFLECTIONMAP_CUBIC: boolean;
|
|
158
|
-
USE_LOCAL_REFLECTIONMAP_CUBIC: boolean;
|
|
159
|
-
REFLECTIONMAP_PROJECTION: boolean;
|
|
160
|
-
REFLECTIONMAP_SKYBOX: boolean;
|
|
161
|
-
REFLECTIONMAP_EXPLICIT: boolean;
|
|
162
|
-
REFLECTIONMAP_EQUIRECTANGULAR: boolean;
|
|
163
|
-
REFLECTIONMAP_EQUIRECTANGULAR_FIXED: boolean;
|
|
164
|
-
REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED: boolean;
|
|
165
|
-
INVERTCUBICMAP: boolean;
|
|
166
|
-
USESPHERICALFROMREFLECTIONMAP: boolean;
|
|
167
|
-
USEIRRADIANCEMAP: boolean;
|
|
168
|
-
USE_IRRADIANCE_DOMINANT_DIRECTION: boolean;
|
|
169
|
-
USESPHERICALINVERTEX: boolean;
|
|
170
|
-
REFLECTIONMAP_OPPOSITEZ: boolean;
|
|
171
|
-
LODINREFLECTIONALPHA: boolean;
|
|
172
|
-
GAMMAREFLECTION: boolean;
|
|
173
|
-
RGBDREFLECTION: boolean;
|
|
174
237
|
RADIANCEOCCLUSION: boolean;
|
|
175
238
|
HORIZONOCCLUSION: boolean;
|
|
176
239
|
INSTANCES: boolean;
|
|
177
240
|
THIN_INSTANCES: boolean;
|
|
178
241
|
INSTANCESCOLOR: boolean;
|
|
179
|
-
PREPASS: boolean;
|
|
180
|
-
PREPASS_COLOR: boolean;
|
|
181
|
-
PREPASS_COLOR_INDEX: number;
|
|
182
|
-
PREPASS_IRRADIANCE: boolean;
|
|
183
|
-
PREPASS_IRRADIANCE_INDEX: number;
|
|
184
|
-
PREPASS_ALBEDO: boolean;
|
|
185
|
-
PREPASS_ALBEDO_INDEX: number;
|
|
186
|
-
PREPASS_ALBEDO_SQRT: boolean;
|
|
187
|
-
PREPASS_ALBEDO_SQRT_INDEX: number;
|
|
188
|
-
PREPASS_DEPTH: boolean;
|
|
189
|
-
PREPASS_DEPTH_INDEX: number;
|
|
190
|
-
PREPASS_SCREENSPACE_DEPTH: boolean;
|
|
191
|
-
PREPASS_SCREENSPACE_DEPTH_INDEX: number;
|
|
192
|
-
PREPASS_NORMALIZED_VIEW_DEPTH: boolean;
|
|
193
|
-
PREPASS_NORMALIZED_VIEW_DEPTH_INDEX: number;
|
|
194
|
-
PREPASS_NORMAL: boolean;
|
|
195
|
-
PREPASS_NORMAL_INDEX: number;
|
|
196
|
-
PREPASS_NORMAL_WORLDSPACE: boolean;
|
|
197
|
-
PREPASS_WORLD_NORMAL: boolean;
|
|
198
|
-
PREPASS_WORLD_NORMAL_INDEX: number;
|
|
199
|
-
PREPASS_POSITION: boolean;
|
|
200
|
-
PREPASS_POSITION_INDEX: number;
|
|
201
|
-
PREPASS_LOCAL_POSITION: boolean;
|
|
202
|
-
PREPASS_LOCAL_POSITION_INDEX: number;
|
|
203
|
-
PREPASS_VELOCITY: boolean;
|
|
204
|
-
PREPASS_VELOCITY_INDEX: number;
|
|
205
|
-
PREPASS_VELOCITY_LINEAR: boolean;
|
|
206
|
-
PREPASS_VELOCITY_LINEAR_INDEX: number;
|
|
207
|
-
PREPASS_REFLECTIVITY: boolean;
|
|
208
|
-
PREPASS_REFLECTIVITY_INDEX: number;
|
|
209
|
-
SCENE_MRT_COUNT: number;
|
|
210
242
|
NUM_BONE_INFLUENCERS: number;
|
|
211
243
|
BonesPerMesh: number;
|
|
212
244
|
BONETEXTURE: boolean;
|
|
@@ -485,6 +517,54 @@ export declare class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
485
517
|
*/
|
|
486
518
|
transmissionDispersionAbbeNumber: number;
|
|
487
519
|
private _transmissionDispersionAbbeNumber;
|
|
520
|
+
/**
|
|
521
|
+
* Defines the amount of subsurface scattering on the surface.
|
|
522
|
+
* See OpenPBR's specs for subsurface_weight
|
|
523
|
+
*/
|
|
524
|
+
subsurfaceWeight: number;
|
|
525
|
+
private _subsurfaceWeight;
|
|
526
|
+
/**
|
|
527
|
+
* Subsurface weight texture.
|
|
528
|
+
* See OpenPBR's specs for subsurface_weight
|
|
529
|
+
*/
|
|
530
|
+
subsurfaceWeightTexture: Nullable<BaseTexture>;
|
|
531
|
+
private _subsurfaceWeightTexture;
|
|
532
|
+
/**
|
|
533
|
+
* Defines the color of the subsurface scattering in the volume.
|
|
534
|
+
* See OpenPBR's specs for subsurface_color
|
|
535
|
+
*/
|
|
536
|
+
subsurfaceColor: Color3;
|
|
537
|
+
private _subsurfaceColor;
|
|
538
|
+
/**
|
|
539
|
+
* Subsurface color texture.
|
|
540
|
+
* See OpenPBR's specs for subsurface_color
|
|
541
|
+
*/
|
|
542
|
+
subsurfaceColorTexture: Nullable<BaseTexture>;
|
|
543
|
+
private _subsurfaceColorTexture;
|
|
544
|
+
/**
|
|
545
|
+
* Defines the radius of the subsurface scattering in the volume.
|
|
546
|
+
* See OpenPBR's specs for subsurface_radius
|
|
547
|
+
*/
|
|
548
|
+
subsurfaceRadius: number;
|
|
549
|
+
private _subsurfaceRadius;
|
|
550
|
+
/**
|
|
551
|
+
* Defines the scale factor applied to the subsurface radius.
|
|
552
|
+
* See OpenPBR's specs for subsurface_radius_scale
|
|
553
|
+
*/
|
|
554
|
+
subsurfaceRadiusScale: Color3;
|
|
555
|
+
private _subsurfaceRadiusScale;
|
|
556
|
+
/**
|
|
557
|
+
* Subsurface radius scale texture.
|
|
558
|
+
* See OpenPBR's specs for subsurface_radius_scale
|
|
559
|
+
*/
|
|
560
|
+
subsurfaceRadiusScaleTexture: Nullable<BaseTexture>;
|
|
561
|
+
private _subsurfaceRadiusScaleTexture;
|
|
562
|
+
/**
|
|
563
|
+
* Defines the anisotropy of the subsurface scattering in the volume.
|
|
564
|
+
* See OpenPBR's specs for subsurface_scatter_anisotropy
|
|
565
|
+
*/
|
|
566
|
+
subsurfaceScatterAnisotropy: number;
|
|
567
|
+
private _subsurfaceScatterAnisotropy;
|
|
488
568
|
/**
|
|
489
569
|
* Defines the amount of clear coat on the surface.
|
|
490
570
|
* See OpenPBR's specs for coat_weight
|
|
@@ -596,6 +676,12 @@ export declare class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
596
676
|
*/
|
|
597
677
|
fuzzRoughnessTexture: Nullable<BaseTexture>;
|
|
598
678
|
private _fuzzRoughnessTexture;
|
|
679
|
+
/**
|
|
680
|
+
* Defines whether the geometry is thin-walled (like a sheet of paper) or not.
|
|
681
|
+
* See OpenPBR's specs for geometry_thin_walled
|
|
682
|
+
*/
|
|
683
|
+
geometryThinWalled: number;
|
|
684
|
+
private _geometryThinWalled;
|
|
599
685
|
/**
|
|
600
686
|
* Defines the normal of the material's geometry.
|
|
601
687
|
* See OpenPBR's specs for geometry_normal
|
|
@@ -725,6 +811,16 @@ export declare class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
725
811
|
*/
|
|
726
812
|
ambientOcclusionTexture: Nullable<BaseTexture>;
|
|
727
813
|
private _ambientOcclusionTexture;
|
|
814
|
+
/**
|
|
815
|
+
* Defines the irradiance texture used for subsurface scattering.
|
|
816
|
+
* If it's not provided, the irradiance will be looked for in the scene.geometryBufferRenderer.
|
|
817
|
+
*/
|
|
818
|
+
sssIrradianceTexture: Nullable<BaseTexture>;
|
|
819
|
+
/**
|
|
820
|
+
* Defines the depth texture used for subsurface scattering. This is the depth defined
|
|
821
|
+
* in screen space. If it's not provided, the depth will be looked for in the scene.geometryBufferRenderer.
|
|
822
|
+
*/
|
|
823
|
+
sssDepthTexture: Nullable<BaseTexture>;
|
|
728
824
|
private _propertyList;
|
|
729
825
|
private _uniformsList;
|
|
730
826
|
private _samplersList;
|
|
@@ -760,6 +856,12 @@ export declare class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
760
856
|
* Specifies if the ambient texture contains the ambient occlusion information in its red channel only.
|
|
761
857
|
*/
|
|
762
858
|
useAmbientInGrayScale: boolean;
|
|
859
|
+
/**
|
|
860
|
+
* Specifies if we can see through the surface of the material due to subsurface scattering or transmission.
|
|
861
|
+
*/
|
|
862
|
+
get hasTransparency(): boolean;
|
|
863
|
+
/** Specifies if the material has scattering properties such as subsurface scattering or transmission scattering. */
|
|
864
|
+
get hasScattering(): boolean;
|
|
763
865
|
/**
|
|
764
866
|
* BJS is using an hardcoded light falloff based on a manually sets up range.
|
|
765
867
|
* In PBR, one way to represents the falloff is to use the inverse squared root algorithm.
|
|
@@ -21,11 +21,14 @@ import { PrePassConfiguration } from "../prePassConfiguration.js";
|
|
|
21
21
|
import { MaterialFlags } from "../materialFlags.js";
|
|
22
22
|
import { Logger } from "../../Misc/logger.js";
|
|
23
23
|
import { UVDefinesMixin } from "../uv.defines.js";
|
|
24
|
+
import { PrepassDefinesMixin } from "../prepass.defines.js";
|
|
25
|
+
import { EnvironmentLightingDefinesMixin } from "../environmentLighting.defines.js";
|
|
24
26
|
import { Vector2, Vector4, TmpVectors } from "../../Maths/math.vector.js";
|
|
25
27
|
import { ImageProcessingMixin } from "../imageProcessing.js";
|
|
26
28
|
import { PushMaterial } from "../pushMaterial.js";
|
|
27
29
|
import { SmartArray } from "../../Misc/smartArray.js";
|
|
28
30
|
import { Tools } from "../../Misc/tools.js";
|
|
31
|
+
import { GeometryBufferRenderer } from "../../Rendering/geometryBufferRenderer.js";
|
|
29
32
|
const onCreatedEffectParameters = { effect: null, subMesh: null };
|
|
30
33
|
class Uniform {
|
|
31
34
|
populateVectorFromLinkedProperties(vector) {
|
|
@@ -140,13 +143,15 @@ class Sampler {
|
|
|
140
143
|
this.textureDefine = textureDefine;
|
|
141
144
|
}
|
|
142
145
|
}
|
|
143
|
-
class OpenPBRMaterialDefinesBase extends UVDefinesMixin(MaterialDefines) {
|
|
146
|
+
class OpenPBRMaterialDefinesBase extends PrepassDefinesMixin(UVDefinesMixin(MaterialDefines)) {
|
|
147
|
+
}
|
|
148
|
+
class OpenPBRMaterialDefinesWithEnvLighting extends EnvironmentLightingDefinesMixin(OpenPBRMaterialDefinesBase) {
|
|
144
149
|
}
|
|
145
150
|
/**
|
|
146
151
|
* Manages the defines for the PBR Material.
|
|
147
152
|
* @internal
|
|
148
153
|
*/
|
|
149
|
-
export class OpenPBRMaterialDefines extends ImageProcessingDefinesMixin(
|
|
154
|
+
export class OpenPBRMaterialDefines extends ImageProcessingDefinesMixin(OpenPBRMaterialDefinesWithEnvLighting) {
|
|
150
155
|
/**
|
|
151
156
|
* Initializes the PBR Material defines.
|
|
152
157
|
* @param externalProperties The external properties
|
|
@@ -156,6 +161,7 @@ export class OpenPBRMaterialDefines extends ImageProcessingDefinesMixin(OpenPBRM
|
|
|
156
161
|
this.NUM_SAMPLES = "0";
|
|
157
162
|
this.REALTIME_FILTERING = false;
|
|
158
163
|
this.IBL_CDF_FILTERING = false;
|
|
164
|
+
this.LIGHTCOUNT = 0;
|
|
159
165
|
this.VERTEXCOLOR = false;
|
|
160
166
|
this.BAKED_VERTEX_ANIMATION_TEXTURE = false;
|
|
161
167
|
this.VERTEXALPHA = false;
|
|
@@ -232,6 +238,26 @@ export class OpenPBRMaterialDefines extends ImageProcessingDefinesMixin(OpenPBRM
|
|
|
232
238
|
* Enables subsurface scattering
|
|
233
239
|
*/
|
|
234
240
|
this.SCATTERING = false;
|
|
241
|
+
/**
|
|
242
|
+
* Enables the use of screen-space irradiance texture for scattering
|
|
243
|
+
*/
|
|
244
|
+
this.USE_IRRADIANCE_TEXTURE_FOR_SCATTERING = false;
|
|
245
|
+
/**
|
|
246
|
+
* Enables transmission slab
|
|
247
|
+
*/
|
|
248
|
+
this.TRANSMISSION_SLAB = false;
|
|
249
|
+
/**
|
|
250
|
+
* Enables transmission slab with volume
|
|
251
|
+
*/
|
|
252
|
+
this.TRANSMISSION_SLAB_VOLUME = false;
|
|
253
|
+
/**
|
|
254
|
+
* Enables subsurface slab
|
|
255
|
+
*/
|
|
256
|
+
this.SUBSURFACE_SLAB = false;
|
|
257
|
+
/**
|
|
258
|
+
* Enables thin-walled geometry
|
|
259
|
+
*/
|
|
260
|
+
this.GEOMETRY_THIN_WALLED = false;
|
|
235
261
|
/**
|
|
236
262
|
* Refraction of the 2D background texture. Might include the rest of the scene or just the background.
|
|
237
263
|
*/
|
|
@@ -246,63 +272,11 @@ export class OpenPBRMaterialDefines extends ImageProcessingDefinesMixin(OpenPBRM
|
|
|
246
272
|
this.REFRACTED_ENVIRONMENT = false;
|
|
247
273
|
this.REFRACTED_ENVIRONMENT_OPPOSITEZ = false;
|
|
248
274
|
this.REFRACTED_ENVIRONMENT_LOCAL_CUBE = false;
|
|
249
|
-
this.REFLECTION = false;
|
|
250
|
-
this.REFLECTIONMAP_3D = false;
|
|
251
|
-
this.REFLECTIONMAP_SPHERICAL = false;
|
|
252
|
-
this.REFLECTIONMAP_PLANAR = false;
|
|
253
|
-
this.REFLECTIONMAP_CUBIC = false;
|
|
254
|
-
this.USE_LOCAL_REFLECTIONMAP_CUBIC = false;
|
|
255
|
-
this.REFLECTIONMAP_PROJECTION = false;
|
|
256
|
-
this.REFLECTIONMAP_SKYBOX = false;
|
|
257
|
-
this.REFLECTIONMAP_EXPLICIT = false;
|
|
258
|
-
this.REFLECTIONMAP_EQUIRECTANGULAR = false;
|
|
259
|
-
this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;
|
|
260
|
-
this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;
|
|
261
|
-
this.INVERTCUBICMAP = false;
|
|
262
|
-
this.USESPHERICALFROMREFLECTIONMAP = false;
|
|
263
|
-
this.USEIRRADIANCEMAP = false;
|
|
264
|
-
this.USE_IRRADIANCE_DOMINANT_DIRECTION = false;
|
|
265
|
-
this.USESPHERICALINVERTEX = false;
|
|
266
|
-
this.REFLECTIONMAP_OPPOSITEZ = false;
|
|
267
|
-
this.LODINREFLECTIONALPHA = false;
|
|
268
|
-
this.GAMMAREFLECTION = false;
|
|
269
|
-
this.RGBDREFLECTION = false;
|
|
270
275
|
this.RADIANCEOCCLUSION = false;
|
|
271
276
|
this.HORIZONOCCLUSION = false;
|
|
272
277
|
this.INSTANCES = false;
|
|
273
278
|
this.THIN_INSTANCES = false;
|
|
274
279
|
this.INSTANCESCOLOR = false;
|
|
275
|
-
this.PREPASS = false;
|
|
276
|
-
this.PREPASS_COLOR = false;
|
|
277
|
-
this.PREPASS_COLOR_INDEX = -1;
|
|
278
|
-
this.PREPASS_IRRADIANCE = false;
|
|
279
|
-
this.PREPASS_IRRADIANCE_INDEX = -1;
|
|
280
|
-
this.PREPASS_ALBEDO = false;
|
|
281
|
-
this.PREPASS_ALBEDO_INDEX = -1;
|
|
282
|
-
this.PREPASS_ALBEDO_SQRT = false;
|
|
283
|
-
this.PREPASS_ALBEDO_SQRT_INDEX = -1;
|
|
284
|
-
this.PREPASS_DEPTH = false;
|
|
285
|
-
this.PREPASS_DEPTH_INDEX = -1;
|
|
286
|
-
this.PREPASS_SCREENSPACE_DEPTH = false;
|
|
287
|
-
this.PREPASS_SCREENSPACE_DEPTH_INDEX = -1;
|
|
288
|
-
this.PREPASS_NORMALIZED_VIEW_DEPTH = false;
|
|
289
|
-
this.PREPASS_NORMALIZED_VIEW_DEPTH_INDEX = -1;
|
|
290
|
-
this.PREPASS_NORMAL = false;
|
|
291
|
-
this.PREPASS_NORMAL_INDEX = -1;
|
|
292
|
-
this.PREPASS_NORMAL_WORLDSPACE = false;
|
|
293
|
-
this.PREPASS_WORLD_NORMAL = false;
|
|
294
|
-
this.PREPASS_WORLD_NORMAL_INDEX = -1;
|
|
295
|
-
this.PREPASS_POSITION = false;
|
|
296
|
-
this.PREPASS_POSITION_INDEX = -1;
|
|
297
|
-
this.PREPASS_LOCAL_POSITION = false;
|
|
298
|
-
this.PREPASS_LOCAL_POSITION_INDEX = -1;
|
|
299
|
-
this.PREPASS_VELOCITY = false;
|
|
300
|
-
this.PREPASS_VELOCITY_INDEX = -1;
|
|
301
|
-
this.PREPASS_VELOCITY_LINEAR = false;
|
|
302
|
-
this.PREPASS_VELOCITY_LINEAR_INDEX = -1;
|
|
303
|
-
this.PREPASS_REFLECTIVITY = false;
|
|
304
|
-
this.PREPASS_REFLECTIVITY_INDEX = -1;
|
|
305
|
-
this.SCENE_MRT_COUNT = 0;
|
|
306
280
|
this.NUM_BONE_INFLUENCERS = 0;
|
|
307
281
|
this.BonesPerMesh = 0;
|
|
308
282
|
this.BONETEXTURE = false;
|
|
@@ -403,6 +377,16 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
403
377
|
set geometryCoatTangentAngle(value) {
|
|
404
378
|
this.geometryCoatTangent = new Vector2(Math.cos(value), Math.sin(value));
|
|
405
379
|
}
|
|
380
|
+
/**
|
|
381
|
+
* Specifies if we can see through the surface of the material due to subsurface scattering or transmission.
|
|
382
|
+
*/
|
|
383
|
+
get hasTransparency() {
|
|
384
|
+
return this.subsurfaceWeight > 0 || this.transmissionWeight > 0;
|
|
385
|
+
}
|
|
386
|
+
/** Specifies if the material has scattering properties such as subsurface scattering or transmission scattering. */
|
|
387
|
+
get hasScattering() {
|
|
388
|
+
return (this.transmissionWeight > 0 && this.transmissionDepth > 0 && !this.transmissionScatter.equals(Color3.BlackReadOnly)) || this.subsurfaceWeight > 0;
|
|
389
|
+
}
|
|
406
390
|
/**
|
|
407
391
|
* BJS is using an hardcoded light falloff based on a manually sets up range.
|
|
408
392
|
* In PBR, one way to represents the falloff is to use the inverse squared root algorithm.
|
|
@@ -536,6 +520,14 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
536
520
|
this._transmissionDispersionScale = new Property("transmission_dispersion_scale", 0.0, "vTransmissionDispersionScale", 1, 0);
|
|
537
521
|
this._transmissionDispersionScaleTexture = new Sampler("transmission_dispersion_scale", "transmissionDispersionScale", "TRANSMISSION_DISPERSION_SCALE");
|
|
538
522
|
this._transmissionDispersionAbbeNumber = new Property("transmission_dispersion_abbe_number", 20.0, "vTransmissionDispersionAbbeNumber", 1, 0);
|
|
523
|
+
this._subsurfaceWeight = new Property("subsurface_weight", 0.0, "vSubsurfaceWeight", 1, 0);
|
|
524
|
+
this._subsurfaceWeightTexture = new Sampler("subsurface_weight", "subsurfaceWeight", "SUBSURFACE_WEIGHT");
|
|
525
|
+
this._subsurfaceColor = new Property("subsurface_color", new Color3(0.8, 0.8, 0.8), "vSubsurfaceColor", 3, 0);
|
|
526
|
+
this._subsurfaceColorTexture = new Sampler("subsurface_color", "subsurfaceColor", "SUBSURFACE_COLOR");
|
|
527
|
+
this._subsurfaceRadius = new Property("subsurface_radius", 1.0, "vSubsurfaceRadius", 1, 0);
|
|
528
|
+
this._subsurfaceRadiusScale = new Property("subsurface_radius_scale", new Color3(1, 0.5, 0.25), "vSubsurfaceRadiusScale", 3, 0);
|
|
529
|
+
this._subsurfaceRadiusScaleTexture = new Sampler("subsurface_radius_scale", "subsurfaceRadiusScale", "SUBSURFACE_RADIUS_SCALE");
|
|
530
|
+
this._subsurfaceScatterAnisotropy = new Property("subsurface_scatter_anisotropy", 0.0, "vSubsurfaceScatterAnisotropy", 1, 0);
|
|
539
531
|
this._coatWeight = new Property("coat_weight", 0.0, "vCoatWeight", 1, 0);
|
|
540
532
|
this._coatWeightTexture = new Sampler("coat_weight", "coatWeight", "COAT_WEIGHT");
|
|
541
533
|
this._coatColor = new Property("coat_color", Color3.White(), "vCoatColor", 3, 0);
|
|
@@ -558,6 +550,7 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
558
550
|
this._fuzzColorTexture = new Sampler("fuzz_color", "fuzzColor", "FUZZ_COLOR");
|
|
559
551
|
this._fuzzRoughness = new Property("fuzz_roughness", 0.5, "vFuzzRoughness", 1, 0);
|
|
560
552
|
this._fuzzRoughnessTexture = new Sampler("fuzz_roughness", "fuzzRoughness", "FUZZ_ROUGHNESS");
|
|
553
|
+
this._geometryThinWalled = new Property("geometry_thin_walled", 0, "vGeometryThinWalled", 1, 0);
|
|
561
554
|
this._geometryNormalTexture = new Sampler("geometry_normal", "geometryNormal", "GEOMETRY_NORMAL");
|
|
562
555
|
this._geometryTangent = new Property("geometry_tangent", new Vector2(1, 0), "vSpecularAnisotropy", 3, 0);
|
|
563
556
|
this._geometryTangentTexture = new Sampler("geometry_tangent", "geometryTangent", "GEOMETRY_TANGENT");
|
|
@@ -578,6 +571,16 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
578
571
|
this._thinFilmThicknessTexture = new Sampler("thin_film_thickness", "thinFilmThickness", "THIN_FILM_THICKNESS");
|
|
579
572
|
this._thinFilmIor = new Property("thin_film_ior", 1.4, "vThinFilmIor", 1, 0);
|
|
580
573
|
this._ambientOcclusionTexture = new Sampler("ambient_occlusion", "ambientOcclusion", "AMBIENT_OCCLUSION");
|
|
574
|
+
/**
|
|
575
|
+
* Defines the irradiance texture used for subsurface scattering.
|
|
576
|
+
* If it's not provided, the irradiance will be looked for in the scene.geometryBufferRenderer.
|
|
577
|
+
*/
|
|
578
|
+
this.sssIrradianceTexture = null;
|
|
579
|
+
/**
|
|
580
|
+
* Defines the depth texture used for subsurface scattering. This is the depth defined
|
|
581
|
+
* in screen space. If it's not provided, the depth will be looked for in the scene.geometryBufferRenderer.
|
|
582
|
+
*/
|
|
583
|
+
this.sssDepthTexture = null;
|
|
581
584
|
this._uniformsList = {};
|
|
582
585
|
this._samplersList = {};
|
|
583
586
|
this._samplerDefines = {};
|
|
@@ -1038,6 +1041,14 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
1038
1041
|
this._transmissionDispersionScale;
|
|
1039
1042
|
this._transmissionDispersionScaleTexture;
|
|
1040
1043
|
this._transmissionDispersionAbbeNumber;
|
|
1044
|
+
this._subsurfaceWeight;
|
|
1045
|
+
this._subsurfaceWeightTexture;
|
|
1046
|
+
this._subsurfaceColor;
|
|
1047
|
+
this._subsurfaceColorTexture;
|
|
1048
|
+
this._subsurfaceRadius;
|
|
1049
|
+
this._subsurfaceRadiusScale;
|
|
1050
|
+
this._subsurfaceRadiusScaleTexture;
|
|
1051
|
+
this._subsurfaceScatterAnisotropy;
|
|
1041
1052
|
this._coatWeight;
|
|
1042
1053
|
this._coatWeightTexture;
|
|
1043
1054
|
this._coatColor;
|
|
@@ -1055,6 +1066,7 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
1055
1066
|
this._fuzzColorTexture;
|
|
1056
1067
|
this._fuzzRoughness;
|
|
1057
1068
|
this._fuzzRoughnessTexture;
|
|
1069
|
+
this._geometryThinWalled;
|
|
1058
1070
|
this._geometryNormalTexture;
|
|
1059
1071
|
this._geometryTangent;
|
|
1060
1072
|
this._geometryTangentTexture;
|
|
@@ -1360,6 +1372,7 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
1360
1372
|
ubo.addUniform("vLightingIntensity", 4);
|
|
1361
1373
|
ubo.addUniform("pointSize", 1);
|
|
1362
1374
|
ubo.addUniform("vDebugMode", 2);
|
|
1375
|
+
ubo.addUniform("renderTargetSize", 2);
|
|
1363
1376
|
ubo.addUniform("cameraInfo", 4);
|
|
1364
1377
|
ubo.addUniform("backgroundRefractionMatrix", 16);
|
|
1365
1378
|
ubo.addUniform("vBackgroundRefractionInfos", 3);
|
|
@@ -1425,7 +1438,6 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
1425
1438
|
}
|
|
1426
1439
|
this._eventInfo.subMesh = subMesh;
|
|
1427
1440
|
this._callbackPluginEventHardBindForSubMesh(this._eventInfo);
|
|
1428
|
-
this.bindPropertiesForSubMesh(this._uniformBuffer, scene, scene.getEngine(), subMesh);
|
|
1429
1441
|
// Normal Matrix
|
|
1430
1442
|
if (defines.OBJECTSPACE_NORMALMAP) {
|
|
1431
1443
|
world.toNormalMatrix(this._normalMatrix);
|
|
@@ -1515,9 +1527,18 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
1515
1527
|
TmpVectors.Vector3[1].set(Math.log2(this._backgroundRefractionTexture.getSize().width), 0, 0);
|
|
1516
1528
|
ubo.updateVector3("vBackgroundRefractionInfos", TmpVectors.Vector3[1]);
|
|
1517
1529
|
}
|
|
1518
|
-
if (defines.ANISOTROPIC || defines.FUZZ || defines.REFRACTED_BACKGROUND) {
|
|
1530
|
+
if (defines.ANISOTROPIC || defines.FUZZ || defines.REFRACTED_BACKGROUND || defines.USE_IRRADIANCE_TEXTURE_FOR_SCATTERING) {
|
|
1519
1531
|
ubo.setTexture("blueNoiseSampler", OpenPBRMaterial._noiseTextures[this.getScene().uniqueId]);
|
|
1520
1532
|
}
|
|
1533
|
+
if (defines.USE_IRRADIANCE_TEXTURE_FOR_SCATTERING) {
|
|
1534
|
+
if (this.sssIrradianceTexture && this.sssDepthTexture) {
|
|
1535
|
+
const renderTargetWidth = this.sssIrradianceTexture.getSize().width;
|
|
1536
|
+
const renderTargetHeight = this.sssIrradianceTexture.getSize().height;
|
|
1537
|
+
ubo.setTexture("sceneIrradianceSampler", this.sssIrradianceTexture);
|
|
1538
|
+
ubo.setTexture("sceneDepthSampler", this.sssDepthTexture);
|
|
1539
|
+
ubo.updateFloat2("renderTargetSize", renderTargetWidth, renderTargetHeight);
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1521
1542
|
}
|
|
1522
1543
|
// OIT with depth peeling
|
|
1523
1544
|
if (this.getScene().useOrderIndependentTransparency && this.needAlphaBlendingForMesh(mesh)) {
|
|
@@ -1532,15 +1553,14 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
1532
1553
|
else if (scene.getEngine()._features.needToAlwaysBindUniformBuffers) {
|
|
1533
1554
|
this._needToBindSceneUbo = true;
|
|
1534
1555
|
}
|
|
1556
|
+
this.bindPropertiesForSubMesh(this._uniformBuffer, scene, scene.getEngine(), subMesh);
|
|
1535
1557
|
if (mustRebind || !this.isFrozen) {
|
|
1536
1558
|
// Lights
|
|
1537
1559
|
if (scene.lightsEnabled && !this._disableLighting) {
|
|
1538
1560
|
BindLights(scene, mesh, this._activeEffect, defines, this._maxSimultaneousLights);
|
|
1539
1561
|
}
|
|
1540
1562
|
// View
|
|
1541
|
-
// if ((scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) || radianceTexture || mesh.receiveShadows || defines.PREPASS) {
|
|
1542
1563
|
this.bindView(effect);
|
|
1543
|
-
// }
|
|
1544
1564
|
// Fog
|
|
1545
1565
|
BindFogParameters(scene, mesh, this._activeEffect, true);
|
|
1546
1566
|
// Morph targets
|
|
@@ -1593,6 +1613,12 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
1593
1613
|
if (this._radianceTexture) {
|
|
1594
1614
|
activeTextures.push(this._radianceTexture);
|
|
1595
1615
|
}
|
|
1616
|
+
if (this.sssIrradianceTexture) {
|
|
1617
|
+
activeTextures.push(this.sssIrradianceTexture);
|
|
1618
|
+
}
|
|
1619
|
+
if (this.sssDepthTexture) {
|
|
1620
|
+
activeTextures.push(this.sssDepthTexture);
|
|
1621
|
+
}
|
|
1596
1622
|
return activeTextures;
|
|
1597
1623
|
}
|
|
1598
1624
|
/**
|
|
@@ -1752,7 +1778,10 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
1752
1778
|
"world",
|
|
1753
1779
|
"view",
|
|
1754
1780
|
"viewProjection",
|
|
1781
|
+
"projection",
|
|
1755
1782
|
"vEyePosition",
|
|
1783
|
+
"inverseProjection",
|
|
1784
|
+
"renderTargetSize",
|
|
1756
1785
|
"vLightsType",
|
|
1757
1786
|
"visibility",
|
|
1758
1787
|
"vFogInfos",
|
|
@@ -1781,9 +1810,13 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
1781
1810
|
if (defines.REFRACTED_BACKGROUND) {
|
|
1782
1811
|
samplers.push("backgroundRefractionSampler");
|
|
1783
1812
|
}
|
|
1784
|
-
if (defines.ANISOTROPIC || defines.FUZZ || defines.REFRACTED_BACKGROUND) {
|
|
1813
|
+
if (defines.ANISOTROPIC || defines.FUZZ || defines.REFRACTED_BACKGROUND || defines.USE_IRRADIANCE_TEXTURE_FOR_SCATTERING) {
|
|
1785
1814
|
samplers.push("blueNoiseSampler");
|
|
1786
1815
|
}
|
|
1816
|
+
if (defines.USE_IRRADIANCE_TEXTURE_FOR_SCATTERING) {
|
|
1817
|
+
samplers.push("sceneIrradianceSampler");
|
|
1818
|
+
samplers.push("sceneDepthSampler");
|
|
1819
|
+
}
|
|
1787
1820
|
for (const key in this._samplersList) {
|
|
1788
1821
|
const sampler = this._samplersList[key];
|
|
1789
1822
|
samplers.push(sampler.samplerName);
|
|
@@ -1953,7 +1986,7 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
1953
1986
|
else {
|
|
1954
1987
|
defines.FUZZENVIRONMENTBRDF = false;
|
|
1955
1988
|
}
|
|
1956
|
-
if (this.
|
|
1989
|
+
if (this.hasTransparency) {
|
|
1957
1990
|
defines.REFRACTED_BACKGROUND = !!this._backgroundRefractionTexture && MaterialFlags.RefractionTextureEnabled;
|
|
1958
1991
|
defines.REFRACTED_LIGHTS = true;
|
|
1959
1992
|
const radianceTexture = this._getRadianceTexture();
|
|
@@ -2037,8 +2070,27 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
2037
2070
|
defines.THIN_FILM = this.thinFilmWeight > 0.0;
|
|
2038
2071
|
defines.IRIDESCENCE = this.thinFilmWeight > 0.0;
|
|
2039
2072
|
defines.DISPERSION = this.transmissionDispersionScale > 0.0;
|
|
2040
|
-
defines.SCATTERING =
|
|
2073
|
+
defines.SCATTERING = this.hasScattering;
|
|
2074
|
+
defines.TRANSMISSION_SLAB = this.transmissionWeight > 0;
|
|
2075
|
+
defines.TRANSMISSION_SLAB_VOLUME = this.transmissionWeight > 0 && this.transmissionDepth > 0;
|
|
2076
|
+
defines.SUBSURFACE_SLAB = this.subsurfaceWeight > 0;
|
|
2077
|
+
// Determine whether we should use the prepass irradiance texture for scattering.
|
|
2078
|
+
// If this IS a prepass, we don't want to use the irradiance texture as it won't be available yet.
|
|
2079
|
+
if (!defines.PREPASS && (defines.SUBSURFACE_SLAB || defines.TRANSMISSION_SLAB_VOLUME)) {
|
|
2080
|
+
if (!this.sssIrradianceTexture && scene.geometryBufferRenderer) {
|
|
2081
|
+
const irradianceTextureIndex = scene.geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.IRRADIANCE_TEXTURE_TYPE);
|
|
2082
|
+
this.sssIrradianceTexture = scene.geometryBufferRenderer.getGBuffer().textures[irradianceTextureIndex];
|
|
2083
|
+
}
|
|
2084
|
+
if (!this.sssDepthTexture && scene.geometryBufferRenderer) {
|
|
2085
|
+
const depthIndex = scene.geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.SCREENSPACE_DEPTH_TEXTURE_TYPE);
|
|
2086
|
+
this.sssDepthTexture = scene.geometryBufferRenderer.getGBuffer().textures[depthIndex];
|
|
2087
|
+
}
|
|
2088
|
+
if (this.sssIrradianceTexture && this.sssDepthTexture) {
|
|
2089
|
+
defines.USE_IRRADIANCE_TEXTURE_FOR_SCATTERING = true;
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2041
2092
|
defines.FUZZ = this.fuzzWeight > 0 && MaterialFlags.ReflectionTextureEnabled;
|
|
2093
|
+
defines.GEOMETRY_THIN_WALLED = this.geometryThinWalled != 0;
|
|
2042
2094
|
if (defines.FUZZ) {
|
|
2043
2095
|
if (!mesh.isVerticesDataPresent(VertexBuffer.TangentKind)) {
|
|
2044
2096
|
defines._needUVs = true;
|
|
@@ -2192,6 +2244,38 @@ __decorate([
|
|
|
2192
2244
|
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "transmissionDispersionAbbeNumber")
|
|
2193
2245
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2194
2246
|
], OpenPBRMaterial.prototype, "_transmissionDispersionAbbeNumber", void 0);
|
|
2247
|
+
__decorate([
|
|
2248
|
+
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "subsurfaceWeight")
|
|
2249
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2250
|
+
], OpenPBRMaterial.prototype, "_subsurfaceWeight", void 0);
|
|
2251
|
+
__decorate([
|
|
2252
|
+
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "subsurfaceWeightTexture")
|
|
2253
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2254
|
+
], OpenPBRMaterial.prototype, "_subsurfaceWeightTexture", void 0);
|
|
2255
|
+
__decorate([
|
|
2256
|
+
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "subsurfaceColor")
|
|
2257
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2258
|
+
], OpenPBRMaterial.prototype, "_subsurfaceColor", void 0);
|
|
2259
|
+
__decorate([
|
|
2260
|
+
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "subsurfaceColorTexture")
|
|
2261
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2262
|
+
], OpenPBRMaterial.prototype, "_subsurfaceColorTexture", void 0);
|
|
2263
|
+
__decorate([
|
|
2264
|
+
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "subsurfaceRadius")
|
|
2265
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2266
|
+
], OpenPBRMaterial.prototype, "_subsurfaceRadius", void 0);
|
|
2267
|
+
__decorate([
|
|
2268
|
+
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "subsurfaceRadiusScale")
|
|
2269
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2270
|
+
], OpenPBRMaterial.prototype, "_subsurfaceRadiusScale", void 0);
|
|
2271
|
+
__decorate([
|
|
2272
|
+
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "subsurfaceRadiusScaleTexture")
|
|
2273
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2274
|
+
], OpenPBRMaterial.prototype, "_subsurfaceRadiusScaleTexture", void 0);
|
|
2275
|
+
__decorate([
|
|
2276
|
+
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "subsurfaceScatterAnisotropy")
|
|
2277
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2278
|
+
], OpenPBRMaterial.prototype, "_subsurfaceScatterAnisotropy", void 0);
|
|
2195
2279
|
__decorate([
|
|
2196
2280
|
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatWeight")
|
|
2197
2281
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -2260,6 +2344,10 @@ __decorate([
|
|
|
2260
2344
|
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "fuzzRoughnessTexture")
|
|
2261
2345
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2262
2346
|
], OpenPBRMaterial.prototype, "_fuzzRoughnessTexture", void 0);
|
|
2347
|
+
__decorate([
|
|
2348
|
+
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryThinWalled")
|
|
2349
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2350
|
+
], OpenPBRMaterial.prototype, "_geometryThinWalled", void 0);
|
|
2263
2351
|
__decorate([
|
|
2264
2352
|
addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryNormalTexture")
|
|
2265
2353
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|