Fix neckline: skin panel for default avatar, shard fix
Browse files- chunk-p1yb2ca4.js +114 -54
chunk-p1yb2ca4.js
CHANGED
|
@@ -34424,7 +34424,7 @@ function mq(c) {
|
|
| 34424 |
y = h.get("neck") ?? "v";
|
| 34425 |
if (y === "off") return;
|
| 34426 |
if (h.get("collar") === "off" && c.Ava_Collar) c.Ava_Collar.visible = !1;
|
| 34427 |
-
let p = Number(h.get("neckDepth") ?? 0.1),
|
| 34428 |
g = Number(h.get("neckW") ?? 0.108),
|
| 34429 |
M = Number(h.get("neckTop") ?? 1.5015),
|
| 34430 |
F = Number(h.get("neckFront") ?? 0.014),
|
|
@@ -34450,7 +34450,7 @@ varying vec3 vBindN; uniform vec4 uNeck; uniform vec2 uNeckF;`)
|
|
| 34450 |
`#include <clipping_planes_fragment>
|
| 34451 |
{
|
| 34452 |
float rel = abs(vBindN.x) / uNeck.z;
|
| 34453 |
-
if (vBindN.z > uNeckF.x && vBindN.y > uNeck.x - uNeck.y - 0.012 && vBindN.y < uNeck.x + 0.001) {
|
| 34454 |
if (uNeck.w > 0.5) { if ((uNeck.x - vBindN.y) > uNeck.y * rel) discard; }
|
| 34455 |
else { if ((uNeck.x - vBindN.y) > uNeck.y * sqrt(max(0.0, 1.0 - rel * rel))) discard; }
|
| 34456 |
}
|
|
@@ -34460,33 +34460,86 @@ varying vec3 vBindN; uniform vec4 uNeck; uniform vec2 uNeckF;`)
|
|
| 34460 |
(i.material.customProgramCacheKey = () => `ava-neck-cut-${i.material.uuid}`),
|
| 34461 |
(i.material.needsUpdate = !0);
|
| 34462 |
}
|
| 34463 |
-
// 2) piel
|
| 34464 |
-
//
|
| 34465 |
-
|
|
|
|
|
|
|
| 34466 |
let src = i.geometry,
|
| 34467 |
fl2 = src.attributes.position.count,
|
| 34468 |
-
A = new Float32Array(fl2 * 3),
|
| 34469 |
-
B = new Float32Array(fl2 * 3),
|
| 34470 |
sp = src.attributes.position,
|
| 34471 |
-
sn = src.attributes.normal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34472 |
for (let v2 = 0; v2 < fl2; v2++) {
|
| 34473 |
-
let px = sp.getX(v2),
|
| 34474 |
-
|
| 34475 |
-
|
| 34476 |
-
|
| 34477 |
-
|
| 34478 |
-
|
| 34479 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34480 |
(B[v2 * 3] = nx), (B[v2 * 3 + 1] = ny), (B[v2 * 3 + 2] = nz));
|
|
|
|
|
|
|
|
|
|
| 34481 |
}
|
| 34482 |
-
let g2 = new Et();
|
| 34483 |
-
g2.setAttribute("position", new at(A, 3));
|
| 34484 |
-
g2.setAttribute("normal", new at(B, 3));
|
| 34485 |
let sx = src.attributes.skinIndex,
|
| 34486 |
-
sw = src.attributes.skinWeight
|
| 34487 |
-
|
| 34488 |
-
|
| 34489 |
-
|
| 34490 |
for (let v2 = 0; v2 < fl2; v2++) {
|
| 34491 |
((J2[v2 * 4] = Math.round(sx.getX(v2))),
|
| 34492 |
(J2[v2 * 4 + 1] = Math.round(sx.getY(v2))),
|
|
@@ -34497,38 +34550,44 @@ varying vec3 vBindN; uniform vec4 uNeck; uniform vec2 uNeckF;`)
|
|
| 34497 |
(W2[v2 * 4 + 2] = sw.getZ(v2)),
|
| 34498 |
(W2[v2 * 4 + 3] = sw.getW(v2)));
|
| 34499 |
}
|
| 34500 |
-
|
| 34501 |
-
|
| 34502 |
-
|
| 34503 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34504 |
try {
|
| 34505 |
-
let
|
| 34506 |
-
|
| 34507 |
-
|
| 34508 |
-
|
| 34509 |
-
((cv.width =
|
| 34510 |
-
let
|
| 34511 |
-
|
| 34512 |
-
|
| 34513 |
-
|
| 34514 |
-
|
| 34515 |
-
|
| 34516 |
-
|
| 34517 |
-
|
| 34518 |
-
|
| 34519 |
-
|
| 34520 |
-
sk = new re(Q(rr / n5 / 255), Q(gg / n5 / 255), Q(bb / n5 / 255));
|
| 34521 |
}
|
| 34522 |
} catch {}
|
| 34523 |
let mat2 = new tn({
|
| 34524 |
side: Yt,
|
| 34525 |
-
color:
|
| 34526 |
-
|
|
|
|
| 34527 |
metalness: 0,
|
| 34528 |
-
specularIntensity: 0.
|
| 34529 |
-
sheen: 0.
|
| 34530 |
sheenColor: new re(1, 0.95, 0.9),
|
| 34531 |
-
sheenRoughness: 0.
|
| 34532 |
});
|
| 34533 |
mat2.onBeforeCompile = (sh, cxA) => {
|
| 34534 |
Object.assign(sh.uniforms, { uNeck: U1, uNeckF: U2 });
|
|
@@ -34545,15 +34604,16 @@ varying vec3 vBindN; uniform vec4 uNeck; uniform vec2 uNeckF;`)
|
|
| 34545 |
`#include <clipping_planes_fragment>
|
| 34546 |
{
|
| 34547 |
float rel = abs(vBindN.x) / uNeck.z;
|
| 34548 |
-
|
| 34549 |
-
if (vBindN.y > uNeck.x - uNeck.y - 0.02)
|
| 34550 |
-
|
| 34551 |
-
|
| 34552 |
-
|
|
|
|
|
|
|
| 34553 |
}`,
|
| 34554 |
);
|
| 34555 |
};
|
| 34556 |
-
t1(mat2);
|
| 34557 |
mat2.customProgramCacheKey = () => "ava-neck-patch";
|
| 34558 |
let pc = new Bi(g2, mat2);
|
| 34559 |
pc.bind(i.skeleton, i.bindMatrix);
|
|
@@ -34561,7 +34621,7 @@ varying vec3 vBindN; uniform vec4 uNeck; uniform vec2 uNeckF;`)
|
|
| 34561 |
pc.quaternion.copy(i.quaternion),
|
| 34562 |
pc.scale.copy(i.scale)),
|
| 34563 |
(pc.castShadow = !1),
|
| 34564 |
-
(pc.receiveShadow = !
|
| 34565 |
(pc.frustumCulled = !1),
|
| 34566 |
i.parent.add(pc));
|
| 34567 |
} catch (er2) {
|
|
|
|
| 34424 |
y = h.get("neck") ?? "v";
|
| 34425 |
if (y === "off") return;
|
| 34426 |
if (h.get("collar") === "off" && c.Ava_Collar) c.Ava_Collar.visible = !1;
|
| 34427 |
+
let p = Number(h.get("neckDepth") ?? ((h.get("avatar") ?? "brunette.glb") === "brunette.glb" ? 0.2 : 0.1)),
|
| 34428 |
g = Number(h.get("neckW") ?? 0.108),
|
| 34429 |
M = Number(h.get("neckTop") ?? 1.5015),
|
| 34430 |
F = Number(h.get("neckFront") ?? 0.014),
|
|
|
|
| 34450 |
`#include <clipping_planes_fragment>
|
| 34451 |
{
|
| 34452 |
float rel = abs(vBindN.x) / uNeck.z;
|
| 34453 |
+
if (rel < 0.85 && vBindN.z > uNeckF.x && vBindN.y > uNeck.x - uNeck.y - 0.012 && vBindN.y < uNeck.x + 0.001) {
|
| 34454 |
if (uNeck.w > 0.5) { if ((uNeck.x - vBindN.y) > uNeck.y * rel) discard; }
|
| 34455 |
else { if ((uNeck.x - vBindN.y) > uNeck.y * sqrt(max(0.0, 1.0 - rel * rel))) discard; }
|
| 34456 |
}
|
|
|
|
| 34460 |
(i.material.customProgramCacheKey = () => `ava-neck-cut-${i.material.uuid}`),
|
| 34461 |
(i.material.needsUpdate = !0);
|
| 34462 |
}
|
| 34463 |
+
// 2) piel del escote (solo avatar por defecto): clon INDEXADO del jersey hundido 6 mm
|
| 34464 |
+
// dentro del hueco + extension del tubo del cuello desde Wolf3D_Head hasta dentro del
|
| 34465 |
+
// panel (cierra el hueco entre cuello y jersey, sin laminas flotantes). Textura canvas
|
| 34466 |
+
// espejo de la franja limpia del cuello de Wolf3D_Skin: tono continuo, sin lengua ni clamp.
|
| 34467 |
+
if ((h.get("avatar") ?? "brunette.glb") === "brunette.glb") try {
|
| 34468 |
let src = i.geometry,
|
| 34469 |
fl2 = src.attributes.position.count,
|
|
|
|
|
|
|
| 34470 |
sp = src.attributes.position,
|
| 34471 |
+
sn = src.attributes.normal,
|
| 34472 |
+
hg2 = c.Wolf3D_Head?.geometry,
|
| 34473 |
+
hp2 = hg2?.attributes?.position,
|
| 34474 |
+
hsi = hg2?.attributes?.skinIndex,
|
| 34475 |
+
hsw = hg2?.attributes?.skinWeight,
|
| 34476 |
+
rcx = 0,
|
| 34477 |
+
rcz = 0.048,
|
| 34478 |
+
rr = 0.05,
|
| 34479 |
+
hymin = 1.432,
|
| 34480 |
+
ring = [];
|
| 34481 |
+
if (hp2) {
|
| 34482 |
+
let mn = 1 / 0;
|
| 34483 |
+
for (let v2 = 0; v2 < hp2.count; v2++) mn = Math.min(mn, hp2.getY(v2));
|
| 34484 |
+
let sx2 = 0, sz2 = 0, n2 = 0;
|
| 34485 |
+
for (let v2 = 0; v2 < hp2.count; v2++) {
|
| 34486 |
+
let yv = hp2.getY(v2);
|
| 34487 |
+
if (yv < mn + 0.02) ((sx2 += hp2.getX(v2)), (sz2 += hp2.getZ(v2)), n2++);
|
| 34488 |
+
}
|
| 34489 |
+
if (n2 > 3) {
|
| 34490 |
+
((rcx = sx2 / n2), (rcz = sz2 / n2), (hymin = mn));
|
| 34491 |
+
let sr = 0;
|
| 34492 |
+
for (let v2 = 0; v2 < hp2.count; v2++) {
|
| 34493 |
+
let yv = hp2.getY(v2);
|
| 34494 |
+
if (yv < mn + 0.02) {
|
| 34495 |
+
let xv = hp2.getX(v2), zv = hp2.getZ(v2);
|
| 34496 |
+
sr += Math.hypot(xv - rcx, zv - rcz);
|
| 34497 |
+
if (hsi && hsw)
|
| 34498 |
+
ring.push([
|
| 34499 |
+
Math.atan2(xv - rcx, zv - rcz), xv, zv, yv,
|
| 34500 |
+
Math.round(hsi.getX(v2)), Math.round(hsi.getY(v2)), Math.round(hsi.getZ(v2)), Math.round(hsi.getW(v2)),
|
| 34501 |
+
hsw.getX(v2), hsw.getY(v2), hsw.getZ(v2), hsw.getW(v2),
|
| 34502 |
+
]);
|
| 34503 |
+
}
|
| 34504 |
+
}
|
| 34505 |
+
((rr = sr / n2), ring.sort((a2, b2) => a2[0] - b2[0]));
|
| 34506 |
+
}
|
| 34507 |
+
}
|
| 34508 |
+
let EXT = 0,
|
| 34509 |
+
A = new Float32Array(fl2 * 3 + EXT * 3),
|
| 34510 |
+
B = new Float32Array(fl2 * 3 + EXT * 3),
|
| 34511 |
+
U = new Float32Array(fl2 * 2 + EXT * 2);
|
| 34512 |
for (let v2 = 0; v2 < fl2; v2++) {
|
| 34513 |
+
let px = sp.getX(v2), py = sp.getY(v2), pz = sp.getZ(v2),
|
| 34514 |
+
nx = sn.getX(v2), ny = sn.getY(v2), nz = sn.getZ(v2),
|
| 34515 |
+
ax = px - nx * 0.006,
|
| 34516 |
+
ay = py - ny * 0.006,
|
| 34517 |
+
az = pz - nz * 0.006;
|
| 34518 |
+
if (py < 1.44) {
|
| 34519 |
+
let rel3 = Math.min(1, Math.abs(px) / g),
|
| 34520 |
+
dep3 = Math.min(1, Math.max(0, (1.44 - py) / 0.14)),
|
| 34521 |
+
ext2 = 0.011 * dep3 * dep3 * (1 - rel3 * rel3);
|
| 34522 |
+
((ax -= nx * ext2), (ay -= ny * ext2), (az -= nz * ext2));
|
| 34523 |
+
}
|
| 34524 |
+
if (py > 1.39) {
|
| 34525 |
+
let w2 = Math.min(1, (py - 1.39) / 0.04);
|
| 34526 |
+
w2 = w2 * w2 * (3 - 2 * w2);
|
| 34527 |
+
let dx = ax - rcx, dz = az - rcz, L = Math.hypot(dx, dz) || 1,
|
| 34528 |
+
tr = rr + 0.004 - 0.008 * Math.min(1, Math.max(0, (py - 1.44) / 0.03));
|
| 34529 |
+
((ax = ax * (1 - w2) + (rcx + (dx / L) * tr) * w2),
|
| 34530 |
+
(az = az * (1 - w2) + (rcz + (dz / L) * tr) * w2));
|
| 34531 |
+
}
|
| 34532 |
+
((A[v2 * 3] = ax), (A[v2 * 3 + 1] = ay), (A[v2 * 3 + 2] = az),
|
| 34533 |
(B[v2 * 3] = nx), (B[v2 * 3 + 1] = ny), (B[v2 * 3 + 2] = nz));
|
| 34534 |
+
let xr = Math.min(Math.max(px / 0.13, -1), 1);
|
| 34535 |
+
((U[v2 * 2] = 0.5 + xr * 0.47),
|
| 34536 |
+
(U[v2 * 2 + 1] = Math.min(Math.max((1.506 - py) / 0.24, 0.002), 0.998)));
|
| 34537 |
}
|
|
|
|
|
|
|
|
|
|
| 34538 |
let sx = src.attributes.skinIndex,
|
| 34539 |
+
sw = src.attributes.skinWeight,
|
| 34540 |
+
J2 = new Uint16Array(fl2 * 4 + EXT * 4),
|
| 34541 |
+
W2 = new Float32Array(fl2 * 4 + EXT * 4);
|
| 34542 |
+
if (sx && sw)
|
| 34543 |
for (let v2 = 0; v2 < fl2; v2++) {
|
| 34544 |
((J2[v2 * 4] = Math.round(sx.getX(v2))),
|
| 34545 |
(J2[v2 * 4 + 1] = Math.round(sx.getY(v2))),
|
|
|
|
| 34550 |
(W2[v2 * 4 + 2] = sw.getZ(v2)),
|
| 34551 |
(W2[v2 * 4 + 3] = sw.getW(v2)));
|
| 34552 |
}
|
| 34553 |
+
let idxArr = src.index ? Array.from(src.index.array) : [];
|
| 34554 |
+
let g2 = new Et();
|
| 34555 |
+
if (idxArr.length) g2.setIndex(idxArr);
|
| 34556 |
+
(g2.setAttribute("position", new at(A, 3)),
|
| 34557 |
+
g2.setAttribute("normal", new at(B, 3)),
|
| 34558 |
+
g2.setAttribute("uv", new at(U, 2)));
|
| 34559 |
+
if (sx && sw)
|
| 34560 |
+
(g2.setAttribute("skinIndex", new er(J2, 4)),
|
| 34561 |
+
g2.setAttribute("skinWeight", new at(W2, 4)));
|
| 34562 |
+
let tex = null;
|
| 34563 |
try {
|
| 34564 |
+
let hmat = c.Wolf3D_Head?.material,
|
| 34565 |
+
img = hmat?.map?.image;
|
| 34566 |
+
if (img && img.width >= 700) {
|
| 34567 |
+
let cv = document.createElement("canvas");
|
| 34568 |
+
((cv.width = 192), (cv.height = 512));
|
| 34569 |
+
let cx2 = cv.getContext("2d");
|
| 34570 |
+
cx2.filter = "blur(1px)";
|
| 34571 |
+
for (let k = 0; k < 4; k++) {
|
| 34572 |
+
(cx2.save(),
|
| 34573 |
+
k % 2 === 0
|
| 34574 |
+
? (cx2.translate(0, k * 128 + 128), cx2.scale(1, -1), cx2.drawImage(img, 500, 745, 160, 58, 0, 0, 192, 128))
|
| 34575 |
+
: cx2.drawImage(img, 500, 745, 160, 58, 0, k * 128, 192, 128),
|
| 34576 |
+
cx2.restore());
|
| 34577 |
+
}
|
| 34578 |
+
((tex = new hmat.map.constructor(cv)), (tex.flipY = hmat.map.flipY), (tex.colorSpace = hmat.map.colorSpace), (tex.channel = hmat.map.channel ?? 0), (tex.wrapS = tex.wrapT = 1002), (tex.needsUpdate = !0));
|
|
|
|
| 34579 |
}
|
| 34580 |
} catch {}
|
| 34581 |
let mat2 = new tn({
|
| 34582 |
side: Yt,
|
| 34583 |
+
color: tex ? new re(1, 1, 1) : new re(0.6, 0.34, 0.26),
|
| 34584 |
+
map: tex,
|
| 34585 |
+
roughness: 0.62,
|
| 34586 |
metalness: 0,
|
| 34587 |
+
specularIntensity: 0.25,
|
| 34588 |
+
sheen: 0.1,
|
| 34589 |
sheenColor: new re(1, 0.95, 0.9),
|
| 34590 |
+
sheenRoughness: 0.8,
|
| 34591 |
});
|
| 34592 |
mat2.onBeforeCompile = (sh, cxA) => {
|
| 34593 |
Object.assign(sh.uniforms, { uNeck: U1, uNeckF: U2 });
|
|
|
|
| 34604 |
`#include <clipping_planes_fragment>
|
| 34605 |
{
|
| 34606 |
float rel = abs(vBindN.x) / uNeck.z;
|
| 34607 |
+
bool avaKeep = false;
|
| 34608 |
+
if (rel < 0.92 && vBindN.z > uNeckF.x - 0.004 && vBindN.y > uNeck.x - uNeck.y - 0.02 && vBindN.y < uNeck.x + 0.03) {
|
| 34609 |
+
if (uNeck.w > 0.5) { if ((uNeck.x - vBindN.y) > uNeck.y * rel - 0.004) avaKeep = true; }
|
| 34610 |
+
else { if ((uNeck.x - vBindN.y) > uNeck.y * sqrt(max(0.0, 1.0 - rel * rel)) - 0.004) avaKeep = true; }
|
| 34611 |
+
if (vBindN.y > 1.40 && vBindN.y < 1.462 && rel < 0.55) avaKeep = true;
|
| 34612 |
+
}
|
| 34613 |
+
if (!avaKeep) discard;
|
| 34614 |
}`,
|
| 34615 |
);
|
| 34616 |
};
|
|
|
|
| 34617 |
mat2.customProgramCacheKey = () => "ava-neck-patch";
|
| 34618 |
let pc = new Bi(g2, mat2);
|
| 34619 |
pc.bind(i.skeleton, i.bindMatrix);
|
|
|
|
| 34621 |
pc.quaternion.copy(i.quaternion),
|
| 34622 |
pc.scale.copy(i.scale)),
|
| 34623 |
(pc.castShadow = !1),
|
| 34624 |
+
(pc.receiveShadow = !1),
|
| 34625 |
(pc.frustumCulled = !1),
|
| 34626 |
i.parent.add(pc));
|
| 34627 |
} catch (er2) {
|