@babylonjs/core 7.32.3 → 7.32.5
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/Decorators/nodeDecorator.d.ts +4 -0
- package/Decorators/nodeDecorator.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +1 -0
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +4 -4
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +2 -2
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.js +3 -3
- package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/sheenBlock.js +2 -2
- package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
- package/Materials/Node/Blocks/clampBlock.js +2 -2
- package/Materials/Node/Blocks/clampBlock.js.map +1 -1
- package/Materials/Node/Blocks/cloudBlock.js +1 -1
- package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
- package/Materials/Node/Blocks/conditionalBlock.js +19 -0
- package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
- package/Materials/Node/Blocks/curveBlock.js +37 -0
- package/Materials/Node/Blocks/curveBlock.js.map +1 -1
- package/Materials/Node/Blocks/loopBlock.js +1 -1
- package/Materials/Node/Blocks/loopBlock.js.map +1 -1
- package/Materials/Node/Blocks/meshAttributeExistsBlock.js +1 -0
- package/Materials/Node/Blocks/meshAttributeExistsBlock.js.map +1 -1
- package/Materials/Node/Blocks/transformBlock.d.ts +6 -0
- package/Materials/Node/Blocks/transformBlock.js +16 -1
- package/Materials/Node/Blocks/transformBlock.js.map +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.js +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
- package/Materials/Node/Blocks/trigonometryBlock.js +29 -0
- package/Materials/Node/Blocks/trigonometryBlock.js.map +1 -1
- package/Materials/Node/Blocks/waveBlock.js +13 -0
- package/Materials/Node/Blocks/waveBlock.js.map +1 -1
- package/Materials/Node/Blocks/worleyNoise3DBlock.js +1 -1
- package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/aggregatorBlock.js +1 -0
- package/Meshes/Node/Blocks/Set/aggregatorBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/latticeBlock.js +4 -4
- package/Meshes/Node/Blocks/Set/latticeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setColorsBlock.js +1 -1
- package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js +1 -1
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setNormalsBlock.js +1 -1
- package/Meshes/Node/Blocks/Set/setNormalsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setPositionsBlock.js +1 -1
- package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setTangentsBlock.js +1 -1
- package/Meshes/Node/Blocks/Set/setTangentsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setUVsBlock.js +2 -1
- package/Meshes/Node/Blocks/Set/setUVsBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/boxBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/capsuleBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/discBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/gridBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/meshBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/planeBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/sphereBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/torusBlock.js +1 -1
- package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
- package/Meshes/Node/Blocks/booleanGeometryBlock.d.ts +5 -0
- package/Meshes/Node/Blocks/booleanGeometryBlock.js +43 -13
- package/Meshes/Node/Blocks/booleanGeometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/cleanGeometryBlock.js +1 -1
- package/Meshes/Node/Blocks/cleanGeometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/conditionBlock.js +1 -0
- package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryClampBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCollectionBlock.js +1 -1
- package/Meshes/Node/Blocks/geometryCollectionBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCurveBlock.js +1 -0
- package/Meshes/Node/Blocks/geometryCurveBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js +3 -3
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTransformBlock.js +1 -1
- package/Meshes/Node/Blocks/geometryTransformBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +1 -0
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mappingBlock.js +1 -0
- package/Meshes/Node/Blocks/mappingBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mathBlock.js +1 -0
- package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
- package/Meshes/Node/Blocks/mergeGeometryBlock.js +1 -1
- package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
- package/Meshes/Node/Blocks/randomBlock.js +1 -0
- package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
- package/Misc/webRequest.d.ts +4 -0
- package/Misc/webRequest.js +6 -0
- package/Misc/webRequest.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsAccumulationPass.d.ts +35 -11
- package/Rendering/IBLShadows/iblShadowsAccumulationPass.js +131 -117
- package/Rendering/IBLShadows/iblShadowsAccumulationPass.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsImportanceSamplingRenderer.js +0 -1
- package/Rendering/IBLShadows/iblShadowsImportanceSamplingRenderer.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.d.ts +60 -0
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.js +166 -0
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.js.map +1 -0
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +97 -56
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +356 -308
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsSpatialBlurPass.d.ts +20 -6
- package/Rendering/IBLShadows/iblShadowsSpatialBlurPass.js +67 -35
- package/Rendering/IBLShadows/iblShadowsSpatialBlurPass.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.d.ts +9 -4
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +84 -66
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.d.ts +31 -6
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js +108 -60
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js.map +1 -1
- package/Rendering/geometryBufferRenderer.d.ts +15 -0
- package/Rendering/geometryBufferRenderer.js +48 -5
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/instancesDeclaration.js +2 -4
- package/Shaders/ShadersInclude/instancesDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/instancesVertex.js +3 -6
- package/Shaders/ShadersInclude/instancesVertex.js.map +1 -1
- package/Shaders/geometry.fragment.js +5 -1
- package/Shaders/geometry.fragment.js.map +1 -1
- package/Shaders/geometry.vertex.js +3 -3
- package/Shaders/geometry.vertex.js.map +1 -1
- package/Shaders/iblShadowAccumulation.fragment.js +7 -11
- package/Shaders/iblShadowAccumulation.fragment.js.map +1 -1
- package/Shaders/iblShadowGBufferDebug.fragment.js +2 -3
- package/Shaders/iblShadowGBufferDebug.fragment.js.map +1 -1
- package/Shaders/iblShadowSpatialBlur.fragment.js +5 -5
- package/Shaders/iblShadowSpatialBlur.fragment.js.map +1 -1
- package/Shaders/iblShadowVoxelTracing.fragment.js +31 -32
- package/Shaders/iblShadowVoxelTracing.fragment.js.map +1 -1
- package/Shaders/iblShadowsCombine.fragment.js +2 -2
- package/Shaders/iblShadowsCombine.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/instancesDeclaration.js +2 -4
- package/ShadersWGSL/ShadersInclude/instancesDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/instancesVertex.js +3 -6
- package/ShadersWGSL/ShadersInclude/instancesVertex.js.map +1 -1
- package/ShadersWGSL/geometry.fragment.js +7 -1
- package/ShadersWGSL/geometry.fragment.js.map +1 -1
- package/ShadersWGSL/geometry.vertex.js +3 -3
- package/ShadersWGSL/geometry.vertex.js.map +1 -1
- package/ShadersWGSL/iblShadowAccumulation.fragment.js +5 -10
- package/ShadersWGSL/iblShadowAccumulation.fragment.js.map +1 -1
- package/ShadersWGSL/iblShadowGBufferDebug.fragment.js +2 -3
- package/ShadersWGSL/iblShadowGBufferDebug.fragment.js.map +1 -1
- package/ShadersWGSL/iblShadowSpatialBlur.fragment.js +5 -5
- package/ShadersWGSL/iblShadowSpatialBlur.fragment.js.map +1 -1
- package/ShadersWGSL/iblShadowVoxelTracing.fragment.js +45 -33
- package/ShadersWGSL/iblShadowVoxelTracing.fragment.js.map +1 -1
- package/ShadersWGSL/iblShadowsCombine.fragment.js +6 -2
- package/ShadersWGSL/iblShadowsCombine.fragment.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { MaterialDefines } from "../../Materials/materialDefines.js";
|
|
2
|
+
import { MaterialPluginBase } from "../../Materials/materialPluginBase.js";
|
|
3
|
+
import type { InternalTexture } from "../../Materials/Textures/internalTexture.js";
|
|
4
|
+
import type { Material } from "../../Materials/material.js";
|
|
5
|
+
import type { StandardMaterial } from "../../Materials/standardMaterial.js";
|
|
6
|
+
import { PBRBaseMaterial } from "../../Materials/PBR/pbrBaseMaterial.js";
|
|
7
|
+
import type { UniformBuffer } from "../../Materials/uniformBuffer.js";
|
|
8
|
+
import { ShaderLanguage } from "../../Materials/shaderLanguage.js";
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
declare class MaterialIBLShadowsRenderDefines extends MaterialDefines {
|
|
13
|
+
RENDER_WITH_IBL_SHADOWS: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Plugin used to render the contribution from IBL shadows.
|
|
17
|
+
*/
|
|
18
|
+
export declare class IBLShadowsPluginMaterial extends MaterialPluginBase {
|
|
19
|
+
/**
|
|
20
|
+
* Defines the name of the plugin.
|
|
21
|
+
*/
|
|
22
|
+
static readonly Name = "IBLShadowsPluginMaterial";
|
|
23
|
+
/**
|
|
24
|
+
* The texture containing the contribution from IBL shadows.
|
|
25
|
+
*/
|
|
26
|
+
iblShadowsTexture: InternalTexture;
|
|
27
|
+
/**
|
|
28
|
+
* The opacity of the shadows.
|
|
29
|
+
*/
|
|
30
|
+
shadowOpacity: number;
|
|
31
|
+
private _isEnabled;
|
|
32
|
+
/**
|
|
33
|
+
* Defines if the plugin is enabled in the material.
|
|
34
|
+
*/
|
|
35
|
+
isEnabled: boolean;
|
|
36
|
+
protected _markAllSubMeshesAsTexturesDirty(): void;
|
|
37
|
+
private _internalMarkAllSubMeshesAsTexturesDirty;
|
|
38
|
+
/**
|
|
39
|
+
* Gets a boolean indicating that the plugin is compatible with a give shader language.
|
|
40
|
+
* @returns true if the plugin is compatible with the shader language
|
|
41
|
+
*/
|
|
42
|
+
isCompatible(): boolean;
|
|
43
|
+
constructor(material: Material | StandardMaterial | PBRBaseMaterial);
|
|
44
|
+
prepareDefines(defines: MaterialIBLShadowsRenderDefines): void;
|
|
45
|
+
getClassName(): string;
|
|
46
|
+
getUniforms(): {
|
|
47
|
+
ubo: {
|
|
48
|
+
name: string;
|
|
49
|
+
size: number;
|
|
50
|
+
type: string;
|
|
51
|
+
}[];
|
|
52
|
+
fragment: string;
|
|
53
|
+
};
|
|
54
|
+
getSamplers(samplers: string[]): void;
|
|
55
|
+
bindForSubMesh(uniformBuffer: UniformBuffer): void;
|
|
56
|
+
getCustomCode(shaderType: string, shaderLanguage: ShaderLanguage): {
|
|
57
|
+
[name: string]: string;
|
|
58
|
+
} | null;
|
|
59
|
+
}
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { __decorate } from "../../tslib.es6.js";
|
|
2
|
+
import { MaterialDefines } from "../../Materials/materialDefines.js";
|
|
3
|
+
import { MaterialPluginBase } from "../../Materials/materialPluginBase.js";
|
|
4
|
+
|
|
5
|
+
import { PBRBaseMaterial } from "../../Materials/PBR/pbrBaseMaterial.js";
|
|
6
|
+
import { expandToProperty, serialize } from "../../Misc/decorators.js";
|
|
7
|
+
import { RegisterClass } from "../../Misc/typeStore.js";
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
class MaterialIBLShadowsRenderDefines extends MaterialDefines {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.RENDER_WITH_IBL_SHADOWS = false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Plugin used to render the contribution from IBL shadows.
|
|
19
|
+
*/
|
|
20
|
+
export class IBLShadowsPluginMaterial extends MaterialPluginBase {
|
|
21
|
+
_markAllSubMeshesAsTexturesDirty() {
|
|
22
|
+
this._enable(this._isEnabled);
|
|
23
|
+
this._internalMarkAllSubMeshesAsTexturesDirty();
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Gets a boolean indicating that the plugin is compatible with a give shader language.
|
|
27
|
+
* @returns true if the plugin is compatible with the shader language
|
|
28
|
+
*/
|
|
29
|
+
isCompatible() {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
constructor(material) {
|
|
33
|
+
super(material, IBLShadowsPluginMaterial.Name, 310, new MaterialIBLShadowsRenderDefines());
|
|
34
|
+
/**
|
|
35
|
+
* The opacity of the shadows.
|
|
36
|
+
*/
|
|
37
|
+
this.shadowOpacity = 1.0;
|
|
38
|
+
this._isEnabled = false;
|
|
39
|
+
/**
|
|
40
|
+
* Defines if the plugin is enabled in the material.
|
|
41
|
+
*/
|
|
42
|
+
this.isEnabled = false;
|
|
43
|
+
this._internalMarkAllSubMeshesAsTexturesDirty = material._dirtyCallbacks[1];
|
|
44
|
+
}
|
|
45
|
+
prepareDefines(defines) {
|
|
46
|
+
defines.RENDER_WITH_IBL_SHADOWS = this._isEnabled;
|
|
47
|
+
}
|
|
48
|
+
getClassName() {
|
|
49
|
+
return "IBLShadowsPluginMaterial";
|
|
50
|
+
}
|
|
51
|
+
getUniforms() {
|
|
52
|
+
return {
|
|
53
|
+
ubo: [
|
|
54
|
+
{ name: "renderTargetSize", size: 2, type: "vec2" },
|
|
55
|
+
{ name: "shadowOpacity", size: 1, type: "float" },
|
|
56
|
+
],
|
|
57
|
+
fragment: `#ifdef RENDER_WITH_IBL_SHADOWS
|
|
58
|
+
uniform vec2 renderTargetSize;
|
|
59
|
+
uniform float shadowOpacity;
|
|
60
|
+
#endif`,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
getSamplers(samplers) {
|
|
64
|
+
samplers.push("iblShadowsTexture");
|
|
65
|
+
}
|
|
66
|
+
bindForSubMesh(uniformBuffer) {
|
|
67
|
+
if (this._isEnabled) {
|
|
68
|
+
uniformBuffer.bindTexture("iblShadowsTexture", this.iblShadowsTexture);
|
|
69
|
+
uniformBuffer.updateFloat2("renderTargetSize", this._material.getScene().getEngine().getRenderWidth(), this._material.getScene().getEngine().getRenderHeight());
|
|
70
|
+
uniformBuffer.updateFloat("shadowOpacity", this.shadowOpacity);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
getCustomCode(shaderType, shaderLanguage) {
|
|
74
|
+
let frag;
|
|
75
|
+
if (shaderLanguage === 1 /* ShaderLanguage.WGSL */) {
|
|
76
|
+
frag = {
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
78
|
+
CUSTOM_FRAGMENT_DEFINITIONS: `
|
|
79
|
+
#ifdef RENDER_WITH_IBL_SHADOWS
|
|
80
|
+
var iblShadowsTextureSampler: sampler;
|
|
81
|
+
var iblShadowsTexture: texture_2d<f32>;
|
|
82
|
+
|
|
83
|
+
fn computeIndirectShadow() -> vec2f {
|
|
84
|
+
var uv = fragmentInputs.position.xy / uniforms.renderTargetSize;
|
|
85
|
+
var shadowValue: vec2f = textureSample(iblShadowsTexture, iblShadowsTextureSampler, uv).rg;
|
|
86
|
+
return mix(shadowValue, vec2f(1.0), 1.0 - uniforms.shadowOpacity);
|
|
87
|
+
}
|
|
88
|
+
#endif
|
|
89
|
+
`,
|
|
90
|
+
};
|
|
91
|
+
if (this._material instanceof PBRBaseMaterial) {
|
|
92
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
93
|
+
frag["CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION"] = `
|
|
94
|
+
#ifdef RENDER_WITH_IBL_SHADOWS
|
|
95
|
+
#ifdef REFLECTION
|
|
96
|
+
var shadowValue: vec2f = computeIndirectShadow();
|
|
97
|
+
finalIrradiance *= vec3f(shadowValue.x);
|
|
98
|
+
finalRadianceScaled *= vec3f(mix(pow(shadowValue.y, 4.0), shadowValue.x, roughness));
|
|
99
|
+
#endif
|
|
100
|
+
#endif
|
|
101
|
+
`;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
frag["CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR"] = `
|
|
105
|
+
#ifdef RENDER_WITH_IBL_SHADOWS
|
|
106
|
+
var shadowValue: vec2f = computeIndirectShadow();
|
|
107
|
+
color *= toGammaSpace(vec4f(shadowValue.x, shadowValue.x, shadowValue.x, 1.0f));
|
|
108
|
+
#endif
|
|
109
|
+
`;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
frag = {
|
|
114
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
115
|
+
CUSTOM_FRAGMENT_DEFINITIONS: `
|
|
116
|
+
#ifdef RENDER_WITH_IBL_SHADOWS
|
|
117
|
+
uniform sampler2D iblShadowsTexture;
|
|
118
|
+
|
|
119
|
+
vec2 computeIndirectShadow() {
|
|
120
|
+
vec2 uv = gl_FragCoord.xy / renderTargetSize;
|
|
121
|
+
vec2 shadowValue = texture2D(iblShadowsTexture, uv).rg;
|
|
122
|
+
return mix(shadowValue.rg, vec2(1.0), 1.0 - shadowOpacity);
|
|
123
|
+
}
|
|
124
|
+
#endif
|
|
125
|
+
`,
|
|
126
|
+
};
|
|
127
|
+
if (this._material instanceof PBRBaseMaterial) {
|
|
128
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
129
|
+
frag["CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION"] = `
|
|
130
|
+
#ifdef RENDER_WITH_IBL_SHADOWS
|
|
131
|
+
#ifdef REFLECTION
|
|
132
|
+
vec2 shadowValue = computeIndirectShadow();
|
|
133
|
+
finalIrradiance *= shadowValue.x;
|
|
134
|
+
finalRadianceScaled *= mix(pow(shadowValue.y, 4.0), shadowValue.x, roughness);
|
|
135
|
+
#endif
|
|
136
|
+
#endif
|
|
137
|
+
`;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
frag["CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR"] = `
|
|
141
|
+
#ifdef RENDER_WITH_IBL_SHADOWS
|
|
142
|
+
vec2 shadowValue = computeIndirectShadow();
|
|
143
|
+
color.rgb *= toGammaSpace(shadowValue.x);
|
|
144
|
+
#endif
|
|
145
|
+
`;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return shaderType === "vertex" ? null : frag;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Defines the name of the plugin.
|
|
153
|
+
*/
|
|
154
|
+
IBLShadowsPluginMaterial.Name = "IBLShadowsPluginMaterial";
|
|
155
|
+
__decorate([
|
|
156
|
+
serialize()
|
|
157
|
+
], IBLShadowsPluginMaterial.prototype, "iblShadowsTexture", void 0);
|
|
158
|
+
__decorate([
|
|
159
|
+
serialize()
|
|
160
|
+
], IBLShadowsPluginMaterial.prototype, "shadowOpacity", void 0);
|
|
161
|
+
__decorate([
|
|
162
|
+
serialize(),
|
|
163
|
+
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
164
|
+
], IBLShadowsPluginMaterial.prototype, "isEnabled", void 0);
|
|
165
|
+
RegisterClass(`BABYLON.IBLShadowsPluginMaterial`, IBLShadowsPluginMaterial);
|
|
166
|
+
//# sourceMappingURL=iblShadowsPluginMaterial.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iblShadowsPluginMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Rendering/IBLShadows/iblShadowsPluginMaterial.ts"],"names":[],"mappings":"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","sourcesContent":["import { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { MaterialPluginBase } from \"core/Materials/materialPluginBase\";\r\nimport type { InternalTexture } from \"core/Materials/Textures/internalTexture\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport type { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport { PBRBaseMaterial } from \"core/Materials/PBR/pbrBaseMaterial\";\r\nimport type { UniformBuffer } from \"core/Materials/uniformBuffer\";\r\nimport { expandToProperty, serialize } from \"core/Misc/decorators\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\n\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\n/**\r\n * @internal\r\n */\r\nclass MaterialIBLShadowsRenderDefines extends MaterialDefines {\r\n public RENDER_WITH_IBL_SHADOWS = false;\r\n}\r\n\r\n/**\r\n * Plugin used to render the contribution from IBL shadows.\r\n */\r\nexport class IBLShadowsPluginMaterial extends MaterialPluginBase {\r\n /**\r\n * Defines the name of the plugin.\r\n */\r\n public static readonly Name = \"IBLShadowsPluginMaterial\";\r\n\r\n /**\r\n * The texture containing the contribution from IBL shadows.\r\n */\r\n @serialize()\r\n public iblShadowsTexture: InternalTexture;\r\n\r\n /**\r\n * The opacity of the shadows.\r\n */\r\n @serialize()\r\n public shadowOpacity: number = 1.0;\r\n\r\n private _isEnabled = false;\r\n /**\r\n * Defines if the plugin is enabled in the material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public isEnabled = false;\r\n\r\n protected _markAllSubMeshesAsTexturesDirty(): void {\r\n this._enable(this._isEnabled);\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n }\r\n\r\n private _internalMarkAllSubMeshesAsTexturesDirty: () => void;\r\n\r\n /**\r\n * Gets a boolean indicating that the plugin is compatible with a give shader language.\r\n * @returns true if the plugin is compatible with the shader language\r\n */\r\n public override isCompatible(): boolean {\r\n return true;\r\n }\r\n\r\n constructor(material: Material | StandardMaterial | PBRBaseMaterial) {\r\n super(material, IBLShadowsPluginMaterial.Name, 310, new MaterialIBLShadowsRenderDefines());\r\n this._internalMarkAllSubMeshesAsTexturesDirty = material._dirtyCallbacks[Constants.MATERIAL_TextureDirtyFlag];\r\n }\r\n\r\n public override prepareDefines(defines: MaterialIBLShadowsRenderDefines) {\r\n defines.RENDER_WITH_IBL_SHADOWS = this._isEnabled;\r\n }\r\n\r\n public override getClassName() {\r\n return \"IBLShadowsPluginMaterial\";\r\n }\r\n\r\n public override getUniforms() {\r\n return {\r\n ubo: [\r\n { name: \"renderTargetSize\", size: 2, type: \"vec2\" },\r\n { name: \"shadowOpacity\", size: 1, type: \"float\" },\r\n ],\r\n fragment: `#ifdef RENDER_WITH_IBL_SHADOWS\r\n uniform vec2 renderTargetSize;\r\n uniform float shadowOpacity;\r\n #endif`,\r\n };\r\n }\r\n\r\n public override getSamplers(samplers: string[]) {\r\n samplers.push(\"iblShadowsTexture\");\r\n }\r\n\r\n public override bindForSubMesh(uniformBuffer: UniformBuffer) {\r\n if (this._isEnabled) {\r\n uniformBuffer.bindTexture(\"iblShadowsTexture\", this.iblShadowsTexture);\r\n uniformBuffer.updateFloat2(\"renderTargetSize\", this._material.getScene().getEngine().getRenderWidth(), this._material.getScene().getEngine().getRenderHeight());\r\n uniformBuffer.updateFloat(\"shadowOpacity\", this.shadowOpacity);\r\n }\r\n }\r\n\r\n public override getCustomCode(shaderType: string, shaderLanguage: ShaderLanguage) {\r\n let frag: { [name: string]: string };\r\n\r\n if (shaderLanguage === ShaderLanguage.WGSL) {\r\n frag = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_FRAGMENT_DEFINITIONS: `\r\n #ifdef RENDER_WITH_IBL_SHADOWS\r\n var iblShadowsTextureSampler: sampler;\r\n var iblShadowsTexture: texture_2d<f32>;\r\n\r\n fn computeIndirectShadow() -> vec2f {\r\n var uv = fragmentInputs.position.xy / uniforms.renderTargetSize;\r\n var shadowValue: vec2f = textureSample(iblShadowsTexture, iblShadowsTextureSampler, uv).rg;\r\n return mix(shadowValue, vec2f(1.0), 1.0 - uniforms.shadowOpacity);\r\n }\r\n #endif\r\n `,\r\n };\r\n\r\n if (this._material instanceof PBRBaseMaterial) {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n frag[\"CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION\"] = `\r\n #ifdef RENDER_WITH_IBL_SHADOWS\r\n #ifdef REFLECTION\r\n var shadowValue: vec2f = computeIndirectShadow();\r\n finalIrradiance *= vec3f(shadowValue.x);\r\n finalRadianceScaled *= vec3f(mix(pow(shadowValue.y, 4.0), shadowValue.x, roughness));\r\n #endif\r\n #endif\r\n `;\r\n } else {\r\n frag[\"CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\"] = `\r\n #ifdef RENDER_WITH_IBL_SHADOWS\r\n var shadowValue: vec2f = computeIndirectShadow();\r\n color *= toGammaSpace(vec4f(shadowValue.x, shadowValue.x, shadowValue.x, 1.0f));\r\n #endif\r\n `;\r\n }\r\n } else {\r\n frag = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CUSTOM_FRAGMENT_DEFINITIONS: `\r\n #ifdef RENDER_WITH_IBL_SHADOWS\r\n uniform sampler2D iblShadowsTexture;\r\n\r\n vec2 computeIndirectShadow() {\r\n vec2 uv = gl_FragCoord.xy / renderTargetSize;\r\n vec2 shadowValue = texture2D(iblShadowsTexture, uv).rg;\r\n return mix(shadowValue.rg, vec2(1.0), 1.0 - shadowOpacity);\r\n }\r\n #endif\r\n `,\r\n };\r\n\r\n if (this._material instanceof PBRBaseMaterial) {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n frag[\"CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION\"] = `\r\n #ifdef RENDER_WITH_IBL_SHADOWS\r\n #ifdef REFLECTION\r\n vec2 shadowValue = computeIndirectShadow();\r\n finalIrradiance *= shadowValue.x;\r\n finalRadianceScaled *= mix(pow(shadowValue.y, 4.0), shadowValue.x, roughness);\r\n #endif\r\n #endif\r\n `;\r\n } else {\r\n frag[\"CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\"] = `\r\n #ifdef RENDER_WITH_IBL_SHADOWS\r\n vec2 shadowValue = computeIndirectShadow();\r\n color.rgb *= toGammaSpace(shadowValue.x);\r\n #endif\r\n `;\r\n }\r\n }\r\n\r\n return shaderType === \"vertex\" ? null : frag;\r\n }\r\n}\r\n\r\nRegisterClass(`BABYLON.IBLShadowsPluginMaterial`, IBLShadowsPluginMaterial);\r\n"]}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Mesh } from "../../Meshes/mesh";
|
|
2
2
|
import type { Scene } from "../../scene";
|
|
3
3
|
import type { BaseTexture } from "../../Materials/Textures/baseTexture";
|
|
4
4
|
import { Texture } from "../../Materials/Textures/texture";
|
|
5
|
-
import { PrePassRenderer } from "../prePassRenderer";
|
|
6
5
|
import { PostProcessRenderPipeline } from "../../PostProcesses/RenderPipeline/postProcessRenderPipeline";
|
|
7
6
|
import type { Camera } from "../../Cameras/camera.js";
|
|
7
|
+
import { RawTexture } from "../../Materials/Textures/rawTexture.js";
|
|
8
|
+
import type { Material } from "../../Materials/material.js";
|
|
9
|
+
import { Observable } from "../../Misc/observable.js";
|
|
8
10
|
interface IblShadowsSettings {
|
|
9
11
|
/**
|
|
10
12
|
* The exponent of the resolution of the voxel shadow grid. Higher resolutions will result in sharper
|
|
@@ -30,6 +32,11 @@ interface IblShadowsSettings {
|
|
|
30
32
|
* bits of missing geometry.
|
|
31
33
|
*/
|
|
32
34
|
triPlanarVoxelization: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* A multiplier for the render size of the shadows. Used for rendering lower-resolution shadows
|
|
37
|
+
* to increase performance. Should be a value between 0 and 1.
|
|
38
|
+
*/
|
|
39
|
+
shadowRenderSizeFactor: number;
|
|
33
40
|
/**
|
|
34
41
|
* Separate control for the opacity of the voxel shadows.
|
|
35
42
|
*/
|
|
@@ -51,11 +58,11 @@ interface IblShadowsSettings {
|
|
|
51
58
|
* The maximum distance a shadow can be cast in screen space. This should usually be kept small
|
|
52
59
|
* as screenspace shadows are mostly useful for small details.
|
|
53
60
|
*/
|
|
54
|
-
|
|
61
|
+
ssShadowDistanceScale: number;
|
|
55
62
|
/**
|
|
56
63
|
* Screen-space shadow thickness. This value controls the perceived thickness of the SS shadows.
|
|
57
64
|
*/
|
|
58
|
-
|
|
65
|
+
ssShadowThicknessScale: number;
|
|
59
66
|
}
|
|
60
67
|
/**
|
|
61
68
|
* Voxel-based shadow rendering for IBL's.
|
|
@@ -66,83 +73,85 @@ export declare class IblShadowsRenderPipeline extends PostProcessRenderPipeline
|
|
|
66
73
|
* The scene that this pipeline is attached to
|
|
67
74
|
*/
|
|
68
75
|
scene: Scene;
|
|
69
|
-
private _voxelizationDirty;
|
|
70
|
-
private _boundsNeedUpdate;
|
|
71
76
|
private _allowDebugPasses;
|
|
72
77
|
private _debugPasses;
|
|
73
|
-
private
|
|
74
|
-
private
|
|
75
|
-
private _excludedMeshes;
|
|
78
|
+
private _geometryBufferRenderer;
|
|
79
|
+
private _shadowCastingMeshes;
|
|
76
80
|
private _voxelRenderer;
|
|
77
81
|
private _importanceSamplingRenderer;
|
|
78
82
|
private _voxelTracingPass;
|
|
79
83
|
private _spatialBlurPass;
|
|
80
84
|
private _accumulationPass;
|
|
81
85
|
private _noiseTexture;
|
|
86
|
+
/**
|
|
87
|
+
* Raw texture to be used before final data is available.
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
_dummyTexture2d: RawTexture;
|
|
91
|
+
private _dummyTexture3d;
|
|
82
92
|
private _shadowOpacity;
|
|
83
93
|
private _enabled;
|
|
94
|
+
private _materialsWithRenderPlugin;
|
|
95
|
+
/**
|
|
96
|
+
* Observable that triggers when the shadow renderer is ready
|
|
97
|
+
*/
|
|
98
|
+
onShadowTextureReadyObservable: Observable<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Observable that triggers when a new IBL is set and the importance sampling is ready
|
|
101
|
+
*/
|
|
102
|
+
onNewIblReadyObservable: Observable<void>;
|
|
84
103
|
/**
|
|
85
104
|
* The current world-space size of that the voxel grid covers in the scene.
|
|
86
105
|
*/
|
|
87
106
|
voxelGridSize: number;
|
|
88
107
|
/**
|
|
89
|
-
*
|
|
108
|
+
* Reset the shadow accumulation.
|
|
90
109
|
*/
|
|
91
|
-
|
|
110
|
+
resetAccumulation(): void;
|
|
92
111
|
/**
|
|
93
112
|
* How dark the shadows appear. 1.0 is full opacity, 0.0 is no shadows.
|
|
94
113
|
*/
|
|
114
|
+
get shadowOpacity(): number;
|
|
95
115
|
set shadowOpacity(value: number);
|
|
116
|
+
private _renderSizeFactor;
|
|
96
117
|
/**
|
|
97
|
-
*
|
|
118
|
+
* A multiplier for the render size of the shadows. Used for rendering lower-resolution shadows.
|
|
98
119
|
*/
|
|
99
|
-
get
|
|
120
|
+
get shadowRenderSizeFactor(): number;
|
|
121
|
+
set shadowRenderSizeFactor(value: number);
|
|
100
122
|
/**
|
|
101
123
|
* How dark the voxel shadows appear. 1.0 is full opacity, 0.0 is no shadows.
|
|
102
124
|
*/
|
|
125
|
+
get voxelShadowOpacity(): number;
|
|
103
126
|
set voxelShadowOpacity(value: number);
|
|
104
127
|
/**
|
|
105
128
|
* How dark the screen-space shadows appear. 1.0 is full opacity, 0.0 is no shadows.
|
|
106
129
|
*/
|
|
107
130
|
get ssShadowOpacity(): number;
|
|
108
|
-
/**
|
|
109
|
-
* How dark the screen-space shadows appear. 1.0 is full opacity, 0.0 is no shadows.
|
|
110
|
-
*/
|
|
111
131
|
set ssShadowOpacity(value: number);
|
|
112
132
|
/**
|
|
113
133
|
* The number of samples used in the screen space shadow pass.
|
|
114
134
|
*/
|
|
115
135
|
get ssShadowSamples(): number;
|
|
116
|
-
/**
|
|
117
|
-
* The number of samples used in the screen space shadow pass.
|
|
118
|
-
*/
|
|
119
136
|
set ssShadowSamples(value: number);
|
|
120
137
|
/**
|
|
121
138
|
* The stride of the screen-space shadow pass. This controls the distance between samples.
|
|
122
139
|
*/
|
|
123
140
|
get ssShadowStride(): number;
|
|
124
|
-
/**
|
|
125
|
-
* The stride of the screen-space shadow pass. This controls the distance between samples.
|
|
126
|
-
*/
|
|
127
141
|
set ssShadowStride(value: number);
|
|
142
|
+
private _sssMaxDistScale;
|
|
128
143
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*/
|
|
132
|
-
get ssShadowMaxDist(): number;
|
|
133
|
-
/**
|
|
134
|
-
* The maximum distance a shadow can be cast in screen space. This should usually be kept small
|
|
135
|
-
* as screenspace shadows are mostly useful for small details.
|
|
136
|
-
*/
|
|
137
|
-
set ssShadowMaxDist(value: number);
|
|
138
|
-
/**
|
|
139
|
-
* Screen-space shadow thickness. This value controls the perceived thickness of the SS shadows.
|
|
144
|
+
* A scale for the maximum distance a shadow can be cast in screen space.
|
|
145
|
+
* The absolute distance for SS shadows is derived from the voxel size and this scalar.
|
|
140
146
|
*/
|
|
141
|
-
get
|
|
147
|
+
get ssShadowDistanceScale(): number;
|
|
148
|
+
set ssShadowDistanceScale(value: number);
|
|
149
|
+
private _sssThicknessScale;
|
|
142
150
|
/**
|
|
143
151
|
* Screen-space shadow thickness. This value controls the perceived thickness of the SS shadows.
|
|
144
152
|
*/
|
|
145
|
-
|
|
153
|
+
get ssShadowThicknessScale(): number;
|
|
154
|
+
set ssShadowThicknessScale(value: number);
|
|
146
155
|
/**
|
|
147
156
|
* Set the IBL image to be used for shadowing. It can be either a cubemap
|
|
148
157
|
* or a 2D equirectangular texture.
|
|
@@ -152,18 +161,45 @@ export declare class IblShadowsRenderPipeline extends PostProcessRenderPipeline
|
|
|
152
161
|
/**
|
|
153
162
|
* Returns the texture containing the voxel grid data
|
|
154
163
|
* @returns The texture containing the voxel grid data
|
|
164
|
+
* @internal
|
|
155
165
|
*/
|
|
156
|
-
|
|
166
|
+
_getVoxelGridTexture(): Texture;
|
|
157
167
|
/**
|
|
158
168
|
* Returns the texture containing the importance sampling CDF data for the IBL shadow pipeline
|
|
159
169
|
* @returns The texture containing the importance sampling CDF data for the IBL shadow pipeline
|
|
170
|
+
* @internal
|
|
160
171
|
*/
|
|
161
|
-
|
|
172
|
+
_getIcdfyTexture(): Texture;
|
|
162
173
|
/**
|
|
163
174
|
* Returns the texture containing the importance sampling CDF data for the IBL shadow pipeline
|
|
164
175
|
* @returns The texture containing the importance sampling CDF data for the IBL shadow pipeline
|
|
176
|
+
* @internal
|
|
177
|
+
*/
|
|
178
|
+
_getIcdfxTexture(): Texture;
|
|
179
|
+
/**
|
|
180
|
+
* Returns the noise texture.
|
|
181
|
+
* @returns The noise texture.
|
|
182
|
+
* @internal
|
|
183
|
+
*/
|
|
184
|
+
_getNoiseTexture(): Texture;
|
|
185
|
+
/**
|
|
186
|
+
* Returns the voxel-tracing texture.
|
|
187
|
+
* @returns The voxel-tracing texture.
|
|
188
|
+
* @internal
|
|
189
|
+
*/
|
|
190
|
+
_getVoxelTracingTexture(): Texture;
|
|
191
|
+
/**
|
|
192
|
+
* Returns the spatial blur texture.
|
|
193
|
+
* @returns The spatial blur texture.
|
|
194
|
+
* @internal
|
|
165
195
|
*/
|
|
166
|
-
|
|
196
|
+
_getSpatialBlurTexture(): Texture;
|
|
197
|
+
/**
|
|
198
|
+
* Returns the accumulated shadow texture.
|
|
199
|
+
* @returns The accumulated shadow texture.
|
|
200
|
+
* @internal
|
|
201
|
+
*/
|
|
202
|
+
_getAccumulatedTexture(): Texture;
|
|
167
203
|
private _gbufferDebugPass;
|
|
168
204
|
private _gbufferDebugEnabled;
|
|
169
205
|
private _gBufferDebugSizeParams;
|
|
@@ -230,15 +266,15 @@ export declare class IblShadowsRenderPipeline extends PostProcessRenderPipeline
|
|
|
230
266
|
*/
|
|
231
267
|
set accumulationPassDebugEnabled(enabled: boolean);
|
|
232
268
|
/**
|
|
233
|
-
* Add a mesh
|
|
234
|
-
* @param mesh
|
|
269
|
+
* Add a mesh to be used for shadow casting in the IBL shadow pipeline
|
|
270
|
+
* @param mesh A mesh or list of meshes that you want to cast shadows
|
|
235
271
|
*/
|
|
236
|
-
|
|
272
|
+
addShadowCastingMesh(mesh: Mesh | Mesh[]): void;
|
|
237
273
|
/**
|
|
238
|
-
* Remove a mesh from the
|
|
239
|
-
* @param mesh The mesh to
|
|
274
|
+
* Remove a mesh from the shadow-casting list.
|
|
275
|
+
* @param mesh The mesh or list of meshes that you don't want to cast shadows.
|
|
240
276
|
*/
|
|
241
|
-
|
|
277
|
+
removeShadowCastingMesh(mesh: Mesh | Mesh[]): void;
|
|
242
278
|
/**
|
|
243
279
|
* The exponent of the resolution of the voxel shadow grid. Higher resolutions will result in sharper
|
|
244
280
|
* shadows but are more expensive to compute and require more memory.
|
|
@@ -300,8 +336,6 @@ export declare class IblShadowsRenderPipeline extends PostProcessRenderPipeline
|
|
|
300
336
|
*/
|
|
301
337
|
toggleShadow(enabled: boolean): void;
|
|
302
338
|
private _handleResize;
|
|
303
|
-
private _createShadowCombinePostProcess;
|
|
304
|
-
private _createEffectPasses;
|
|
305
339
|
private _getGBufferDebugPass;
|
|
306
340
|
private _createDebugPasses;
|
|
307
341
|
private _disposeEffectPasses;
|
|
@@ -316,23 +350,30 @@ export declare class IblShadowsRenderPipeline extends PostProcessRenderPipeline
|
|
|
316
350
|
* to be recalculated. This will also trigger a re-voxelization.
|
|
317
351
|
*/
|
|
318
352
|
updateSceneBounds(): void;
|
|
319
|
-
private _updateBeforeRender;
|
|
320
|
-
private _listenForCameraChanges;
|
|
321
353
|
/**
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
|
|
354
|
+
* Update the SS shadow max distance and thickness based on the voxel grid size and resolution.
|
|
355
|
+
* The max distance should be just a little larger than the world size of a single voxel.
|
|
356
|
+
*/
|
|
357
|
+
private _updateSSShadowParams;
|
|
358
|
+
/**
|
|
359
|
+
* Apply the shadows to a material or array of materials.
|
|
360
|
+
* @param material Material that will be affected by the shadows. If not provided, all materials of the scene will be affected.
|
|
325
361
|
*/
|
|
326
|
-
|
|
362
|
+
addShadowReceivingMaterial(material?: Material | Material[]): void;
|
|
363
|
+
/**
|
|
364
|
+
* Remove a material from receiving shadows
|
|
365
|
+
* @param material The material that will no longer receive shadows
|
|
366
|
+
*/
|
|
367
|
+
removeShadowReceivingMaterial(material: Material | Material[]): void;
|
|
368
|
+
protected _addShadowSupportToMaterial(material: Material): void;
|
|
369
|
+
protected _setPluginParameters(): void;
|
|
370
|
+
private _updateBeforeRender;
|
|
371
|
+
private _listenForCameraChanges;
|
|
327
372
|
/**
|
|
328
373
|
* Checks if the IBL shadow pipeline is ready to render shadows
|
|
329
374
|
* @returns true if the IBL shadow pipeline is ready to render the shadows
|
|
330
375
|
*/
|
|
331
376
|
isReady(): boolean;
|
|
332
|
-
/**
|
|
333
|
-
* Renders accumulated shadows for IBL
|
|
334
|
-
*/
|
|
335
|
-
update(): void;
|
|
336
377
|
/**
|
|
337
378
|
* Get the class name
|
|
338
379
|
* @returns "IBLShadowsRenderPipeline"
|