Retro VFX! (also airboarder works now) (#780)

* Super Retro VFX!

* Updated Screen Jump default

* also airboarder works now

---------

Co-authored-by: minenice55 <star.elementa@gmail.com>
This commit is contained in:
wookywok
2024-03-11 16:21:51 -05:00
committed by GitHub
parent bc93a7ab94
commit 92962fef26
915 changed files with 32248 additions and 73 deletions

View File

@ -0,0 +1,98 @@

//----------------------------------------------------------------------------------------------------------
// X-PostProcessing Library
// https://github.com/QianMo/X-PostProcessing-Library
// Copyright (C) 2020 QianMo. All rights reserved.
// Licensed under the MIT License
// You may not use this file except in compliance with the License.You may obtain a copy of the License at
// http://opensource.org/licenses/MIT
//----------------------------------------------------------------------------------------------------------
using System;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
namespace XPostProcessing
{
[Serializable]
[PostProcess(typeof(DirectionalBlurRenderer), PostProcessEvent.AfterStack, "X-PostProcessing/Blur/DirectionalBlur")]
public class DirectionalBlur : PostProcessEffectSettings
{
[Range(0.0f, 5.0f)]
public FloatParameter BlurRadius = new FloatParameter { value = 1f };
[Range(1, 30)]
public IntParameter Iteration = new IntParameter { value = 12 };
[Range(0.0f, 6.0f)]
public FloatParameter Angle = new FloatParameter { value = 0.5f };
[Range(1.0f, 10.0f)]
public FloatParameter RTDownScaling = new FloatParameter { value = 1.0f };
}
public sealed class DirectionalBlurRenderer : PostProcessEffectRenderer<DirectionalBlur>
{
private const string PROFILER_TAG = "X-DirectionalBlur";
private Shader shader;
public override void Init()
{
shader = Shader.Find("Hidden/X-PostProcessing/DirectionalBlur");
}
public override void Release()
{
base.Release();
}
static class ShaderIDs
{
internal static readonly int Params = Shader.PropertyToID("_Params");
internal static readonly int BufferRT = Shader.PropertyToID("_BufferRT");
}
public override void Render(PostProcessRenderContext context)
{
CommandBuffer cmd = context.command;
PropertySheet sheet = context.propertySheets.Get(shader);
cmd.BeginSample(PROFILER_TAG);
if (settings.RTDownScaling > 1)
{
int RTWidth = (int)(context.screenWidth / settings.RTDownScaling);
int RTHeight = (int)(context.screenHeight / settings.RTDownScaling);
cmd.GetTemporaryRT(ShaderIDs.BufferRT, RTWidth, RTHeight, 0, FilterMode.Bilinear);
// downsample screen copy into smaller RT
context.command.BlitFullscreenTriangle(context.source, ShaderIDs.BufferRT);
}
float sinVal = (Mathf.Sin(settings.Angle) * settings.BlurRadius * 0.05f) / settings.Iteration;
float cosVal = (Mathf.Cos(settings.Angle) * settings.BlurRadius * 0.05f) / settings.Iteration;
sheet.properties.SetVector(ShaderIDs.Params, new Vector3(settings.Iteration, sinVal, cosVal));
if (settings.RTDownScaling > 1)
{
cmd.BlitFullscreenTriangle(ShaderIDs.BufferRT, context.destination, sheet, 0);
}
else
{
cmd.BlitFullscreenTriangle(context.source, context.destination, sheet, 0);
}
cmd.ReleaseTemporaryRT(ShaderIDs.BufferRT);
cmd.EndSample(PROFILER_TAG);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 13b499c0ad495f64b96022d11dce284a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0b5c47af6317cc84c8a7db51cda5fc9f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,54 @@

//----------------------------------------------------------------------------------------------------------
// X-PostProcessing Library
// https://github.com/QianMo/X-PostProcessing-Library
// Copyright (C) 2020 QianMo. All rights reserved.
// Licensed under the MIT License
// You may not use this file except in compliance with the License.You may obtain a copy of the License at
// http://opensource.org/licenses/MIT
//----------------------------------------------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditor.Rendering.PostProcessing;
using UnityEngine.Rendering.PostProcessing;
namespace XPostProcessing
{
[PostProcessEditor(typeof(DirectionalBlur))]
public sealed class DirectionalBlurEditor : PostProcessEffectEditor<DirectionalBlur>
{
SerializedParameterOverride BlurRadius;
SerializedParameterOverride Iteration;
SerializedParameterOverride Angle;
SerializedParameterOverride RTDownScaling;
public override void OnEnable()
{
BlurRadius = FindParameterOverride(x => x.BlurRadius);
Iteration = FindParameterOverride(x => x.Iteration);
Angle = FindParameterOverride(x => x.Angle);
RTDownScaling = FindParameterOverride(x => x.RTDownScaling);
}
public override string GetDisplayTitle()
{
return XPostProcessingEditorUtility.DISPLAY_TITLE_PREFIX + base.GetDisplayTitle();
}
public override void OnInspectorGUI()
{
PropertyField(BlurRadius);
PropertyField(Iteration);
PropertyField(Angle);
PropertyField(RTDownScaling);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 61a609feeacd234418699cc0df079c7c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,18 @@
# Directional Blur
## Source Code List
- [Shader Code](Shader/DirectionalBlur.shader)
- [C# Code](DirectionalBlur.cs)
- [Editor Code](Editor/DirectionalBlurEditor.cs)
## Property
![](https://raw.githubusercontent.com/QianMo/X-PostProcessing-Gallery/master/Media/Blur/DirectionalBlur/DirectionalBlurProperty.png)
## Gallery
![](https://raw.githubusercontent.com/QianMo/X-PostProcessing-Gallery/master/Media/Blur/DirectionalBlur/DirectionalBlur.png)
![](https://raw.githubusercontent.com/QianMo/X-PostProcessing-Gallery/master/Media/Blur/DirectionalBlur/DirectionalBlur-1.gif)
![](https://raw.githubusercontent.com/QianMo/X-PostProcessing-Gallery/master/Media/Blur/DirectionalBlur/DirectionalBlur-2.gif)

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d999739f9969606409ceaeb5ba062fae
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f4983fcdd46cc4844b516d420734a32a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,61 @@

//----------------------------------------------------------------------------------------------------------
// X-PostProcessing Library
// https://github.com/QianMo/X-PostProcessing-Library
// Copyright (C) 2020 QianMo. All rights reserved.
// Licensed under the MIT License
// You may not use this file except in compliance with the License.You may obtain a copy of the License at
// http://opensource.org/licenses/MIT
//----------------------------------------------------------------------------------------------------------
Shader "Hidden/X-PostProcessing/DirectionalBlur"
{
HLSLINCLUDE
#include "../../../Shaders/StdLib.hlsl"
#include "../../../Shaders/XPostProcessing.hlsl"
half3 _Params;
#define _Iteration _Params.x
#define _Direction _Params.yz
half4 DirectionalBlur(VaryingsDefault i)
{
half4 color = half4(0.0, 0.0, 0.0, 0.0);
for (int k = -_Iteration; k < _Iteration; k++)
{
color += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord - _Direction * k);
}
half4 finalColor = color / (_Iteration * 2.0);
return finalColor;
}
half4 Frag(VaryingsDefault i): SV_Target
{
return DirectionalBlur(i);
}
ENDHLSL
SubShader
{
Cull Off ZWrite Off ZTest Always
Pass
{
HLSLPROGRAM
#pragma vertex VertDefault
#pragma fragment Frag
ENDHLSL
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f17140f396318f044b32aa86a3d283a6
ShaderImporter:
externalObjects: {}
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant: