ugly-game 0.15.52 → 0.15.53

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.
@@ -134,7 +134,7 @@ fn pcfLayer(world: vec3<f32>, ndl: f32, layer: i32, inside: ptr<function, bool>)
134
134
  }
135
135
  *inside = true;
136
136
  let bias = max(0.0006 * (1.0 - ndl), 0.0004) * (1.0 + f32(layer) * 1.5);
137
- let texel = 1.0 / 2048.0;
137
+ let texel = 1.0 / vec2<f32>(textureDimensions(shadowMap));
138
138
  var s = 0.0;
139
139
  for (var dy = -1; dy <= 1; dy = dy + 1) {
140
140
  for (var dx = -1; dx <= 1; dx = dx + 1) {
@@ -303,8 +303,13 @@ fn linearToSrgb(c: vec3<f32>) -> vec3<f32> {
303
303
  let cell = floor(flakeP);
304
304
  let grain = fract(sin(dot(cell,vec3(127.1,311.7,74.7)))*43758.5453);
305
305
  let coverage = 1.0-smoothstep(0.45,1.8,footprint);
306
- let sparkle = smoothstep(0.91,1.0,grain)*coverage*mtl.paint.x;
307
- let flakes = (u.sunCol.xyz*pow(nh,72.0)*nl*sh*3.0 + env*0.18)
306
+ // Unresolved flakes contribute their average coverage instead of vanishing
307
+ // at normal viewing distances. Resolved glints stay attached to the object.
308
+ let sparkle = mix(0.045,smoothstep(0.91,1.0,grain),coverage)*mtl.paint.x;
309
+ let flakeLobe = ggx(nh,nv,nl,max(rough,0.28))*nl*sh;
310
+ let flakes = (u.sunCol.xyz*flakeLobe*0.32 + environment(R,max(rough,0.28))*0.14)
311
+ * mtl.paint.x * mix(vec3(1.0),albedo,0.35)
312
+ + (u.sunCol.xyz*pow(nh,72.0)*nl*sh*3.0 + env*0.18)
308
313
  * sparkle * mix(vec3(1.0),albedo,0.35);
309
314
  let hdr = (flakes + direct + diffuse * (1.0-mtl.surface.y*0.12) + reflected + sheen) * (vec3(1.0)-coatF) + coating;
310
315
  // Smooth highlight compression preserves saturated paint rather than
@@ -699,6 +704,10 @@ export class GpuPropsRenderer {
699
704
  format: 'depth32float',
700
705
  depthWriteEnabled: true,
701
706
  depthCompare: 'less',
707
+ // Offset the caster by its rasterized slope: a constant receiver bias
708
+ // alone leaves diagonal self-shadow bands on shallow curved panels.
709
+ depthBias: 2,
710
+ depthBiasSlopeScale: 2,
702
711
  },
703
712
  });
704
713
  this.uBuf = device.createBuffer({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugly-game",
3
- "version": "0.15.52",
3
+ "version": "0.15.53",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {