Camo: generalize brightness + add persistent saturation
Move brightness out of the half-lambert diffuse term to a final exposure multiply on the whole shaded body color (diffuse + GI + specular), and add a saturation grade (0 = neutral, -1 = grayscale, >0 = boosted) on the same final stage. Saturation rides as a 4th component on CamoKnobs (Vector3 -> Vector4) so it inherits all three persistence paths: HUD JSON, network replication (_camo NetworkVariable), and painting-slot metadata. Wires the renamed Slider_Brightness and new Slider_Saturation. Bumps HudFileVersion and PaintMetaVersion with load-time remaps so existing paintings keep their look (old 1=neutral saturation remaps to 0=neutral). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
45b7de05e4
commit
50781e32d2
7 files changed
+87
-36
No files matched your search
@@ -78,6 +78,16 @@ public partial class MeshPainter : MonoBehaviour
|
||||
set => SetMatFloat(SpecularDampenId, value);
|
||||
}
|
||||
|
||||
/// <summary>General colour saturation of the shaded body (0 = neutral, -1 = greyscale, >0 = punchier).
|
||||
/// A camo body-tone knob alongside <see cref="CamoHalfLambertBrightness"/>; drives the material's
|
||||
/// <c>_Saturation</c> (offset: shader lerps to grey by 1 + value). Persisted + replicated with the
|
||||
/// other camo knobs (see <see cref="CamoKnobs"/>).</summary>
|
||||
public float CamoSaturation
|
||||
{
|
||||
get => GetMatFloat(SaturationId, 0f);
|
||||
set => SetMatFloat(SaturationId, value);
|
||||
}
|
||||
|
||||
// Painted-height look knobs on the same material instance, surfaced/guarded/persisted/replicated
|
||||
// like the camo knobs above. Defaults match the shader so the unpainted look is unchanged.
|
||||
|
||||
@@ -104,11 +114,12 @@ public partial class MeshPainter : MonoBehaviour
|
||||
set => SetMatFloat(ParallaxId, Mathf.Max(0f, value) * ParallaxBase);
|
||||
}
|
||||
|
||||
/// <summary>The three camo knobs as one vector (x = half-Lambert, y = its brightness, z = specular dampen).</summary>
|
||||
public Vector3 CamoKnobs
|
||||
/// <summary>The four camo knobs as one vector (x = half-Lambert, y = brightness, z = specular dampen,
|
||||
/// w = saturation) - one payload for persistence + network replication.</summary>
|
||||
public Vector4 CamoKnobs
|
||||
{
|
||||
get => new(CamoHalfLambert, CamoHalfLambertBrightness, CamoSpecularDampen);
|
||||
set { CamoHalfLambert = value.x; CamoHalfLambertBrightness = value.y; CamoSpecularDampen = value.z; }
|
||||
get => new(CamoHalfLambert, CamoHalfLambertBrightness, CamoSpecularDampen, CamoSaturation);
|
||||
set { CamoHalfLambert = value.x; CamoHalfLambertBrightness = value.y; CamoSpecularDampen = value.z; CamoSaturation = value.w; }
|
||||
}
|
||||
|
||||
/// <summary>The three painted-height knobs as one vector (x = occlusion threshold, y = relief normal intensity, z = parallax intensity).</summary>
|
||||
@@ -454,6 +465,7 @@ public partial class MeshPainter : MonoBehaviour
|
||||
private const float ParallaxBase = 0.02f;
|
||||
private static readonly int HalfLambertId = Shader.PropertyToID("_HalfLambert");
|
||||
private static readonly int HalfLambertBrightnessId = Shader.PropertyToID("_HalfLambertBrightness");
|
||||
private static readonly int SaturationId = Shader.PropertyToID("_Saturation");
|
||||
private static readonly int SpecularDampenId = Shader.PropertyToID("_SpecularDampen");
|
||||
private static readonly int XRayColorId = Shader.PropertyToID("_XRayColor");
|
||||
private static readonly int XRayPulseSpeedId = Shader.PropertyToID("_XRayPulseSpeed");
|
||||
|
||||
Reference in new issue
Block a user