@zephyr3d/scene 0.8.2 → 0.9.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.
- package/dist/animation/animationset.js +473 -60
- package/dist/animation/animationset.js.map +1 -1
- package/dist/animation/cloth/gpu_cloth_system.js +2516 -0
- package/dist/animation/cloth/gpu_cloth_system.js.map +1 -0
- package/dist/animation/fixed_geometry_cache_track.js +138 -0
- package/dist/animation/fixed_geometry_cache_track.js.map +1 -0
- package/dist/animation/geometry_cache_utils.js +120 -0
- package/dist/animation/geometry_cache_utils.js.map +1 -0
- package/dist/animation/ik_modifier.js +9 -1
- package/dist/animation/ik_modifier.js.map +1 -1
- package/dist/animation/joint_dynamics/collision.js +469 -0
- package/dist/animation/joint_dynamics/collision.js.map +1 -0
- package/dist/animation/joint_dynamics/constraints.js +329 -0
- package/dist/animation/joint_dynamics/constraints.js.map +1 -0
- package/dist/animation/joint_dynamics/controller.js +699 -0
- package/dist/animation/joint_dynamics/controller.js.map +1 -0
- package/dist/animation/joint_dynamics/joint_dynamics_system.js +393 -0
- package/dist/animation/joint_dynamics/joint_dynamics_system.js.map +1 -0
- package/dist/animation/joint_dynamics/solver.js +794 -0
- package/dist/animation/joint_dynamics/solver.js.map +1 -0
- package/dist/animation/joint_dynamics/types.js +19 -0
- package/dist/animation/joint_dynamics/types.js.map +1 -0
- package/dist/animation/joint_dynamics/vrm_spring_bone.js +46 -0
- package/dist/animation/joint_dynamics/vrm_spring_bone.js.map +1 -0
- package/dist/animation/joint_dynamics_modifier.js +51 -0
- package/dist/animation/joint_dynamics_modifier.js.map +1 -0
- package/dist/animation/pca_geometry_cache_track.js +222 -0
- package/dist/animation/pca_geometry_cache_track.js.map +1 -0
- package/dist/animation/skeleton.js +2011 -139
- package/dist/animation/skeleton.js.map +1 -1
- package/dist/animation/skeleton_modifier.js +3 -5
- package/dist/animation/skeleton_modifier.js.map +1 -1
- package/dist/animation/spring/multi_chain_spring_system.js +2 -0
- package/dist/animation/spring/multi_chain_spring_system.js.map +1 -1
- package/dist/animation/spring/spring_chain.js +3 -2
- package/dist/animation/spring/spring_chain.js.map +1 -1
- package/dist/animation/spring/spring_collider.js +35 -5
- package/dist/animation/spring/spring_collider.js.map +1 -1
- package/dist/animation/spring/spring_particle.js +1 -0
- package/dist/animation/spring/spring_particle.js.map +1 -1
- package/dist/animation/spring/spring_system.js +325 -28
- package/dist/animation/spring/spring_system.js.map +1 -1
- package/dist/animation/spring2/collision.js +469 -0
- package/dist/animation/spring2/collision.js.map +1 -0
- package/dist/animation/spring2/constraints.js +329 -0
- package/dist/animation/spring2/constraints.js.map +1 -0
- package/dist/animation/spring2/controller.js +434 -0
- package/dist/animation/spring2/controller.js.map +1 -0
- package/dist/animation/spring2/math.js +16 -0
- package/dist/animation/spring2/math.js.map +1 -0
- package/dist/animation/spring2/solver.js +624 -0
- package/dist/animation/spring2/solver.js.map +1 -0
- package/dist/animation/spring2/spring_system.js +118 -0
- package/dist/animation/spring2/spring_system.js.map +1 -0
- package/dist/animation/spring2/types.js +19 -0
- package/dist/animation/spring2/types.js.map +1 -0
- package/dist/animation/spring_modifier.js +17 -1
- package/dist/animation/spring_modifier.js.map +1 -1
- package/dist/app/engine.js +42 -15
- package/dist/app/engine.js.map +1 -1
- package/dist/app/runtimescript.js +132 -1
- package/dist/app/runtimescript.js.map +1 -1
- package/dist/app/screen.js +3 -3
- package/dist/app/screen.js.map +1 -1
- package/dist/app/scriptingsystem.js +69 -37
- package/dist/app/scriptingsystem.js.map +1 -1
- package/dist/app/scriptregistry.js +14 -3
- package/dist/app/scriptregistry.js.map +1 -1
- package/dist/asset/assetmanager.js +2 -1
- package/dist/asset/assetmanager.js.map +1 -1
- package/dist/asset/loaders/zabc/zabc_loader.js +570 -0
- package/dist/asset/loaders/zabc/zabc_loader.js.map +1 -0
- package/dist/asset/model.js +192 -0
- package/dist/asset/model.js.map +1 -1
- package/dist/camera/base.js +26 -7
- package/dist/camera/base.js.map +1 -1
- package/dist/camera/camera.js +146 -24
- package/dist/camera/camera.js.map +1 -1
- package/dist/camera/fps.js +2 -2
- package/dist/camera/fps.js.map +1 -1
- package/dist/camera/orbit.js +2 -2
- package/dist/camera/orbit.js.map +1 -1
- package/dist/index.d.ts +11728 -8535
- package/dist/index.js +29 -8
- package/dist/index.js.map +1 -1
- package/dist/material/lambert.js +1 -1
- package/dist/material/lambert.js.map +1 -1
- package/dist/material/material.js +9 -3
- package/dist/material/material.js.map +1 -1
- package/dist/material/meshmaterial.js +54 -7
- package/dist/material/meshmaterial.js.map +1 -1
- package/dist/material/mixins/lightmodel/blinnphong.js +17 -7
- package/dist/material/mixins/lightmodel/blinnphong.js.map +1 -1
- package/dist/material/mixins/lightmodel/lambert.js +7 -2
- package/dist/material/mixins/lightmodel/lambert.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrblueprintmixin.js +108 -16
- package/dist/material/mixins/lightmodel/pbrblueprintmixin.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js +209 -14
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrspecularglossness.js +24 -12
- package/dist/material/mixins/lightmodel/pbrspecularglossness.js.map +1 -1
- package/dist/material/mixins/lit.js +11 -8
- package/dist/material/mixins/lit.js.map +1 -1
- package/dist/material/mixins/pbr/common.js +72 -5
- package/dist/material/mixins/pbr/common.js.map +1 -1
- package/dist/material/pbrblueprint.js +148 -1
- package/dist/material/pbrblueprint.js.map +1 -1
- package/dist/material/pbrmr.js +115 -2
- package/dist/material/pbrmr.js.map +1 -1
- package/dist/material/shader/helper.js +10 -4
- package/dist/material/shader/helper.js.map +1 -1
- package/dist/material/water.js +2 -2
- package/dist/material/water.js.map +1 -1
- package/dist/posteffect/coloradjust.js +145 -0
- package/dist/posteffect/coloradjust.js.map +1 -0
- package/dist/posteffect/taa.js +68 -32
- package/dist/posteffect/taa.js.map +1 -1
- package/dist/render/cluster_light.js +17 -12
- package/dist/render/cluster_light.js.map +1 -1
- package/dist/render/deferredlightpass.js +510 -0
- package/dist/render/deferredlightpass.js.map +1 -0
- package/dist/render/deferredshadowlightpass.js +428 -0
- package/dist/render/deferredshadowlightpass.js.map +1 -0
- package/dist/render/drawable.js.map +1 -1
- package/dist/render/drawable_mixin.js +21 -12
- package/dist/render/drawable_mixin.js.map +1 -1
- package/dist/render/envlight.js +20 -22
- package/dist/render/envlight.js.map +1 -1
- package/dist/render/gbufferpass.js +50 -0
- package/dist/render/gbufferpass.js.map +1 -0
- package/dist/render/lightpass.js +1 -2
- package/dist/render/lightpass.js.map +1 -1
- package/dist/render/primitive.js +1 -1
- package/dist/render/primitive.js.map +1 -1
- package/dist/render/render_queue.js +3 -2
- package/dist/render/render_queue.js.map +1 -1
- package/dist/render/renderer.js +5 -358
- package/dist/render/renderer.js.map +1 -1
- package/dist/render/rendergraph/executor.js +15 -12
- package/dist/render/rendergraph/executor.js.map +1 -1
- package/dist/render/rendergraph/forward_plus_builder.js +144 -88
- package/dist/render/rendergraph/forward_plus_builder.js.map +1 -1
- package/dist/render/rendergraph/history_resource_manager.js +178 -0
- package/dist/render/rendergraph/history_resource_manager.js.map +1 -0
- package/dist/render/rendergraph/rendergraph.js +12 -1
- package/dist/render/rendergraph/rendergraph.js.map +1 -1
- package/dist/render/rendergraph/types.js +2 -2
- package/dist/render/rendergraph/types.js.map +1 -1
- package/dist/render/sky.js +26 -9
- package/dist/render/sky.js.map +1 -1
- package/dist/scene/basesprite.js +4 -3
- package/dist/scene/basesprite.js.map +1 -1
- package/dist/scene/batchgroup.js +4 -4
- package/dist/scene/environment.js +7 -4
- package/dist/scene/environment.js.map +1 -1
- package/dist/scene/light.js +184 -18
- package/dist/scene/light.js.map +1 -1
- package/dist/scene/mesh.js +30 -0
- package/dist/scene/mesh.js.map +1 -1
- package/dist/scene/particlesys.js +3 -2
- package/dist/scene/particlesys.js.map +1 -1
- package/dist/scene/raycast_visitor.js +29 -3
- package/dist/scene/raycast_visitor.js.map +1 -1
- package/dist/scene/scene.js +86 -19
- package/dist/scene/scene.js.map +1 -1
- package/dist/scene/scene_node.js +87 -31
- package/dist/scene/scene_node.js.map +1 -1
- package/dist/scene/script_attachment.js +59 -0
- package/dist/scene/script_attachment.js.map +1 -0
- package/dist/scene/terrain-cm/grass.js +3 -2
- package/dist/scene/terrain-cm/grass.js.map +1 -1
- package/dist/scene/terrain-cm/terrain-cm.js +4 -3
- package/dist/scene/terrain-cm/terrain-cm.js.map +1 -1
- package/dist/scene/water.js +3 -2
- package/dist/scene/water.js.map +1 -1
- package/dist/shaders/shadow.js +2 -2
- package/dist/shaders/shadow.js.map +1 -1
- package/dist/shadow/shadowmapper.js +74 -4
- package/dist/shadow/shadowmapper.js.map +1 -1
- package/dist/shapes/box.js +163 -0
- package/dist/shapes/box.js.map +1 -1
- package/dist/shapes/capsule.js +216 -0
- package/dist/shapes/capsule.js.map +1 -0
- package/dist/shapes/cylinder.js +91 -0
- package/dist/shapes/cylinder.js.map +1 -1
- package/dist/shapes/plane.js +32 -0
- package/dist/shapes/plane.js.map +1 -1
- package/dist/shapes/tetrahedron.js +211 -0
- package/dist/shapes/tetrahedron.js.map +1 -1
- package/dist/shapes/torus.js +173 -0
- package/dist/shapes/torus.js.map +1 -1
- package/dist/utility/blueprint/common/math.js +111 -1
- package/dist/utility/blueprint/common/math.js.map +1 -1
- package/dist/utility/blueprint/material/inputs.js +235 -1
- package/dist/utility/blueprint/material/inputs.js.map +1 -1
- package/dist/utility/blueprint/material/ir.js +154 -10
- package/dist/utility/blueprint/material/ir.js.map +1 -1
- package/dist/utility/blueprint/material/texture.js +273 -19
- package/dist/utility/blueprint/material/texture.js.map +1 -1
- package/dist/utility/serialization/json.js +12 -2
- package/dist/utility/serialization/json.js.map +1 -1
- package/dist/utility/serialization/manager.js +30 -11
- package/dist/utility/serialization/manager.js.map +1 -1
- package/dist/utility/serialization/scene/animation.js +250 -7
- package/dist/utility/serialization/scene/animation.js.map +1 -1
- package/dist/utility/serialization/scene/batch.js +4 -2
- package/dist/utility/serialization/scene/batch.js.map +1 -1
- package/dist/utility/serialization/scene/camera.js +154 -2
- package/dist/utility/serialization/scene/camera.js.map +1 -1
- package/dist/utility/serialization/scene/cloth_script.js +834 -0
- package/dist/utility/serialization/scene/cloth_script.js.map +1 -0
- package/dist/utility/serialization/scene/common.js +7 -0
- package/dist/utility/serialization/scene/common.js.map +1 -1
- package/dist/utility/serialization/scene/light.js +120 -4
- package/dist/utility/serialization/scene/light.js.map +1 -1
- package/dist/utility/serialization/scene/material.js +453 -1
- package/dist/utility/serialization/scene/material.js.map +1 -1
- package/dist/utility/serialization/scene/mesh.js +4 -2
- package/dist/utility/serialization/scene/mesh.js.map +1 -1
- package/dist/utility/serialization/scene/node.js +298 -10
- package/dist/utility/serialization/scene/node.js.map +1 -1
- package/dist/utility/serialization/scene/particle.js +4 -2
- package/dist/utility/serialization/scene/particle.js.map +1 -1
- package/dist/utility/serialization/scene/primitive.js +100 -3
- package/dist/utility/serialization/scene/primitive.js.map +1 -1
- package/dist/utility/serialization/scene/scene.js +130 -3
- package/dist/utility/serialization/scene/scene.js.map +1 -1
- package/dist/utility/serialization/scene/script.js +66 -0
- package/dist/utility/serialization/scene/script.js.map +1 -0
- package/dist/utility/serialization/scene/spring_script.js +596 -0
- package/dist/utility/serialization/scene/spring_script.js.map +1 -0
- package/dist/utility/serialization/scene/sprite.js +5 -3
- package/dist/utility/serialization/scene/sprite.js.map +1 -1
- package/dist/utility/serialization/scene/terrain.js +4 -2
- package/dist/utility/serialization/scene/terrain.js.map +1 -1
- package/dist/utility/serialization/scene/water.js +4 -2
- package/dist/utility/serialization/scene/water.js.map +1 -1
- package/dist/utility/serialization/types.js.map +1 -1
- package/dist/values.js +5 -1
- package/dist/values.js.map +1 -1
- package/package.json +3 -3
|
@@ -2,8 +2,15 @@ import { applyMaterialMixins } from '../../meshmaterial.js';
|
|
|
2
2
|
import { mixinLight } from '../lit.js';
|
|
3
3
|
import { mixinPBRBRDF } from '../pbr/brdf.js';
|
|
4
4
|
import { ShaderHelper } from '../../shader/helper.js';
|
|
5
|
+
import { LIGHT_TYPE_RECT, LIGHT_TYPE_POINT } from '../../../values.js';
|
|
5
6
|
import { getGGXLUT } from '../../../utility/textures/ggxlut.js';
|
|
6
7
|
|
|
8
|
+
const PBR_REFLECTION_MODE = {
|
|
9
|
+
none: 0,
|
|
10
|
+
ggx: 1,
|
|
11
|
+
anisotropic: 2,
|
|
12
|
+
glint: 3
|
|
13
|
+
};
|
|
7
14
|
/**
|
|
8
15
|
* PBRBluePrint lighting model mixin
|
|
9
16
|
* @param BaseCls - Class to mix in
|
|
@@ -59,17 +66,73 @@ import { getGGXLUT } from '../../../utility/textures/ggxlut.js';
|
|
|
59
66
|
} else {
|
|
60
67
|
that.indirectLighting(this, this.viewVec, this.pbrData, this.lightingColor);
|
|
61
68
|
}
|
|
62
|
-
that.forEachLight(this, function(type, posRange, dirCutoff, colorIntensity, shadow) {
|
|
63
|
-
this.$
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
this.
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
that.forEachLight(this, function(type, posRange, dirCutoff, colorIntensity, extra, shadow) {
|
|
70
|
+
this.$if(pb.equal(type, LIGHT_TYPE_RECT), function() {
|
|
71
|
+
this.$l.center = posRange.xyz;
|
|
72
|
+
this.$l.range = posRange.w;
|
|
73
|
+
this.$l.ax = dirCutoff.xyz;
|
|
74
|
+
this.$l.ay = extra.xyz;
|
|
75
|
+
this.$l.halfWidth = pb.length(this.ax);
|
|
76
|
+
this.$l.halfHeight = pb.length(this.ay);
|
|
77
|
+
this.$l.area = pb.mul(this.halfWidth, this.halfHeight, 4);
|
|
78
|
+
this.$l.lightNormal = pb.normalize(pb.cross(this.ax, this.ay));
|
|
79
|
+
this.lightNormal = pb.neg(this.lightNormal);
|
|
80
|
+
this.$if(pb.greaterThan(this.area, 0), function() {
|
|
81
|
+
this.$l.baseColor = pb.mul(colorIntensity.rgb, colorIntensity.a, this.area, 0.25);
|
|
82
|
+
this.$l.samplePos = pb.vec3();
|
|
83
|
+
this.$l.Lvec = pb.vec3();
|
|
84
|
+
this.$l.L = pb.vec3();
|
|
85
|
+
this.$l.dist = pb.float();
|
|
86
|
+
this.$l.invDist2 = pb.float();
|
|
87
|
+
this.$l.NoL = pb.float();
|
|
88
|
+
this.$l.NoL_light = pb.float();
|
|
89
|
+
this.$l.falloff = pb.float();
|
|
90
|
+
this.$l.atten = pb.float();
|
|
91
|
+
this.$l.lightColor = pb.vec3();
|
|
92
|
+
const sample = (u, v)=>{
|
|
93
|
+
this.samplePos = pb.add(this.center, pb.add(pb.mul(this.ax, pb.sub(pb.mul(u, 2), 1)), pb.mul(this.ay, pb.sub(pb.mul(v, 2), 1))));
|
|
94
|
+
this.Lvec = pb.sub(this.samplePos, this.worldPos);
|
|
95
|
+
this.dist = pb.length(this.Lvec);
|
|
96
|
+
this.invDist2 = pb.div(1, pb.max(pb.mul(this.dist, this.dist), 0.0001));
|
|
97
|
+
this.L = pb.normalize(this.Lvec);
|
|
98
|
+
this.NoL = pb.clamp(pb.dot(this.pbrData.normal, this.L), 0, 1);
|
|
99
|
+
this.NoL_light = pb.clamp(pb.dot(this.lightNormal, pb.neg(this.L)), 0, 1);
|
|
100
|
+
this.$if(pb.greaterThan(this.NoL_light, 0), function() {
|
|
101
|
+
this.falloff = pb.float(1);
|
|
102
|
+
this.$if(pb.greaterThan(this.range, 0), function() {
|
|
103
|
+
this.falloff = pb.max(0, pb.sub(1, pb.div(this.dist, this.range)));
|
|
104
|
+
this.falloff = pb.mul(this.falloff, this.falloff);
|
|
105
|
+
});
|
|
106
|
+
this.atten = pb.mul(this.invDist2, this.NoL_light, this.falloff);
|
|
107
|
+
this.lightColor = pb.mul(this.baseColor, this.atten, this.NoL);
|
|
108
|
+
that.directLighting(this, this.L, this.lightColor, this.viewVec, this.pbrData, pb.float(1), pb.float(1), pb.float(0), this.lightingColor);
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
sample(0.25, 0.25);
|
|
112
|
+
sample(0.75, 0.25);
|
|
113
|
+
sample(0.25, 0.75);
|
|
114
|
+
sample(0.75, 0.75);
|
|
115
|
+
});
|
|
116
|
+
}).$else(function() {
|
|
117
|
+
this.$l.diffuse = pb.vec3();
|
|
118
|
+
this.$l.specular = pb.vec3();
|
|
119
|
+
this.$l.diffuseScale = pb.float(1);
|
|
120
|
+
this.$l.specularScale = pb.float(1);
|
|
121
|
+
this.$l.sourceRadiusFactor = pb.float(0);
|
|
122
|
+
this.$if(pb.equal(type, LIGHT_TYPE_POINT), function() {
|
|
123
|
+
this.diffuseScale = extra.x;
|
|
124
|
+
this.specularScale = extra.y;
|
|
125
|
+
this.sourceRadiusFactor = pb.div(extra.z, pb.max(pb.distance(posRange.xyz, this.worldPos), 0.0001));
|
|
126
|
+
});
|
|
127
|
+
this.$l.lightAtten = that.calculateLightAttenuation(this, type, this.worldPos, posRange, dirCutoff);
|
|
128
|
+
this.$l.lightDir = that.calculateLightDirection(this, type, this.worldPos, posRange, dirCutoff);
|
|
129
|
+
this.$l.NoL = pb.clamp(pb.dot(this.pbrData.normal, this.lightDir), 0, 1);
|
|
130
|
+
this.$l.lightColor = pb.mul(colorIntensity.rgb, colorIntensity.a, this.lightAtten, this.NoL);
|
|
131
|
+
if (shadow) {
|
|
132
|
+
this.lightColor = pb.mul(this.lightColor, that.calculateShadow(this, this.worldPos, this.NoL));
|
|
133
|
+
}
|
|
134
|
+
that.directLighting(this, this.lightDir, this.lightColor, this.viewVec, this.pbrData, this.diffuseScale, this.specularScale, this.sourceRadiusFactor, this.lightingColor);
|
|
135
|
+
});
|
|
73
136
|
});
|
|
74
137
|
this.$return(pb.vec4(pb.add(this.lightingColor, this.emissiveColor), this.pbrData.albedo.a));
|
|
75
138
|
});
|
|
@@ -82,6 +145,7 @@ import { getGGXLUT } from '../../../utility/textures/ggxlut.js';
|
|
|
82
145
|
const pb = scope.$builder;
|
|
83
146
|
super.fragmentShader(scope);
|
|
84
147
|
if (this.needFragmentColor()) {
|
|
148
|
+
scope.zReflectionMode = pb.float().uniform(2);
|
|
85
149
|
if (this.drawContext.drawEnvLight) {
|
|
86
150
|
scope.zGGXLut = pb.tex2D().uniform(2);
|
|
87
151
|
}
|
|
@@ -145,7 +209,7 @@ import { getGGXLUT } from '../../../utility/textures/ggxlut.js';
|
|
|
145
209
|
getOutput(outputs, name) {
|
|
146
210
|
return outputs.find((output)=>output.name === name)?.exp;
|
|
147
211
|
}
|
|
148
|
-
directLighting(scope, lightDir, lightColor, viewVec, commonData, outColor) {
|
|
212
|
+
directLighting(scope, lightDir, lightColor, viewVec, commonData, diffuseScale, specularScale, sourceRadiusFactor, outColor) {
|
|
149
213
|
const pb = scope.$builder;
|
|
150
214
|
const that = this;
|
|
151
215
|
const funcName = 'Z_PBRDirectLighting';
|
|
@@ -154,8 +218,12 @@ import { getGGXLUT } from '../../../utility/textures/ggxlut.js';
|
|
|
154
218
|
pb.vec3('lightColor'),
|
|
155
219
|
pb.vec3('viewVec'),
|
|
156
220
|
that.getCommonDatasStruct(scope)('data'),
|
|
221
|
+
pb.float('diffuseScale'),
|
|
222
|
+
pb.float('specularScale'),
|
|
223
|
+
pb.float('sourceRadiusFactor'),
|
|
157
224
|
pb.vec3('outColor').inout()
|
|
158
225
|
], function() {
|
|
226
|
+
this.$l.reflectionMode = this.zReflectionMode;
|
|
159
227
|
this.$l.H = pb.normalize(pb.add(this.viewVec, this.L));
|
|
160
228
|
this.$l.NoH = pb.clamp(pb.dot(this.data.normal, this.H), 0, 1);
|
|
161
229
|
this.$l.NoL = pb.clamp(pb.dot(this.data.normal, this.L), 0, 1);
|
|
@@ -164,17 +232,39 @@ import { getGGXLUT } from '../../../utility/textures/ggxlut.js';
|
|
|
164
232
|
this.$l.VoH = pb.clamp(pb.dot(this.viewVec, this.H), 0, 1);
|
|
165
233
|
this.$l.schlickFresnel = that.fresnelSchlick(this, this.VoH, this.data.f0.rgb, this.data.f90);
|
|
166
234
|
this.$l.F = this.schlickFresnel;
|
|
167
|
-
this.$l.
|
|
235
|
+
this.$l.specularRoughness = pb.clamp(pb.add(this.data.roughness, this.sourceRadiusFactor), 0, 1);
|
|
236
|
+
this.$l.alphaRoughness = pb.mul(this.specularRoughness, this.specularRoughness);
|
|
168
237
|
this.$l.D = that.distributionGGX(this, this.NoH, this.alphaRoughness);
|
|
238
|
+
this.$if(pb.equal(this.reflectionMode, PBR_REFLECTION_MODE.anisotropic), function() {
|
|
239
|
+
this.$l.dirAngle = pb.mul(pb.add(pb.mul(this.zAnisotropyDirection, this.zAnisotropyDirectionScaleBias.x), this.zAnisotropyDirectionScaleBias.y), Math.PI / 180);
|
|
240
|
+
this.$l.t0 = pb.normalize(this.data.TBN[0]);
|
|
241
|
+
this.$l.b0 = pb.normalize(this.data.TBN[1]);
|
|
242
|
+
this.$l.tangent = pb.normalize(pb.add(pb.mul(this.t0, pb.cos(this.dirAngle)), pb.mul(this.b0, pb.sin(this.dirAngle))));
|
|
243
|
+
this.$l.bitangent = pb.normalize(pb.cross(this.data.normal, this.tangent));
|
|
244
|
+
this.$l.ToH = pb.dot(this.tangent, this.H);
|
|
245
|
+
this.$l.BoH = pb.dot(this.bitangent, this.H);
|
|
246
|
+
this.$l.at = pb.max(pb.mul(this.alphaRoughness, pb.add(1, this.zAnisotropy)), 0.0001);
|
|
247
|
+
this.$l.ab = pb.max(pb.mul(this.alphaRoughness, pb.sub(1, this.zAnisotropy)), 0.0001);
|
|
248
|
+
this.$l.anisoDenom = pb.mul(Math.PI, this.at, this.ab, pb.pow(pb.add(pb.div(pb.mul(this.ToH, this.ToH), pb.mul(this.at, this.at)), pb.div(pb.mul(this.BoH, this.BoH), pb.mul(this.ab, this.ab)), pb.mul(this.NoH, this.NoH)), 2));
|
|
249
|
+
this.D = pb.div(1, pb.max(this.anisoDenom, 0.0001));
|
|
250
|
+
});
|
|
251
|
+
this.$if(pb.equal(this.reflectionMode, PBR_REFLECTION_MODE.glint), function() {
|
|
252
|
+
this.$l.glintNoise = pb.fract(pb.mul(pb.sin(pb.add(pb.dot(this.H, pb.vec3(127.1, 311.7, 74.7)), pb.mul(this.NoH, 43.1))), 43758.5453));
|
|
253
|
+
this.$l.glintMask = pb.smoothStep(0.97, 1, this.glintNoise);
|
|
254
|
+
this.D = pb.mul(this.D, pb.add(1, pb.mul(this.glintMask, 8)));
|
|
255
|
+
});
|
|
169
256
|
this.$l.V = that.visGGX(this, this.NoV, this.NoL, this.alphaRoughness);
|
|
170
|
-
this.$l.specular = pb.mul(this.lightColor, this.D, this.V, this.F);
|
|
257
|
+
this.$l.specular = pb.mul(this.lightColor, this.D, this.V, this.F, this.specularScale);
|
|
258
|
+
this.$if(pb.equal(this.reflectionMode, PBR_REFLECTION_MODE.none), function() {
|
|
259
|
+
this.specular = pb.vec3(0);
|
|
260
|
+
});
|
|
171
261
|
this.outColor = pb.add(this.outColor, this.specular);
|
|
172
262
|
this.$l.diffuseBRDF = pb.mul(pb.sub(pb.vec3(1), this.F), pb.div(this.data.diffuse.rgb, Math.PI));
|
|
173
|
-
this.$l.diffuse = pb.mul(this.lightColor, pb.max(this.diffuseBRDF, pb.vec3(0)));
|
|
263
|
+
this.$l.diffuse = pb.mul(this.lightColor, pb.max(this.diffuseBRDF, pb.vec3(0)), this.diffuseScale);
|
|
174
264
|
this.outColor = pb.add(this.outColor, this.diffuse);
|
|
175
265
|
});
|
|
176
266
|
});
|
|
177
|
-
scope.$g[funcName](lightDir, lightColor, viewVec, commonData, outColor);
|
|
267
|
+
scope.$g[funcName](lightDir, lightColor, viewVec, commonData, diffuseScale, specularScale, sourceRadiusFactor, outColor);
|
|
178
268
|
}
|
|
179
269
|
indirectLighting(scope, viewVec, commonData, outColor, outRoughness) {
|
|
180
270
|
const pb = scope.$builder;
|
|
@@ -194,6 +284,7 @@ import { getGGXLUT } from '../../../utility/textures/ggxlut.js';
|
|
|
194
284
|
}
|
|
195
285
|
const envLightStrength = ShaderHelper.getEnvLightStrength(this);
|
|
196
286
|
this.$l.occlusion = envLightStrength;
|
|
287
|
+
this.$l.reflectionMode = this.zReflectionMode;
|
|
197
288
|
this.$l.NoV = pb.clamp(pb.dot(this.data.normal, this.viewVec), 0.0001, 1);
|
|
198
289
|
this.$l.ggxLutSample = pb.clamp(pb.textureSampleLevel(this.zGGXLut, pb.clamp(pb.vec2(this.NoV, this.data.roughness), pb.vec2(0), pb.vec2(1)), 0), pb.vec4(0), pb.vec4(1));
|
|
199
290
|
this.$l.f_ab = this.ggxLutSample.rg;
|
|
@@ -202,6 +293,7 @@ import { getGGXLUT } from '../../../utility/textures/ggxlut.js';
|
|
|
202
293
|
if (outRoughness || ctx.env.light.envLight.hasRadiance()) {
|
|
203
294
|
this.$l.FssEss = pb.add(pb.mul(this.k_S, this.f_ab.x), pb.vec3(this.f_ab.y));
|
|
204
295
|
this.$l.specularFactor = pb.mul(this.FssEss, this.occlusion);
|
|
296
|
+
this.specularFactor = pb.mul(this.specularFactor, pb.float(pb.notEqual(this.reflectionMode, PBR_REFLECTION_MODE.none)));
|
|
205
297
|
if (outRoughness) {
|
|
206
298
|
this.outRoughness = pb.vec4(this.specularFactor /*this.data.f0.rgb*/ , this.data.roughness);
|
|
207
299
|
} else if (ctx.env.light.envLight.hasRadiance()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pbrblueprintmixin.js","sources":["../../../../src/material/mixins/lightmodel/pbrblueprintmixin.ts"],"sourcesContent":["import type { BindGroup, PBFunctionScope, PBInsideFunctionScope, ShaderTypeFunc } from '@zephyr3d/device';\r\nimport type { PBShaderExp } from '@zephyr3d/device';\r\nimport type { MeshMaterial } from '../../meshmaterial';\r\nimport { applyMaterialMixins } from '../../meshmaterial';\r\nimport type { IMixinLight } from '../lit';\r\nimport { mixinLight } from '../lit';\r\nimport type { IMixinPBRBRDF } from '../pbr/brdf';\r\nimport { mixinPBRBRDF } from '../pbr/brdf';\r\nimport type { MaterialBlueprintIR } from '../../../utility/blueprint/material/ir';\r\nimport { ShaderHelper } from '../../shader/helper';\r\nimport type { DrawContext } from '../../../render';\r\nimport { getGGXLUT } from '../../../utility/textures/ggxlut';\r\n\r\n/**\r\n * Interface for mixinPBRBluePrint lighting model mixin\r\n * @public\r\n */\r\nexport type IMixinPBRBluePrint = {\r\n PBRLight(\r\n scope: PBInsideFunctionScope,\r\n worldPos: PBShaderExp,\r\n viewVec: PBShaderExp,\r\n commonData: PBShaderExp,\r\n outRoughness?: PBShaderExp\r\n ): PBShaderExp;\r\n getCommonDatasStruct(scope: PBInsideFunctionScope): ShaderTypeFunc;\r\n getCommonData(\r\n scope: PBInsideFunctionScope,\r\n data: PBShaderExp,\r\n viewVec: PBShaderExp,\r\n worldPos: PBShaderExp,\r\n worldNorm: PBShaderExp,\r\n worldTangent: PBShaderExp,\r\n worldBinormal: PBShaderExp,\r\n vertexColor: PBShaderExp,\r\n vertexUV: PBShaderExp,\r\n ir: MaterialBlueprintIR\r\n ): void;\r\n calculateCommonData(\r\n scope: PBInsideFunctionScope,\r\n ir: MaterialBlueprintIR,\r\n viewVec: PBShaderExp,\r\n worldPos: PBShaderExp,\r\n worldNorm: PBShaderExp,\r\n worldTangent: PBShaderExp,\r\n worldBinormal: PBShaderExp,\r\n vertexColor: PBShaderExp,\r\n vertexUV: PBShaderExp,\r\n data: PBShaderExp\r\n ): void;\r\n directLighting(\r\n scope: PBInsideFunctionScope,\r\n lightDir: PBShaderExp,\r\n lightColor: PBShaderExp,\r\n viewVec: PBShaderExp,\r\n commonData: PBShaderExp,\r\n outColor: PBShaderExp\r\n ): void;\r\n indirectLighting(\r\n scope: PBInsideFunctionScope,\r\n viewVec: PBShaderExp,\r\n commonData: PBShaderExp,\r\n outColor: PBShaderExp,\r\n outRoughness?: PBShaderExp\r\n ): void;\r\n} & IMixinPBRBRDF &\r\n IMixinLight;\r\n\r\n/**\r\n * PBRBluePrint lighting model mixin\r\n * @param BaseCls - Class to mix in\r\n * @returns Mixed class\r\n * @public\r\n */\r\nexport function mixinPBRBluePrint<T extends typeof MeshMaterial>(BaseCls: T) {\r\n if ((BaseCls as any).pbrBluePrint) {\r\n return BaseCls as T & { new (...args: any[]): IMixinPBRBluePrint };\r\n }\r\n const S = applyMaterialMixins(BaseCls, mixinPBRBRDF, mixinLight);\r\n\r\n return class extends S {\r\n static readonly pbrBluePrint = true;\r\n constructor() {\r\n super();\r\n }\r\n copyFrom(other: this) {\r\n super.copyFrom(other);\r\n }\r\n getCommonData(\r\n scope: PBInsideFunctionScope,\r\n data: PBShaderExp,\r\n viewVec: PBShaderExp,\r\n worldPos: PBShaderExp,\r\n worldNorm: PBShaderExp,\r\n worldTangent: PBShaderExp,\r\n worldBinormal: PBShaderExp,\r\n vertexColor: PBShaderExp,\r\n vertexUV: PBShaderExp,\r\n ir: MaterialBlueprintIR\r\n ) {\r\n this.calculateCommonData(\r\n scope,\r\n ir,\r\n viewVec,\r\n worldPos,\r\n worldNorm,\r\n worldTangent,\r\n worldBinormal,\r\n vertexColor,\r\n vertexUV,\r\n data\r\n );\r\n }\r\n getCommonDatasStruct(scope: PBInsideFunctionScope) {\r\n const pb = scope.$builder;\r\n return pb.defineStruct([\r\n pb.vec4('f0'),\r\n pb.vec3('f90'),\r\n pb.vec4('albedo'),\r\n pb.vec4('diffuse'),\r\n pb.float('metallic'),\r\n pb.float('roughness'),\r\n pb.vec3('normal'),\r\n pb.mat3('TBN'),\r\n pb.vec3('emissive'),\r\n pb.vec3('specular')\r\n ]);\r\n }\r\n\r\n PBRLight(\r\n scope: PBInsideFunctionScope,\r\n worldPos: PBShaderExp,\r\n viewVec: PBShaderExp,\r\n commonData: PBShaderExp,\r\n outRoughness?: PBShaderExp\r\n ) {\r\n const pb = scope.$builder;\r\n const funcName = 'Z_PBRBluePrintLight';\r\n const that = this;\r\n pb.func(\r\n funcName,\r\n [\r\n that.getCommonDatasStruct(scope)('pbrData'),\r\n pb.vec3('viewVec'),\r\n pb.vec3('worldPos'),\r\n ...(outRoughness ? [pb.vec4('outRoughness').out()] : [])\r\n ],\r\n function () {\r\n this.$l.lightingColor = pb.vec3(0);\r\n this.$l.emissiveColor = this.pbrData.emissive;\r\n if (outRoughness) {\r\n that.indirectLighting(this, this.viewVec, this.pbrData, this.lightingColor, this.outRoughness);\r\n } else {\r\n that.indirectLighting(this, this.viewVec, this.pbrData, this.lightingColor);\r\n }\r\n that.forEachLight(this, function (type, posRange, dirCutoff, colorIntensity, shadow) {\r\n this.$l.diffuse = pb.vec3();\r\n this.$l.specular = pb.vec3();\r\n this.$l.lightAtten = that.calculateLightAttenuation(\r\n this,\r\n type,\r\n this.worldPos,\r\n posRange,\r\n dirCutoff\r\n );\r\n this.$l.lightDir = that.calculateLightDirection(this, type, this.worldPos, posRange, dirCutoff);\r\n this.$l.NoL = pb.clamp(pb.dot(this.pbrData.normal, this.lightDir), 0, 1);\r\n this.$l.lightColor = pb.mul(colorIntensity.rgb, colorIntensity.a, this.lightAtten, this.NoL);\r\n if (shadow) {\r\n this.lightColor = pb.mul(this.lightColor, that.calculateShadow(this, this.worldPos, this.NoL));\r\n }\r\n that.directLighting(\r\n this,\r\n this.lightDir,\r\n this.lightColor,\r\n this.viewVec,\r\n this.pbrData,\r\n this.lightingColor\r\n );\r\n });\r\n this.$return(pb.vec4(pb.add(this.lightingColor, this.emissiveColor), this.pbrData.albedo.a));\r\n }\r\n );\r\n return (\r\n outRoughness\r\n ? pb.getGlobalScope()[funcName](commonData, viewVec, worldPos, outRoughness)\r\n : pb.getGlobalScope()[funcName](commonData, viewVec, worldPos)\r\n ) as PBShaderExp;\r\n }\r\n vertexShader(scope: PBFunctionScope) {\r\n super.vertexShader(scope);\r\n }\r\n fragmentShader(scope: PBFunctionScope) {\r\n const pb = scope.$builder;\r\n super.fragmentShader(scope);\r\n if (this.needFragmentColor()) {\r\n if (this.drawContext.drawEnvLight) {\r\n scope.zGGXLut = pb.tex2D().uniform(2);\r\n }\r\n }\r\n }\r\n calculateCommonData(\r\n scope: PBInsideFunctionScope,\r\n ir: MaterialBlueprintIR,\r\n viewVec: PBShaderExp,\r\n worldPos: PBShaderExp,\r\n worldNorm: PBShaderExp,\r\n worldTangent: PBShaderExp,\r\n worldBinormal: PBShaderExp,\r\n vertexColor: PBShaderExp,\r\n vertexUV: PBShaderExp,\r\n data: PBShaderExp\r\n ) {\r\n const that = this;\r\n const pb = scope.$builder;\r\n const funcName = 'zCalculateCommonDataPBRBluePrint';\r\n const params: PBShaderExp[] = [\r\n this.getCommonDatasStruct(scope)('zCommonData').out(),\r\n pb.vec3('zViewVec'),\r\n pb.vec3('zWorldPos'),\r\n pb.vec3('zVertexNormal'),\r\n pb.vec3('zVertexTangent'),\r\n pb.vec3('zVertexBinormal'),\r\n pb.vec4('zVertexColor'),\r\n pb.vec2('zVertexUV')\r\n ];\r\n const paramValues: PBShaderExp[] = [\r\n data,\r\n viewVec,\r\n worldPos,\r\n worldNorm,\r\n worldTangent,\r\n worldBinormal,\r\n vertexColor,\r\n vertexUV\r\n ];\r\n pb.func(funcName, params, function () {\r\n const outputs = ir.create(pb)!;\r\n this.zCommonData.albedo = pb.vec4(\r\n (that.getOutput(outputs, 'BaseColor') as PBShaderExp)?.rgb ?? pb.vec3(1),\r\n (that.getOutput(outputs, 'Opacity') as number | PBShaderExp) ?? 1\r\n );\r\n this.zCommonData.metallic = that.getOutput(outputs, 'Metallic') ?? 0;\r\n this.zCommonData.roughness = that.getOutput(outputs, 'Roughness')\r\n ? pb.mul(\r\n that.getOutput(outputs, 'Roughness') as number | PBShaderExp,\r\n ShaderHelper.getCameraRoughnessFactor(scope)\r\n )\r\n : ShaderHelper.getCameraRoughnessFactor(scope);\r\n this.zCommonData.specular = that.getOutput(outputs, 'Specular') ?? pb.vec3(1);\r\n this.zCommonData.emissive = that.getOutput(outputs, 'Emissive') ?? pb.vec3(0);\r\n this.zCommonData.f90 = pb.vec3(1);\r\n this.zCommonData.f0 = pb.vec4(\r\n pb.mix(\r\n pb.min(pb.mul(pb.vec3(0.04), this.zCommonData.specular), pb.vec3(1)),\r\n this.zCommonData.albedo.rgb,\r\n this.zCommonData.metallic\r\n ),\r\n 1.5\r\n );\r\n this.$l.tangent = that.getOutput(outputs, 'Tangent') ?? this.zVertexTangent;\r\n this.$l.ng = pb.normalize(this.zVertexNormal);\r\n this.$l.t_ = pb.normalize(this.tangent);\r\n this.$l.t = pb.normalize(pb.sub(this.t_, pb.mul(this.ng, pb.dot(this.ng, this.t_))));\r\n this.$l.b = pb.cross(this.ng, this.t);\r\n if (that.doubleSidedLighting && that.cullMode !== 'back') {\r\n this.$if(pb.not(this.$builtins.frontFacing), function () {\r\n this.t = pb.mul(this.t, -1);\r\n this.b = pb.mul(this.b, -1);\r\n this.ng = pb.mul(this.ng, -1);\r\n });\r\n }\r\n this.zCommonData.TBN = pb.mat3(this.t, this.b, this.ng);\r\n\r\n if (that.getOutput(outputs, 'Normal')) {\r\n this.zCommonData.normal = pb.normalize(\r\n pb.mul(this.zCommonData.TBN, that.getOutput(outputs, 'Normal') as number | PBShaderExp)\r\n );\r\n } else {\r\n this.zCommonData.normal = this.ng;\r\n }\r\n this.zCommonData.diffuse = pb.vec4(\r\n pb.mix(this.zCommonData.albedo.rgb, pb.vec3(0), this.zCommonData.metallic),\r\n this.zCommonData.albedo.a\r\n );\r\n });\r\n scope[funcName](...paramValues);\r\n }\r\n private getOutput(\r\n outputs: {\r\n name: string;\r\n exp: number | boolean | PBShaderExp;\r\n }[],\r\n name: string\r\n ) {\r\n return outputs.find((output) => output.name === name)?.exp;\r\n }\r\n directLighting(\r\n scope: PBInsideFunctionScope,\r\n lightDir: PBShaderExp,\r\n lightColor: PBShaderExp,\r\n viewVec: PBShaderExp,\r\n commonData: PBShaderExp,\r\n outColor: PBShaderExp\r\n ) {\r\n const pb = scope.$builder;\r\n const that = this;\r\n const funcName = 'Z_PBRDirectLighting';\r\n pb.func(\r\n funcName,\r\n [\r\n pb.vec3('L'),\r\n pb.vec3('lightColor'),\r\n pb.vec3('viewVec'),\r\n that.getCommonDatasStruct(scope)('data'),\r\n pb.vec3('outColor').inout()\r\n ],\r\n function () {\r\n this.$l.H = pb.normalize(pb.add(this.viewVec, this.L));\r\n this.$l.NoH = pb.clamp(pb.dot(this.data.normal, this.H), 0, 1);\r\n this.$l.NoL = pb.clamp(pb.dot(this.data.normal, this.L), 0, 1);\r\n this.$l.NoV = pb.clamp(pb.dot(this.data.normal, this.viewVec), 0, 1);\r\n this.$if(pb.greaterThan(this.NoL, 0), function () {\r\n this.$l.VoH = pb.clamp(pb.dot(this.viewVec, this.H), 0, 1);\r\n this.$l.schlickFresnel = that.fresnelSchlick(this, this.VoH, this.data.f0.rgb, this.data.f90);\r\n this.$l.F = this.schlickFresnel;\r\n this.$l.alphaRoughness = pb.mul(this.data.roughness, this.data.roughness);\r\n this.$l.D = that.distributionGGX(this, this.NoH, this.alphaRoughness);\r\n this.$l.V = that.visGGX(this, this.NoV, this.NoL, this.alphaRoughness);\r\n this.$l.specular = pb.mul(this.lightColor, this.D, this.V, this.F);\r\n this.outColor = pb.add(this.outColor, this.specular);\r\n this.$l.diffuseBRDF = pb.mul(pb.sub(pb.vec3(1), this.F), pb.div(this.data.diffuse.rgb, Math.PI));\r\n this.$l.diffuse = pb.mul(this.lightColor, pb.max(this.diffuseBRDF, pb.vec3(0)));\r\n this.outColor = pb.add(this.outColor, this.diffuse);\r\n });\r\n }\r\n );\r\n scope.$g[funcName](lightDir, lightColor, viewVec, commonData, outColor);\r\n }\r\n indirectLighting(\r\n scope: PBInsideFunctionScope,\r\n viewVec: PBShaderExp,\r\n commonData: PBShaderExp,\r\n outColor: PBShaderExp,\r\n outRoughness?: PBShaderExp\r\n ) {\r\n const pb = scope.$builder;\r\n const that = this;\r\n const ctx = that.drawContext;\r\n const funcName = 'Z_PBRIndirectLighting';\r\n pb.func(\r\n funcName,\r\n [\r\n pb.vec3('viewVec'),\r\n that.getCommonDatasStruct(scope)('data'),\r\n pb.vec3('outColor').inout(),\r\n ...(outRoughness ? [pb.vec4('outRoughness').out()] : [])\r\n ],\r\n function () {\r\n if (\r\n !ctx.drawEnvLight ||\r\n (!ctx.env!.light.envLight.hasRadiance() && !ctx.env!.light.envLight.hasIrradiance())\r\n ) {\r\n return;\r\n }\r\n const envLightStrength = ShaderHelper.getEnvLightStrength(this);\r\n this.$l.occlusion = envLightStrength;\r\n this.$l.NoV = pb.clamp(pb.dot(this.data.normal, this.viewVec), 0.0001, 1);\r\n this.$l.ggxLutSample = pb.clamp(\r\n pb.textureSampleLevel(\r\n this.zGGXLut,\r\n pb.clamp(pb.vec2(this.NoV, this.data.roughness), pb.vec2(0), pb.vec2(1)),\r\n 0\r\n ),\r\n pb.vec4(0),\r\n pb.vec4(1)\r\n );\r\n this.$l.f_ab = this.ggxLutSample.rg;\r\n this.$l.Fr = pb.sub(\r\n pb.max(pb.vec3(pb.sub(1, this.data.roughness)), this.data.f0.rgb),\r\n this.data.f0.rgb\r\n );\r\n this.$l.k_S = pb.add(this.data.f0.rgb, pb.mul(this.Fr, pb.pow(pb.sub(1, this.NoV), 5)));\r\n if (outRoughness || ctx.env!.light.envLight.hasRadiance()) {\r\n this.$l.FssEss = pb.add(pb.mul(this.k_S, this.f_ab.x), pb.vec3(this.f_ab.y));\r\n this.$l.specularFactor = pb.mul(this.FssEss, this.occlusion);\r\n if (outRoughness) {\r\n this.outRoughness = pb.vec4(this.specularFactor /*this.data.f0.rgb*/, this.data.roughness);\r\n } else if (ctx.env!.light.envLight.hasRadiance()) {\r\n this.$l.radiance = ctx.env!.light.envLight.getRadiance(\r\n this,\r\n pb.reflect(pb.neg(this.viewVec), this.data.normal),\r\n this.data.roughness\r\n );\r\n this.outColor = pb.add(this.outColor, pb.mul(this.radiance, this.specularFactor));\r\n }\r\n }\r\n if (ctx.env!.light.envLight.hasIrradiance()) {\r\n this.$l.irradiance = ctx.env!.light.envLight.getIrradiance(this, this.data.normal);\r\n this.$l.mixedF0 = this.data.f0.rgb;\r\n this.$l.FssEss = pb.add(pb.mul(this.k_S, this.f_ab.x), pb.vec3(this.f_ab.y));\r\n this.$l.Ems = pb.sub(1, pb.add(this.f_ab.x, this.f_ab.y));\r\n this.$l.F_avg = pb.add(this.mixedF0, pb.div(pb.sub(pb.vec3(1), this.mixedF0), 21));\r\n this.$l.FmsEms = pb.div(\r\n pb.mul(this.FssEss, this.F_avg, this.Ems),\r\n pb.sub(pb.vec3(1), pb.mul(this.F_avg, this.Ems))\r\n );\r\n this.$l.k_D = pb.mul(this.data.diffuse.rgb, pb.add(pb.sub(pb.vec3(1), this.FssEss), this.FmsEms));\r\n this.$l.iblDiffuse = pb.mul(pb.add(this.FmsEms, this.k_D), this.irradiance, this.occlusion);\r\n this.outColor = pb.add(this.outColor, this.iblDiffuse);\r\n }\r\n }\r\n );\r\n if (outRoughness) {\r\n scope.$g[funcName](viewVec, commonData, outColor, outRoughness);\r\n } else {\r\n scope.$g[funcName](viewVec, commonData, outColor);\r\n }\r\n }\r\n applyUniformValues(bindGroup: BindGroup, ctx: DrawContext, pass: number) {\r\n super.applyUniformValues(bindGroup, ctx, pass);\r\n if (this.needFragmentColor(ctx)) {\r\n if (ctx.drawEnvLight) {\r\n bindGroup.setTexture('zGGXLut', getGGXLUT(1024));\r\n }\r\n }\r\n }\r\n } as unknown as T & { new (...args: any[]): IMixinPBRBluePrint };\r\n}\r\n"],"names":["mixinPBRBluePrint","BaseCls","pbrBluePrint","S","applyMaterialMixins","mixinPBRBRDF","mixinLight","copyFrom","other","getCommonData","scope","data","viewVec","worldPos","worldNorm","worldTangent","worldBinormal","vertexColor","vertexUV","ir","calculateCommonData","getCommonDatasStruct","pb","$builder","defineStruct","vec4","vec3","float","mat3","PBRLight","commonData","outRoughness","funcName","that","func","out","$l","lightingColor","emissiveColor","pbrData","emissive","indirectLighting","forEachLight","type","posRange","dirCutoff","colorIntensity","shadow","diffuse","specular","lightAtten","calculateLightAttenuation","lightDir","calculateLightDirection","NoL","clamp","dot","normal","lightColor","mul","rgb","a","calculateShadow","directLighting","$return","add","albedo","getGlobalScope","vertexShader","fragmentShader","needFragmentColor","drawContext","drawEnvLight","zGGXLut","tex2D","uniform","params","vec2","paramValues","outputs","create","zCommonData","getOutput","metallic","roughness","ShaderHelper","getCameraRoughnessFactor","f90","f0","mix","min","tangent","zVertexTangent","ng","normalize","zVertexNormal","t_","t","sub","b","cross","doubleSidedLighting","cullMode","$if","not","$builtins","frontFacing","TBN","name","find","output","exp","outColor","inout","H","L","NoH","NoV","greaterThan","VoH","schlickFresnel","fresnelSchlick","F","alphaRoughness","D","distributionGGX","V","visGGX","diffuseBRDF","div","Math","PI","max","$g","ctx","env","light","envLight","hasRadiance","hasIrradiance","envLightStrength","getEnvLightStrength","occlusion","ggxLutSample","textureSampleLevel","f_ab","rg","Fr","k_S","pow","FssEss","x","y","specularFactor","radiance","getRadiance","reflect","neg","irradiance","getIrradiance","mixedF0","Ems","F_avg","FmsEms","k_D","iblDiffuse","applyUniformValues","bindGroup","pass","setTexture","getGGXLUT"],"mappings":";;;;;;AAoEA;;;;;IAMO,SAASA,iBAAAA,CAAiDC,OAAU,EAAA;IACzE,IAAKA,OAAgBC,CAAAA,YAAY,EAAE;QACjC,OAAOD,OAAAA;AACT;IACA,MAAME,CAAAA,GAAIC,mBAAoBH,CAAAA,OAAAA,EAASI,YAAcC,EAAAA,UAAAA,CAAAA;AAErD,IAAA,OAAO,cAAcH,CAAAA,CAAAA;AACnB,QAAA,OAAgBD,eAAe,IAAK;QACpC,WAAc,EAAA;YACZ,KAAK,EAAA;AACP;AACAK,QAAAA,QAAAA,CAASC,KAAW,EAAE;AACpB,YAAA,KAAK,CAACD,QAASC,CAAAA,KAAAA,CAAAA;AACjB;AACAC,QAAAA,aAAAA,CACEC,KAA4B,EAC5BC,IAAiB,EACjBC,OAAoB,EACpBC,QAAqB,EACrBC,SAAsB,EACtBC,YAAyB,EACzBC,aAA0B,EAC1BC,WAAwB,EACxBC,QAAqB,EACrBC,EAAuB,EACvB;YACA,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2H,EAAE,CAACrG,QAAS,CAAA,CAACpB,SAASkB,UAAYkF,EAAAA,QAAAA,CAAAA;AAC1C;AACF;AACAsD,QAAAA,kBAAAA,CAAmBC,SAAoB,EAAEjC,GAAgB,EAAEkC,IAAY,EAAE;YACvE,KAAK,CAACF,kBAAmBC,CAAAA,SAAAA,EAAWjC,GAAKkC,EAAAA,IAAAA,CAAAA;AACzC,YAAA,IAAI,IAAI,CAAClG,iBAAiB,CAACgE,GAAM,CAAA,EAAA;gBAC/B,IAAIA,GAAAA,CAAI9D,YAAY,EAAE;oBACpB+F,SAAUE,CAAAA,UAAU,CAAC,SAAA,EAAWC,SAAU,CAAA,IAAA,CAAA,CAAA;AAC5C;AACF;AACF;AACF,KAAA;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"pbrblueprintmixin.js","sources":["../../../../src/material/mixins/lightmodel/pbrblueprintmixin.ts"],"sourcesContent":["import type { BindGroup, PBFunctionScope, PBInsideFunctionScope, ShaderTypeFunc } from '@zephyr3d/device';\r\nimport type { PBShaderExp } from '@zephyr3d/device';\r\nimport type { MeshMaterial } from '../../meshmaterial';\r\nimport { applyMaterialMixins } from '../../meshmaterial';\r\nimport type { IMixinLight } from '../lit';\r\nimport { mixinLight } from '../lit';\r\nimport type { IMixinPBRBRDF } from '../pbr/brdf';\r\nimport { mixinPBRBRDF } from '../pbr/brdf';\r\nimport type { MaterialBlueprintIR } from '../../../utility/blueprint/material/ir';\r\nimport { ShaderHelper } from '../../shader/helper';\r\nimport { LIGHT_TYPE_POINT, LIGHT_TYPE_RECT } from '../../../values';\r\nimport type { DrawContext } from '../../../render';\r\nimport { getGGXLUT } from '../../../utility/textures/ggxlut';\r\n\r\nconst PBR_REFLECTION_MODE = {\r\n none: 0,\r\n ggx: 1,\r\n anisotropic: 2,\r\n glint: 3\r\n} as const;\r\n\r\n/**\r\n * Interface for mixinPBRBluePrint lighting model mixin\r\n * @public\r\n */\r\nexport type IMixinPBRBluePrint = {\r\n PBRLight(\r\n scope: PBInsideFunctionScope,\r\n worldPos: PBShaderExp,\r\n viewVec: PBShaderExp,\r\n commonData: PBShaderExp,\r\n outRoughness?: PBShaderExp\r\n ): PBShaderExp;\r\n getCommonDatasStruct(scope: PBInsideFunctionScope): ShaderTypeFunc;\r\n getCommonData(\r\n scope: PBInsideFunctionScope,\r\n data: PBShaderExp,\r\n viewVec: PBShaderExp,\r\n worldPos: PBShaderExp,\r\n worldNorm: PBShaderExp,\r\n worldTangent: PBShaderExp,\r\n worldBinormal: PBShaderExp,\r\n vertexColor: PBShaderExp,\r\n vertexUV: PBShaderExp,\r\n ir: MaterialBlueprintIR\r\n ): void;\r\n calculateCommonData(\r\n scope: PBInsideFunctionScope,\r\n ir: MaterialBlueprintIR,\r\n viewVec: PBShaderExp,\r\n worldPos: PBShaderExp,\r\n worldNorm: PBShaderExp,\r\n worldTangent: PBShaderExp,\r\n worldBinormal: PBShaderExp,\r\n vertexColor: PBShaderExp,\r\n vertexUV: PBShaderExp,\r\n data: PBShaderExp\r\n ): void;\r\n directLighting(\r\n scope: PBInsideFunctionScope,\r\n lightDir: PBShaderExp,\r\n lightColor: PBShaderExp,\r\n viewVec: PBShaderExp,\r\n commonData: PBShaderExp,\r\n diffuseScale: PBShaderExp,\r\n specularScale: PBShaderExp,\r\n sourceRadiusFactor: PBShaderExp,\r\n outColor: PBShaderExp\r\n ): void;\r\n indirectLighting(\r\n scope: PBInsideFunctionScope,\r\n viewVec: PBShaderExp,\r\n commonData: PBShaderExp,\r\n outColor: PBShaderExp,\r\n outRoughness?: PBShaderExp\r\n ): void;\r\n} & IMixinPBRBRDF &\r\n IMixinLight;\r\n\r\n/**\r\n * PBRBluePrint lighting model mixin\r\n * @param BaseCls - Class to mix in\r\n * @returns Mixed class\r\n * @public\r\n */\r\nexport function mixinPBRBluePrint<T extends typeof MeshMaterial>(BaseCls: T) {\r\n if ((BaseCls as any).pbrBluePrint) {\r\n return BaseCls as T & { new (...args: any[]): IMixinPBRBluePrint };\r\n }\r\n const S = applyMaterialMixins(BaseCls, mixinPBRBRDF, mixinLight);\r\n\r\n return class extends S {\r\n static readonly pbrBluePrint = true;\r\n constructor() {\r\n super();\r\n }\r\n copyFrom(other: this) {\r\n super.copyFrom(other);\r\n }\r\n getCommonData(\r\n scope: PBInsideFunctionScope,\r\n data: PBShaderExp,\r\n viewVec: PBShaderExp,\r\n worldPos: PBShaderExp,\r\n worldNorm: PBShaderExp,\r\n worldTangent: PBShaderExp,\r\n worldBinormal: PBShaderExp,\r\n vertexColor: PBShaderExp,\r\n vertexUV: PBShaderExp,\r\n ir: MaterialBlueprintIR\r\n ) {\r\n this.calculateCommonData(\r\n scope,\r\n ir,\r\n viewVec,\r\n worldPos,\r\n worldNorm,\r\n worldTangent,\r\n worldBinormal,\r\n vertexColor,\r\n vertexUV,\r\n data\r\n );\r\n }\r\n getCommonDatasStruct(scope: PBInsideFunctionScope) {\r\n const pb = scope.$builder;\r\n return pb.defineStruct([\r\n pb.vec4('f0'),\r\n pb.vec3('f90'),\r\n pb.vec4('albedo'),\r\n pb.vec4('diffuse'),\r\n pb.float('metallic'),\r\n pb.float('roughness'),\r\n pb.vec3('normal'),\r\n pb.mat3('TBN'),\r\n pb.vec3('emissive'),\r\n pb.vec3('specular')\r\n ]);\r\n }\r\n\r\n PBRLight(\r\n scope: PBInsideFunctionScope,\r\n worldPos: PBShaderExp,\r\n viewVec: PBShaderExp,\r\n commonData: PBShaderExp,\r\n outRoughness?: PBShaderExp\r\n ) {\r\n const pb = scope.$builder;\r\n const funcName = 'Z_PBRBluePrintLight';\r\n const that = this;\r\n pb.func(\r\n funcName,\r\n [\r\n that.getCommonDatasStruct(scope)('pbrData'),\r\n pb.vec3('viewVec'),\r\n pb.vec3('worldPos'),\r\n ...(outRoughness ? [pb.vec4('outRoughness').out()] : [])\r\n ],\r\n function () {\r\n this.$l.lightingColor = pb.vec3(0);\r\n this.$l.emissiveColor = this.pbrData.emissive;\r\n if (outRoughness) {\r\n that.indirectLighting(this, this.viewVec, this.pbrData, this.lightingColor, this.outRoughness);\r\n } else {\r\n that.indirectLighting(this, this.viewVec, this.pbrData, this.lightingColor);\r\n }\r\n that.forEachLight(this, function (type, posRange, dirCutoff, colorIntensity, extra, shadow) {\r\n this.$if(pb.equal(type, LIGHT_TYPE_RECT), function () {\r\n this.$l.center = posRange.xyz;\r\n this.$l.range = posRange.w;\r\n this.$l.ax = dirCutoff.xyz;\r\n this.$l.ay = extra.xyz;\r\n this.$l.halfWidth = pb.length(this.ax);\r\n this.$l.halfHeight = pb.length(this.ay);\r\n this.$l.area = pb.mul(this.halfWidth, this.halfHeight, 4);\r\n this.$l.lightNormal = pb.normalize(pb.cross(this.ax, this.ay));\r\n this.lightNormal = pb.neg(this.lightNormal);\r\n this.$if(pb.greaterThan(this.area, 0), function () {\r\n this.$l.baseColor = pb.mul(colorIntensity.rgb, colorIntensity.a, this.area, 0.25);\r\n this.$l.samplePos = pb.vec3();\r\n this.$l.Lvec = pb.vec3();\r\n this.$l.L = pb.vec3();\r\n this.$l.dist = pb.float();\r\n this.$l.invDist2 = pb.float();\r\n this.$l.NoL = pb.float();\r\n this.$l.NoL_light = pb.float();\r\n this.$l.falloff = pb.float();\r\n this.$l.atten = pb.float();\r\n this.$l.lightColor = pb.vec3();\r\n\r\n const sample = (u: number, v: number) => {\r\n this.samplePos = pb.add(\r\n this.center,\r\n pb.add(pb.mul(this.ax, pb.sub(pb.mul(u, 2), 1)), pb.mul(this.ay, pb.sub(pb.mul(v, 2), 1)))\r\n );\r\n this.Lvec = pb.sub(this.samplePos, this.worldPos);\r\n this.dist = pb.length(this.Lvec);\r\n this.invDist2 = pb.div(1, pb.max(pb.mul(this.dist, this.dist), 0.0001));\r\n this.L = pb.normalize(this.Lvec);\r\n this.NoL = pb.clamp(pb.dot(this.pbrData.normal, this.L), 0, 1);\r\n this.NoL_light = pb.clamp(pb.dot(this.lightNormal, pb.neg(this.L)), 0, 1);\r\n this.$if(pb.greaterThan(this.NoL_light, 0), function () {\r\n this.falloff = pb.float(1);\r\n this.$if(pb.greaterThan(this.range, 0), function () {\r\n this.falloff = pb.max(0, pb.sub(1, pb.div(this.dist, this.range)));\r\n this.falloff = pb.mul(this.falloff, this.falloff);\r\n });\r\n this.atten = pb.mul(this.invDist2, this.NoL_light, this.falloff);\r\n this.lightColor = pb.mul(this.baseColor, this.atten, this.NoL);\r\n that.directLighting(\r\n this,\r\n this.L,\r\n this.lightColor,\r\n this.viewVec,\r\n this.pbrData,\r\n pb.float(1),\r\n pb.float(1),\r\n pb.float(0),\r\n this.lightingColor\r\n );\r\n });\r\n };\r\n\r\n sample(0.25, 0.25);\r\n sample(0.75, 0.25);\r\n sample(0.25, 0.75);\r\n sample(0.75, 0.75);\r\n });\r\n }).$else(function () {\r\n this.$l.diffuse = pb.vec3();\r\n this.$l.specular = pb.vec3();\r\n this.$l.diffuseScale = pb.float(1);\r\n this.$l.specularScale = pb.float(1);\r\n this.$l.sourceRadiusFactor = pb.float(0);\r\n this.$if(pb.equal(type, LIGHT_TYPE_POINT), function () {\r\n this.diffuseScale = extra.x;\r\n this.specularScale = extra.y;\r\n this.sourceRadiusFactor = pb.div(\r\n extra.z,\r\n pb.max(pb.distance(posRange.xyz, this.worldPos), 0.0001)\r\n );\r\n });\r\n this.$l.lightAtten = that.calculateLightAttenuation(\r\n this,\r\n type,\r\n this.worldPos,\r\n posRange,\r\n dirCutoff\r\n );\r\n this.$l.lightDir = that.calculateLightDirection(this, type, this.worldPos, posRange, dirCutoff);\r\n this.$l.NoL = pb.clamp(pb.dot(this.pbrData.normal, this.lightDir), 0, 1);\r\n this.$l.lightColor = pb.mul(colorIntensity.rgb, colorIntensity.a, this.lightAtten, this.NoL);\r\n if (shadow) {\r\n this.lightColor = pb.mul(\r\n this.lightColor,\r\n that.calculateShadow(this, this.worldPos, this.NoL)\r\n );\r\n }\r\n that.directLighting(\r\n this,\r\n this.lightDir,\r\n this.lightColor,\r\n this.viewVec,\r\n this.pbrData,\r\n this.diffuseScale,\r\n this.specularScale,\r\n this.sourceRadiusFactor,\r\n this.lightingColor\r\n );\r\n });\r\n });\r\n this.$return(pb.vec4(pb.add(this.lightingColor, this.emissiveColor), this.pbrData.albedo.a));\r\n }\r\n );\r\n return (\r\n outRoughness\r\n ? pb.getGlobalScope()[funcName](commonData, viewVec, worldPos, outRoughness)\r\n : pb.getGlobalScope()[funcName](commonData, viewVec, worldPos)\r\n ) as PBShaderExp;\r\n }\r\n vertexShader(scope: PBFunctionScope) {\r\n super.vertexShader(scope);\r\n }\r\n fragmentShader(scope: PBFunctionScope) {\r\n const pb = scope.$builder;\r\n super.fragmentShader(scope);\r\n if (this.needFragmentColor()) {\r\n scope.zReflectionMode = pb.float().uniform(2);\r\n if (this.drawContext.drawEnvLight) {\r\n scope.zGGXLut = pb.tex2D().uniform(2);\r\n }\r\n }\r\n }\r\n calculateCommonData(\r\n scope: PBInsideFunctionScope,\r\n ir: MaterialBlueprintIR,\r\n viewVec: PBShaderExp,\r\n worldPos: PBShaderExp,\r\n worldNorm: PBShaderExp,\r\n worldTangent: PBShaderExp,\r\n worldBinormal: PBShaderExp,\r\n vertexColor: PBShaderExp,\r\n vertexUV: PBShaderExp,\r\n data: PBShaderExp\r\n ) {\r\n const that = this;\r\n const pb = scope.$builder;\r\n const funcName = 'zCalculateCommonDataPBRBluePrint';\r\n const params: PBShaderExp[] = [\r\n this.getCommonDatasStruct(scope)('zCommonData').out(),\r\n pb.vec3('zViewVec'),\r\n pb.vec3('zWorldPos'),\r\n pb.vec3('zVertexNormal'),\r\n pb.vec3('zVertexTangent'),\r\n pb.vec3('zVertexBinormal'),\r\n pb.vec4('zVertexColor'),\r\n pb.vec2('zVertexUV')\r\n ];\r\n const paramValues: PBShaderExp[] = [\r\n data,\r\n viewVec,\r\n worldPos,\r\n worldNorm,\r\n worldTangent,\r\n worldBinormal,\r\n vertexColor,\r\n vertexUV\r\n ];\r\n pb.func(funcName, params, function () {\r\n const outputs = ir.create(pb)!;\r\n this.zCommonData.albedo = pb.vec4(\r\n (that.getOutput(outputs, 'BaseColor') as PBShaderExp)?.rgb ?? pb.vec3(1),\r\n (that.getOutput(outputs, 'Opacity') as number | PBShaderExp) ?? 1\r\n );\r\n this.zCommonData.metallic = that.getOutput(outputs, 'Metallic') ?? 0;\r\n this.zCommonData.roughness = that.getOutput(outputs, 'Roughness')\r\n ? pb.mul(\r\n that.getOutput(outputs, 'Roughness') as number | PBShaderExp,\r\n ShaderHelper.getCameraRoughnessFactor(scope)\r\n )\r\n : ShaderHelper.getCameraRoughnessFactor(scope);\r\n this.zCommonData.specular = that.getOutput(outputs, 'Specular') ?? pb.vec3(1);\r\n this.zCommonData.emissive = that.getOutput(outputs, 'Emissive') ?? pb.vec3(0);\r\n this.zCommonData.f90 = pb.vec3(1);\r\n this.zCommonData.f0 = pb.vec4(\r\n pb.mix(\r\n pb.min(pb.mul(pb.vec3(0.04), this.zCommonData.specular), pb.vec3(1)),\r\n this.zCommonData.albedo.rgb,\r\n this.zCommonData.metallic\r\n ),\r\n 1.5\r\n );\r\n this.$l.tangent = that.getOutput(outputs, 'Tangent') ?? this.zVertexTangent;\r\n this.$l.ng = pb.normalize(this.zVertexNormal);\r\n this.$l.t_ = pb.normalize(this.tangent);\r\n this.$l.t = pb.normalize(pb.sub(this.t_, pb.mul(this.ng, pb.dot(this.ng, this.t_))));\r\n this.$l.b = pb.cross(this.ng, this.t);\r\n if (that.doubleSidedLighting && that.cullMode !== 'back') {\r\n this.$if(pb.not(this.$builtins.frontFacing), function () {\r\n this.t = pb.mul(this.t, -1);\r\n this.b = pb.mul(this.b, -1);\r\n this.ng = pb.mul(this.ng, -1);\r\n });\r\n }\r\n this.zCommonData.TBN = pb.mat3(this.t, this.b, this.ng);\r\n\r\n if (that.getOutput(outputs, 'Normal')) {\r\n this.zCommonData.normal = pb.normalize(\r\n pb.mul(this.zCommonData.TBN, that.getOutput(outputs, 'Normal') as number | PBShaderExp)\r\n );\r\n } else {\r\n this.zCommonData.normal = this.ng;\r\n }\r\n this.zCommonData.diffuse = pb.vec4(\r\n pb.mix(this.zCommonData.albedo.rgb, pb.vec3(0), this.zCommonData.metallic),\r\n this.zCommonData.albedo.a\r\n );\r\n });\r\n scope[funcName](...paramValues);\r\n }\r\n private getOutput(\r\n outputs: {\r\n name: string;\r\n exp: number | boolean | PBShaderExp;\r\n }[],\r\n name: string\r\n ) {\r\n return outputs.find((output) => output.name === name)?.exp;\r\n }\r\n directLighting(\r\n scope: PBInsideFunctionScope,\r\n lightDir: PBShaderExp,\r\n lightColor: PBShaderExp,\r\n viewVec: PBShaderExp,\r\n commonData: PBShaderExp,\r\n diffuseScale: PBShaderExp,\r\n specularScale: PBShaderExp,\r\n sourceRadiusFactor: PBShaderExp,\r\n outColor: PBShaderExp\r\n ) {\r\n const pb = scope.$builder;\r\n const that = this;\r\n const funcName = 'Z_PBRDirectLighting';\r\n pb.func(\r\n funcName,\r\n [\r\n pb.vec3('L'),\r\n pb.vec3('lightColor'),\r\n pb.vec3('viewVec'),\r\n that.getCommonDatasStruct(scope)('data'),\r\n pb.float('diffuseScale'),\r\n pb.float('specularScale'),\r\n pb.float('sourceRadiusFactor'),\r\n pb.vec3('outColor').inout()\r\n ],\r\n function () {\r\n this.$l.reflectionMode = this.zReflectionMode;\r\n this.$l.H = pb.normalize(pb.add(this.viewVec, this.L));\r\n this.$l.NoH = pb.clamp(pb.dot(this.data.normal, this.H), 0, 1);\r\n this.$l.NoL = pb.clamp(pb.dot(this.data.normal, this.L), 0, 1);\r\n this.$l.NoV = pb.clamp(pb.dot(this.data.normal, this.viewVec), 0, 1);\r\n this.$if(pb.greaterThan(this.NoL, 0), function () {\r\n this.$l.VoH = pb.clamp(pb.dot(this.viewVec, this.H), 0, 1);\r\n this.$l.schlickFresnel = that.fresnelSchlick(this, this.VoH, this.data.f0.rgb, this.data.f90);\r\n this.$l.F = this.schlickFresnel;\r\n this.$l.specularRoughness = pb.clamp(pb.add(this.data.roughness, this.sourceRadiusFactor), 0, 1);\r\n this.$l.alphaRoughness = pb.mul(this.specularRoughness, this.specularRoughness);\r\n this.$l.D = that.distributionGGX(this, this.NoH, this.alphaRoughness);\r\n this.$if(pb.equal(this.reflectionMode, PBR_REFLECTION_MODE.anisotropic), function () {\r\n this.$l.dirAngle = pb.mul(\r\n pb.add(\r\n pb.mul(this.zAnisotropyDirection, this.zAnisotropyDirectionScaleBias.x),\r\n this.zAnisotropyDirectionScaleBias.y\r\n ),\r\n Math.PI / 180\r\n );\r\n this.$l.t0 = pb.normalize(this.data.TBN[0]);\r\n this.$l.b0 = pb.normalize(this.data.TBN[1]);\r\n this.$l.tangent = pb.normalize(\r\n pb.add(pb.mul(this.t0, pb.cos(this.dirAngle)), pb.mul(this.b0, pb.sin(this.dirAngle)))\r\n );\r\n this.$l.bitangent = pb.normalize(pb.cross(this.data.normal, this.tangent));\r\n this.$l.ToH = pb.dot(this.tangent, this.H);\r\n this.$l.BoH = pb.dot(this.bitangent, this.H);\r\n this.$l.at = pb.max(pb.mul(this.alphaRoughness, pb.add(1, this.zAnisotropy)), 0.0001);\r\n this.$l.ab = pb.max(pb.mul(this.alphaRoughness, pb.sub(1, this.zAnisotropy)), 0.0001);\r\n this.$l.anisoDenom = pb.mul(\r\n Math.PI,\r\n this.at,\r\n this.ab,\r\n pb.pow(\r\n pb.add(\r\n pb.div(pb.mul(this.ToH, this.ToH), pb.mul(this.at, this.at)),\r\n pb.div(pb.mul(this.BoH, this.BoH), pb.mul(this.ab, this.ab)),\r\n pb.mul(this.NoH, this.NoH)\r\n ),\r\n 2\r\n )\r\n );\r\n this.D = pb.div(1, pb.max(this.anisoDenom, 0.0001));\r\n });\r\n this.$if(pb.equal(this.reflectionMode, PBR_REFLECTION_MODE.glint), function () {\r\n this.$l.glintNoise = pb.fract(\r\n pb.mul(\r\n pb.sin(pb.add(pb.dot(this.H, pb.vec3(127.1, 311.7, 74.7)), pb.mul(this.NoH, 43.1))),\r\n 43758.5453\r\n )\r\n );\r\n this.$l.glintMask = pb.smoothStep(0.97, 1, this.glintNoise);\r\n this.D = pb.mul(this.D, pb.add(1, pb.mul(this.glintMask, 8)));\r\n });\r\n this.$l.V = that.visGGX(this, this.NoV, this.NoL, this.alphaRoughness);\r\n this.$l.specular = pb.mul(this.lightColor, this.D, this.V, this.F, this.specularScale);\r\n this.$if(pb.equal(this.reflectionMode, PBR_REFLECTION_MODE.none), function () {\r\n this.specular = pb.vec3(0);\r\n });\r\n this.outColor = pb.add(this.outColor, this.specular);\r\n this.$l.diffuseBRDF = pb.mul(pb.sub(pb.vec3(1), this.F), pb.div(this.data.diffuse.rgb, Math.PI));\r\n this.$l.diffuse = pb.mul(\r\n this.lightColor,\r\n pb.max(this.diffuseBRDF, pb.vec3(0)),\r\n this.diffuseScale\r\n );\r\n this.outColor = pb.add(this.outColor, this.diffuse);\r\n });\r\n }\r\n );\r\n scope.$g[funcName](\r\n lightDir,\r\n lightColor,\r\n viewVec,\r\n commonData,\r\n diffuseScale,\r\n specularScale,\r\n sourceRadiusFactor,\r\n outColor\r\n );\r\n }\r\n indirectLighting(\r\n scope: PBInsideFunctionScope,\r\n viewVec: PBShaderExp,\r\n commonData: PBShaderExp,\r\n outColor: PBShaderExp,\r\n outRoughness?: PBShaderExp\r\n ) {\r\n const pb = scope.$builder;\r\n const that = this;\r\n const ctx = that.drawContext;\r\n const funcName = 'Z_PBRIndirectLighting';\r\n pb.func(\r\n funcName,\r\n [\r\n pb.vec3('viewVec'),\r\n that.getCommonDatasStruct(scope)('data'),\r\n pb.vec3('outColor').inout(),\r\n ...(outRoughness ? [pb.vec4('outRoughness').out()] : [])\r\n ],\r\n function () {\r\n if (\r\n !ctx.drawEnvLight ||\r\n (!ctx.env!.light.envLight.hasRadiance() && !ctx.env!.light.envLight.hasIrradiance())\r\n ) {\r\n return;\r\n }\r\n const envLightStrength = ShaderHelper.getEnvLightStrength(this);\r\n this.$l.occlusion = envLightStrength;\r\n this.$l.reflectionMode = this.zReflectionMode;\r\n this.$l.NoV = pb.clamp(pb.dot(this.data.normal, this.viewVec), 0.0001, 1);\r\n this.$l.ggxLutSample = pb.clamp(\r\n pb.textureSampleLevel(\r\n this.zGGXLut,\r\n pb.clamp(pb.vec2(this.NoV, this.data.roughness), pb.vec2(0), pb.vec2(1)),\r\n 0\r\n ),\r\n pb.vec4(0),\r\n pb.vec4(1)\r\n );\r\n this.$l.f_ab = this.ggxLutSample.rg;\r\n this.$l.Fr = pb.sub(\r\n pb.max(pb.vec3(pb.sub(1, this.data.roughness)), this.data.f0.rgb),\r\n this.data.f0.rgb\r\n );\r\n this.$l.k_S = pb.add(this.data.f0.rgb, pb.mul(this.Fr, pb.pow(pb.sub(1, this.NoV), 5)));\r\n if (outRoughness || ctx.env!.light.envLight.hasRadiance()) {\r\n this.$l.FssEss = pb.add(pb.mul(this.k_S, this.f_ab.x), pb.vec3(this.f_ab.y));\r\n this.$l.specularFactor = pb.mul(this.FssEss, this.occlusion);\r\n this.specularFactor = pb.mul(\r\n this.specularFactor,\r\n pb.float(pb.notEqual(this.reflectionMode, PBR_REFLECTION_MODE.none))\r\n );\r\n if (outRoughness) {\r\n this.outRoughness = pb.vec4(this.specularFactor /*this.data.f0.rgb*/, this.data.roughness);\r\n } else if (ctx.env!.light.envLight.hasRadiance()) {\r\n this.$l.radiance = ctx.env!.light.envLight.getRadiance(\r\n this,\r\n pb.reflect(pb.neg(this.viewVec), this.data.normal),\r\n this.data.roughness\r\n );\r\n this.outColor = pb.add(this.outColor, pb.mul(this.radiance, this.specularFactor));\r\n }\r\n }\r\n if (ctx.env!.light.envLight.hasIrradiance()) {\r\n this.$l.irradiance = ctx.env!.light.envLight.getIrradiance(this, this.data.normal);\r\n this.$l.mixedF0 = this.data.f0.rgb;\r\n this.$l.FssEss = pb.add(pb.mul(this.k_S, this.f_ab.x), pb.vec3(this.f_ab.y));\r\n this.$l.Ems = pb.sub(1, pb.add(this.f_ab.x, this.f_ab.y));\r\n this.$l.F_avg = pb.add(this.mixedF0, pb.div(pb.sub(pb.vec3(1), this.mixedF0), 21));\r\n this.$l.FmsEms = pb.div(\r\n pb.mul(this.FssEss, this.F_avg, this.Ems),\r\n pb.sub(pb.vec3(1), pb.mul(this.F_avg, this.Ems))\r\n );\r\n this.$l.k_D = pb.mul(this.data.diffuse.rgb, pb.add(pb.sub(pb.vec3(1), this.FssEss), this.FmsEms));\r\n this.$l.iblDiffuse = pb.mul(pb.add(this.FmsEms, this.k_D), this.irradiance, this.occlusion);\r\n this.outColor = pb.add(this.outColor, this.iblDiffuse);\r\n }\r\n }\r\n );\r\n if (outRoughness) {\r\n scope.$g[funcName](viewVec, commonData, outColor, outRoughness);\r\n } else {\r\n scope.$g[funcName](viewVec, commonData, outColor);\r\n }\r\n }\r\n applyUniformValues(bindGroup: BindGroup, ctx: DrawContext, pass: number) {\r\n super.applyUniformValues(bindGroup, ctx, pass);\r\n if (this.needFragmentColor(ctx)) {\r\n if (ctx.drawEnvLight) {\r\n bindGroup.setTexture('zGGXLut', getGGXLUT(1024));\r\n }\r\n }\r\n }\r\n } as unknown as T & { new (...args: any[]): IMixinPBRBluePrint };\r\n}\r\n"],"names":["PBR_REFLECTION_MODE","none","ggx","anisotropic","glint","mixinPBRBluePrint","BaseCls","pbrBluePrint","S","applyMaterialMixins","mixinPBRBRDF","mixinLight","copyFrom","other","getCommonData","scope","data","viewVec","worldPos","worldNorm","worldTangent","worldBinormal","vertexColor","vertexUV","ir","calculateCommonData","getCommonDatasStruct","pb","$builder","defineStruct","vec4","vec3","float","mat3","PBRLight","commonData","outRoughness","funcName","that","func","out","$l","lightingColor","emissiveColor","pbrData","emissive","indirectLighting","forEachLight","type","posRange","dirCutoff","colorIntensity","extra","shadow","$if","equal","LIGHT_TYPE_RECT","center","xyz","range","w","ax","ay","halfWidth","length","halfHeight","area","mul","lightNormal","normalize","cross","neg","greaterThan","baseColor","rgb","a","samplePos","Lvec","L","dist","invDist2","NoL","NoL_light","falloff","atten","lightColor","sample","u","v","add","sub","div","max","clamp","dot","normal","directLighting","$else","diffuse","specular","diffuseScale","specularScale","sourceRadiusFactor","LIGHT_TYPE_POINT","x","y","z","distance","lightAtten","calculateLightAttenuation","lightDir","calculateLightDirection","calculateShadow","$return","albedo","getGlobalScope","vertexShader","fragmentShader","needFragmentColor","zReflectionMode","uniform","drawContext","drawEnvLight","zGGXLut","tex2D","params","vec2","paramValues","outputs","create","zCommonData","getOutput","metallic","roughness","ShaderHelper","getCameraRoughnessFactor","f90","f0","mix","min","tangent","zVertexTangent","ng","zVertexNormal","t_","t","b","doubleSidedLighting","cullMode","not","$builtins","frontFacing","TBN","name","find","output","exp","outColor","inout","reflectionMode","H","NoH","NoV","VoH","schlickFresnel","fresnelSchlick","F","specularRoughness","alphaRoughness","D","distributionGGX","dirAngle","zAnisotropyDirection","zAnisotropyDirectionScaleBias","Math","PI","t0","b0","cos","sin","bitangent","ToH","BoH","at","zAnisotropy","ab","anisoDenom","pow","glintNoise","fract","glintMask","smoothStep","V","visGGX","diffuseBRDF","$g","ctx","env","light","envLight","hasRadiance","hasIrradiance","envLightStrength","getEnvLightStrength","occlusion","ggxLutSample","textureSampleLevel","f_ab","rg","Fr","k_S","FssEss","specularFactor","notEqual","radiance","getRadiance","reflect","irradiance","getIrradiance","mixedF0","Ems","F_avg","FmsEms","k_D","iblDiffuse","applyUniformValues","bindGroup","pass","setTexture","getGGXLUT"],"mappings":";;;;;;;AAcA,MAAMA,mBAAsB,GAAA;IAC1BC,IAAM,EAAA,CAAA;IACNC,GAAK,EAAA,CAAA;IACLC,WAAa,EAAA,CAAA;IACbC,KAAO,EAAA;AACT,CAAA;AA4DA;;;;;IAMO,SAASC,iBAAAA,CAAiDC,OAAU,EAAA;IACzE,IAAKA,OAAgBC,CAAAA,YAAY,EAAE;QACjC,OAAOD,OAAAA;AACT;IACA,MAAME,CAAAA,GAAIC,mBAAoBH,CAAAA,OAAAA,EAASI,YAAcC,EAAAA,UAAAA,CAAAA;AAErD,IAAA,OAAO,cAAcH,CAAAA,CAAAA;AACnB,QAAA,OAAgBD,eAAe,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