diff --git a/JotunnModStub/Dvergar/DvergarPatches.cs b/JotunnModStub/Dvergar/DvergarPatches.cs index 94ae69e..0375054 100644 --- a/JotunnModStub/Dvergar/DvergarPatches.cs +++ b/JotunnModStub/Dvergar/DvergarPatches.cs @@ -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. diff --git a/JotunnModStub/Dvergar/DvergarVisuals.cs b/JotunnModStub/Dvergar/DvergarVisuals.cs index 5647fef..f27c198 100644 --- a/JotunnModStub/Dvergar/DvergarVisuals.cs +++ b/JotunnModStub/Dvergar/DvergarVisuals.cs @@ -107,6 +107,56 @@ namespace RacesOfValheim return BossProgressionManager.GetCurrentProgressionState(); } + // ─── Shader survey ─────────────────────────────────────────────────── + + private static bool loggedSkinShader; + + /// + /// 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. + /// + 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;