aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-22 14:58:33 +0900
committerYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-22 14:58:33 +0900
commitc891299737dd0c73a54f9bd1510dc00d6f140f1f (patch)
treefdb46ebb6bc200f9540abb2d0dc9289d33f5b421
parentd0cf74606f8a304d41f3b837beac14be4c562490 (diff)
bluebey-studio: 横から見たとき口が体を透ける問題を修正
正面判定を内積>0から>0.5に変更し、真横(内積がほぼ0)では深度テストを有効に戻すようにした。
-rw-r--r--public/bluebey-studio/src/main.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/public/bluebey-studio/src/main.js b/public/bluebey-studio/src/main.js
index 9178427..6507bf4 100644
--- a/public/bluebey-studio/src/main.js
+++ b/public/bluebey-studio/src/main.js
@@ -1428,8 +1428,11 @@ async function init() {
&& (mouth.tongue ?? 1) > 0.01;
mouthMesh.getWorldDirection(mouthNormal);
mouthMesh.getWorldPosition(mouthToCamera);
- mouthToCamera.subVectors(view.camera.position, mouthToCamera);
- const facing = mouthNormal.dot(mouthToCamera) > 0;
+ mouthToCamera.subVectors(view.camera.position, mouthToCamera).normalize();
+ // Only let the artwork win the depth test when the camera is actually in
+ // front of the face. At a side view the dot product is near zero, and the
+ // mouth must lose to the body (or it shows through the far side).
+ const facing = mouthNormal.dot(mouthToCamera) > 0.5;
const wallOn = state.render.wall?.on === true || state.render.wall2?.on === true;
const depthTest = !tongueOverLip || !facing || wallOn;
if (mouthMesh.material.depthTest !== depthTest) {