chore(dvergar): retire the eye trace and the shader survey

Both were built to answer questions and both answered them: the trace found the camera anchor sitting half a metre above the head bone, the counter-rotating axes, and the tilt that put the eyes at the jaw; the survey established that Custom/Player carries no desaturation control and never will make a pale Dvergar.

Neither belongs in a session log now that the answers are known, so the trace goes and the survey's finding stays as the comment that stops anyone re-deriving it. The one-line reports that remain are the ones a game update could invalidate - which glow shader resolved, and the star offsets read off the creature prefab.
This commit is contained in:
kanym 2026-08-05 21:44:50 +02:00
commit bd27bd8fd4
2 changed files with 16 additions and 92 deletions

View file

@ -351,9 +351,6 @@ namespace RacesOfValheim
if (__instance.m_bodyModel != null && __instance.m_bodyModel.material != null) if (__instance.m_bodyModel != null && __instance.m_bodyModel.material != null)
{ {
// Once per session: settles whether this material can be desaturated properly
// or whether the multiplier tint is the ceiling.
DvergarVisuals.LogSkinShaderOnce(__instance.m_bodyModel.material);
// Not the flat config colour any more: it carries the star shift a dverger of // Not the flat config colour any more: it carries the star shift a dverger of
// this standing would wear, so the race visibly ages at Bonemass and again at // this standing would wear, so the race visibly ages at Bonemass and again at

View file

@ -274,48 +274,6 @@ namespace RacesOfValheim
eye.localPosition = baseLocal + localRight * (side * DvergarConfig.EyeSeparation * raceScale * toLocal); eye.localPosition = baseLocal + localRight * (side * DvergarConfig.EyeSeparation * raceScale * toLocal);
eye.localScale = Vector3.one * eyeLocalSize; eye.localScale = Vector3.one * eyeLocalSize;
} }
LogEyeTrace(player, headBone, holder, lossy, raceScale);
}
// Traced repeatedly rather than once. The arithmetic says these eyes land 7cm from the
// head bone, and the screen says they are metres away - so the useful question is no
// longer what the offsets are, but whether the objects are where they were put and whether
// they stay there. Position, parent and distance, several times over the first few
// seconds, answers both.
private static int eyeTraceCount;
private static float nextEyeTrace;
private static void LogEyeTrace(Player player, Transform headBone, Transform holder, float lossy, float raceScale)
{
if (eyeTraceCount >= 6 || Time.time < nextEyeTrace) return;
eyeTraceCount++;
nextEyeTrace = Time.time + 2f;
Transform eye = holder.childCount > 0 ? holder.GetChild(0) : null;
Jotunn.Logger.LogInfo(
$"[Dvergar] trace {eyeTraceCount}: player={player.transform.position} head={headBone.position} " +
$"lossy={lossy:F2} race={raceScale:F2}");
Jotunn.Logger.LogInfo(
$"[Dvergar] holder parent='{(holder.parent != null ? holder.parent.name : "none")}' " +
$"localPos={holder.localPosition} localScale={holder.localScale} world={holder.position}");
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={offset.magnitude:F3}m up={offset.y:F3}m " +
$"towardFace={towardFace:F2} worldSize={eye.lossyScale.x:F3}m");
}
} }
/// <summary> /// <summary>
@ -425,53 +383,22 @@ namespace RacesOfValheim
// ─── Shader survey ─────────────────────────────────────────────────── // ─── Shader survey ───────────────────────────────────────────────────
private static bool loggedSkinShader; // What the player's body material can be asked to do, surveyed once and recorded here
// rather than logged every session:
/// <summary> //
/// Reports what the player's body material can actually be asked to do, once per session. // Custom/Player, 13 properties, of which exactly one is a colour - _SkinColor.
/// // No _Hue, no _Saturation, no _Value, no _Brightness, no _Grayscale.
/// This was written to settle whether a pale Dvergar was reachable, and it settled it: //
/// // Which settles why a pale Dvergar is out of reach, and settles it as a property of the
/// Custom/Player, 13 properties, of which exactly one is a colour - _SkinColor. // shader rather than of the numbers anyone picks. A real dverger goes pale at two stars
/// No _Hue, no _Saturation, no _Value, no _Brightness, no _Grayscale. // through saturation -1 on the creature shader, which genuinely desaturates its texture.
/// // The player body has no such control: _SkinColor multiplies the human skin map, and a
/// So the answer is no, and it is a property of the shader rather than of the numbers we // multiply can darken or bias but never desaturate - the pink is in the texture and
/// pick. A real dverger goes pale at two stars by way of saturation -1 on the creature // survives being multiplied by grey. White is the multiplier's identity, so "paler" and
/// shader, which genuinely desaturates its texture. The player body has no such control: // "more human" are the same direction, which is what every attempt walked into.
/// _SkinColor multiplies the human skin map, and a multiply can darken or bias but never //
/// desaturate - the pink is in the texture and survives being multiplied by grey. White // Getting there would mean replacing _MainTex with a desaturated copy of the skin texture,
/// is the multiplier's identity, so "paler" and "more human" are the same direction. // a per-player blit through a custom shader. Disproportionate for a cosmetic tier.
///
/// Getting there would mean replacing _MainTex with a desaturated copy of the skin
/// texture, which is a blit through a custom shader per player - far more machinery than a
/// cosmetic tier is worth. Kept as a check rather than deleted, in case a game update ever
/// changes the player shader.
/// </summary>
public static void LogSkinShaderOnce(Material material)
{
if (loggedSkinShader || material == null) return;
loggedSkinShader = true;
Shader shader = material.shader;
Jotunn.Logger.LogInfo($"[Dvergar] Body shader: '{(shader != null ? shader.name : "null")}'");
if (shader != null)
{
int count = shader.GetPropertyCount();
System.Text.StringBuilder sb = new System.Text.StringBuilder();
for (int i = 0; i < count; i++)
{
sb.Append(shader.GetPropertyName(i)).Append(" (").Append(shader.GetPropertyType(i)).Append(") ");
}
Jotunn.Logger.LogInfo($"[Dvergar] Body shader has {count} properties: {sb}");
}
string[] wanted = { "_Hue", "_Saturation", "_Value", "_Brightness", "_Contrast", "_Grayscale", "_SkinColor" };
foreach (string name in wanted)
{
Jotunn.Logger.LogInfo($"[Dvergar] HasProperty('{name}') = {material.HasProperty(name)}");
}
}
private static LevelEffects.LevelSetup GetStarSetup(int tier) private static LevelEffects.LevelSetup GetStarSetup(int tier)
{ {