aboutsummaryrefslogtreecommitdiffhomepage
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to 'public')
-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) {