ugly-game 0.15.71 → 0.15.72
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.
|
@@ -145,6 +145,9 @@ export interface PropMesh {
|
|
|
145
145
|
specularIntensity?: number;
|
|
146
146
|
/** Soft grazing-angle fiber reflection, 0..1; default 0. */
|
|
147
147
|
sheen?: number;
|
|
148
|
+
/** Fraction of solar diffuse light transmitted through a thin pigmented sheet
|
|
149
|
+
* (leaf, fin, petal). Keeps opaque depth and visibility. Default 0. */
|
|
150
|
+
diffuseTransmission?: number;
|
|
148
151
|
/** Roughness of the clear lacquer layer; default 0.12. */
|
|
149
152
|
clearcoatRoughness?: number;
|
|
150
153
|
/** Stable fine metallic flake strength; zero disables. */
|
package/dist/assets/gpuProps.js
CHANGED
|
@@ -377,6 +377,9 @@ fn linearToSrgb(c: vec3<f32>) -> vec3<f32> {
|
|
|
377
377
|
if (mtl.mat.z >= 0.0) {
|
|
378
378
|
let V = normalize(u.cam.xyz - i.world);
|
|
379
379
|
let L = -normalize(u.sun.xyz);
|
|
380
|
+
// Thin tissue scatters a share of the key light into the opposite
|
|
381
|
+
// hemisphere. Keep the surface opaque to visibility and retain its shadow.
|
|
382
|
+
if (mtl.optics.z > 0.0 && dot(i.n,V) < 0.0) { N = -N; }
|
|
380
383
|
let H = normalize(L + V);
|
|
381
384
|
let nv = max(dot(N, V), 0.001);
|
|
382
385
|
let nl = max(dot(N, L), 0.0);
|
|
@@ -394,7 +397,8 @@ fn linearToSrgb(c: vec3<f32>) -> vec3<f32> {
|
|
|
394
397
|
+ pearlTint * mtl.paint.z * (0.035 + 0.13*pow(1.0-nv,2.0));
|
|
395
398
|
let F = fresnel(f0, vh);
|
|
396
399
|
let kd = (vec3(1.0)-F) * (1.0-metal);
|
|
397
|
-
let
|
|
400
|
+
let diffuseCosine = mix(nl,max(-dot(N,L),0.0),mtl.optics.z);
|
|
401
|
+
let direct = (kd * albedo * diffuseCosine / 3.14159265 + F * ggx(nh,nv,nl,rough) * nl) * u.sunCol.xyz * sh * 2.5;
|
|
398
402
|
let R = reflect(-V,N);
|
|
399
403
|
let env = environment(R,rough) * mtl.coat.y;
|
|
400
404
|
let reflected = env * fresnel(f0,nv) * (1.0-rough*0.6);
|
|
@@ -1237,7 +1241,7 @@ export class GpuPropsRenderer {
|
|
|
1237
1241
|
0,
|
|
1238
1242
|
Math.max(0, Math.min(1, m.transmission ?? 0)),
|
|
1239
1243
|
m.unlit ? 1 : m.glow ? 2 : 0,
|
|
1240
|
-
0,
|
|
1244
|
+
Math.max(0, Math.min(1, m.diffuseTransmission ?? 0)),
|
|
1241
1245
|
0,
|
|
1242
1246
|
]);
|
|
1243
1247
|
dev.queue.writeBuffer(matBuf, 0, materialValues);
|