@meimu/mutracer 0.1.1 → 0.1.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.
Files changed (95) hide show
  1. package/dist/assets/bvh.worker.js +1 -1
  2. package/dist/mutracer.umd.js +3525 -3484
  3. package/docs/materials.md +27 -7
  4. package/docs/threejs.md +13 -2
  5. package/docs/viewer.md +53 -0
  6. package/lib/oidn.d.ts +1 -1
  7. package/lib/oidnBundledWeights.cdn.d.ts +2 -2
  8. package/lib/renderer/MaterialTable.d.ts +1 -0
  9. package/lib/renderer/MaterialTable.js +2 -1
  10. package/lib/renderer/MaterialTable.js.map +1 -1
  11. package/lib/renderer/WGPUBloomPass.js +18 -18
  12. package/lib/renderer/WGPUFullQuadPass.js +3 -3
  13. package/lib/renderer/WGPUJNLMDenoiser.js +62 -62
  14. package/lib/renderer/WGPURayTraceOutput.js +14 -12
  15. package/lib/renderer/WGPURayTraceOutput.js.map +1 -1
  16. package/lib/renderer/WGPURayTracePass.js +2 -2
  17. package/lib/renderer/WGPURayTracePass.js.map +1 -1
  18. package/lib/renderer/WGPURenderingPipeline.js +20 -18
  19. package/lib/renderer/WGPURenderingPipeline.js.map +1 -1
  20. package/lib/renderer/WebGLJNLMDenoiser.js +61 -61
  21. package/lib/renderer/WebGLRayTraceOutputPass.js +4 -4
  22. package/lib/renderer/WebGLRayTracePass.js +3 -1
  23. package/lib/renderer/WebGLRayTracePass.js.map +1 -1
  24. package/lib/renderer/glsl/chunks/cameraRay.glsl.js +9 -9
  25. package/lib/renderer/glsl/chunks/envMap.glsl.js +45 -45
  26. package/lib/renderer/glsl/chunks/intersect.glsl.js +262 -262
  27. package/lib/renderer/glsl/chunks/materialBuffer.glsl.js +111 -111
  28. package/lib/renderer/glsl/chunks/openPbrBsdf.glsl.js +436 -436
  29. package/lib/renderer/glsl/chunks/rand.glsl.js +3 -3
  30. package/lib/renderer/glsl/chunks/random.glsl.js +3 -3
  31. package/lib/renderer/glsl/chunks/rayTraceCore.glsl.js +32 -32
  32. package/lib/renderer/glsl/chunks/sampleLight.glsl.js +54 -54
  33. package/lib/renderer/glsl/chunks/sampleMaterial.glsl.js +71 -71
  34. package/lib/renderer/glsl/chunks/sampleShadowCatcher.glsl.js +12 -12
  35. package/lib/renderer/glsl/chunks/sampling.glsl.js +64 -64
  36. package/lib/renderer/glsl/chunks/sobol.glsl.js +49 -49
  37. package/lib/renderer/glsl/chunks/textureLinear.glsl.js +5 -5
  38. package/lib/renderer/glsl/chunks/uvProjection.glsl.js +5 -5
  39. package/lib/renderer/glsl/depthQuery.frag.js +2 -2
  40. package/lib/renderer/glsl/normalizeRayTraceOutput.frag.js +8 -8
  41. package/lib/renderer/glsl/rayTrace.frag.js +128 -128
  42. package/lib/renderer/glsl/shadowCatcher.frag.js +12 -12
  43. package/lib/renderer/glsl/webglPipeline.frag.js +49 -49
  44. package/lib/renderer/lightsUtil.js +1 -1
  45. package/lib/renderer/lightsUtil.js.map +1 -1
  46. package/lib/renderer/materialComparison.generated.js +5 -0
  47. package/lib/renderer/materialComparison.generated.js.map +1 -1
  48. package/lib/renderer/materialLayout.js +2 -1
  49. package/lib/renderer/materialLayout.js.map +1 -1
  50. package/lib/renderer/prepareMeshBVH.d.ts +4 -2
  51. package/lib/renderer/prepareMeshBVH.js +44 -20
  52. package/lib/renderer/prepareMeshBVH.js.map +1 -1
  53. package/lib/renderer/scratchSampling.js +6 -6
  54. package/lib/renderer/wgsl/chunks/common.wgsl.js +4 -4
  55. package/lib/renderer/wgsl/chunks/envMap.wgsl.js +29 -29
  56. package/lib/renderer/wgsl/chunks/intersect.wgsl.js +376 -379
  57. package/lib/renderer/wgsl/chunks/intersect.wgsl.js.map +1 -1
  58. package/lib/renderer/wgsl/chunks/intersectionAlpha.wgsl.js +5 -5
  59. package/lib/renderer/wgsl/chunks/materialBuffer.wgsl.js +51 -51
  60. package/lib/renderer/wgsl/chunks/openPbrBsdf.wgsl.js +453 -453
  61. package/lib/renderer/wgsl/chunks/pdm_displacement.wgsl.d.ts +1 -1
  62. package/lib/renderer/wgsl/chunks/pdm_displacement.wgsl.js +122 -117
  63. package/lib/renderer/wgsl/chunks/pdm_displacement.wgsl.js.map +1 -1
  64. package/lib/renderer/wgsl/chunks/rand.wgsl.js +3 -3
  65. package/lib/renderer/wgsl/chunks/rayTraceCore.wgsl.js +13 -13
  66. package/lib/renderer/wgsl/chunks/sampleLight.wgsl.js +94 -94
  67. package/lib/renderer/wgsl/chunks/sampleMaterial.wgsl.js +119 -119
  68. package/lib/renderer/wgsl/chunks/sampleShadowCatcher.wgsl.js +5 -5
  69. package/lib/renderer/wgsl/chunks/sampling.wgsl.js +62 -62
  70. package/lib/renderer/wgsl/chunks/shadowCatcherAccumulation.wgsl.d.ts +3 -3
  71. package/lib/renderer/wgsl/chunks/shadowCatcherAccumulation.wgsl.js +2 -2
  72. package/lib/renderer/wgsl/chunks/shadowCatcherAccumulation.wgsl.js.map +1 -1
  73. package/lib/renderer/wgsl/chunks/sobol.wgsl.js +53 -53
  74. package/lib/renderer/wgsl/chunks/uvProjection.wgsl.js +5 -5
  75. package/lib/renderer/wgsl/compose.frag.wgsl.d.ts +2 -2
  76. package/lib/renderer/wgsl/compose.frag.wgsl.js +120 -92
  77. package/lib/renderer/wgsl/compose.frag.wgsl.js.map +1 -1
  78. package/lib/renderer/wgsl/customDenoise.wgsl.js +10 -10
  79. package/lib/renderer/wgsl/depthQuery.wgsl.js +3 -3
  80. package/lib/renderer/wgsl/offlineAdaptive.compute.js +26 -26
  81. package/lib/renderer/wgsl/rayTrace.compute.js +220 -211
  82. package/lib/renderer/wgsl/rayTrace.compute.js.map +1 -1
  83. package/lib/scene/OpenPBRMaterial.d.ts +4 -2
  84. package/lib/scene/OpenPBRMaterial.js +4 -2
  85. package/lib/scene/OpenPBRMaterial.js.map +1 -1
  86. package/lib/scene/openPbrSchema.d.ts +7 -2
  87. package/lib/scene/openPbrSchema.js +2 -1
  88. package/lib/scene/openPbrSchema.js.map +1 -1
  89. package/lib/util/fromTHREE.d.ts +1 -0
  90. package/lib/util/fromTHREE.js +24 -6
  91. package/lib/util/fromTHREE.js.map +1 -1
  92. package/lib/version.d.ts +1 -1
  93. package/lib/version.js +1 -1
  94. package/lib/version.js.map +1 -1
  95. package/package.json +5 -4
