From e512dcfb93d43b7481d7eaf7fa2dff4f2a497ea8 Mon Sep 17 00:00:00 2001 From: kanym Date: Wed, 5 Aug 2026 20:51:11 +0200 Subject: [PATCH] fix(dvergar): push the eyes out to the surface of the face Placement is right and the trace proves it - 0.095m from the head bone, exactly the offsets after the race scale, parented to Head and following it. They were simply still inside the skull, and the shader that resolved is depth-tested, so the head hid them completely. The bone sits at the base of the skull and a face is further forward than it looks. Offsets raised to land about 0.109m out on a Dvergar. The trace now also reports how far up the eye ended up and whether it is on the face side of the head at all, so the next look distinguishes too shallow from the wrong direction entirely. --- JotunnModStub/Dvergar/DvergarConfig.cs | 8 ++++++-- JotunnModStub/Dvergar/DvergarVisuals.cs | 11 +++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/JotunnModStub/Dvergar/DvergarConfig.cs b/JotunnModStub/Dvergar/DvergarConfig.cs index 6078c2d..0498cd9 100644 --- a/JotunnModStub/Dvergar/DvergarConfig.cs +++ b/JotunnModStub/Dvergar/DvergarConfig.cs @@ -95,9 +95,13 @@ namespace RacesOfValheim // reference and is not: it is where the camera goes, half a metre above the head bone, // and starting from it put the eyes in the treetops. That was measured, not guessed - // the trace is in the commit history. + // These are pre-scale numbers: a Dvergar renders at 0.78, so 0.140 forward lands about + // 0.109m out. The bone is at the base of the skull, and a face is further forward than it + // looks - at 0.095 the eyes were correctly placed and entirely inside the head, which the + // depth-tested shader then hid completely. public static readonly float EyeSeparation = 0.032f; // half the distance between them - public static readonly float EyeForward = 0.095f; - public static readonly float EyeHeight = 0.070f; + public static readonly float EyeForward = 0.140f; + public static readonly float EyeHeight = 0.100f; public static readonly float EyeSize = 0.020f; // Base glow, before any star. The tiers replace it with the emissive colours the game diff --git a/JotunnModStub/Dvergar/DvergarVisuals.cs b/JotunnModStub/Dvergar/DvergarVisuals.cs index ffdac13..befdaef 100644 --- a/JotunnModStub/Dvergar/DvergarVisuals.cs +++ b/JotunnModStub/Dvergar/DvergarVisuals.cs @@ -281,11 +281,18 @@ namespace RacesOfValheim if (eye != null) { + // Which side of the head it came out on. Positive means the face; negative would + // mean the offsets are pushing into the back of the skull, which no amount of + // increasing them would ever fix. + Vector3 offset = eye.position - headBone.position; + Vector3 flat = new Vector3(offset.x, 0f, offset.z); + float towardFace = Vector3.Dot(flat.normalized, player.transform.forward); + Jotunn.Logger.LogInfo( $"[Dvergar] eye parent='{(eye.parent != null ? eye.parent.name : "none")}' " + $"localPos={eye.localPosition} localScale={eye.localScale} world={eye.position} " + - $"distFromHead={Vector3.Distance(eye.position, headBone.position):F3}m " + - $"worldSize={eye.lossyScale.x:F3}m"); + $"distFromHead={offset.magnitude:F3}m up={offset.y:F3}m " + + $"towardFace={towardFace:F2} worldSize={eye.lossyScale.x:F3}m"); } }