42 lines
1.7 KiB
C#
42 lines
1.7 KiB
C#
#if UNITY_EDITOR
|
|
using System.Linq;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
public static class TuneHomeCampShadeLift
|
|
{
|
|
const string Root = "Assets/Bundles/Scenes/Town/HomeCamp";
|
|
|
|
public static string Run()
|
|
{
|
|
AssetDatabase.ImportAsset("Assets/Bundles/Shaders/XShader/HomeCampXPbr.shader", ImportAssetOptions.ForceSynchronousImport);
|
|
AssetDatabase.ImportAsset("Assets/Bundles/Shaders/XShader/XTerrain.shader", ImportAssetOptions.ForceSynchronousImport);
|
|
|
|
var report = new System.Collections.Generic.List<string>();
|
|
foreach (var path in AssetDatabase.FindAssets("t:Material", new[] { Root }).Select(AssetDatabase.GUIDToAssetPath))
|
|
{
|
|
var mat = AssetDatabase.LoadAssetAtPath<Material>(path);
|
|
if (!mat || mat.shader == null) continue;
|
|
if (mat.shader.name == "Test/HomeCampXPbr")
|
|
{
|
|
// Stronger open: gamma 0.4 ≈ visibly half the crushed shade.
|
|
mat.SetFloat("_LightmapShadeGamma", .4f);
|
|
mat.SetFloat("_AO", .5f);
|
|
EditorUtility.SetDirty(mat);
|
|
report.Add(mat.name + " gamma=" + mat.GetFloat("_LightmapShadeGamma"));
|
|
}
|
|
else if (mat.shader.name == "XWorld/XTerrain")
|
|
{
|
|
mat.SetFloat("_LightmapContrast", .4f);
|
|
mat.SetFloat("_LightmapShadeMul", 1f);
|
|
mat.SetColor("_LightmapShadeTint", new Color(.9f, .92f, .96f, 1f));
|
|
EditorUtility.SetDirty(mat);
|
|
report.Add(mat.name + " contrast=" + mat.GetFloat("_LightmapContrast"));
|
|
}
|
|
}
|
|
AssetDatabase.SaveAssets();
|
|
return string.Join("; ", report);
|
|
}
|
|
}
|
|
#endif
|