@babylonjs/core 6.33.2 → 6.34.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/Animations/animation.js +1 -1
  2. package/Animations/animation.js.map +1 -1
  3. package/Buffers/storageBuffer.d.ts +2 -1
  4. package/Buffers/storageBuffer.js +3 -2
  5. package/Buffers/storageBuffer.js.map +1 -1
  6. package/Cameras/arcRotateCamera.js +1 -1
  7. package/Cameras/arcRotateCamera.js.map +1 -1
  8. package/Engines/Extensions/engine.storageBuffer.d.ts +2 -1
  9. package/Engines/Extensions/engine.storageBuffer.js.map +1 -1
  10. package/Engines/WebGPU/Extensions/engine.storageBuffer.js +14 -5
  11. package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +1 -1
  12. package/Engines/thinEngine.js +2 -2
  13. package/Engines/thinEngine.js.map +1 -1
  14. package/Engines/webgpuEngine.js +4 -0
  15. package/Engines/webgpuEngine.js.map +1 -1
  16. package/FlowGraph/flowGraphBlock.js +1 -21
  17. package/FlowGraph/flowGraphBlock.js.map +1 -1
  18. package/FlowGraph/flowGraphExecutionBlock.d.ts +1 -0
  19. package/FlowGraph/flowGraphExecutionBlock.js +20 -0
  20. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  21. package/Gizmos/axisScaleGizmo.d.ts +1 -0
  22. package/Gizmos/axisScaleGizmo.js +12 -0
  23. package/Gizmos/axisScaleGizmo.js.map +1 -1
  24. package/Materials/uniformBuffer.d.ts +4 -1
  25. package/Materials/uniformBuffer.js +5 -2
  26. package/Materials/uniformBuffer.js.map +1 -1
  27. package/Meshes/abstractMesh.js +3 -1
  28. package/Meshes/abstractMesh.js.map +1 -1
  29. package/Physics/v2/index.d.ts +1 -0
  30. package/Physics/v2/index.js +1 -0
  31. package/Physics/v2/index.js.map +1 -1
  32. package/Physics/v2/ragdoll.d.ts +107 -0
  33. package/Physics/v2/ragdoll.js +228 -0
  34. package/Physics/v2/ragdoll.js.map +1 -0
  35. package/Shaders/ShadersInclude/pbrBlockSubSurface.js +3 -2
  36. package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
  37. package/package.json +1 -1
@@ -4,5 +4,6 @@ export * from "./physicsShape";
4
4
  export * from "./physicsConstraint";
5
5
  export * from "./physicsMaterial";
6
6
  export * from "./physicsAggregate";
7
+ export * from "./ragdoll";
7
8
  export * from "./IPhysicsEnginePlugin";
8
9
  export * from "./Plugins/index";
@@ -5,6 +5,7 @@ export * from "./physicsShape.js";
5
5
  export * from "./physicsConstraint.js";
6
6
  export * from "./physicsMaterial.js";
7
7
  export * from "./physicsAggregate.js";
8
+ export * from "./ragdoll.js";
8
9
  export * from "./IPhysicsEnginePlugin.js";
9
10
  /* eslint-disable import/no-internal-modules */
10
11
  export * from "./Plugins/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACnE,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,+CAA+C;AAC/C,cAAc,iBAAiB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport { PhysicsEngine as PhysicsEngineV2 } from \"./physicsEngine\";\r\nexport * from \"./physicsBody\";\r\nexport * from \"./physicsShape\";\r\nexport * from \"./physicsConstraint\";\r\nexport * from \"./physicsMaterial\";\r\nexport * from \"./physicsAggregate\";\r\nexport * from \"./IPhysicsEnginePlugin\";\r\n/* eslint-disable import/no-internal-modules */\r\nexport * from \"./Plugins/index\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACnE,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,+CAA+C;AAC/C,cAAc,iBAAiB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport { PhysicsEngine as PhysicsEngineV2 } from \"./physicsEngine\";\r\nexport * from \"./physicsBody\";\r\nexport * from \"./physicsShape\";\r\nexport * from \"./physicsConstraint\";\r\nexport * from \"./physicsMaterial\";\r\nexport * from \"./physicsAggregate\";\r\nexport * from \"./ragdoll\";\r\nexport * from \"./IPhysicsEnginePlugin\";\r\n/* eslint-disable import/no-internal-modules */\r\nexport * from \"./Plugins/index\";\r\n"]}
