chore(dvergar): survey the body shader, and record why pale is out of reach

Custom/Player carries 13 properties and exactly one colour among them,
_SkinColor. No _Hue, no _Saturation, no _Value, no _Brightness, no _Grayscale.

That closes the question the last three commits kept circling. A real dverger
turns pale at two stars through saturation -1 on the creature shader, which
genuinely desaturates its texture. The player body has no equivalent control:
_SkinColor multiplies the human skin map, and a multiply can darken or bias but
never desaturate, because the pink lives in the texture and survives being
multiplied by grey. White is the multiplier's identity, so "paler" and "more
human" are the same direction - which is exactly what every attempt walked into.

Reaching it would mean swapping _MainTex for a desaturated copy of the skin
texture, a per-player blit through a custom shader. Disproportionate for a
cosmetic tier.

The survey stays as a check rather than being deleted, in case a game update ever
changes the player shader, and the finding is written where the next person will
look for it.

The star offsets read off the prefab, for the record:
  Star 1: hue +0.100, saturation +0.200, value 0, emissive RGBA(0, 4, 3.294)
  Star 2: hue 0, saturation -1.000, value 0, emissive RGBA(11.984, 0, 8.784)

Both emissive colours are HDR and are what a starred dverger's eyes glow with.
This commit is contained in:
kanym 2026-08-05 20:00:15 +02:00
commit 0b6a61a852
2 changed files with 54 additions and 0 deletions

View file

@ -343,6 +343,10 @@ namespace RacesOfValheim
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
// this standing would wear, so the race visibly ages at Bonemass and again at
// Fader.

View file

@ -107,6 +107,56 @@ namespace RacesOfValheim
return BossProgressionManager.GetCurrentProgressionState();
}
// ─── Shader survey ───────────────────────────────────────────────────
private static bool loggedSkinShader;
/// <summary>
/// Reports what the player's body material can actually be asked to do, once per session.
///
/// This was written to settle whether a pale Dvergar was reachable, and it settled it:
///
/// Custom/Player, 13 properties, of which exactly one is a colour - _SkinColor.
/// No _Hue, no _Saturation, no _Value, no _Brightness, no _Grayscale.
///
/// So the answer is no, and it is a property of the shader rather than of the numbers we
/// pick. A real dverger goes pale at two stars by way of 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 multiply can darken or bias but never
/// desaturate - the pink is in the texture and survives being multiplied by grey. White
/// is the multiplier's identity, so "paler" and "more human" are the same direction.
///
/// 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)
{
if (tier <= 0) return null;