ugly-game 0.15.52 → 0.15.54
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/dist/assets/gpuProps.js +23 -4
- package/package.json +2 -1
package/dist/assets/gpuProps.js
CHANGED
|
@@ -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 /
|
|
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) {
|
|
@@ -211,7 +211,17 @@ fn studioEnv(r: vec3<f32>, rough: f32) -> vec3<f32> {
|
|
|
211
211
|
fn environment(r: vec3<f32>, rough: f32) -> vec3<f32> {
|
|
212
212
|
if (mtl.coat.z < 0.5) { return studioEnv(r,rough); }
|
|
213
213
|
let uv=vec2(atan2(r.z,r.x)/6.2831853+0.5,acos(clamp(r.y,-1.0,1.0))/3.14159265);
|
|
214
|
-
|
|
214
|
+
// Roughness alone under-filters glossy curved surfaces: one screen pixel can
|
|
215
|
+
// span many environment texels, making chrome/clearcoat flash while orbiting.
|
|
216
|
+
// Respect that footprint as well as the material's prefiltered reflection.
|
|
217
|
+
// Longitude wraps at the panorama seam; unwrap its derivatives so crossing
|
|
218
|
+
// that seam does not introduce a spurious blurry stripe.
|
|
219
|
+
let dx=dpdx(uv); let dy=dpdy(uv);
|
|
220
|
+
let dimensions=vec2<f32>(textureDimensions(environmentTex));
|
|
221
|
+
let sx=vec2(dx.x-round(dx.x),dx.y)*dimensions;
|
|
222
|
+
let sy=vec2(dy.x-round(dy.x),dy.y)*dimensions;
|
|
223
|
+
let pixelLod=log2(max(1.0,max(length(sx),length(sy))));
|
|
224
|
+
return textureSampleLevel(environmentTex,albedoSamp,uv,max(rough*mtl.coat.w,pixelLod)).rgb;
|
|
215
225
|
}
|
|
216
226
|
fn fresnel(f0: vec3<f32>, cosTheta: f32) -> vec3<f32> {
|
|
217
227
|
return f0 + (vec3(1.0) - f0) * pow(1.0 - clamp(cosTheta, 0.0, 1.0), 5.0);
|
|
@@ -303,8 +313,13 @@ fn linearToSrgb(c: vec3<f32>) -> vec3<f32> {
|
|
|
303
313
|
let cell = floor(flakeP);
|
|
304
314
|
let grain = fract(sin(dot(cell,vec3(127.1,311.7,74.7)))*43758.5453);
|
|
305
315
|
let coverage = 1.0-smoothstep(0.45,1.8,footprint);
|
|
306
|
-
|
|
307
|
-
|
|
316
|
+
// Unresolved flakes contribute their average coverage instead of vanishing
|
|
317
|
+
// at normal viewing distances. Resolved glints stay attached to the object.
|
|
318
|
+
let sparkle = mix(0.045,smoothstep(0.91,1.0,grain),coverage)*mtl.paint.x;
|
|
319
|
+
let flakeLobe = ggx(nh,nv,nl,max(rough,0.28))*nl*sh;
|
|
320
|
+
let flakes = (u.sunCol.xyz*flakeLobe*0.32 + environment(R,max(rough,0.28))*0.14)
|
|
321
|
+
* mtl.paint.x * mix(vec3(1.0),albedo,0.35)
|
|
322
|
+
+ (u.sunCol.xyz*pow(nh,72.0)*nl*sh*3.0 + env*0.18)
|
|
308
323
|
* sparkle * mix(vec3(1.0),albedo,0.35);
|
|
309
324
|
let hdr = (flakes + direct + diffuse * (1.0-mtl.surface.y*0.12) + reflected + sheen) * (vec3(1.0)-coatF) + coating;
|
|
310
325
|
// Smooth highlight compression preserves saturated paint rather than
|
|
@@ -699,6 +714,10 @@ export class GpuPropsRenderer {
|
|
|
699
714
|
format: 'depth32float',
|
|
700
715
|
depthWriteEnabled: true,
|
|
701
716
|
depthCompare: 'less',
|
|
717
|
+
// Offset the caster by its rasterized slope: a constant receiver bias
|
|
718
|
+
// alone leaves diagonal self-shadow bands on shallow curved panels.
|
|
719
|
+
depthBias: 2,
|
|
720
|
+
depthBiasSlopeScale: 2,
|
|
702
721
|
},
|
|
703
722
|
});
|
|
704
723
|
this.uBuf = device.createBuffer({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ugly-game",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.54",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"test": "node --experimental-strip-types --import ./tools/tsResolve.mjs --test src/*.test.mts && pnpm run test:gpu-skin",
|
|
24
24
|
"test:flight": "node --experimental-strip-types --import ./tools/tsResolve.mjs --test src/flight*.test.mts",
|
|
25
25
|
"test:flight-browser": "playwright test -c playwright.flight.config.ts",
|
|
26
|
+
"test:props-browser": "playwright test -c playwright.props.config.ts",
|
|
26
27
|
"test:flight-perf": "playwright test -c playwright.flight.config.ts --grep 'CPU and retained-memory'",
|
|
27
28
|
"test:types": "tsc -p tsconfig.test.json",
|
|
28
29
|
"test:package-types": "node tools/packageTypesSmoke.mjs",
|