@forgeax/engine-vfx-render 0.1.19 → 0.1.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgeax/engine-vfx-render",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -22,13 +22,13 @@
22
22
  "LICENSE"
23
23
  ],
24
24
  "dependencies": {
25
- "@forgeax/engine-assets-runtime": "0.1.19",
26
- "@forgeax/engine-ecs": "0.1.19",
27
- "@forgeax/engine-math": "0.1.19",
28
- "@forgeax/engine-render": "0.1.19",
29
- "@forgeax/engine-scene": "0.1.19",
30
- "@forgeax/engine-types": "0.1.19",
31
- "@forgeax/engine-vfx": "0.1.19"
25
+ "@forgeax/engine-assets-runtime": "0.1.20",
26
+ "@forgeax/engine-ecs": "0.1.20",
27
+ "@forgeax/engine-math": "0.1.20",
28
+ "@forgeax/engine-render": "0.1.20",
29
+ "@forgeax/engine-scene": "0.1.20",
30
+ "@forgeax/engine-types": "0.1.20",
31
+ "@forgeax/engine-vfx": "0.1.20"
32
32
  },
33
33
  "devDependencies": {},
34
34
  "forgeax": {
@@ -8,25 +8,11 @@ function shaderSource(name: (typeof shaderNames)[number]): string {
8
8
  return readFileSync(fileURLToPath(new URL(`../shaders/${name}.wgsl`, import.meta.url)), 'utf8');
9
9
  }
10
10
 
11
- function count(source: string, pattern: RegExp): number {
12
- return source.match(pattern)?.length ?? 0;
13
- }
14
-
15
- describe('VFX Fog producer contract', () => {
16
- it('requires one shared Fog call with a world-space ray for every topology', () => {
11
+ describe('VFX volumetric-fog boundary contract', () => {
12
+ it('keeps analytic fog out of every particle topology', () => {
17
13
  for (const name of shaderNames) {
18
14
  const source = shaderSource(name);
19
- expect(source, name).toMatch(
20
- /#import\s+forgeax_view::common::\{[^}]*\bFogViewParams\b[^}]*\bFogRay\b[^}]*\}/,
21
- );
22
- expect(source, name).toMatch(/#import\s+forgeax_view::fog::\{[^}]*\bapply_fog\b[^}]*\}/);
23
- expect(count(source, /\bapply_fog\s*\(/g), name).toBe(1);
24
- expect(count(source, /\bFogRay\s*\(/g) + count(source, /\bfogRayFromNdc\s*\(/g), name).toBe(
25
- 1,
26
- );
27
- expect(source, name).toMatch(/world[_A-Za-z]*position|worldPosition|fogRayFromNdc/);
28
- expect(source, name).toMatch(/ray[_A-Za-z]*distance|distance|fogRayFromNdc/);
29
- expect(source, name).toMatch(/\.a\b|alpha/);
15
+ expect(source, name).not.toMatch(/\bFogViewParams\b|\bFogRay\b|\bapply_fog\s*\(/);
30
16
  expect(source, name).not.toMatch(/texture_3d|raymarch/i);
31
17
  }
32
18
  });
@@ -48,15 +34,16 @@ describe('VFX Fog producer contract', () => {
48
34
  expect(camera).toContain('viewProjection');
49
35
  });
50
36
 
51
- it('keeps billboard scene-depth soft-particle alpha before Fog mixing', () => {
37
+ it('keeps billboard scene-depth soft-particle alpha in the final color', () => {
52
38
  const billboard = shaderSource('billboard');
53
39
  const depthLoad = billboard.indexOf('textureLoad(scene_depth');
54
40
  const softParticleCall = billboard.indexOf('softParticle(input.position');
55
- const fogCall = billboard.indexOf('apply_fog(');
41
+ const finalColor = billboard.indexOf('return vec4<f32>(rgb * alpha, alpha);');
56
42
 
57
43
  expect(depthLoad).toBeGreaterThanOrEqual(0);
58
44
  expect(softParticleCall).toBeGreaterThan(depthLoad);
59
- expect(fogCall).toBeGreaterThan(softParticleCall);
45
+ expect(finalColor).toBeGreaterThan(softParticleCall);
60
46
  expect(billboard).toContain('input.color.a * edge, input.fade_distance');
47
+ expect(billboard).not.toContain('apply_fog(');
61
48
  });
62
49
  });
@@ -1,6 +1,4 @@
1
1
  #define_import_path forgeax::vfx-render.particles.beam
2
- #import forgeax_view::common::{View, FogViewParams, FogRay, view, fogRayFromNdc}
3
- #import forgeax_view::fog::{apply_fog}
4
2
 
5
3
  struct BeamInput {
6
4
  @location(0) start: vec3<f32>,
@@ -37,10 +35,5 @@ fn vs_main(input: BeamInput, @builtin(vertex_index) vertexIndex: u32) -> VertexO
37
35
  fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> {
38
36
  let base = vec4<f32>(0.7, 0.2, 1.0, 1.0);
39
37
  let alpha = base.a * input.color.a;
40
- let fogged = apply_fog(
41
- view.fog,
42
- fogRayFromNdc(input.clip_position),
43
- vec4<f32>(base.rgb * input.color.rgb, alpha),
44
- );
45
- return vec4<f32>(fogged.rgb * fogged.a, fogged.a);
38
+ return vec4<f32>(base.rgb * input.color.rgb * alpha, alpha);
46
39
  }
@@ -1,8 +1,8 @@
1
1
  #define_import_path forgeax::vfx-render.particles.billboard
2
- #import forgeax_view::common::{View, FogViewParams, FogRay, view, fogRayFromNdc}
3
- #import forgeax_view::fog::{apply_fog}
4
-
5
- @group(0) @binding(1) var scene_depth: texture_depth_2d;
2
+ // The analytic fog producer was removed from this shader. Billboard
3
+ // soft-particle depth is therefore the sole group-0 resource again, matching
4
+ // the prepared group-0-resource layout and its binding resolver.
5
+ @group(0) @binding(0) var scene_depth: texture_depth_2d;
6
6
 
7
7
  struct VertexOutput {
8
8
  @builtin(position) position: vec4<f32>,
@@ -104,6 +104,5 @@ fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> {
104
104
  let alpha = softParticle(input.position, input.color.a * edge, input.fade_distance);
105
105
  let sheetPulse = 0.82 + 0.18 * fract(input.sheet_frame * 0.618 + input.sheet_uv.x + input.sheet_uv.y);
106
106
  let rgb = (input.color.rgb + emissive * (0.35 + core * 0.65) + vec3<f32>(highlight)) * sheetPulse;
107
- let fogged = apply_fog(view.fog, fogRayFromNdc(input.clip_position), vec4<f32>(rgb, alpha));
108
- return vec4<f32>(fogged.rgb * fogged.a, fogged.a);
107
+ return vec4<f32>(rgb * alpha, alpha);
109
108
  }
@@ -1,6 +1,4 @@
1
1
  #define_import_path forgeax::vfx-render.particles.mesh
2
- #import forgeax_view::common::{View, FogViewParams, FogRay, view, fogRayFromNdc}
3
- #import forgeax_view::fog::{apply_fog}
4
2
 
5
3
  struct VertexOutput {
6
4
  @builtin(position) position: vec4<f32>,
@@ -66,10 +64,6 @@ fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> {
66
64
  let specular_color = mix(dielectric, input.color.rgb, metallic);
67
65
  let lit = input.color.rgb * diffuse * (1.0 - metallic * 0.55);
68
66
  let emissive = input.emissive_intensity.rgb * input.emissive_intensity.a;
69
- let fogged = apply_fog(
70
- view.fog,
71
- fogRayFromNdc(input.clip_position),
72
- vec4<f32>(lit + specular_color * specular + vec3<f32>(coat) + emissive, input.color.a),
73
- );
74
- return vec4<f32>(fogged.rgb * fogged.a, fogged.a);
67
+ let rgb = lit + specular_color * specular + vec3<f32>(coat) + emissive;
68
+ return vec4<f32>(rgb * input.color.a, input.color.a);
75
69
  }
@@ -1,6 +1,4 @@
1
1
  #define_import_path forgeax::vfx-render.particles.ribbon
2
- #import forgeax_view::common::{View, FogViewParams, FogRay, view, fogRayFromNdc}
3
- #import forgeax_view::fog::{apply_fog}
4
2
 
5
3
  struct SegmentInput {
6
4
  @location(0) start: vec3<f32>,
@@ -37,10 +35,5 @@ fn vs_main(input: SegmentInput, @builtin(vertex_index) vertexIndex: u32) -> Vert
37
35
  fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> {
38
36
  let base = vec4<f32>(0.2, 0.7, 1.0, 0.9);
39
37
  let alpha = base.a * input.color.a;
40
- let fogged = apply_fog(
41
- view.fog,
42
- fogRayFromNdc(input.clip_position),
43
- vec4<f32>(base.rgb * input.color.rgb, alpha),
44
- );
45
- return fogged;
38
+ return vec4<f32>(base.rgb * input.color.rgb * alpha, alpha);
46
39
  }
@@ -1,6 +1,4 @@
1
1
  #define_import_path forgeax::vfx-render.particles.trail
2
- #import forgeax_view::common::{View, FogViewParams, FogRay, view, fogRayFromNdc}
3
- #import forgeax_view::fog::{apply_fog}
4
2
 
5
3
  struct SegmentInput {
6
4
  @location(0) start: vec3<f32>,
@@ -45,10 +43,5 @@ fn vs_main(input: SegmentInput, @builtin(vertex_index) vertexIndex: u32) -> Vert
45
43
  fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> {
46
44
  let base = vec4<f32>(0.8, 0.35, 0.1, 1.0);
47
45
  let alpha = base.a * input.color.a;
48
- let fogged = apply_fog(
49
- view.fog,
50
- fogRayFromNdc(input.clip_position),
51
- vec4<f32>(base.rgb * input.color.rgb, alpha),
52
- );
53
- return vec4<f32>(fogged.rgb * fogged.a, fogged.a);
46
+ return vec4<f32>(base.rgb * input.color.rgb * alpha, alpha);
54
47
  }