@forgeax/engine-shader 0.1.27 → 0.1.29

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 (73) hide show
  1. package/NOTICE +35 -0
  2. package/README.md +39 -0
  3. package/dist/ShaderRegistry.d.ts +8 -0
  4. package/dist/ShaderRegistry.d.ts.map +1 -1
  5. package/dist/index.d.ts +6 -2
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.mjs +312 -71
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/material/artifact-types.d.ts +12 -2
  10. package/dist/material/artifact-types.d.ts.map +1 -1
  11. package/dist/material-schemas.d.ts +5 -0
  12. package/dist/material-schemas.d.ts.map +1 -1
  13. package/package.json +5 -4
  14. package/src/ShaderRegistry.ts +10 -0
  15. package/src/__tests__/auto-exposure-graph.unit.test.ts +59 -0
  16. package/src/__tests__/bloom-fxaa-tonemap.unit.test.ts +30 -15
  17. package/src/__tests__/builtin-texture-sampling-contract.test.ts +1 -1
  18. package/src/__tests__/default-standard-pbr-alpha.unit.test.ts +2 -1
  19. package/src/__tests__/default-standard-pbr-transmission.unit.test.ts +167 -6
  20. package/src/__tests__/direct-light-layout.unit.test.ts +1 -1
  21. package/src/__tests__/lighting-punctual.unit.test.ts +29 -1
  22. package/src/__tests__/ltc-provenance.unit.test.ts +13 -2
  23. package/src/__tests__/material-builtins.unit.test.ts +1 -0
  24. package/src/__tests__/material-contract.unit.test.ts +42 -9
  25. package/src/__tests__/material-derived-builtins.integration.test.ts +18 -2
  26. package/src/__tests__/probe-lighting-composition.unit.test.ts +1 -1
  27. package/src/__tests__/reflection-probe-sampling.unit.test.ts +23 -2
  28. package/src/__tests__/scene-temporal.unit.test.ts +10 -0
  29. package/src/__tests__/shader.unit.test.ts +1 -0
  30. package/src/__tests__/sprite-variants.unit.test.ts +1 -0
  31. package/src/__tests__/ssr-artifact.unit.test.ts +141 -0
  32. package/src/__tests__/ssr-bgl.integration.test.ts +185 -0
  33. package/src/__tests__/standard-output-domain.unit.test.ts +36 -0
  34. package/src/__tests__/standard-pbr-artifact-receipt.unit.test.ts +93 -0
  35. package/src/__tests__/standard-surface-pass-evaluation.integration.test.ts +16 -4
  36. package/src/__tests__/surface-v1.unit.test.ts +6 -0
  37. package/src/__tests__/taa-resolve.unit.test.ts +20 -9
  38. package/src/__tests__/transmission-thickness-scale.unit.test.ts +6 -1
  39. package/src/__tests__/transparent-pbr.unit.test.ts +1 -1
  40. package/src/__tests__/vertex-color-variant.unit.test.ts +4 -1
  41. package/src/atmosphere-background.wgsl +3 -3
  42. package/src/auto-exposure-meter.wgsl +179 -0
  43. package/src/color-lut.wgsl +17 -0
  44. package/src/common.wgsl +7 -5
  45. package/src/default-standard-pbr-skin.wgsl +142 -40
  46. package/src/default-standard-pbr.wgsl +198 -82
  47. package/src/default_standard_surface.wgsl +56 -19
  48. package/src/fxaa.wgsl +9 -5
  49. package/src/ibl-sampling.wgsl +30 -6
  50. package/src/index.ts +189 -0
  51. package/src/lighting-punctual.wgsl +5 -6
  52. package/src/material/artifact-types.ts +109 -63
  53. package/src/material-schemas.ts +84 -8
  54. package/src/output-encoding.wgsl +10 -0
  55. package/src/pbr-temporal.wgsl +9 -1
  56. package/src/scene-temporal.wgsl +2 -0
  57. package/src/shadow-pcf.wgsl +6 -8
  58. package/src/shadow-surface.wgsl +16 -0
  59. package/src/shadow_caster.wgsl +99 -61
  60. package/src/sprite-lit.wgsl +4 -4
  61. package/src/sprite.wgsl +3 -3
  62. package/src/ssr-compose.wgsl +129 -0
  63. package/src/ssr-hiz-reduce.wgsl +53 -0
  64. package/src/ssr-hiz.wgsl +66 -0
  65. package/src/ssr-temporal.wgsl +305 -0
  66. package/src/ssr-trace.wgsl +784 -0
  67. package/src/standard-cluster.wgsl +6 -4
  68. package/src/standard-surface.wgsl +696 -0
  69. package/src/surface_v1.wgsl +6 -0
  70. package/src/taa-resolve.wgsl +222 -28
  71. package/src/tbn.wgsl +1 -1
  72. package/src/tonemap.wgsl +37 -18
  73. package/src/unlit.wgsl +3 -3
@@ -100,6 +100,7 @@ fn evaluate_cluster_light(
100
100
  alpha_sq : f32,
101
101
  f0 : vec3<f32>,
102
102
  flat_2d : bool,
103
+ receive_shadows : bool,
103
104
  ) -> vec3<f32> {
104
105
  let kind = light.metadata.x;
105
106
  if (kind == KIND_POINT) {
@@ -111,7 +112,7 @@ fn evaluate_cluster_light(
111
112
  }
112
113
  #ifdef POINT_SHADOW_AVAILABLE
113
114
  let layer = bitcast<i32>(light.metadata.y);
114
- if (layer >= 0) {
115
+ if (receive_shadows && layer >= 0) {
115
116
  let shadow = shadowParams[layer];
116
117
  return evalPointShadowed(
117
118
  light.position.xyz, light.colorTimesIntensity.xyz, light.position.w,
@@ -119,7 +120,7 @@ fn evaluate_cluster_light(
119
120
  layer,
120
121
  shadow.x,
121
122
  shadow.y,
122
- 0.005, 0.05,
123
+ shadow.z, shadow.w,
123
124
  );
124
125
  }
125
126
  #endif
@@ -163,7 +164,7 @@ fn evaluate_cluster_light(
163
164
  world_pos, normal, view_dir, base_color, metallic, alpha_sq, f0,
164
165
  view.spotLightViewProj[tile], tile, 0.005, 0.05,
165
166
  3.0,
166
- 1.0,
167
+ select(0.0, 1.0, receive_shadows),
167
168
  ) * modifier
168
169
  #ifdef PROJECTOR_AVAILABLE
169
170
  * select(
@@ -212,6 +213,7 @@ fn evaluateStandardClusterLights(
212
213
  alpha_sq : f32,
213
214
  f0 : vec3<f32>,
214
215
  flat_2d : bool,
216
+ receive_shadows : bool,
215
217
  ) -> vec3<f32> {
216
218
  let gx = cluster_uniform.grid.x;
217
219
  let gy = cluster_uniform.grid.y;
@@ -230,7 +232,7 @@ fn evaluateStandardClusterLights(
230
232
  let light = light_data[light_index_list[list_offset + i]];
231
233
  total_radiance += evaluate_cluster_light(
232
234
  light, world_pos, normal, view_dir, base_color, metallic, alpha_sq, f0,
233
- flat_2d,
235
+ flat_2d, receive_shadows,
234
236
  );
235
237
  }
236
238
  return total_radiance;