@@ -1,6 +1,6 @@
1
1
  import { LIGHT_CHOICE_ANALYTIC, LIGHT_CHOICE_EMISSIVE_TRIANGLE, LIGHT_CHOICE_ENVIRONMENT } from '../../lightSampling.js';
2
2
  export default /*wgsl */ `
3
- fn eJ(light: Light, fm: vec3f, iT: vec2f, lightSample: ptr<function, LightSampleRec>) {
3
+ fn eJ(light: Light, fm: vec3f, iU: vec2f, lightSample: ptr<function, LightSampleRec>) {
4
4
  let iq = light.position - fm;
5
5
  let aj = length(iq);
6
6
  if (light.radiusOrSpread <= 0.0) {
@@ -27,13 +27,13 @@ return;
27
27
  }
28
28
  let radius = max(light.radiusOrSpread, 1e-6);
29
29
  (*lightSample).isDelta = false;
30
- var gC: vec3f;
30
+ var gF: vec3f;
31
31
 
32
32
  if (aj <= radius) {
33
- let z = 1.0 - 2.0 * iT.x;
33
+ let z = 1.0 - 2.0 * iU.x;
34
34
  let fi = sqrt(max(0.0, 1.0 - z * z));
35
- let br = TWOPI * iT.y;
36
- gC = vec3f(
35
+ let br = TWOPI * iU.y;
36
+ gF = vec3f(
37
37
  fi * cos(br),
38
38
  fi * sin(br),
39
39
  z
@@ -41,19 +41,19 @@ z
41
41
  (*lightSample).pdf = INV4PI;
42
42
  }
43
43
  else {
44
- let sF = iq / aj;
45
- let jn = min(
44
+ let sK = iq / aj;
45
+ let jp = min(
46
46
  1.0,
47
47
  radius * radius / (aj * aj)
48
48
  );
49
- let cosThetaMax = sqrt(max(0.0, 1.0 - jn));
50
- let cc = mix(1.0, cosThetaMax, iT.x);
49
+ let cosThetaMax = sqrt(max(0.0, 1.0 - jp));
50
+ let cc = mix(1.0, cosThetaMax, iU.x);
51
51
  let sinTheta = sqrt(max(0.0, 1.0 - cc * cc));
52
- let br = TWOPI * iT.y;
52
+ let br = TWOPI * iU.y;
53
53
  var tangent: vec3f;
54
54
  var bitangent: vec3f;
55
- aK(sF, &tangent, &bitangent);
56
- gC = sF * cc
55
+ aL(sK, &tangent, &bitangent);
56
+ gF = sK * cc
57
57
  + tangent * (sinTheta * cos(br))
58
58
  + bitangent * (sinTheta * sin(br));
59
59
  (*lightSample).pdf = 1.0 / max(
@@ -62,16 +62,16 @@ TWOPI * (1.0 - cosThetaMax),
62
62
  );
63
63
  }
64
64
 
65
- let ir = dot(gC, iq);
66
- let pQ = dot(iq, iq);
65
+ let ir = dot(gF, iq);
66
+ let pU = dot(iq, iq);
67
67
  let ej = ir * ir
68
- - pQ + radius * radius;
68
+ - pU + radius * radius;
69
69
  let cN = ir - sqrt(max(0.0, ej));
70
- let cB = ir + sqrt(max(0.0, ej));
71
- (*lightSample).dist = select(cB, cN, cN > 1e-6);
72
- (*lightSample).direction = gC;
73
- let rQ = fm + gC * (*lightSample).dist;
74
- (*lightSample).normal = normalize(rQ - light.position);
70
+ let cC = ir + sqrt(max(0.0, ej));
71
+ (*lightSample).dist = select(cC, cN, cN > 1e-6);
72
+ (*lightSample).direction = gF;
73
+ let rV = fm + gF * (*lightSample).dist;
74
+ (*lightSample).normal = normalize(rV - light.position);
75
75
  (*lightSample).emission = light.emission;
76
76
  }
77
77
 
@@ -86,15 +86,15 @@ return;
86
86
  }
87
87
  let width = length(light.u);
88
88
  let height = length(light.v);
89
- let hY = surfacePoint - lowerLeft;
89
+ let hX = surfacePoint - lowerLeft;
90
90
  let uv = vec2f(
91
- dot(hY, light.u / width) / width,
92
- dot(hY, light.v / height) / height
91
+ dot(hX, light.u / width) / width,
92
+ dot(hX, light.v / height) / height
93
93
  );
94
94
  (*result).emission *= sampleMap(i32(light.textureIndex), uv).rgb;
95
95
  }
96
96
 
97
- fn jJ(
97
+ fn jL(
98
98
  light: Light,
99
99
  shadingPoint: vec3f,
100
100
  samplePoint: vec2f,
@@ -105,22 +105,22 @@ let lowerLeft = light.position - 0.5 * (light.u + light.v);
105
105
  let spread = clamp(light.radiusOrSpread, 0.0, 1.0);
106
106
 
107
107
  if (spread <= 0.001) {
108
- let ga = dot(normal, shadingPoint - light.position);
109
- let surfacePoint = shadingPoint - normal * ga;
110
- let hY = surfacePoint - lowerLeft;
108
+ let gb = dot(normal, shadingPoint - light.position);
109
+ let surfacePoint = shadingPoint - normal * gb;
110
+ let hX = surfacePoint - lowerLeft;
111
111
  let width = length(light.u);
112
112
  let height = length(light.v);
113
113
  let uv = vec2f(
114
- dot(hY, light.u / width) / width,
115
- dot(hY, light.v / height) / height
114
+ dot(hX, light.u / width) / width,
115
+ dot(hX, light.v / height) / height
116
116
  );
117
- if (ga <= 0.0 || any(uv < vec2f(0.0)) || any(uv > vec2f(1.0))) {
117
+ if (gb <= 0.0 || any(uv < vec2f(0.0)) || any(uv > vec2f(1.0))) {
118
118
  (*result).emission = vec3f(0.0);
119
119
  (*result).pdf = 0.0;
120
120
  return;
121
121
  }
122
122
  (*result).direction = -normal;
123
- (*result).dist = ga;
123
+ (*result).dist = gb;
124
124
  (*result).normal = normal;
125
125
  (*result).emission = light.emission;
126
126
  (*result).pdf = 1.0;
@@ -138,8 +138,8 @@ let hl = dot(offset, offset);
138
138
  (*result).direction = offset / (*result).dist;
139
139
  (*result).normal = normal;
140
140
  let fV = dot(-(*result).direction, normal);
141
- let oC = cos(0.5 * PI * spread);
142
- if (fV <= 0.0 || fV < oC) {
141
+ let oF = cos(0.5 * PI * spread);
142
+ if (fV <= 0.0 || fV < oF) {
143
143
  (*result).emission = vec3f(0.0);
144
144
  (*result).pdf = 0.0;
145
145
  return;
@@ -149,7 +149,7 @@ return;
149
149
  cZ(light, surfacePoint, lowerLeft, result);
150
150
  }
151
151
 
152
- fn fX(
152
+ fn fY(
153
153
  light: Light,
154
154
  result: ptr<function, LightSampleRec>
155
155
  ) {
@@ -161,7 +161,7 @@ result: ptr<function, LightSampleRec>
161
161
  (*result).isDelta = true;
162
162
  }
163
163
 
164
- fn jK(
164
+ fn jM(
165
165
  light: Light,
166
166
  shadingPoint: vec3f,
167
167
  samplePoint: vec2f,
@@ -173,7 +173,7 @@ let dJ = normalize(shadingPoint - surfacePoint);
173
173
  (*result).emission *= bL(light, dJ);
174
174
  }
175
175
 
176
- fn iK(
176
+ fn iL(
177
177
  light: Light,
178
178
  shadingPoint: vec3f,
179
179
  samplePoint: vec2f,
@@ -181,7 +181,7 @@ result: ptr<function, LightSampleRec>
181
181
  ) {
182
182
  let dO = i32(light.litType);
183
183
  if (dO == RECT_LIGHT) {
184
- jJ(light, shadingPoint, samplePoint, result);
184
+ jL(light, shadingPoint, samplePoint, result);
185
185
  return;
186
186
  }
187
187
  if (dO == SPHERE_LIGHT) {
@@ -189,31 +189,31 @@ eJ(light, shadingPoint, samplePoint, result);
189
189
  return;
190
190
  }
191
191
  if (dO == SPOT_LIGHT) {
192
- jK(light, shadingPoint, samplePoint, result);
192
+ jM(light, shadingPoint, samplePoint, result);
193
193
  return;
194
194
  }
195
195
  if (dO == DIRECTIONAL_LIGHT) {
196
- fX(light, result);
196
+ fY(light, result);
197
197
  }
198
198
  }
199
199
 
200
- fn mu(iT: vec2f, lightSample: ptr<function, LightSampleRec>) {
200
+ fn mx(iU: vec2f, lightSample: ptr<function, LightSampleRec>) {
201
201
  var uv: vec2f;
202
- (*lightSample).direction = oA(iT, &uv, &(*lightSample).pdf);
202
+ (*lightSample).direction = oD(iU, &uv, &(*lightSample).pdf);
203
203
  (*lightSample).emission = textureLinear(envMap, uv).rgb;
204
204
  (*lightSample).dist = INF;
205
205
  }
206
206
 
207
- fn bV(ij: i32) -> vec4f {
207
+ fn bV(ih: i32) -> vec4f {
208
208
  let width = rtUniform.lightSamplingTextureWidth;
209
209
  return textureLoad(
210
210
  lightSamplingData,
211
- vec2i(ij % width, ij / width),
211
+ vec2i(ih % width, ih / width),
212
212
  0
213
213
  );
214
214
  }
215
215
 
216
- fn pR(index: i32) -> EmissiveTriangle {
216
+ fn pV(index: i32) -> EmissiveTriangle {
217
217
  let offset = index * 6;
218
218
  let a = bV(offset);
219
219
  let b = bV(offset + 1);
@@ -230,9 +230,9 @@ e.zw, f.xy, f.zw
230
230
  );
231
231
  }
232
232
 
233
- fn sa(index: i32) -> oR {
233
+ fn sf(index: i32) -> oV {
234
234
  let data = bV(rtUniform.lightChoiceTexelOffset + index);
235
- return oR(
235
+ return oV(
236
236
  data.x,
237
237
  bitcast<i32>(data.y),
238
238
  bitcast<i32>(data.z),
@@ -240,35 +240,35 @@ bitcast<i32>(data.w)
240
240
  );
241
241
  }
242
242
 
243
- fn jt(mN: i32, index: i32) -> oR {
244
- return sa(mN + index);
243
+ fn jv(mQ: i32, index: i32) -> oV {
244
+ return sf(mQ + index);
245
245
  }
246
246
 
247
- fn mF(
247
+ fn mI(
248
248
  rnd: vec3f,
249
249
  ca: u32,
250
250
  aW: u32
251
251
  ) -> vec3f {
252
- var sH = rnd;
252
+ var sM = rnd;
253
253
  let count = max(aW, 1u);
254
- sH.z = (rnd.z + f32(min(ca, count - 1u))) /
254
+ sM.z = (rnd.z + f32(min(ca, count - 1u))) /
255
255
  f32(count);
256
- return sH;
256
+ return sM;
257
257
  }
258
258
 
259
- fn lK(
259
+ fn lN(
260
260
  triangle: EmissiveTriangle,
261
261
  fm: vec3f,
262
- iT: vec2f,
262
+ iU: vec2f,
263
263
  lightSample: ptr<function, LightSampleRec>
264
264
  ) {
265
- let vl = sqrt(iT.x);
265
+ let vt = sqrt(iU.x);
266
266
  let barycentric = vec3f(
267
- 1.0 - vl,
268
- vl * (1.0 - iT.y),
269
- vl * iT.y
267
+ 1.0 - vt,
268
+ vt * (1.0 - iU.y),
269
+ vt * iU.y
270
270
  );
271
- let sN =
271
+ let sS =
272
272
  barycentric.x * triangle.p0 +
273
273
  barycentric.y * triangle.p1 +
274
274
  barycentric.z * triangle.p2;
@@ -281,7 +281,7 @@ barycentric.x * triangle.secondaryUv0 +
281
281
  barycentric.y * triangle.secondaryUv1 +
282
282
  barycentric.z * triangle.secondaryUv2;
283
283
  let normal = normalize(cross(triangle.p1 - triangle.p0, triangle.p2 - triangle.p0));
284
- (*lightSample).direction = sN - fm;
284
+ (*lightSample).direction = sS - fm;
285
285
  (*lightSample).dist = length((*lightSample).direction);
286
286
  if ((*lightSample).dist <= EPS) {
287
287
  (*lightSample).emission = vec3f(0.0);
@@ -290,27 +290,27 @@ return;
290
290
  }
291
291
  (*lightSample).direction /= (*lightSample).dist;
292
292
  (*lightSample).normal = normal;
293
- let oZ = dot(normal, -(*lightSample).direction);
294
- if (oZ <= 0.0) {
293
+ let pd = dot(normal, -(*lightSample).direction);
294
+ if (pd <= 0.0) {
295
295
  (*lightSample).emission = vec3f(0.0);
296
296
  (*lightSample).pdf = 0.0;
297
297
  return;
298
298
  }
299
- (*lightSample).emission = lB(
299
+ (*lightSample).emission = lE(
300
300
  i32(triangle.materialIndex), uv, cX
301
301
  );
302
302
  (*lightSample).selectionPmf = triangle.selectionPmf;
303
303
  (*lightSample).pdf = triangle.selectionPmf *
304
304
  ((*lightSample).dist * (*lightSample).dist) /
305
- max(triangle.area * oZ, 1e-8);
305
+ max(triangle.area * pd, 1e-8);
306
306
  }
307
307
 
308
- fn jZ(
308
+ fn kb(
309
309
  fm: vec3f,
310
310
  rnd: vec3f,
311
- mN: i32,
312
- oY: i32,
313
- mM: f32,
311
+ mQ: i32,
312
+ pc: i32,
313
+ mP: f32,
314
314
  lightSample: ptr<function, LightSampleRec>
315
315
  ) {
316
316
  (*lightSample).emission = vec3f(0.0);
@@ -320,55 +320,55 @@ lightSample: ptr<function, LightSampleRec>
320
320
  (*lightSample).isDelta = false;
321
321
  (*lightSample).sourceType = 0u;
322
322
  (*lightSample).sourceIndex = 0xffffffffu;
323
- if (oY <= 0) {
323
+ if (pc <= 0) {
324
324
  return;
325
325
  }
326
326
 
327
- let qV = rnd.z * f32(oY);
328
- let column = min(i32(qV), oY - 1);
329
- let qF = jt(mN, column);
330
- let kQ = select(
331
- qF.aliasIndex,
327
+ let qZ = rnd.z * f32(pc);
328
+ let column = min(i32(qZ), pc - 1);
329
+ let qJ = jv(mQ, column);
330
+ let kT = select(
331
+ qJ.aliasIndex,
332
332
  column,
333
- fract(qV) < qF.probability
333
+ fract(qZ) < qJ.probability
334
334
  );
335
- let oX = jt(mN, kQ);
336
- if (oX.sourceType == ${LIGHT_CHOICE_ENVIRONMENT}) {
335
+ let pb = jv(mQ, kT);
336
+ if (pb.sourceType == ${LIGHT_CHOICE_ENVIRONMENT}) {
337
337
  (*lightSample).sourceType = 0u;
338
- (*lightSample).sourceIndex = u32(oX.sourceIndex);
339
- mu(rnd.xy, lightSample);
338
+ (*lightSample).sourceIndex = u32(pb.sourceIndex);
339
+ mx(rnd.xy, lightSample);
340
340
  (*lightSample).selectionPmf = rtUniform.envLightPmf;
341
341
  (*lightSample).pdf *= rtUniform.envLightPmf;
342
342
  }
343
- else if (oX.sourceType == ${LIGHT_CHOICE_ANALYTIC}) {
343
+ else if (pb.sourceType == ${LIGHT_CHOICE_ANALYTIC}) {
344
344
  (*lightSample).sourceType = 2u;
345
- (*lightSample).sourceIndex = u32(oX.sourceIndex);
346
- let light = analyticLights[oX.sourceIndex];
347
- iK(light, fm, rnd.xy, lightSample);
345
+ (*lightSample).sourceIndex = u32(pb.sourceIndex);
346
+ let light = analyticLights[pb.sourceIndex];
347
+ iL(light, fm, rnd.xy, lightSample);
348
348
  (*lightSample).selectionPmf = light.selectionPmf;
349
349
  (*lightSample).pdf *= light.selectionPmf;
350
350
  }
351
- else if (oX.sourceType == ${LIGHT_CHOICE_EMISSIVE_TRIANGLE}) {
351
+ else if (pb.sourceType == ${LIGHT_CHOICE_EMISSIVE_TRIANGLE}) {
352
352
  (*lightSample).sourceType = 1u;
353
- (*lightSample).sourceIndex = u32(oX.sourceIndex);
354
- lK(
355
- pR(oX.sourceIndex),
353
+ (*lightSample).sourceIndex = u32(pb.sourceIndex);
354
+ lN(
355
+ pV(pb.sourceIndex),
356
356
  fm,
357
357
  rnd.xy,
358
358
  lightSample
359
359
  );
360
360
  }
361
- (*lightSample).selectionPmf *= mM;
362
- (*lightSample).pdf *= mM;
361
+ (*lightSample).selectionPmf *= mP;
362
+ (*lightSample).pdf *= mP;
363
363
  }
364
364
 
365
365
  fn sampleLight(
366
366
  fm: vec3f,
367
367
  rnd: vec3f,
368
368
  lightSample: ptr<function, LightSampleRec>,
369
- rP: bool
369
+ rU: bool
370
370
  ) {
371
- jZ(
371
+ kb(
372
372
  fm,
373
373
  rnd,
374
374
  0,
@@ -380,16 +380,16 @@ lightSample
380
380
 
381
381
 
382
382
 
383
- fn mv(
383
+ fn my(
384
384
  fm: vec3f,
385
385
  rnd: vec3f,
386
386
  ca: u32,
387
387
  aW: u32,
388
388
  lightSample: ptr<function, LightSampleRec>
389
389
  ) {
390
- jZ(
390
+ kb(
391
391
  fm,
392
- mF(rnd, ca, aW),
392
+ mI(rnd, ca, aW),
393
393
  0,
394
394
  rtUniform.lightChoiceCount,
395
395
  1.0,