@fps-games/vfx 0.3.18 → 0.3.19

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.
@@ -21,6 +21,7 @@ export interface EnergyShieldParams extends VfxParamValues {
21
21
  backRimStrength: number;
22
22
  backGlowStrength: number;
23
23
  backGlowHeight: number;
24
+ showSurfaceTexture: boolean;
24
25
  showSurfaceFlow: boolean;
25
26
  surfaceIntensity: number;
26
27
  noiseScale: number;
@@ -25,6 +25,7 @@ const DEFAULT_PARAMS = {
25
25
  backRimStrength: 1,
26
26
  backGlowStrength: 0.36,
27
27
  backGlowHeight: 0.49,
28
+ showSurfaceTexture: false,
28
29
  showSurfaceFlow: false,
29
30
  surfaceIntensity: 0.04,
30
31
  noiseScale: 0.9,
@@ -77,6 +78,7 @@ uniform float uRimIntensity;
77
78
  uniform float uHorizonStrength;
78
79
  uniform float uHorizonHeight;
79
80
  uniform float uSurfaceVariation;
81
+ uniform float uSurfaceTextureEnabled;
80
82
  uniform float uSurfaceFlowEnabled;
81
83
  uniform float uSurfaceIntensity;
82
84
  uniform float uNoiseScale;
@@ -133,14 +135,15 @@ void main(void) {
133
135
  float cloud = valueNoise(vObjPos * max(0.05, uNoiseScale)) * 0.65;
134
136
  cloud += valueNoise(vObjPos * max(0.05, uFlowScale) + motion) * 0.35;
135
137
  float shapedCloud = pow(clamp(cloud, 0.0, 1.0), max(0.25, uMarbleContrast));
136
- float variation = mix(1.0 - uSurfaceVariation, 1.0 + uSurfaceVariation, shapedCloud);
137
- float cloudShade = mix(0.92, 1.08, shapedCloud);
138
+ float surfaceTexture = step(0.5, uSurfaceTextureEnabled);
139
+ float variation = mix(1.0, mix(1.0 - uSurfaceVariation, 1.0 + uSurfaceVariation, shapedCloud), surfaceTexture);
140
+ float cloudShade = mix(1.0, mix(0.92, 1.08, shapedCloud), surfaceTexture);
138
141
  rim *= cloudShade;
139
142
 
140
143
  float edgeWidth = max(0.005, uNoiseEdgeWidth);
141
144
  float edgeSoftness = max(0.005, uNoiseEdgeSmoothness * 0.2);
142
145
  float flowBand = 1.0 - smoothstep(edgeWidth, edgeWidth + edgeSoftness, abs(shapedCloud - 0.5));
143
- float flowGlow = flowBand * uFlowIntensity * uNoiseEdgeIntensity * uSurfaceFlowEnabled;
146
+ float flowGlow = flowBand * uFlowIntensity * uNoiseEdgeIntensity * uSurfaceFlowEnabled * surfaceTexture;
144
147
 
145
148
  float alpha = uOpacity * variation + rim * uRimStrength + horizon * uHorizonStrength * variation;
146
149
  alpha += flowGlow * uOpacity * 0.5;
@@ -177,6 +180,7 @@ const energyShieldEffectPackage = {
177
180
  { key: "backRimStrength", label: "背面轮廓强度", kind: "number", min: 0, max: 1.5, step: 0.01 },
178
181
  { key: "backGlowStrength", label: "背面底部辉光", kind: "number", min: 0, max: 1, step: 0.01 },
179
182
  { key: "backGlowHeight", label: "背面辉光高度", kind: "number", min: 0.04, max: 1, step: 0.01 },
183
+ { key: "showSurfaceTexture", label: "显示表面纹理", kind: "boolean" },
180
184
  { key: "showSurfaceFlow", label: "显示表面流动", kind: "boolean" },
181
185
  { key: "surfaceIntensity", label: "表面亮度", kind: "number", min: 0, max: 3, step: 0.01 },
182
186
  { key: "noiseScale", label: "噪声缩放", kind: "number", min: 0.2, max: 5, step: 0.01 },
@@ -395,6 +399,7 @@ function createShieldMaterial(scene, options = {}) {
395
399
  "uHorizonStrength",
396
400
  "uHorizonHeight",
397
401
  "uSurfaceVariation",
402
+ "uSurfaceTextureEnabled",
398
403
  "uSurfaceFlowEnabled",
399
404
  "uSurfaceIntensity",
400
405
  "uNoiseScale",
@@ -466,6 +471,7 @@ function applyMaterialParams(material, params, settings) {
466
471
  material.setFloat("uHorizonStrength", settings.horizonStrength);
467
472
  material.setFloat("uHorizonHeight", settings.horizonHeight);
468
473
  material.setFloat("uSurfaceVariation", params.surfaceVariation);
474
+ material.setFloat("uSurfaceTextureEnabled", params.showSurfaceTexture ? 1 : 0);
469
475
  material.setFloat("uSurfaceFlowEnabled", params.showSurfaceFlow ? 1 : 0);
470
476
  material.setFloat("uSurfaceIntensity", params.surfaceIntensity);
471
477
  material.setFloat("uNoiseScale", params.noiseScale);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fps-games/vfx",
3
- "version": "0.3.18",
3
+ "version": "0.3.19",
4
4
  "type": "module",
5
5
  "description": "Shared VFX library for Playable projects: engine-injected effect packages + runtime. Project-pure (no imports of host project code).",
6
6
  "publishConfig": {
@@ -24,6 +24,7 @@
24
24
  "backRimStrength": 1,
25
25
  "backGlowStrength": 0.36,
26
26
  "backGlowHeight": 0.49,
27
+ "showSurfaceTexture": false,
27
28
  "showSurfaceFlow": false,
28
29
  "surfaceIntensity": 0.04,
29
30
  "noiseScale": 0.9,