reze-engine 0.66.2 → 0.66.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"probe.d.ts","sourceRoot":"","sources":["../../../src/shaders/passes/probe.ts"],"names":[],"mappings":"AAgBA;6EAC6E;AAC7E,eAAO,MAAM,kBAAkB,MAAM,CAAA;AACrC,eAAO,MAAM,UAAU,KAAK,CAAA;AAC5B,0DAA0D;AAC1D,eAAO,MAAM,YAAY,IAAI,CAAA;AAC7B,eAAO,MAAM,oBAAoB,IAAI,CAAA;AAErC;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIzD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAIvE;AA+DD;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,QAmB9B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAoC7B,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,QAmD9B,CAAA"}
1
+ {"version":3,"file":"probe.d.ts","sourceRoot":"","sources":["../../../src/shaders/passes/probe.ts"],"names":[],"mappings":"AAgBA;6EAC6E;AAC7E,eAAO,MAAM,kBAAkB,MAAM,CAAA;AACrC,eAAO,MAAM,UAAU,KAAK,CAAA;AAC5B,0DAA0D;AAC1D,eAAO,MAAM,YAAY,IAAI,CAAA;AAC7B,eAAO,MAAM,oBAAoB,IAAI,CAAA;AAErC;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIzD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAIvE;AA+DD;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,QA8B9B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAoC7B,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,QAmD9B,CAAA"}
@@ -120,12 +120,23 @@ struct RzProbeStep { face: u32, lod: f32, roughness: f32, srcSize: f32 };
120
120
  @group(0) @binding(21) var rzCaptureAux: texture_2d_array<f32>;
121
121
  @group(0) @binding(22) var<uniform> rzStep: RzProbeStep;
122
122
 
123
+ /** Radiance the probe can hold: finite, not negative, inside half float.
124
+ * One pixel that is not — a NaN from any surface in the capture, or an
125
+ * emissive sheet that overflowed the half-float target to infinity — spreads
126
+ * through every GGX level built from it (each texel averages up to 128
127
+ * samples), and every Lit surface reading the probe went dark with it. A
128
+ * bad pixel here costs one texel, not the stage. */
129
+ fn rz_probe_radiance(c: vec3f) -> vec3f {
130
+ let finite = (c == c) & (abs(c) < vec3f(65000.0));
131
+ return clamp(select(vec3f(0.0), c, finite), vec3f(0.0), vec3f(65000.0));
132
+ }
133
+
123
134
  @fragment fn fs_compose(in: RzFullOut) -> @location(0) vec4f {
124
135
  let size = textureDimensions(rzCaptureColor);
125
136
  let px = vec2u(min(in.pos.xy, vec2f(size) - vec2f(1.0)));
126
- let c = textureLoad(rzCaptureColor, px, rzStep.face, 0).rgb;
137
+ let c = rz_probe_radiance(textureLoad(rzCaptureColor, px, rzStep.face, 0).rgb);
127
138
  let cover = saturate(textureLoad(rzCaptureAux, px, rzStep.face, 0).g);
128
- let sky = rzWorldSpecularLod(rz_face_dir(rzStep.face, in.uv), 0.0, 0.0);
139
+ let sky = rz_probe_radiance(rzWorldSpecularLod(rz_face_dir(rzStep.face, in.uv), 0.0, 0.0));
129
140
  return vec4f(c + sky * (1.0 - cover), 1.0);
130
141
  }
131
142
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reze-engine",
3
- "version": "0.66.2",
3
+ "version": "0.66.3",
4
4
  "description": "A lightweight WebGPU engine for real-time 3D MMD/PMX model rendering",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -126,12 +126,23 @@ struct RzProbeStep { face: u32, lod: f32, roughness: f32, srcSize: f32 };
126
126
  @group(0) @binding(21) var rzCaptureAux: texture_2d_array<f32>;
127
127
  @group(0) @binding(22) var<uniform> rzStep: RzProbeStep;
128
128
 
129
+ /** Radiance the probe can hold: finite, not negative, inside half float.
130
+ * One pixel that is not — a NaN from any surface in the capture, or an
131
+ * emissive sheet that overflowed the half-float target to infinity — spreads
132
+ * through every GGX level built from it (each texel averages up to 128
133
+ * samples), and every Lit surface reading the probe went dark with it. A
134
+ * bad pixel here costs one texel, not the stage. */
135
+ fn rz_probe_radiance(c: vec3f) -> vec3f {
136
+ let finite = (c == c) & (abs(c) < vec3f(65000.0));
137
+ return clamp(select(vec3f(0.0), c, finite), vec3f(0.0), vec3f(65000.0));
138
+ }
139
+
129
140
  @fragment fn fs_compose(in: RzFullOut) -> @location(0) vec4f {
130
141
  let size = textureDimensions(rzCaptureColor);
131
142
  let px = vec2u(min(in.pos.xy, vec2f(size) - vec2f(1.0)));
132
- let c = textureLoad(rzCaptureColor, px, rzStep.face, 0).rgb;
143
+ let c = rz_probe_radiance(textureLoad(rzCaptureColor, px, rzStep.face, 0).rgb);
133
144
  let cover = saturate(textureLoad(rzCaptureAux, px, rzStep.face, 0).g);
134
- let sky = rzWorldSpecularLod(rz_face_dir(rzStep.face, in.uv), 0.0, 0.0);
145
+ let sky = rz_probe_radiance(rzWorldSpecularLod(rz_face_dir(rzStep.face, in.uv), 0.0, 0.0));
135
146
  return vec4f(c + sky * (1.0 - cover), 1.0);
136
147
  }
137
148
  `