Color grading
This commit is contained in:
parent
c87210e52d
commit
e3d25a53e9
File diff suppressed because it is too large
Load diff
|
|
@ -973,6 +973,57 @@ namespace HeavenStudio
|
||||||
new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "intenStart", "xStart", "yStart" })
|
new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "intenStart", "xStart", "yStart" })
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
new GameAction("grain", "Grain")
|
||||||
|
{
|
||||||
|
resizable = true,
|
||||||
|
parameters = new()
|
||||||
|
{
|
||||||
|
new("intenStart", new EntityTypes.Float(0f, 1f), "Start Intensity"),
|
||||||
|
new("intenEnd", new EntityTypes.Float(0f, 1f, 1f), "End Intensity"),
|
||||||
|
|
||||||
|
new("sizeStart", new EntityTypes.Float(0.3f, 3f, 1f), "Start Size"),
|
||||||
|
new("sizeEnd", new EntityTypes.Float(0.3f, 3f, 1f), "End Size"),
|
||||||
|
|
||||||
|
new("colored", true, "Colored"),
|
||||||
|
|
||||||
|
new("ease", Util.EasingFunction.Ease.Linear, "Ease", "", new()
|
||||||
|
{
|
||||||
|
new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "intenStart", "sizeStart" })
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new GameAction("colorGrading", "Color Grading")
|
||||||
|
{
|
||||||
|
resizable = true,
|
||||||
|
parameters = new()
|
||||||
|
{
|
||||||
|
new("tempStart", new EntityTypes.Float(-100f, 100f), "Start Temperature"),
|
||||||
|
new("tempEnd", new EntityTypes.Float(-100f, 100f), "End Temperature"),
|
||||||
|
|
||||||
|
new("tintStart", new EntityTypes.Float(-100f, 100f), "Start Tint"),
|
||||||
|
new("tintEnd", new EntityTypes.Float(-100f, 100f), "End Tint"),
|
||||||
|
|
||||||
|
new("colorStart", Color.white, "Start Color Filter"),
|
||||||
|
new("colorEnd", Color.white, "End Color Filter"),
|
||||||
|
|
||||||
|
new("hueShiftStart", new EntityTypes.Float(-180f, 180f), "Start Hue Shift"),
|
||||||
|
new("hueShiftEnd", new EntityTypes.Float(-180f, 180f), "End Hue Shift"),
|
||||||
|
|
||||||
|
new("satStart", new EntityTypes.Float(-100f, 100f), "Start Saturation"),
|
||||||
|
new("satEnd", new EntityTypes.Float(-100f, 100f), "End Saturation"),
|
||||||
|
|
||||||
|
new("brightStart", new EntityTypes.Float(-100f, 100f), "Start Brightness"),
|
||||||
|
new("brightEnd", new EntityTypes.Float(-100f, 100f), "End Brightness"),
|
||||||
|
|
||||||
|
new("conStart", new EntityTypes.Float(-100f, 100f), "Start Contrast"),
|
||||||
|
new("conEnd", new EntityTypes.Float(-100f, 100f), "End Contrast"),
|
||||||
|
|
||||||
|
new("ease", Util.EasingFunction.Ease.Linear, "Ease", "", new()
|
||||||
|
{
|
||||||
|
new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "tempStart", "tintStart", "colorStart", "hueShiftStart", "satStart", "brightStart", "conStart" })
|
||||||
|
}),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ namespace HeavenStudio
|
||||||
private List<RiqEntity> _cabbs = new();
|
private List<RiqEntity> _cabbs = new();
|
||||||
private List<RiqEntity> _blooms = new();
|
private List<RiqEntity> _blooms = new();
|
||||||
private List<RiqEntity> _lensDs = new();
|
private List<RiqEntity> _lensDs = new();
|
||||||
|
private List<RiqEntity> _grains = new();
|
||||||
|
private List<RiqEntity> _colorGradings = new();
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
|
|
@ -32,11 +34,15 @@ namespace HeavenStudio
|
||||||
_cabbs = EventCaller.GetAllInGameManagerList("vfx", new string[] { "cabb" });
|
_cabbs = EventCaller.GetAllInGameManagerList("vfx", new string[] { "cabb" });
|
||||||
_blooms = EventCaller.GetAllInGameManagerList("vfx", new string[] { "bloom" });
|
_blooms = EventCaller.GetAllInGameManagerList("vfx", new string[] { "bloom" });
|
||||||
_lensDs = EventCaller.GetAllInGameManagerList("vfx", new string[] { "lensD" });
|
_lensDs = EventCaller.GetAllInGameManagerList("vfx", new string[] { "lensD" });
|
||||||
|
_grains = EventCaller.GetAllInGameManagerList("vfx", new string[] { "grain" });
|
||||||
|
_colorGradings = EventCaller.GetAllInGameManagerList("vfx", new string[] { "colorGrading" });
|
||||||
|
|
||||||
UpdateVignette();
|
UpdateVignette();
|
||||||
UpdateChromaticAbberations();
|
UpdateChromaticAbberations();
|
||||||
UpdateBlooms();
|
UpdateBlooms();
|
||||||
UpdateLensDistortions();
|
UpdateLensDistortions();
|
||||||
|
UpdateGrain();
|
||||||
|
UpdateColorGrading();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
|
|
@ -45,6 +51,8 @@ namespace HeavenStudio
|
||||||
UpdateChromaticAbberations();
|
UpdateChromaticAbberations();
|
||||||
UpdateBlooms();
|
UpdateBlooms();
|
||||||
UpdateLensDistortions();
|
UpdateLensDistortions();
|
||||||
|
UpdateGrain();
|
||||||
|
UpdateColorGrading();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateVignette()
|
private void UpdateVignette()
|
||||||
|
|
@ -156,6 +164,65 @@ namespace HeavenStudio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateGrain()
|
||||||
|
{
|
||||||
|
if (!_volume.profile.TryGetSettings<Grain>(out var g)) return;
|
||||||
|
g.enabled.Override(false);
|
||||||
|
foreach (var e in _grains)
|
||||||
|
{
|
||||||
|
float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
||||||
|
if (normalized < 0) break;
|
||||||
|
|
||||||
|
float clampNormal = Mathf.Clamp01(normalized);
|
||||||
|
var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
|
||||||
|
|
||||||
|
float newIntensity = func(e["intenStart"], e["intenEnd"], clampNormal);
|
||||||
|
g.enabled.Override(newIntensity != 0);
|
||||||
|
if (!g.enabled) continue;
|
||||||
|
g.intensity.Override(newIntensity);
|
||||||
|
g.colored.Override(e["colored"]);
|
||||||
|
|
||||||
|
float newSize = func(e["sizeStart"], e["sizeEnd"], clampNormal);
|
||||||
|
g.size.Override(newSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateColorGrading()
|
||||||
|
{
|
||||||
|
if (!_volume.profile.TryGetSettings<ColorGrading>(out var c)) return;
|
||||||
|
c.enabled.Override(false);
|
||||||
|
foreach (var e in _colorGradings)
|
||||||
|
{
|
||||||
|
c.enabled.Override(true);
|
||||||
|
float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
||||||
|
if (normalized < 0) break;
|
||||||
|
|
||||||
|
float clampNormal = Mathf.Clamp01(normalized);
|
||||||
|
var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
|
||||||
|
|
||||||
|
float newTemp = func(e["tempStart"], e["tempEnd"], clampNormal);
|
||||||
|
c.temperature.Override(newTemp);
|
||||||
|
|
||||||
|
float newTint = func(e["tintStart"], e["tintEnd"], clampNormal);
|
||||||
|
c.tint.Override(newTint);
|
||||||
|
|
||||||
|
Color newColor = ColorEase(e["colorStart"], e["colorEnd"], clampNormal, func);
|
||||||
|
c.colorFilter.Override(newColor);
|
||||||
|
|
||||||
|
float newHue = func(e["hueShiftStart"], e["hueShiftEnd"], clampNormal);
|
||||||
|
c.hueShift.Override(newHue);
|
||||||
|
|
||||||
|
float newSat = func(e["satStart"], e["satEnd"], clampNormal);
|
||||||
|
c.saturation.Override(newSat);
|
||||||
|
|
||||||
|
float newBright = func(e["brightStart"], e["brightEnd"], clampNormal);
|
||||||
|
c.brightness.Override(newBright);
|
||||||
|
|
||||||
|
float newCon = func(e["conStart"], e["conEnd"], clampNormal);
|
||||||
|
c.contrast.Override(newCon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Color ColorEase(Color start, Color end, float time, Util.EasingFunction.Function func)
|
private Color ColorEase(Color start, Color end, float time, Util.EasingFunction.Function func)
|
||||||
{
|
{
|
||||||
float newR = func(start.r, end.r, time);
|
float newR = func(start.r, end.r, time);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue