mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-09 11:15:07 +00:00
Pixelize VFX! (#895)
Finally, the dark days of zooming the camera and viewport are over...
This commit is contained in:
parent
b189eb8895
commit
2a4489262b
7 changed files with 104 additions and 14 deletions
|
@ -1412,7 +1412,7 @@ MonoBehaviour:
|
||||||
overrideState: 0
|
overrideState: 0
|
||||||
value: 0
|
value: 0
|
||||||
intervalType:
|
intervalType:
|
||||||
overrideState: 0
|
overrideState: 1
|
||||||
value: 0
|
value: 0
|
||||||
frequency:
|
frequency:
|
||||||
overrideState: 0
|
overrideState: 0
|
||||||
|
@ -1446,6 +1446,37 @@ MonoBehaviour:
|
||||||
fastMode:
|
fastMode:
|
||||||
overrideState: 0
|
overrideState: 0
|
||||||
value: 0
|
value: 0
|
||||||
|
--- !u!114 &-2221949593409771698
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 3
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: bcc23458a58ff384c82bd27e09aa0cc6, type: 3}
|
||||||
|
m_Name: PixelizeQuad
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
active: 1
|
||||||
|
enabled:
|
||||||
|
overrideState: 1
|
||||||
|
value: 1
|
||||||
|
pixelSize:
|
||||||
|
overrideState: 1
|
||||||
|
value: 0.184
|
||||||
|
useAutoScreenRatio:
|
||||||
|
overrideState: 1
|
||||||
|
value: 0
|
||||||
|
pixelRatio:
|
||||||
|
overrideState: 1
|
||||||
|
value: 1
|
||||||
|
pixelScaleX:
|
||||||
|
overrideState: 1
|
||||||
|
value: 1
|
||||||
|
pixelScaleY:
|
||||||
|
overrideState: 1
|
||||||
|
value: 1
|
||||||
--- !u!114 &-1752554079016775041
|
--- !u!114 &-1752554079016775041
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 3
|
m_ObjectHideFlags: 3
|
||||||
|
@ -1469,7 +1500,7 @@ MonoBehaviour:
|
||||||
overrideState: 1
|
overrideState: 1
|
||||||
value: {r: 0, g: 0, b: 0, a: 1}
|
value: {r: 0, g: 0, b: 0, a: 1}
|
||||||
center:
|
center:
|
||||||
overrideState: 0
|
overrideState: 1
|
||||||
value: {x: 0.5, y: 0.5}
|
value: {x: 0.5, y: 0.5}
|
||||||
intensity:
|
intensity:
|
||||||
overrideState: 1
|
overrideState: 1
|
||||||
|
@ -1540,6 +1571,7 @@ MonoBehaviour:
|
||||||
- {fileID: -44530092333175149}
|
- {fileID: -44530092333175149}
|
||||||
- {fileID: -6672723021951195849}
|
- {fileID: -6672723021951195849}
|
||||||
- {fileID: 6617679330616591269}
|
- {fileID: 6617679330616591269}
|
||||||
|
- {fileID: -2221949593409771698}
|
||||||
--- !u!114 &190338221448500764
|
--- !u!114 &190338221448500764
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 3
|
m_ObjectHideFlags: 3
|
||||||
|
@ -1589,7 +1621,7 @@ MonoBehaviour:
|
||||||
value: 1
|
value: 1
|
||||||
intensity:
|
intensity:
|
||||||
overrideState: 1
|
overrideState: 1
|
||||||
value: 0
|
value: 0.5
|
||||||
size:
|
size:
|
||||||
overrideState: 1
|
overrideState: 1
|
||||||
value: 1
|
value: 1
|
||||||
|
|
|
@ -14,8 +14,8 @@ RenderTexture:
|
||||||
m_DownscaleFallback: 0
|
m_DownscaleFallback: 0
|
||||||
m_IsAlphaChannelOptional: 0
|
m_IsAlphaChannelOptional: 0
|
||||||
serializedVersion: 5
|
serializedVersion: 5
|
||||||
m_Width: 1249
|
m_Width: 1920
|
||||||
m_Height: 703
|
m_Height: 1080
|
||||||
m_AntiAliasing: 2
|
m_AntiAliasing: 2
|
||||||
m_MipCount: -1
|
m_MipCount: -1
|
||||||
m_DepthStencilFormat: 92
|
m_DepthStencilFormat: 92
|
||||||
|
|
|
@ -14,8 +14,8 @@ RenderTexture:
|
||||||
m_DownscaleFallback: 0
|
m_DownscaleFallback: 0
|
||||||
m_IsAlphaChannelOptional: 0
|
m_IsAlphaChannelOptional: 0
|
||||||
serializedVersion: 5
|
serializedVersion: 5
|
||||||
m_Width: 1873
|
m_Width: 2880
|
||||||
m_Height: 1054
|
m_Height: 1620
|
||||||
m_AntiAliasing: 1
|
m_AntiAliasing: 1
|
||||||
m_MipCount: -1
|
m_MipCount: -1
|
||||||
m_DepthStencilFormat: 92
|
m_DepthStencilFormat: 92
|
||||||
|
|
|
@ -13155,7 +13155,7 @@ MonoBehaviour:
|
||||||
m_TargetGraphic: {fileID: 171581557}
|
m_TargetGraphic: {fileID: 171581557}
|
||||||
m_HandleRect: {fileID: 171581556}
|
m_HandleRect: {fileID: 171581556}
|
||||||
m_Direction: 2
|
m_Direction: 2
|
||||||
m_Value: 1
|
m_Value: 0
|
||||||
m_Size: 1
|
m_Size: 1
|
||||||
m_NumberOfSteps: 0
|
m_NumberOfSteps: 0
|
||||||
m_OnValueChanged:
|
m_OnValueChanged:
|
||||||
|
@ -25414,8 +25414,8 @@ MonoBehaviour:
|
||||||
m_TargetGraphic: {fileID: 1589389272}
|
m_TargetGraphic: {fileID: 1589389272}
|
||||||
m_HandleRect: {fileID: 1589389271}
|
m_HandleRect: {fileID: 1589389271}
|
||||||
m_Direction: 2
|
m_Direction: 2
|
||||||
m_Value: 1
|
m_Value: 0
|
||||||
m_Size: 0.99995804
|
m_Size: 0.99392056
|
||||||
m_NumberOfSteps: 0
|
m_NumberOfSteps: 0
|
||||||
m_OnValueChanged:
|
m_OnValueChanged:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
|
@ -31580,7 +31580,7 @@ RectTransform:
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0.5}
|
m_AnchorMin: {x: 0, y: 0.5}
|
||||||
m_AnchorMax: {x: 1, y: 0.5}
|
m_AnchorMax: {x: 1, y: 0.5}
|
||||||
m_AnchoredPosition: {x: 0, y: 122.12238}
|
m_AnchoredPosition: {x: 0, y: 199.0612}
|
||||||
m_SizeDelta: {x: 0, y: 0}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 1}
|
m_Pivot: {x: 0.5, y: 1}
|
||||||
--- !u!222 &1154875945
|
--- !u!222 &1154875945
|
||||||
|
@ -41326,8 +41326,8 @@ MonoBehaviour:
|
||||||
m_TargetGraphic: {fileID: 1220118245}
|
m_TargetGraphic: {fileID: 1220118245}
|
||||||
m_HandleRect: {fileID: 1220118244}
|
m_HandleRect: {fileID: 1220118244}
|
||||||
m_Direction: 2
|
m_Direction: 2
|
||||||
m_Value: 1.0000005
|
m_Value: 1
|
||||||
m_Size: 0.61358607
|
m_Size: 1
|
||||||
m_NumberOfSteps: 0
|
m_NumberOfSteps: 0
|
||||||
m_OnValueChanged:
|
m_OnValueChanged:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
|
|
|
@ -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")
|
new GameAction("retroTv", "Retro TV")
|
||||||
{
|
{
|
||||||
resizable = true,
|
resizable = true,
|
||||||
|
|
|
@ -24,12 +24,15 @@ namespace HeavenStudio
|
||||||
private List<RiqEntity> _analogNoises = new();
|
private List<RiqEntity> _analogNoises = new();
|
||||||
private List<RiqEntity> _screenJumps = new();
|
private List<RiqEntity> _screenJumps = new();
|
||||||
private List<RiqEntity> _sobelNeons = new();
|
private List<RiqEntity> _sobelNeons = new();
|
||||||
|
private List<RiqEntity> _pixelizeQuads = new();
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
_volume = GetComponent<PostProcessVolume>();
|
_volume = GetComponent<PostProcessVolume>();
|
||||||
UpdateRetroTV();
|
UpdateRetroTV();
|
||||||
UpdateAnalogNoise();
|
UpdateAnalogNoise();
|
||||||
UpdateSobelNeons();
|
UpdateSobelNeons();
|
||||||
|
UpdatePixelizes();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +55,7 @@ namespace HeavenStudio
|
||||||
_analogNoises = EventCaller.GetAllInGameManagerList("vfx", new string[] {"analogNoise"});
|
_analogNoises = EventCaller.GetAllInGameManagerList("vfx", new string[] {"analogNoise"});
|
||||||
_screenJumps = EventCaller.GetAllInGameManagerList("vfx", new string[] {"screenJump"});
|
_screenJumps = EventCaller.GetAllInGameManagerList("vfx", new string[] {"screenJump"});
|
||||||
_sobelNeons = EventCaller.GetAllInGameManagerList("vfx", new string[] {"sobelNeon"});
|
_sobelNeons = EventCaller.GetAllInGameManagerList("vfx", new string[] {"sobelNeon"});
|
||||||
|
_pixelizeQuads = EventCaller.GetAllInGameManagerList("vfx", new string [] {"pixelQuad"});
|
||||||
|
|
||||||
UpdateVignette();
|
UpdateVignette();
|
||||||
UpdateChromaticAbberations();
|
UpdateChromaticAbberations();
|
||||||
|
@ -65,6 +69,7 @@ namespace HeavenStudio
|
||||||
UpdateAnalogNoise();
|
UpdateAnalogNoise();
|
||||||
UpdateScreenJumps();
|
UpdateScreenJumps();
|
||||||
UpdateSobelNeons();
|
UpdateSobelNeons();
|
||||||
|
UpdatePixelizes();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,6 +87,7 @@ namespace HeavenStudio
|
||||||
UpdateAnalogNoise();
|
UpdateAnalogNoise();
|
||||||
UpdateScreenJumps();
|
UpdateScreenJumps();
|
||||||
UpdateSobelNeons();
|
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)
|
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);
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace XPostProcessing
|
||||||
public class PixelizeQuad : PostProcessEffectSettings
|
public class PixelizeQuad : PostProcessEffectSettings
|
||||||
{
|
{
|
||||||
|
|
||||||
[Range(0.01f, 1.0f)]
|
[Range(0.00f, 1.0f)]
|
||||||
public FloatParameter pixelSize = new FloatParameter { value = 0.5f };
|
public FloatParameter pixelSize = new FloatParameter { value = 0.5f };
|
||||||
|
|
||||||
public BoolParameter useAutoScreenRatio = new BoolParameter { value = true };
|
public BoolParameter useAutoScreenRatio = new BoolParameter { value = true };
|
||||||
|
|
Loading…
Reference in a new issue