mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-13 06:47:37 +02:00
Pixelize VFX! (#895)
Finally, the dark days of zooming the camera and viewport are over...
This commit is contained in:
@ -1188,6 +1188,26 @@ namespace HeavenStudio
|
||||
}
|
||||
},
|
||||
|
||||
new GameAction("pixelQuad", "Pixelize")
|
||||
{
|
||||
resizable = true,
|
||||
parameters = new()
|
||||
{
|
||||
new("pixelSizeStart", new EntityTypes.Float(0.00f, 1f, 0.00f), "Start Pixel Size", "Set the pixel size at the start of the event."),
|
||||
new("pixelSizeEnd", new EntityTypes.Float(0.00f, 1f, 0.5f), "End Pixel Size", "Set the pixel size at the end of the event."),
|
||||
new("ratioStart", new EntityTypes.Float(0.2f, 5f, 1f), "Start Pixel Ratio", "Set the pixel ratio at the start of the event."),
|
||||
new("ratioEnd", new EntityTypes.Float(0.2f, 5f, 1f), "End Pixel Ratio", "Set the pixel ratio at the end of the event."),
|
||||
new("xScaleStart", new EntityTypes.Float(0.2f, 5f, 1f), "Start X Scale", "Set the X scale of the pixels at the start of the event."),
|
||||
new("xScaleEnd", new EntityTypes.Float(0.2f, 5f, 1f), "End X Scale", "Set the X scale of the pixels at the end of the event."),
|
||||
new("yScaleStart", new EntityTypes.Float(0.2f, 5f, 1f), "Start Y Scale", "Set the Y scale of the pixels at the start of the event."),
|
||||
new("yScaleEnd", new EntityTypes.Float(0.2f, 5f, 1f), "End Y Scale", "Set the Y scale of the pixels at the end of the event."),
|
||||
new("ease", Util.EasingFunction.Ease.Linear, "Ease", "Set the easing of the action.", new()
|
||||
{
|
||||
new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "pixelSizeStart", "ratioStart", "xScaleStart", "yScaleStart" })
|
||||
}),
|
||||
}
|
||||
},
|
||||
|
||||
new GameAction("retroTv", "Retro TV")
|
||||
{
|
||||
resizable = true,
|
||||
|
@ -24,12 +24,15 @@ namespace HeavenStudio
|
||||
private List<RiqEntity> _analogNoises = new();
|
||||
private List<RiqEntity> _screenJumps = new();
|
||||
private List<RiqEntity> _sobelNeons = new();
|
||||
private List<RiqEntity> _pixelizeQuads = new();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_volume = GetComponent<PostProcessVolume>();
|
||||
UpdateRetroTV();
|
||||
UpdateAnalogNoise();
|
||||
UpdateSobelNeons();
|
||||
UpdatePixelizes();
|
||||
|
||||
}
|
||||
|
||||
@ -52,6 +55,7 @@ namespace HeavenStudio
|
||||
_analogNoises = EventCaller.GetAllInGameManagerList("vfx", new string[] {"analogNoise"});
|
||||
_screenJumps = EventCaller.GetAllInGameManagerList("vfx", new string[] {"screenJump"});
|
||||
_sobelNeons = EventCaller.GetAllInGameManagerList("vfx", new string[] {"sobelNeon"});
|
||||
_pixelizeQuads = EventCaller.GetAllInGameManagerList("vfx", new string [] {"pixelQuad"});
|
||||
|
||||
UpdateVignette();
|
||||
UpdateChromaticAbberations();
|
||||
@ -65,6 +69,7 @@ namespace HeavenStudio
|
||||
UpdateAnalogNoise();
|
||||
UpdateScreenJumps();
|
||||
UpdateSobelNeons();
|
||||
UpdatePixelizes();
|
||||
|
||||
}
|
||||
|
||||
@ -82,6 +87,7 @@ namespace HeavenStudio
|
||||
UpdateAnalogNoise();
|
||||
UpdateScreenJumps();
|
||||
UpdateSobelNeons();
|
||||
UpdatePixelizes();
|
||||
|
||||
}
|
||||
|
||||
@ -399,6 +405,38 @@ namespace HeavenStudio
|
||||
|
||||
}
|
||||
|
||||
private void UpdatePixelizes()
|
||||
{
|
||||
if (!_volume.profile.TryGetSettings<PixelizeQuad>(out var pq)) return;
|
||||
pq.enabled.Override(false);
|
||||
foreach (var e in _pixelizeQuads)
|
||||
{
|
||||
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 newPixelSize = func(e["pixelSizeStart"], e["pixelSizeEnd"], clampNormal);
|
||||
pq.enabled.Override(newPixelSize != 0);
|
||||
if (!pq.enabled) continue;
|
||||
pq.pixelSize.Override(newPixelSize);
|
||||
|
||||
float newPixelRatio = func(e["ratioStart"], e["ratioEnd"], clampNormal);
|
||||
if (!pq.enabled) continue;
|
||||
pq.pixelRatio.Override(newPixelRatio);
|
||||
|
||||
float newPixelXScale = func(e["xScaleStart"], e["xScaleEnd"], clampNormal);
|
||||
if (!pq.enabled) continue;
|
||||
pq.pixelScaleX.Override(newPixelXScale);
|
||||
|
||||
float newPixelYScale = func(e["yScaleStart"], e["yScaleEnd"], clampNormal);
|
||||
if (!pq.enabled) continue;
|
||||
pq.pixelScaleY.Override(newPixelYScale);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private Color ColorEase(Color start, Color end, float time, Util.EasingFunction.Function func)
|
||||
{
|
||||
float newR = func(start.r, end.r, time);
|
||||
|
Reference in New Issue
Block a user