@@ -0,0 +1,107 @@
1
+ import type { Skeleton } from "../../Bones/skeleton";
2
+ import { Vector3 } from "../../Maths/math.vector";
3
+ import type { Mesh } from "../../Meshes/mesh";
4
+ /**
5
+ * Ragdoll bone properties
6
+ * @experimental
7
+ */
8
+ export declare class RagdollBoneProperties {
9
+ /**
10
+ * Width of the box shape
11
+ */
12
+ width?: number;
13
+ /**
14
+ * depth of the box shape
15
+ */
16
+ depth?: number;
17
+ /**
18
+ * height of the box shape
19
+ */
20
+ height?: number;
21
+ /**
22
+ * size that will be used of width, depth and height of the shape box
23
+ */
24
+ size?: number;
25
+ /**
26
+ * Type of Physics Constraint used between bones
27
+ */
28
+ joint?: number | undefined;
29
+ /**
30
+ * Main rotation axis used by the constraint, in local space
31
+ */
32
+ rotationAxis?: Vector3;
33
+ /**
34
+ * Minimum rotation angle value
35
+ */
36
+ min?: number;
37
+ /**
38
+ * Maximum rotation angle value
39
+ */
40
+ max?: number;
41
+ /**
42
+ * Offset along local axis
43
+ */
44
+ boxOffset?: number;
45
+ /**
46
+ * Axis that need an offset
47
+ */
48
+ boneOffsetAxis?: Vector3;
49
+ }
50
+ /**
51
+ * Ragdoll for Physics V2
52
+ * Current known limitation is scene must be using Right hand coordinates
53
+ * @experimental
54
+ */
55
+ export declare class Ragdoll {
56
+ /**
57
+ * Opacity of debug boxes
58
+ */
59
+ boxVisibility: number;
60
+ private _skeleton;
61
+ private _scene;
62
+ private _mesh;
63
+ private _config;
64
+ private _boxConfigs;
65
+ private _bones;
66
+ private _initialRotation;
67
+ private _boneNames;
68
+ private _boxes;
69
+ private _aggregates;
70
+ private _ragdollMode;
71
+ private _rootBoneName;
72
+ private _rootBoneIndex;
73
+ private _mass;
74
+ private _restitution;
75
+ private _pauseSync;
76
+ private _putBoxesInBoneCenter;
77
+ private _defaultJoint;
78
+ private _defaultJointMin;
79
+ private _defaultJointMax;
80
+ private _boneOffsetAxis;
81
+ /**
82
+ * Construct a new Ragdoll object. Once ready, it can be made dynamic by calling `Ragdoll` method
83
+ * @param skeleton The skeleton containing bones to be physicalized
84
+ * @param mesh The mesh used by the skeleton
85
+ * @param config an array of `RagdollBoneProperties` corresponding to bones and their properties used to instanciate physics bodies
86
+ */
87
+ constructor(skeleton: Skeleton, mesh: Mesh, config: RagdollBoneProperties[]);
88
+ /**
89
+ * Set the debug boxes visibility
90
+ */
91
+ set boxesVisibility(visible: boolean);
92
+ private _createColliders;
93
+ private _initJoints;
94
+ private _syncBonesAndBoxes;
95
+ private _addImpostorRotationToBone;
96
+ private _defineRootBone;
97
+ private _findNearestParent;
98
+ private _init;
99
+ /**
100
+ * Enable ragdoll mode. Create physics objects and make them dynamic.
101
+ */
102
+ ragdoll(): void;
103
+ /**
104
+ * Dispose resources and remove physics objects
105
+ */
106
+ dispose(): void;
107
+ }
@@ -0,0 +1,228 @@
1
+ import { MeshBuilder } from "../..//Meshes/meshBuilder.js";
2
+ import { Vector3, Matrix } from "../../Maths/math.vector.js";
3
+ import { PhysicsAggregate } from "./physicsAggregate.js";
4
+ import { BallAndSocketConstraint } from "./physicsConstraint.js";
5
+ import { Axis, Space } from "../../Maths/math.axis.js";
6
+ import { PhysicsShapeType, PhysicsConstraintType } from "./IPhysicsEnginePlugin.js";
7
+ import { Logger } from "../../Misc/logger.js";
8
+ /**
9
+ * Ragdoll bone properties
10
+ * @experimental
11
+ */
12
+ export class RagdollBoneProperties {
13
+ }
14
+ /**
15
+ * Ragdoll for Physics V2
16
+ * Current known limitation is scene must be using Right hand coordinates
17
+ * @experimental
18
+ */
19
+ export class Ragdoll {
20
+ /**
21
+ * Construct a new Ragdoll object. Once ready, it can be made dynamic by calling `Ragdoll` method
22
+ * @param skeleton The skeleton containing bones to be physicalized
23
+ * @param mesh The mesh used by the skeleton
24
+ * @param config an array of `RagdollBoneProperties` corresponding to bones and their properties used to instanciate physics bodies
25
+ */
26
+ constructor(skeleton, mesh, config) {
27
+ /**
28
+ * Opacity of debug boxes
29
+ */
30
+ this.boxVisibility = 0.6;
31
+ this._boxConfigs = new Array();
32
+ this._bones = new Array();
33
+ this._initialRotation = new Array();
34
+ this._boneNames = [];
35
+ this._boxes = new Array();
36
+ this._aggregates = new Array();
37
+ this._ragdollMode = false;
38
+ this._rootBoneName = "";
39
+ this._rootBoneIndex = -1;
40
+ this._mass = 10;
41
+ this._restitution = 0;
42
+ this._pauseSync = false;
43
+ this._defaultJoint = PhysicsConstraintType.HINGE;
44
+ this._defaultJointMin = -90;
45
+ this._defaultJointMax = 90;
46
+ this._skeleton = skeleton;
47
+ this._scene = skeleton.getScene();
48
+ this._mesh = mesh;
49
+ this._config = config; // initial, user defined box configs. May have several box configs jammed into 1 index.
50
+ this._boxConfigs = []; // final box configs. Every element is a separate box config (this.config may have several configs jammed into 1 index).
51
+ this._putBoxesInBoneCenter = false;
52
+ this._defaultJoint = PhysicsConstraintType.HINGE;
53
+ this._boneOffsetAxis = Axis.Y;
54
+ }
55
+ /**
56
+ * Set the debug boxes visibility
57
+ */
58
+ set boxesVisibility(visible) {
59
+ for (const box of this._boxes) {
60
+ box.visibility = visible ? this.boxVisibility : 0;
61
+ }
62
+ }
63
+ _createColliders() {
64
+ this._mesh.computeWorldMatrix();
65
+ const config = this._config;
66
+ for (let i = 0; i < config.length; i++) {
67
+ const boneNames = config[i].bone !== undefined ? [config[i].bone] : config[i].bones;
68
+ for (let ii = 0; ii < boneNames.length; ii++) {
69
+ const currentBone = this._skeleton.bones[this._skeleton.getBoneIndexByName(boneNames[ii])];
70
+ if (currentBone == undefined) {
71
+ return;
72
+ }
73
+ // First define the box dimensions, so we can then use them when calling CreateBox().
74
+ const currentRagdollBoneProperties = {
75
+ width: this._config[i].width,
76
+ depth: this._config[i].depth,
77
+ height: this._config[i].height,
78
+ size: this._config[i].size,
79
+ };
80
+ const box = MeshBuilder.CreateBox(boneNames[ii] + "_box", currentRagdollBoneProperties, this._scene);
81
+ box.visibility = 0;
82
+ // Define the rest of the box properties.
83
+ currentRagdollBoneProperties.joint = config[i].joint !== undefined ? config[i].joint : this._defaultJoint;
84
+ currentRagdollBoneProperties.rotationAxis = config[i].rotationAxis !== undefined ? config[i].rotationAxis : Axis.X;
85
+ currentRagdollBoneProperties.min = config[i].min !== undefined ? config[i].min : this._defaultJointMin;
86
+ currentRagdollBoneProperties.max = config[i].max !== undefined ? config[i].max : this._defaultJointMax;
87
+ // Offset value.
88
+ let boxOffset = 0;
89
+ if ((config[i].putBoxInBoneCenter !== undefined && config[i].putBoxInBoneCenter) || this._putBoxesInBoneCenter) {
90
+ if (currentBone.length === undefined) {
91
+ Logger.Log("The length property is not defined for bone " + currentBone.name);
92
+ }
93
+ boxOffset = currentBone.length / 2;
94
+ }
95
+ else if (config[i].boxOffset !== undefined) {
96
+ boxOffset = config[i].boxOffset;
97
+ }
98
+ currentRagdollBoneProperties.boxOffset = boxOffset;
99
+ // Offset axis.
100
+ const boneOffsetAxis = config[i].boneOffsetAxis !== undefined ? config[i].boneOffsetAxis : this._boneOffsetAxis;
101
+ const boneDir = currentBone.getDirection(boneOffsetAxis, this._mesh);
102
+ currentRagdollBoneProperties.boneOffsetAxis = boneOffsetAxis;
103
+ box.position = currentBone.getAbsolutePosition(this._mesh).add(boneDir.scale(boxOffset));
104
+ const mass = config[i].mass !== undefined ? config[i].mass : this._mass;
105
+ const restitution = config[i].restitution !== undefined ? config[i].restitution : this._restitution;
106
+ const aggregate = new PhysicsAggregate(box, PhysicsShapeType.BOX, {
107
+ mass: mass,
108
+ restitution: restitution,
109
+ friction: 0.6,
110
+ }, this._scene);
111
+ aggregate.body.setCollisionCallbackEnabled(true);
112
+ aggregate.body.disablePreStep = false;
113
+ this._aggregates.push(aggregate);
114
+ this._bones.push(currentBone);
115
+ this._boneNames.push(currentBone.name);
116
+ this._boxes.push(box);
117
+ this._boxConfigs.push(currentRagdollBoneProperties);
118
+ this._initialRotation.push(currentBone.getRotationQuaternion(Space.WORLD, this._mesh));
119
+ }
120
+ }
121
+ }
122
+ _initJoints() {
123
+ this._mesh.computeWorldMatrix();
124
+ for (let i = 0; i < this._bones.length; i++) {
125
+ // The root bone has no joints.
126
+ if (i == this._rootBoneIndex)
127
+ continue;
128
+ const nearestParent = this._findNearestParent(i);
129
+ if (nearestParent == null) {
130
+ Logger.Warn("Couldn't find a nearest parent bone in the configs for bone called " + this._boneNames[i]);
131
+ return;
132
+ }
133
+ const boneParentIndex = this._boneNames.indexOf(nearestParent.name);
134
+ let distanceFromParentBoxToBone = this._bones[i].getAbsolutePosition(this._mesh).subtract(this._boxes[boneParentIndex].position);
135
+ const wmat = this._boxes[boneParentIndex].computeWorldMatrix();
136
+ const invertedWorldMat = Matrix.Invert(wmat);
137
+ distanceFromParentBoxToBone = Vector3.TransformCoordinates(this._bones[i].getAbsolutePosition(this._mesh), invertedWorldMat);
138
+ const boneAbsPos = this._bones[i].getAbsolutePosition(this._mesh);
139
+ const boxAbsPos = this._boxes[i].position.clone();
140
+ const myConnectedPivot = boneAbsPos.subtract(boxAbsPos);
141
+ const joint = new BallAndSocketConstraint(distanceFromParentBoxToBone, myConnectedPivot, this._boxConfigs[i].rotationAxis, this._boxConfigs[i].rotationAxis, this._scene);
142
+ this._aggregates[boneParentIndex].body.addConstraint(this._aggregates[i].body, joint);
143
+ }
144
+ }
145
+ _syncBonesAndBoxes() {
146
+ if (this._pauseSync) {
147
+ return;
148
+ }
149
+ if (this._ragdollMode) {
150
+ const rootBoneDirection = this._bones[this._rootBoneIndex].getDirection(this._boxConfigs[this._rootBoneIndex].boneOffsetAxis, this._mesh);
151
+ const rootBoneOffsetPosition = this._bones[this._rootBoneIndex]
152
+ .getAbsolutePosition(this._mesh)
153
+ .add(rootBoneDirection.scale(this._boxConfigs[this._rootBoneIndex].boxOffset));
154
+ this._bones[this._rootBoneIndex].setAbsolutePosition(this._boxes[this._rootBoneIndex].position, this._mesh);
155
+ this._addImpostorRotationToBone(this._rootBoneIndex);
156
+ const rootPos = this._aggregates[this._rootBoneIndex].body.transformNode.position;
157
+ // Move the mesh, to guarantee alignment between root bone and impostor box position
158
+ const dist = rootBoneOffsetPosition.subtract(rootPos);
159
+ this._mesh.position = this._mesh.position.subtract(dist);
160
+ for (let i = 0; i < this._bones.length; i++) {
161
+ if (i == this._rootBoneIndex)
162
+ continue;
163
+ this._addImpostorRotationToBone(i);
164
+ }
165
+ }
166
+ }
167
+ _addImpostorRotationToBone(boneIndex) {
168
+ var _a, _b, _c;
169
+ const newRotQuat = (_c = (_b = (_a = this._aggregates[boneIndex].body) === null || _a === void 0 ? void 0 : _a.transformNode) === null || _b === void 0 ? void 0 : _b.rotationQuaternion) === null || _c === void 0 ? void 0 : _c.multiply(this._initialRotation[boneIndex]);
170
+ if (newRotQuat) {
171
+ this._bones[boneIndex].setRotationQuaternion(newRotQuat, Space.WORLD, this._mesh);
172
+ }
173
+ }
174
+ // Return true if root bone is valid/exists in this.bonesNames. false otherwise.
175
+ _defineRootBone() {
176
+ const skeletonRoots = this._skeleton.getChildren();
177
+ if (skeletonRoots.length != 1) {
178
+ Logger.Log("Ragdoll creation failed: there can only be one root in the skeleton.");
179
+ return false;
180
+ }
181
+ this._rootBoneName = skeletonRoots[0].name;
182
+ this._rootBoneIndex = this._boneNames.indexOf(this._rootBoneName);
183
+ if (this._rootBoneIndex == -1) {
184
+ Logger.Log("Ragdoll creation failed: the array boneNames doesn't have the root bone. The root bone is " + this._skeleton.getChildren());
185
+ return false;
186
+ }
187
+ return true;
188
+ }
189
+ _findNearestParent(boneIndex) {
190
+ let nearestParent = this._bones[boneIndex].getParent();
191
+ do {
192
+ if (nearestParent != null && this._boneNames.includes(nearestParent.name)) {
193
+ break;
194
+ }
195
+ nearestParent = nearestParent === null || nearestParent === void 0 ? void 0 : nearestParent.getParent();
196
+ } while (nearestParent != null);
197
+ return nearestParent;
198
+ }
199
+ _init() {
200
+ this._createColliders();
201
+ // If this.defineRootBone() returns false... there is not root bone.
202
+ if (!this._defineRootBone()) {
203
+ return;
204
+ }
205
+ this._initJoints();
206
+ this._scene.registerBeforeRender(() => {
207
+ this._syncBonesAndBoxes();
208
+ });
209
+ }
210
+ /**
211
+ * Enable ragdoll mode. Create physics objects and make them dynamic.
212
+ */
213
+ ragdoll() {
214
+ if (!this._ragdollMode) {
215
+ this._ragdollMode = true;
216
+ this._init();
217
+ }
218
+ }
219
+ /**
220
+ * Dispose resources and remove physics objects
221
+ */
222
+ dispose() {
223
+ this._aggregates.forEach((aggregate) => {
224
+ aggregate.dispose();
225
+ });
226
+ }
227
+ }
228
+ //# sourceMappingURL=ragdoll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ragdoll.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/ragdoll.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,uBAAu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,CAAC,SAAS,CAAC,CAAC,SAAS,EAAE,CAAC;QACnF,GAAG;YACC,IAAI,aAAa,IAAI,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE;gBACvE,MAAM;aACT;YAED,aAAa,GAAG,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,SAAS,EAAE,CAAC;SAC9C,QAAQ,aAAa,IAAI,IAAI,EAAE;QAEhC,OAAO,aAAa,CAAC;IACzB,CAAC;IAEO,KAAK;QACT,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAExB,oEAAoE;QACpE,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE;YACzB,OAAO;SACV;QAED,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE;YAClC,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC9B,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACpB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,KAAK,EAAE,CAAC;SAChB;IACL,CAAC;IAED;;OAEG;IACH,OAAO;QACH,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,SAA2B,EAAE,EAAE;YACrD,SAAS,CAAC,OAAO,EAAE,CAAC;QACxB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import type { Skeleton } from \"../../Bones/skeleton\";\r\nimport { MeshBuilder } from \"../..//Meshes/meshBuilder\";\r\nimport { Vector3, Matrix } from \"../../Maths/math.vector\";\r\nimport type { Quaternion } from \"../../Maths/math.vector\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { PhysicsAggregate } from \"./physicsAggregate\";\r\nimport { BallAndSocketConstraint } from \"./physicsConstraint\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport { Axis, Space } from \"core/Maths/math.axis\";\r\nimport { PhysicsShapeType, PhysicsConstraintType } from \"./IPhysicsEnginePlugin\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Bone } from \"../../Bones/bone\";\r\nimport { Logger } from \"../../Misc/logger\";\r\n\r\n/**\r\n * Ragdoll bone properties\r\n * @experimental\r\n */\r\nexport class RagdollBoneProperties {\r\n /**\r\n * Width of the box shape\r\n */\r\n width?: number;\r\n /**\r\n * depth of the box shape\r\n */\r\n depth?: number;\r\n /**\r\n * height of the box shape\r\n */\r\n height?: number;\r\n /**\r\n * size that will be used of width, depth and height of the shape box\r\n */\r\n size?: number;\r\n /**\r\n * Type of Physics Constraint used between bones\r\n */\r\n joint?: number | undefined;\r\n /**\r\n * Main rotation axis used by the constraint, in local space\r\n */\r\n rotationAxis?: Vector3;\r\n /**\r\n * Minimum rotation angle value\r\n */\r\n min?: number;\r\n /**\r\n * Maximum rotation angle value\r\n */\r\n max?: number;\r\n /**\r\n * Offset along local axis\r\n */\r\n boxOffset?: number;\r\n /**\r\n * Axis that need an offset\r\n */\r\n boneOffsetAxis?: Vector3;\r\n}\r\n\r\n/**\r\n * Ragdoll for Physics V2\r\n * Current known limitation is scene must be using Right hand coordinates\r\n * @experimental\r\n */\r\nexport class Ragdoll {\r\n /**\r\n * Opacity of debug boxes\r\n */\r\n public boxVisibility: number = 0.6;\r\n\r\n private _skeleton: Skeleton;\r\n private _scene: Scene;\r\n private _mesh: Mesh;\r\n private _config: any;\r\n private _boxConfigs: Array<RagdollBoneProperties> = new Array<RagdollBoneProperties>();\r\n\r\n private _bones: Array<Bone> = new Array<Bone>();\r\n private _initialRotation: Array<Quaternion> = new Array<Quaternion>();\r\n private _boneNames: string[] = [];\r\n private _boxes: Array<Mesh> = new Array<Mesh>();\r\n private _aggregates: Array<PhysicsAggregate> = new Array<PhysicsAggregate>();\r\n private _ragdollMode: boolean = false;\r\n private _rootBoneName: string = \"\";\r\n private _rootBoneIndex: number = -1;\r\n private _mass: number = 10;\r\n private _restitution: number = 0;\r\n private _pauseSync: boolean = false;\r\n\r\n private _putBoxesInBoneCenter: boolean;\r\n private _defaultJoint: number = PhysicsConstraintType.HINGE;\r\n private _defaultJointMin: number = -90;\r\n private _defaultJointMax: number = 90;\r\n\r\n private _boneOffsetAxis: Vector3;\r\n\r\n /**\r\n * Construct a new Ragdoll object. Once ready, it can be made dynamic by calling `Ragdoll` method\r\n * @param skeleton The skeleton containing bones to be physicalized\r\n * @param mesh The mesh used by the skeleton\r\n * @param config an array of `RagdollBoneProperties` corresponding to bones and their properties used to instanciate physics bodies\r\n */\r\n constructor(skeleton: Skeleton, mesh: Mesh, config: RagdollBoneProperties[]) {\r\n this._skeleton = skeleton;\r\n this._scene = skeleton.getScene();\r\n this._mesh = mesh;\r\n this._config = config; // initial, user defined box configs. May have several box configs jammed into 1 index.\r\n this._boxConfigs = []; // final box configs. Every element is a separate box config (this.config may have several configs jammed into 1 index).\r\n this._putBoxesInBoneCenter = false;\r\n this._defaultJoint = PhysicsConstraintType.HINGE;\r\n this._boneOffsetAxis = Axis.Y;\r\n }\r\n\r\n /**\r\n * Set the debug boxes visibility\r\n */\r\n public set boxesVisibility(visible: boolean) {\r\n for (const box of this._boxes) {\r\n box.visibility = visible ? this.boxVisibility : 0;\r\n }\r\n }\r\n\r\n private _createColliders(): void {\r\n this._mesh.computeWorldMatrix();\r\n\r\n const config = this._config;\r\n for (let i = 0; i < config.length; i++) {\r\n const boneNames = config[i].bone !== undefined ? [config[i].bone] : config[i].bones;\r\n\r\n for (let ii = 0; ii < boneNames.length; ii++) {\r\n const currentBone = this._skeleton.bones[this._skeleton.getBoneIndexByName(boneNames[ii])];\r\n if (currentBone == undefined) {\r\n return;\r\n }\r\n\r\n // First define the box dimensions, so we can then use them when calling CreateBox().\r\n const currentRagdollBoneProperties: RagdollBoneProperties = {\r\n width: this._config[i].width,\r\n depth: this._config[i].depth,\r\n height: this._config[i].height,\r\n size: this._config[i].size,\r\n };\r\n\r\n const box = MeshBuilder.CreateBox(boneNames[ii] + \"_box\", currentRagdollBoneProperties, this._scene);\r\n\r\n box.visibility = 0;\r\n\r\n // Define the rest of the box properties.\r\n currentRagdollBoneProperties.joint = config[i].joint !== undefined ? config[i].joint : this._defaultJoint;\r\n currentRagdollBoneProperties.rotationAxis = config[i].rotationAxis !== undefined ? config[i].rotationAxis : Axis.X;\r\n currentRagdollBoneProperties.min = config[i].min !== undefined ? config[i].min : this._defaultJointMin;\r\n currentRagdollBoneProperties.max = config[i].max !== undefined ? config[i].max : this._defaultJointMax;\r\n\r\n // Offset value.\r\n let boxOffset = 0;\r\n if ((config[i].putBoxInBoneCenter !== undefined && config[i].putBoxInBoneCenter) || this._putBoxesInBoneCenter) {\r\n if (currentBone.length === undefined) {\r\n Logger.Log(\"The length property is not defined for bone \" + currentBone.name);\r\n }\r\n boxOffset = currentBone.length / 2;\r\n } else if (config[i].boxOffset !== undefined) {\r\n boxOffset = config[i].boxOffset;\r\n }\r\n currentRagdollBoneProperties.boxOffset = boxOffset;\r\n\r\n // Offset axis.\r\n const boneOffsetAxis = config[i].boneOffsetAxis !== undefined ? config[i].boneOffsetAxis : this._boneOffsetAxis;\r\n const boneDir = currentBone.getDirection(boneOffsetAxis, this._mesh);\r\n currentRagdollBoneProperties.boneOffsetAxis = boneOffsetAxis;\r\n\r\n box.position = currentBone.getAbsolutePosition(this._mesh).add(boneDir.scale(boxOffset));\r\n\r\n const mass = config[i].mass !== undefined ? config[i].mass : this._mass;\r\n const restitution = config[i].restitution !== undefined ? config[i].restitution : this._restitution;\r\n const aggregate = new PhysicsAggregate(\r\n box,\r\n PhysicsShapeType.BOX,\r\n {\r\n mass: mass,\r\n restitution: restitution,\r\n friction: 0.6,\r\n },\r\n this._scene\r\n );\r\n aggregate.body.setCollisionCallbackEnabled(true);\r\n aggregate.body.disablePreStep = false;\r\n this._aggregates.push(aggregate);\r\n this._bones.push(currentBone);\r\n this._boneNames.push(currentBone.name);\r\n this._boxes.push(box);\r\n this._boxConfigs.push(currentRagdollBoneProperties);\r\n this._initialRotation.push(currentBone.getRotationQuaternion(Space.WORLD, this._mesh));\r\n }\r\n }\r\n }\r\n\r\n private _initJoints(): void {\r\n this._mesh.computeWorldMatrix();\r\n for (let i = 0; i < this._bones.length; i++) {\r\n // The root bone has no joints.\r\n if (i == this._rootBoneIndex) continue;\r\n\r\n const nearestParent = this._findNearestParent(i);\r\n\r\n if (nearestParent == null) {\r\n Logger.Warn(\"Couldn't find a nearest parent bone in the configs for bone called \" + this._boneNames[i]);\r\n return;\r\n }\r\n\r\n const boneParentIndex = this._boneNames.indexOf(nearestParent.name);\r\n\r\n let distanceFromParentBoxToBone = this._bones[i].getAbsolutePosition(this._mesh).subtract(this._boxes[boneParentIndex].position);\r\n\r\n const wmat = this._boxes[boneParentIndex].computeWorldMatrix();\r\n const invertedWorldMat = Matrix.Invert(wmat);\r\n distanceFromParentBoxToBone = Vector3.TransformCoordinates(this._bones[i].getAbsolutePosition(this._mesh), invertedWorldMat);\r\n\r\n const boneAbsPos = this._bones[i].getAbsolutePosition(this._mesh);\r\n const boxAbsPos = this._boxes[i].position.clone();\r\n const myConnectedPivot = boneAbsPos.subtract(boxAbsPos);\r\n\r\n const joint = new BallAndSocketConstraint(\r\n distanceFromParentBoxToBone,\r\n myConnectedPivot,\r\n this._boxConfigs[i].rotationAxis!,\r\n this._boxConfigs[i].rotationAxis!,\r\n this._scene\r\n );\r\n this._aggregates[boneParentIndex].body.addConstraint(this._aggregates[i].body, joint);\r\n }\r\n }\r\n\r\n private _syncBonesAndBoxes(): void {\r\n if (this._pauseSync) {\r\n return;\r\n }\r\n\r\n if (this._ragdollMode) {\r\n const rootBoneDirection = this._bones[this._rootBoneIndex].getDirection(this._boxConfigs[this._rootBoneIndex].boneOffsetAxis as any, this._mesh);\r\n const rootBoneOffsetPosition = this._bones[this._rootBoneIndex]\r\n .getAbsolutePosition(this._mesh)\r\n .add(rootBoneDirection.scale(this._boxConfigs[this._rootBoneIndex].boxOffset as any));\r\n\r\n this._bones[this._rootBoneIndex].setAbsolutePosition(this._boxes[this._rootBoneIndex].position, this._mesh);\r\n this._addImpostorRotationToBone(this._rootBoneIndex);\r\n\r\n const rootPos = this._aggregates[this._rootBoneIndex].body.transformNode.position;\r\n\r\n // Move the mesh, to guarantee alignment between root bone and impostor box position\r\n const dist = rootBoneOffsetPosition.subtract(rootPos);\r\n this._mesh.position = this._mesh.position.subtract(dist);\r\n\r\n for (let i = 0; i < this._bones.length; i++) {\r\n if (i == this._rootBoneIndex) continue;\r\n this._addImpostorRotationToBone(i);\r\n }\r\n }\r\n }\r\n\r\n private _addImpostorRotationToBone(boneIndex: number): void {\r\n const newRotQuat = this._aggregates[boneIndex].body?.transformNode?.rotationQuaternion?.multiply(this._initialRotation[boneIndex]);\r\n if (newRotQuat) {\r\n this._bones[boneIndex].setRotationQuaternion(newRotQuat, Space.WORLD, this._mesh);\r\n }\r\n }\r\n\r\n // Return true if root bone is valid/exists in this.bonesNames. false otherwise.\r\n private _defineRootBone(): boolean {\r\n const skeletonRoots = this._skeleton.getChildren();\r\n if (skeletonRoots.length != 1) {\r\n Logger.Log(\"Ragdoll creation failed: there can only be one root in the skeleton.\");\r\n return false;\r\n }\r\n\r\n this._rootBoneName = skeletonRoots[0].name;\r\n this._rootBoneIndex = this._boneNames.indexOf(this._rootBoneName);\r\n if (this._rootBoneIndex == -1) {\r\n Logger.Log(\"Ragdoll creation failed: the array boneNames doesn't have the root bone. The root bone is \" + this._skeleton.getChildren());\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n private _findNearestParent(boneIndex: number): any {\r\n let nearestParent: Nullable<Bone> | undefined = this._bones[boneIndex].getParent();\r\n do {\r\n if (nearestParent != null && this._boneNames.includes(nearestParent.name)) {\r\n break;\r\n }\r\n\r\n nearestParent = nearestParent?.getParent();\r\n } while (nearestParent != null);\r\n\r\n return nearestParent;\r\n }\r\n\r\n private _init() {\r\n this._createColliders();\r\n\r\n // If this.defineRootBone() returns false... there is not root bone.\r\n if (!this._defineRootBone()) {\r\n return;\r\n }\r\n\r\n this._initJoints();\r\n this._scene.registerBeforeRender(() => {\r\n this._syncBonesAndBoxes();\r\n });\r\n }\r\n\r\n /**\r\n * Enable ragdoll mode. Create physics objects and make them dynamic.\r\n */\r\n public ragdoll(): void {\r\n if (!this._ragdollMode) {\r\n this._ragdollMode = true;\r\n this._init();\r\n }\r\n }\r\n\r\n /**\r\n * Dispose resources and remove physics objects\r\n */\r\n dispose(): void {\r\n this._aggregates.forEach((aggregate: PhysicsAggregate) => {\r\n aggregate.dispose();\r\n });\r\n }\r\n}\r\n"]}
@@ -269,10 +269,11 @@ float refractionRoughness=alphaG;refractionRoughness=mix(alphaG,0.0,clamp(ior*3.
269
269
  #else
270
270
  float refractionAlphaG=alphaG;refractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));float refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,refractionAlphaG);
271
271
  #endif
272
+ float refraction_ior=vRefractionInfos.y;
272
273
  #ifdef SS_DISPERSION
273
- float realIOR=1.0/ior;float iorDispersionSpread=0.04*dispersion*(realIOR-1.0);vec3 iors=vec3(1.0/(realIOR-iorDispersionSpread),ior,1.0/(realIOR+iorDispersionSpread));for (int i=0; i<3; i++) {ior=iors[i];
274
+ float realIOR=1.0/refraction_ior;float iorDispersionSpread=0.04*dispersion*(realIOR-1.0);vec3 iors=vec3(1.0/(realIOR-iorDispersionSpread),refraction_ior,1.0/(realIOR+iorDispersionSpread));for (int i=0; i<3; i++) {refraction_ior=iors[i];
274
275
  #endif
275
- vec4 envSample=sampleEnvironmentRefraction(ior,thickness,refractionLOD,normalW,vPositionW,viewDirectionW,view,vRefractionInfos,refractionMatrix,vRefractionMicrosurfaceInfos,alphaG
276
+ vec4 envSample=sampleEnvironmentRefraction(refraction_ior,thickness,refractionLOD,normalW,vPositionW,viewDirectionW,view,vRefractionInfos,refractionMatrix,vRefractionMicrosurfaceInfos,alphaG
276
277
  #ifdef SS_REFRACTIONMAP_3D
277
278
  ,refractionSampler
278
279
  #ifndef LODBASEDMICROSFURACE
@@ -1 +1 @@
1
- {"version":3,"file":"pbrBlockSubSurface.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/pbrBlockSubSurface.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyXd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"pbrBlockSubSurface\";\nconst shader = `struct subSurfaceOutParams\n{vec3 specularEnvironmentReflectance;\n#ifdef SS_REFRACTION\nvec3 finalRefraction;vec3 surfaceAlbedo;\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nfloat alpha;\n#endif\n#ifdef REFLECTION\nfloat refractionFactorForIrradiance;\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nvec3 transmittance;float translucencyIntensity;\n#ifdef REFLECTION\nvec3 refractionIrradiance;\n#endif\n#endif\n#if DEBUGMODE>0\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nvec4 thicknessMap;\n#endif\n#ifdef SS_REFRACTION\nvec4 environmentRefraction;vec3 refractionTransmittance;\n#endif\n#endif\n};\n#ifdef SUBSURFACE\n#define pbr_inline\n#define inline\n#ifdef SS_REFRACTION\nvec4 sampleEnvironmentRefraction(\nin float ior\n,in float thickness\n,in float refractionLOD\n,in vec3 normalW\n,in vec3 vPositionW\n,in vec3 viewDirectionW\n,in mat4 view\n,in vec4 vRefractionInfos\n,in mat4 refractionMatrix\n,in vec4 vRefractionMicrosurfaceInfos\n,in float alphaG\n#ifdef SS_REFRACTIONMAP_3D\n,in samplerCube refractionSampler\n#ifndef LODBASEDMICROSFURACE\n,in samplerCube refractionSamplerLow\n,in samplerCube refractionSamplerHigh\n#endif\n#else\n,in sampler2D refractionSampler\n#ifndef LODBASEDMICROSFURACE\n,in sampler2D refractionSamplerLow\n,in sampler2D refractionSamplerHigh\n#endif\n#endif\n#ifdef ANISOTROPIC\n,in anisotropicOutParams anisotropicOut\n#endif\n#ifdef REALTIME_FILTERING\n,in vec2 vRefractionFilteringInfo\n#endif\n#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\n,in vec3 refractionPosition\n,in vec3 refractionSize\n#endif\n) {vec4 environmentRefraction=vec4(0.,0.,0.,0.);\n#ifdef ANISOTROPIC\nvec3 refractionVector=refract(-viewDirectionW,anisotropicOut.anisotropicNormal,ior);\n#else\nvec3 refractionVector=refract(-viewDirectionW,normalW,ior);\n#endif\n#ifdef SS_REFRACTIONMAP_OPPOSITEZ\nrefractionVector.z*=-1.0;\n#endif\n#ifdef SS_REFRACTIONMAP_3D\n#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\nrefractionVector=parallaxCorrectNormal(vPositionW,refractionVector,refractionSize,refractionPosition);\n#endif\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;vec3 refractionCoords=refractionVector;refractionCoords=vec3(refractionMatrix*vec4(refractionCoords,0));\n#else\n#ifdef SS_USE_THICKNESS_AS_DEPTH\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*thickness,1.0)));\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\n#endif\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;refractionCoords.y=1.0-refractionCoords.y;\n#endif\n#ifdef LODBASEDMICROSFURACE\nrefractionLOD=refractionLOD*vRefractionMicrosurfaceInfos.y+vRefractionMicrosurfaceInfos.z;\n#ifdef SS_LODINREFRACTIONALPHA\nfloat automaticRefractionLOD=UNPACK_LOD(sampleRefraction(refractionSampler,refractionCoords).a);float requestedRefractionLOD=max(automaticRefractionLOD,refractionLOD);\n#else\nfloat requestedRefractionLOD=refractionLOD;\n#endif\n#if defined(REALTIME_FILTERING) && defined(SS_REFRACTIONMAP_3D)\nenvironmentRefraction=vec4(radiance(alphaG,refractionSampler,refractionCoords,vRefractionFilteringInfo),1.0);\n#else\nenvironmentRefraction=sampleRefractionLod(refractionSampler,refractionCoords,requestedRefractionLOD);\n#endif\n#else\nfloat lodRefractionNormalized=saturate(refractionLOD/log2(vRefractionMicrosurfaceInfos.x));float lodRefractionNormalizedDoubled=lodRefractionNormalized*2.0;vec4 environmentRefractionMid=sampleRefraction(refractionSampler,refractionCoords);if (lodRefractionNormalizedDoubled<1.0){environmentRefraction=mix(\nsampleRefraction(refractionSamplerHigh,refractionCoords),\nenvironmentRefractionMid,\nlodRefractionNormalizedDoubled\n);} else {environmentRefraction=mix(\nenvironmentRefractionMid,\nsampleRefraction(refractionSamplerLow,refractionCoords),\nlodRefractionNormalizedDoubled-1.0\n);}\n#endif\n#ifdef SS_RGBDREFRACTION\nenvironmentRefraction.rgb=fromRGBD(environmentRefraction);\n#endif\n#ifdef SS_GAMMAREFRACTION\nenvironmentRefraction.rgb=toLinearSpace(environmentRefraction.rgb);\n#endif\nreturn environmentRefraction;}\n#endif\nvoid subSurfaceBlock(\nin vec3 vSubSurfaceIntensity,\nin vec2 vThicknessParam,\nin vec4 vTintColor,\nin vec3 normalW,\nin vec3 specularEnvironmentReflectance,\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nin vec4 thicknessMap,\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\nin vec4 refractionIntensityMap,\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\nin vec4 translucencyIntensityMap,\n#endif\n#ifdef REFLECTION\n#ifdef SS_TRANSLUCENCY\nin mat4 reflectionMatrix,\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nin vec3 irradianceVector_,\n#endif\n#if defined(REALTIME_FILTERING)\nin samplerCube reflectionSampler,\nin vec2 vReflectionFilteringInfo,\n#endif\n#endif\n#ifdef USEIRRADIANCEMAP\n#ifdef REFLECTIONMAP_3D\nin samplerCube irradianceSampler,\n#else\nin sampler2D irradianceSampler,\n#endif\n#endif\n#endif\n#endif\n#if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)\nin vec3 surfaceAlbedo,\n#endif\n#ifdef SS_REFRACTION\nin vec3 vPositionW,\nin vec3 viewDirectionW,\nin mat4 view,\nin vec4 vRefractionInfos,\nin mat4 refractionMatrix,\nin vec4 vRefractionMicrosurfaceInfos,\nin vec4 vLightingIntensity,\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nin float alpha,\n#endif\n#ifdef SS_LODINREFRACTIONALPHA\nin float NdotVUnclamped,\n#endif\n#ifdef SS_LINEARSPECULARREFRACTION\nin float roughness,\n#endif\nin float alphaG,\n#ifdef SS_REFRACTIONMAP_3D\nin samplerCube refractionSampler,\n#ifndef LODBASEDMICROSFURACE\nin samplerCube refractionSamplerLow,\nin samplerCube refractionSamplerHigh,\n#endif\n#else\nin sampler2D refractionSampler,\n#ifndef LODBASEDMICROSFURACE\nin sampler2D refractionSamplerLow,\nin sampler2D refractionSamplerHigh,\n#endif\n#endif\n#ifdef ANISOTROPIC\nin anisotropicOutParams anisotropicOut,\n#endif\n#ifdef REALTIME_FILTERING\nin vec2 vRefractionFilteringInfo,\n#endif\n#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\nin vec3 refractionPosition,\nin vec3 refractionSize,\n#endif\n#ifdef SS_DISPERSION\nin float dispersion,\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nin vec3 vDiffusionDistance,\n#endif\nout subSurfaceOutParams outParams\n)\n{outParams.specularEnvironmentReflectance=specularEnvironmentReflectance;\n#ifdef SS_REFRACTION\nfloat refractionIntensity=vSubSurfaceIntensity.x;\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nrefractionIntensity*=(1.0-alpha);outParams.alpha=1.0;\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nfloat translucencyIntensity=vSubSurfaceIntensity.y;\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\n#if defined(SS_USE_GLTF_TEXTURES)\nfloat thickness=thicknessMap.g*vThicknessParam.y+vThicknessParam.x;\n#else\nfloat thickness=thicknessMap.r*vThicknessParam.y+vThicknessParam.x;\n#endif\n#if DEBUGMODE>0\noutParams.thicknessMap=thicknessMap;\n#endif\n#ifdef SS_MASK_FROM_THICKNESS_TEXTURE\n#if defined(SS_REFRACTION) && defined(SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE)\n#if defined(SS_USE_GLTF_TEXTURES)\nrefractionIntensity*=thicknessMap.r;\n#else\nrefractionIntensity*=thicknessMap.g;\n#endif\n#endif\n#if defined(SS_TRANSLUCENCY) && defined(SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE)\ntranslucencyIntensity*=thicknessMap.b;\n#endif\n#endif\n#else\nfloat thickness=vThicknessParam.y;\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\n#ifdef SS_USE_GLTF_TEXTURES\nrefractionIntensity*=refractionIntensityMap.r;\n#else\nrefractionIntensity*=refractionIntensityMap.g;\n#endif\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\ntranslucencyIntensity*=translucencyIntensityMap.b;\n#endif\n#ifdef SS_TRANSLUCENCY\nthickness=maxEps(thickness);vec3 transmittance=transmittanceBRDF_Burley(vTintColor.rgb,vDiffusionDistance,thickness);transmittance*=translucencyIntensity;outParams.transmittance=transmittance;outParams.translucencyIntensity=translucencyIntensity;\n#endif\n#ifdef SS_REFRACTION\nvec4 environmentRefraction=vec4(0.,0.,0.,0.);\n#ifdef SS_HAS_THICKNESS\nfloat ior=vRefractionInfos.y;\n#else\nfloat ior=vRefractionMicrosurfaceInfos.w;\n#endif\n#ifdef SS_LODINREFRACTIONALPHA\nfloat refractionAlphaG=alphaG;refractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));float refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,refractionAlphaG,NdotVUnclamped);\n#elif defined(SS_LINEARSPECULARREFRACTION)\nfloat refractionRoughness=alphaG;refractionRoughness=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));float refractionLOD=getLinearLodFromRoughness(vRefractionMicrosurfaceInfos.x,refractionRoughness);\n#else\nfloat refractionAlphaG=alphaG;refractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));float refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,refractionAlphaG);\n#endif\n#ifdef SS_DISPERSION\nfloat realIOR=1.0/ior;float iorDispersionSpread=0.04*dispersion*(realIOR-1.0);vec3 iors=vec3(1.0/(realIOR-iorDispersionSpread),ior,1.0/(realIOR+iorDispersionSpread));for (int i=0; i<3; i++) {ior=iors[i];\n#endif\nvec4 envSample=sampleEnvironmentRefraction(ior,thickness,refractionLOD,normalW,vPositionW,viewDirectionW,view,vRefractionInfos,refractionMatrix,vRefractionMicrosurfaceInfos,alphaG\n#ifdef SS_REFRACTIONMAP_3D\n,refractionSampler\n#ifndef LODBASEDMICROSFURACE\n,refractionSamplerLow\n,refractionSamplerHigh\n#endif\n#else\n,refractionSampler\n#ifndef LODBASEDMICROSFURACE\n,refractionSamplerLow\n,refractionSamplerHigh\n#endif\n#endif\n#ifdef ANISOTROPIC\n,anisotropicOut\n#endif\n#ifdef REALTIME_FILTERING\n,vRefractionFilteringInfo\n#endif\n#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\n,refractionPosition\n,refractionSize\n#endif\n);\n#ifdef SS_DISPERSION\nenvironmentRefraction[i]=envSample[i];}\n#else\nenvironmentRefraction=envSample;\n#endif\nenvironmentRefraction.rgb*=vRefractionInfos.x;\n#endif\n#ifdef SS_REFRACTION\nvec3 refractionTransmittance=vec3(refractionIntensity);\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);refractionTransmittance*=cocaLambert(volumeAlbedo,thickness);\n#elif defined(SS_LINKREFRACTIONTOTRANSPARENCY)\nfloat maxChannel=max(max(surfaceAlbedo.r,surfaceAlbedo.g),surfaceAlbedo.b);vec3 volumeAlbedo=saturate(maxChannel*surfaceAlbedo);environmentRefraction.rgb*=volumeAlbedo;\n#else\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);refractionTransmittance*=cocaLambert(volumeAlbedo,vThicknessParam.y);\n#endif\n#ifdef SS_ALBEDOFORREFRACTIONTINT\nenvironmentRefraction.rgb*=surfaceAlbedo.rgb;\n#endif\noutParams.surfaceAlbedo=surfaceAlbedo*(1.-refractionIntensity);\n#ifdef REFLECTION\noutParams.refractionFactorForIrradiance=(1.-refractionIntensity);\n#endif\n#ifdef UNUSED_MULTIPLEBOUNCES\nvec3 bounceSpecularEnvironmentReflectance=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);outParams.specularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,refractionIntensity);\n#endif\nrefractionTransmittance*=1.0-outParams.specularEnvironmentReflectance;\n#if DEBUGMODE>0\noutParams.refractionTransmittance=refractionTransmittance;\n#endif\noutParams.finalRefraction=environmentRefraction.rgb*refractionTransmittance*vLightingIntensity.z;\n#if DEBUGMODE>0\noutParams.environmentRefraction=environmentRefraction;\n#endif\n#endif\n#if defined(REFLECTION) && defined(SS_TRANSLUCENCY)\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX) || !defined(USESPHERICALFROMREFLECTIONMAP)\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;\n#ifdef REFLECTIONMAP_OPPOSITEZ\nirradianceVector.z*=-1.0;\n#endif\n#ifdef INVERTCUBICMAP\nirradianceVector.y*=-1.0;\n#endif\n#else\nvec3 irradianceVector=irradianceVector_;\n#endif\n#if defined(USESPHERICALFROMREFLECTIONMAP)\n#if defined(REALTIME_FILTERING)\nvec3 refractionIrradiance=irradiance(reflectionSampler,-irradianceVector,vReflectionFilteringInfo);\n#else\nvec3 refractionIrradiance=computeEnvironmentIrradiance(-irradianceVector);\n#endif\n#elif defined(USEIRRADIANCEMAP)\n#ifdef REFLECTIONMAP_3D\nvec3 irradianceCoords=irradianceVector;\n#else\nvec2 irradianceCoords=irradianceVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nirradianceCoords/=irradianceVector.z;\n#endif\nirradianceCoords.y=1.0-irradianceCoords.y;\n#endif\nvec4 refractionIrradiance=sampleReflection(irradianceSampler,-irradianceCoords);\n#ifdef RGBDREFLECTION\nrefractionIrradiance.rgb=fromRGBD(refractionIrradiance);\n#endif\n#ifdef GAMMAREFLECTION\nrefractionIrradiance.rgb=toLinearSpace(refractionIrradiance.rgb);\n#endif\n#else\nvec4 refractionIrradiance=vec4(0.);\n#endif\nrefractionIrradiance.rgb*=transmittance;\n#ifdef SS_ALBEDOFORTRANSLUCENCYTINT\nrefractionIrradiance.rgb*=surfaceAlbedo.rgb;\n#endif\noutParams.refractionIrradiance=refractionIrradiance.rgb;\n#endif\n}\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockSubSurface = { name, shader };\n"]}
1
+ {"version":3,"file":"pbrBlockSubSurface.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/pbrBlockSubSurface.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Xd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"pbrBlockSubSurface\";\nconst shader = `struct subSurfaceOutParams\n{vec3 specularEnvironmentReflectance;\n#ifdef SS_REFRACTION\nvec3 finalRefraction;vec3 surfaceAlbedo;\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nfloat alpha;\n#endif\n#ifdef REFLECTION\nfloat refractionFactorForIrradiance;\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nvec3 transmittance;float translucencyIntensity;\n#ifdef REFLECTION\nvec3 refractionIrradiance;\n#endif\n#endif\n#if DEBUGMODE>0\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nvec4 thicknessMap;\n#endif\n#ifdef SS_REFRACTION\nvec4 environmentRefraction;vec3 refractionTransmittance;\n#endif\n#endif\n};\n#ifdef SUBSURFACE\n#define pbr_inline\n#define inline\n#ifdef SS_REFRACTION\nvec4 sampleEnvironmentRefraction(\nin float ior\n,in float thickness\n,in float refractionLOD\n,in vec3 normalW\n,in vec3 vPositionW\n,in vec3 viewDirectionW\n,in mat4 view\n,in vec4 vRefractionInfos\n,in mat4 refractionMatrix\n,in vec4 vRefractionMicrosurfaceInfos\n,in float alphaG\n#ifdef SS_REFRACTIONMAP_3D\n,in samplerCube refractionSampler\n#ifndef LODBASEDMICROSFURACE\n,in samplerCube refractionSamplerLow\n,in samplerCube refractionSamplerHigh\n#endif\n#else\n,in sampler2D refractionSampler\n#ifndef LODBASEDMICROSFURACE\n,in sampler2D refractionSamplerLow\n,in sampler2D refractionSamplerHigh\n#endif\n#endif\n#ifdef ANISOTROPIC\n,in anisotropicOutParams anisotropicOut\n#endif\n#ifdef REALTIME_FILTERING\n,in vec2 vRefractionFilteringInfo\n#endif\n#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\n,in vec3 refractionPosition\n,in vec3 refractionSize\n#endif\n) {vec4 environmentRefraction=vec4(0.,0.,0.,0.);\n#ifdef ANISOTROPIC\nvec3 refractionVector=refract(-viewDirectionW,anisotropicOut.anisotropicNormal,ior);\n#else\nvec3 refractionVector=refract(-viewDirectionW,normalW,ior);\n#endif\n#ifdef SS_REFRACTIONMAP_OPPOSITEZ\nrefractionVector.z*=-1.0;\n#endif\n#ifdef SS_REFRACTIONMAP_3D\n#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\nrefractionVector=parallaxCorrectNormal(vPositionW,refractionVector,refractionSize,refractionPosition);\n#endif\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;vec3 refractionCoords=refractionVector;refractionCoords=vec3(refractionMatrix*vec4(refractionCoords,0));\n#else\n#ifdef SS_USE_THICKNESS_AS_DEPTH\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*thickness,1.0)));\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\n#endif\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;refractionCoords.y=1.0-refractionCoords.y;\n#endif\n#ifdef LODBASEDMICROSFURACE\nrefractionLOD=refractionLOD*vRefractionMicrosurfaceInfos.y+vRefractionMicrosurfaceInfos.z;\n#ifdef SS_LODINREFRACTIONALPHA\nfloat automaticRefractionLOD=UNPACK_LOD(sampleRefraction(refractionSampler,refractionCoords).a);float requestedRefractionLOD=max(automaticRefractionLOD,refractionLOD);\n#else\nfloat requestedRefractionLOD=refractionLOD;\n#endif\n#if defined(REALTIME_FILTERING) && defined(SS_REFRACTIONMAP_3D)\nenvironmentRefraction=vec4(radiance(alphaG,refractionSampler,refractionCoords,vRefractionFilteringInfo),1.0);\n#else\nenvironmentRefraction=sampleRefractionLod(refractionSampler,refractionCoords,requestedRefractionLOD);\n#endif\n#else\nfloat lodRefractionNormalized=saturate(refractionLOD/log2(vRefractionMicrosurfaceInfos.x));float lodRefractionNormalizedDoubled=lodRefractionNormalized*2.0;vec4 environmentRefractionMid=sampleRefraction(refractionSampler,refractionCoords);if (lodRefractionNormalizedDoubled<1.0){environmentRefraction=mix(\nsampleRefraction(refractionSamplerHigh,refractionCoords),\nenvironmentRefractionMid,\nlodRefractionNormalizedDoubled\n);} else {environmentRefraction=mix(\nenvironmentRefractionMid,\nsampleRefraction(refractionSamplerLow,refractionCoords),\nlodRefractionNormalizedDoubled-1.0\n);}\n#endif\n#ifdef SS_RGBDREFRACTION\nenvironmentRefraction.rgb=fromRGBD(environmentRefraction);\n#endif\n#ifdef SS_GAMMAREFRACTION\nenvironmentRefraction.rgb=toLinearSpace(environmentRefraction.rgb);\n#endif\nreturn environmentRefraction;}\n#endif\nvoid subSurfaceBlock(\nin vec3 vSubSurfaceIntensity,\nin vec2 vThicknessParam,\nin vec4 vTintColor,\nin vec3 normalW,\nin vec3 specularEnvironmentReflectance,\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nin vec4 thicknessMap,\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\nin vec4 refractionIntensityMap,\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\nin vec4 translucencyIntensityMap,\n#endif\n#ifdef REFLECTION\n#ifdef SS_TRANSLUCENCY\nin mat4 reflectionMatrix,\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nin vec3 irradianceVector_,\n#endif\n#if defined(REALTIME_FILTERING)\nin samplerCube reflectionSampler,\nin vec2 vReflectionFilteringInfo,\n#endif\n#endif\n#ifdef USEIRRADIANCEMAP\n#ifdef REFLECTIONMAP_3D\nin samplerCube irradianceSampler,\n#else\nin sampler2D irradianceSampler,\n#endif\n#endif\n#endif\n#endif\n#if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)\nin vec3 surfaceAlbedo,\n#endif\n#ifdef SS_REFRACTION\nin vec3 vPositionW,\nin vec3 viewDirectionW,\nin mat4 view,\nin vec4 vRefractionInfos,\nin mat4 refractionMatrix,\nin vec4 vRefractionMicrosurfaceInfos,\nin vec4 vLightingIntensity,\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nin float alpha,\n#endif\n#ifdef SS_LODINREFRACTIONALPHA\nin float NdotVUnclamped,\n#endif\n#ifdef SS_LINEARSPECULARREFRACTION\nin float roughness,\n#endif\nin float alphaG,\n#ifdef SS_REFRACTIONMAP_3D\nin samplerCube refractionSampler,\n#ifndef LODBASEDMICROSFURACE\nin samplerCube refractionSamplerLow,\nin samplerCube refractionSamplerHigh,\n#endif\n#else\nin sampler2D refractionSampler,\n#ifndef LODBASEDMICROSFURACE\nin sampler2D refractionSamplerLow,\nin sampler2D refractionSamplerHigh,\n#endif\n#endif\n#ifdef ANISOTROPIC\nin anisotropicOutParams anisotropicOut,\n#endif\n#ifdef REALTIME_FILTERING\nin vec2 vRefractionFilteringInfo,\n#endif\n#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\nin vec3 refractionPosition,\nin vec3 refractionSize,\n#endif\n#ifdef SS_DISPERSION\nin float dispersion,\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nin vec3 vDiffusionDistance,\n#endif\nout subSurfaceOutParams outParams\n)\n{outParams.specularEnvironmentReflectance=specularEnvironmentReflectance;\n#ifdef SS_REFRACTION\nfloat refractionIntensity=vSubSurfaceIntensity.x;\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nrefractionIntensity*=(1.0-alpha);outParams.alpha=1.0;\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nfloat translucencyIntensity=vSubSurfaceIntensity.y;\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\n#if defined(SS_USE_GLTF_TEXTURES)\nfloat thickness=thicknessMap.g*vThicknessParam.y+vThicknessParam.x;\n#else\nfloat thickness=thicknessMap.r*vThicknessParam.y+vThicknessParam.x;\n#endif\n#if DEBUGMODE>0\noutParams.thicknessMap=thicknessMap;\n#endif\n#ifdef SS_MASK_FROM_THICKNESS_TEXTURE\n#if defined(SS_REFRACTION) && defined(SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE)\n#if defined(SS_USE_GLTF_TEXTURES)\nrefractionIntensity*=thicknessMap.r;\n#else\nrefractionIntensity*=thicknessMap.g;\n#endif\n#endif\n#if defined(SS_TRANSLUCENCY) && defined(SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE)\ntranslucencyIntensity*=thicknessMap.b;\n#endif\n#endif\n#else\nfloat thickness=vThicknessParam.y;\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\n#ifdef SS_USE_GLTF_TEXTURES\nrefractionIntensity*=refractionIntensityMap.r;\n#else\nrefractionIntensity*=refractionIntensityMap.g;\n#endif\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\ntranslucencyIntensity*=translucencyIntensityMap.b;\n#endif\n#ifdef SS_TRANSLUCENCY\nthickness=maxEps(thickness);vec3 transmittance=transmittanceBRDF_Burley(vTintColor.rgb,vDiffusionDistance,thickness);transmittance*=translucencyIntensity;outParams.transmittance=transmittance;outParams.translucencyIntensity=translucencyIntensity;\n#endif\n#ifdef SS_REFRACTION\nvec4 environmentRefraction=vec4(0.,0.,0.,0.);\n#ifdef SS_HAS_THICKNESS\nfloat ior=vRefractionInfos.y;\n#else\nfloat ior=vRefractionMicrosurfaceInfos.w;\n#endif\n#ifdef SS_LODINREFRACTIONALPHA\nfloat refractionAlphaG=alphaG;refractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));float refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,refractionAlphaG,NdotVUnclamped);\n#elif defined(SS_LINEARSPECULARREFRACTION)\nfloat refractionRoughness=alphaG;refractionRoughness=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));float refractionLOD=getLinearLodFromRoughness(vRefractionMicrosurfaceInfos.x,refractionRoughness);\n#else\nfloat refractionAlphaG=alphaG;refractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));float refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,refractionAlphaG);\n#endif\nfloat refraction_ior=vRefractionInfos.y;\n#ifdef SS_DISPERSION\nfloat realIOR=1.0/refraction_ior;float iorDispersionSpread=0.04*dispersion*(realIOR-1.0);vec3 iors=vec3(1.0/(realIOR-iorDispersionSpread),refraction_ior,1.0/(realIOR+iorDispersionSpread));for (int i=0; i<3; i++) {refraction_ior=iors[i];\n#endif\nvec4 envSample=sampleEnvironmentRefraction(refraction_ior,thickness,refractionLOD,normalW,vPositionW,viewDirectionW,view,vRefractionInfos,refractionMatrix,vRefractionMicrosurfaceInfos,alphaG\n#ifdef SS_REFRACTIONMAP_3D\n,refractionSampler\n#ifndef LODBASEDMICROSFURACE\n,refractionSamplerLow\n,refractionSamplerHigh\n#endif\n#else\n,refractionSampler\n#ifndef LODBASEDMICROSFURACE\n,refractionSamplerLow\n,refractionSamplerHigh\n#endif\n#endif\n#ifdef ANISOTROPIC\n,anisotropicOut\n#endif\n#ifdef REALTIME_FILTERING\n,vRefractionFilteringInfo\n#endif\n#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\n,refractionPosition\n,refractionSize\n#endif\n);\n#ifdef SS_DISPERSION\nenvironmentRefraction[i]=envSample[i];}\n#else\nenvironmentRefraction=envSample;\n#endif\nenvironmentRefraction.rgb*=vRefractionInfos.x;\n#endif\n#ifdef SS_REFRACTION\nvec3 refractionTransmittance=vec3(refractionIntensity);\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);refractionTransmittance*=cocaLambert(volumeAlbedo,thickness);\n#elif defined(SS_LINKREFRACTIONTOTRANSPARENCY)\nfloat maxChannel=max(max(surfaceAlbedo.r,surfaceAlbedo.g),surfaceAlbedo.b);vec3 volumeAlbedo=saturate(maxChannel*surfaceAlbedo);environmentRefraction.rgb*=volumeAlbedo;\n#else\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);refractionTransmittance*=cocaLambert(volumeAlbedo,vThicknessParam.y);\n#endif\n#ifdef SS_ALBEDOFORREFRACTIONTINT\nenvironmentRefraction.rgb*=surfaceAlbedo.rgb;\n#endif\noutParams.surfaceAlbedo=surfaceAlbedo*(1.-refractionIntensity);\n#ifdef REFLECTION\noutParams.refractionFactorForIrradiance=(1.-refractionIntensity);\n#endif\n#ifdef UNUSED_MULTIPLEBOUNCES\nvec3 bounceSpecularEnvironmentReflectance=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);outParams.specularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,refractionIntensity);\n#endif\nrefractionTransmittance*=1.0-outParams.specularEnvironmentReflectance;\n#if DEBUGMODE>0\noutParams.refractionTransmittance=refractionTransmittance;\n#endif\noutParams.finalRefraction=environmentRefraction.rgb*refractionTransmittance*vLightingIntensity.z;\n#if DEBUGMODE>0\noutParams.environmentRefraction=environmentRefraction;\n#endif\n#endif\n#if defined(REFLECTION) && defined(SS_TRANSLUCENCY)\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX) || !defined(USESPHERICALFROMREFLECTIONMAP)\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;\n#ifdef REFLECTIONMAP_OPPOSITEZ\nirradianceVector.z*=-1.0;\n#endif\n#ifdef INVERTCUBICMAP\nirradianceVector.y*=-1.0;\n#endif\n#else\nvec3 irradianceVector=irradianceVector_;\n#endif\n#if defined(USESPHERICALFROMREFLECTIONMAP)\n#if defined(REALTIME_FILTERING)\nvec3 refractionIrradiance=irradiance(reflectionSampler,-irradianceVector,vReflectionFilteringInfo);\n#else\nvec3 refractionIrradiance=computeEnvironmentIrradiance(-irradianceVector);\n#endif\n#elif defined(USEIRRADIANCEMAP)\n#ifdef REFLECTIONMAP_3D\nvec3 irradianceCoords=irradianceVector;\n#else\nvec2 irradianceCoords=irradianceVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nirradianceCoords/=irradianceVector.z;\n#endif\nirradianceCoords.y=1.0-irradianceCoords.y;\n#endif\nvec4 refractionIrradiance=sampleReflection(irradianceSampler,-irradianceCoords);\n#ifdef RGBDREFLECTION\nrefractionIrradiance.rgb=fromRGBD(refractionIrradiance);\n#endif\n#ifdef GAMMAREFLECTION\nrefractionIrradiance.rgb=toLinearSpace(refractionIrradiance.rgb);\n#endif\n#else\nvec4 refractionIrradiance=vec4(0.);\n#endif\nrefractionIrradiance.rgb*=transmittance;\n#ifdef SS_ALBEDOFORTRANSLUCENCYTINT\nrefractionIrradiance.rgb*=surfaceAlbedo.rgb;\n#endif\noutParams.refractionIrradiance=refractionIrradiance.rgb;\n#endif\n}\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockSubSurface = { name, shader };\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonjs/core",
3
- "version": "6.33.2",
3
+ "version": "6.34.1",
4
4
  "main": "index.js",
5
5
  "module": "index.js",
6
6
  "types": "index.d.ts",