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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
915 changed files with 32248 additions and 73 deletions

8
Assets/CRTEffects.meta Normal file
View file

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

View file

@ -0,0 +1,19 @@
# CRTEffects
post processing stack v2 にて使えるブラウン管風のエフェクトです。
## 使い方
このファイルをAssetに追加し、Post Processing Stack Volumeで"Custom/CRT"を追加すると適応されます。
Unity2019.1.1f1にて動作を確認しています。
## パラメータ
- Distort - レンズ歪みの強さ
- RGB Blend - 0だとRGBが完全に分離、1だと通常のRGB
- Bottom Collapse - 画面下部の映像が圧縮された部分の大きさ
- Noise Amount - 画面下部のノイズの量
## 参考にさせていただいたサイト樣
[notargs.com "ブラウン管風シェーダーを作った"](http://wordpress.notargs.com/blog/blog/2016/01/09/unity3d%e3%83%96%e3%83%a9%e3%82%a6%e3%83%b3%e7%ae%a1%e9%a2%a8%e3%82%b7%e3%82%a7%e3%83%bc%e3%83%80%e3%83%bc%e3%82%92%e4%bd%9c%e3%81%a3%e3%81%9f/)
[おもちゃラボ "シェーダで作るノイズ5種盛り"](http://nn-hokuson.hatenablog.com/entry/2017/01/27/195659#fBm%E3%83%8E%E3%82%A4%E3%82%BA)
[LIGHT11 "Post Processingで自作のポストエフェクトを実装する"](http://light11.hatenadiary.com/entry/2019/03/31/225111#FXAA%E3%82%92%E4%BD%BF%E3%81%86%E5%A0%B4%E5%90%88%E3%81%AF%E6%9B%B8%E3%81%8D%E6%96%B9%E3%81%AB%E6%B3%A8%E6%84%8F%E3%81%99%E3%82%8B)

View file

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

View file

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

View file

@ -0,0 +1,28 @@
using System;
using UnityEngine;
// UnityEngine.Rendering.PostProcessingをusing
using UnityEngine.Rendering.PostProcessing;
[Serializable] // 必ずSerializableアトリビュートを付ける
[PostProcess(typeof(CRTRenderer), PostProcessEvent.AfterStack, "Custom/CRT", true)]
public sealed class CRT : PostProcessEffectSettings
{
[Range(0f, 1f)]
public FloatParameter distort = new FloatParameter { value = 0.0f };
[Range(0f, 1f)]
public FloatParameter RGBBlend = new FloatParameter { value = 1f };
[Range(0f, 1f)]
public FloatParameter BottomCollapse = new FloatParameter { value = 0f };
[Range(0f, 1f)]
public FloatParameter NoiseAmount = new FloatParameter { value = 0f };
/*// 有効化する条件はこうやって指定する(ちゃんとやっておいたほうがパフォーマンスにつながりそう)
public override bool IsEnabledAndSupported(PostProcessRenderContext context)
{
//Debug.Log(base.IsEnabledAndSupported(context));
return base.IsEnabledAndSupported(context) || distort != 0;
//return true;
}*/
}

View file

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

View file

@ -0,0 +1,34 @@
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
public sealed class CRTRenderer : PostProcessEffectRenderer<CRT>
{
// 初期化時の処理
public override void Init()
{
base.Init();
}
public override void Render(PostProcessRenderContext context)
{
// 内部的にプールされているMaterialPropertyBlockが保存されているPropertySheetを取得
var sheet = context.propertySheets.Get(Shader.Find("Hidden/Custom/CRT"));
// MaterialPropertyBlockに対してプロパティをセット
sheet.properties.SetFloat("_Distort", settings.distort);
sheet.properties.SetFloat("_RGBBlend", settings.RGBBlend);
sheet.properties.SetFloat("_BottomCollapse", settings.BottomCollapse);
sheet.properties.SetFloat("_NoiseAmount", settings.NoiseAmount);
sheet.properties.SetFloat("_ScreenWidth", Screen.width);
sheet.properties.SetFloat("_ScreenHeight", Screen.height);
// CommandBufferのBlitFullscreenTriangleを使って描画
context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0);
}
// 破棄時の処理
public override void Release()
{
base.Release();
}
}

View file

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

View file

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

View file

@ -0,0 +1,100 @@
Shader "Hidden/Custom/CRT"
{
SubShader
{
Cull Off ZWrite Off ZTest Always
Pass
{
HLSLPROGRAM
const float PI = 3.14159265;
#pragma vertex VertDefault
#pragma fragment Frag
#include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl"
float rand(float2 st) {
return frac(sin(dot(st.xy, float2(12.9898, 78.233))) * 43758.5453);
}
float2 random2(float2 st){
st = float2( dot(st,float2(127.1,311.7)),
dot(st,float2(269.5,183.3)) );
return -1.0 + 2.0*frac(sin(st)*43758.5453123);
}
float perlinNoise(float2 st)
{
float2 p = floor(st);
float2 f = frac(st);
float2 u = f*f*(3.0-2.0*f);
float v00 = random2(p+float2(0,0));
float v10 = random2(p+float2(1,0));
float v01 = random2(p+float2(0,1));
float v11 = random2(p+float2(1,1));
return lerp( lerp( dot( v00, f - float2(0,0) ), dot( v10, f - float2(1,0) ), u.x ),
lerp( dot( v01, f - float2(0,1) ), dot( v11, f - float2(1,1) ), u.x ),
u.y)+0.5f;
}
TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex);
float _Distort;
float _ScreenWidth;
float _ScreenHeight;
float _RGBBlend;
float _BottomCollapse;
float _NoiseAmount;
float4 Frag(VaryingsDefault i) : SV_Target
{
//レンズ歪み
float2 distcoord = i.texcoord;
distcoord -= 0.5;
distcoord /= 1 - length(distcoord) * _Distort;
distcoord += 0.5;
//画面のズレ
float2 linecoord = distcoord;
//linecoord.x += (sin(_Time.r * 1.5 + linecoord.y * 0.7) > 0.9) * 0.05;
float linedistsin = sin(_Time.g + linecoord.y * 2 * PI);
float linedistwidth = 0.995;
linecoord.x += (linedistsin > linedistwidth) * (linedistsin - linedistwidth);
linecoord.x += (sin(_Time.a * 100 + linecoord.y * 10)) * 0.0005;
//下部の圧縮された部分
linecoord.x -= (linecoord.y < _BottomCollapse) * rand(float2(_Time.a,linecoord.y)) * 0.1;
linecoord.y = linecoord.y < _BottomCollapse ? linecoord.y * (1 / _BottomCollapse) : linecoord.y;
//rgbずれ
float4 color;
color.r = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, linecoord + float2(0.002,0)).r ;
color.g = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, linecoord + float2(0,0)).g;
color.b = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, linecoord + float2(-0.002,0)).b;
//下部のノイズ
float noisevalue = perlinNoise(linecoord * float2(5,500) + rand(_Time) + _Time.ba);
float noiseCrit = (1 - _NoiseAmount) + max(linecoord.y - _BottomCollapse, linecoord.y < _BottomCollapse) * 2;
color.r = (noisevalue > noiseCrit) ? rand(linecoord + float2(0,1)) : color.r;
color.g = (noisevalue > noiseCrit) ? rand(linecoord + float2(1,2)) : color.g;
color.b = (noisevalue > noiseCrit) ? rand(linecoord + float2(3,4)) : color.b;
//rgb配列
float rgbmod = fmod((i.texcoord.x) * _ScreenWidth, 3);
color.r *= max(rgbmod < 1, _RGBBlend);
color.g *= max(1 < rgbmod && rgbmod < 2, _RGBBlend);
color.b *= max(2 < rgbmod, _RGBBlend);
rgbmod = fmod((i.texcoord.y) * _ScreenHeight, 4);
color.rgb *= rgbmod >= 1;
//レンズ歪みの外側
color.rgb *= 1 - (distcoord.x < 0 || distcoord.x > 1 || distcoord.y < 0 || distcoord.y > 1);
return color;
}
ENDHLSL
}
}
}

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 23ffd5ce9efd848f79aac1e537568c42
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,5 +1,27 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-6672723021951195849
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: 2116fb4751a1a3046a3bae7177ecc731, type: 3}
m_Name: GlitchScreenJump
m_EditorClassIdentifier:
active: 1
enabled:
overrideState: 1
value: 1
ScreenJumpDirection:
overrideState: 0
value: 1
ScreenJumpIndensity:
overrideState: 1
value: 0
--- !u!114 &-4362154923023080619
MonoBehaviour:
m_ObjectHideFlags: 3
@ -34,6 +56,31 @@ MonoBehaviour:
scale:
overrideState: 0
value: 1
--- !u!114 &-3842561579889000714
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: 824ef16946450f94186364308f3d1eaf, type: 3}
m_Name: GaussianBlur
m_EditorClassIdentifier:
active: 1
enabled:
overrideState: 1
value: 1
BlurRadius:
overrideState: 1
value: 0
Iteration:
overrideState: 0
value: 1
RTDownScaling:
overrideState: 0
value: 1
--- !u!114 &-3146643709030431664
MonoBehaviour:
m_ObjectHideFlags: 3
@ -1345,6 +1392,34 @@ MonoBehaviour:
- 0.5
- 0.5
- 0.5
--- !u!114 &-2800641430439692943
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: 29f414c45c95c4c4fab1fba6f7db9a44, type: 3}
m_Name: GlitchScanLineJitter
m_EditorClassIdentifier:
active: 1
enabled:
overrideState: 1
value: 1
JitterDirection:
overrideState: 0
value: 0
intervalType:
overrideState: 0
value: 0
frequency:
overrideState: 0
value: 0
JitterIndensity:
overrideState: 1
value: 0
--- !u!114 &-2309378551457945779
MonoBehaviour:
m_ObjectHideFlags: 3
@ -1415,6 +1490,31 @@ MonoBehaviour:
opacity:
overrideState: 0
value: 1
--- !u!114 &-44530092333175149
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: 292a5d75bad86324881ba9dbb87cb997, type: 3}
m_Name: GlitchAnalogNoise
m_EditorClassIdentifier:
active: 1
enabled:
overrideState: 1
value: 1
NoiseSpeed:
overrideState: 1
value: 0
NoiseFading:
overrideState: 1
value: 0
LuminanceJitterThreshold:
overrideState: 1
value: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1434,6 +1534,40 @@ MonoBehaviour:
- {fileID: -4362154923023080619}
- {fileID: 2598374393394070623}
- {fileID: -3146643709030431664}
- {fileID: 190338221448500764}
- {fileID: -2800641430439692943}
- {fileID: -3842561579889000714}
- {fileID: -44530092333175149}
- {fileID: -6672723021951195849}
- {fileID: 6617679330616591269}
--- !u!114 &190338221448500764
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: 901667e98588d4b23a60fa932445374b, type: 3}
m_Name: CRT
m_EditorClassIdentifier:
active: 1
enabled:
overrideState: 1
value: 1
distort:
overrideState: 1
value: 0
RGBBlend:
overrideState: 1
value: 1
BottomCollapse:
overrideState: 1
value: 0
NoiseAmount:
overrideState: 1
value: 0
--- !u!114 &2598374393394070623
MonoBehaviour:
m_ObjectHideFlags: 3
@ -1462,6 +1596,37 @@ MonoBehaviour:
lumContrib:
overrideState: 1
value: 0.8
--- !u!114 &6617679330616591269
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: efbb636e5cc391347869277957d9c319, type: 3}
m_Name: EdgeDetectionSobelNeonV2
m_EditorClassIdentifier:
active: 1
enabled:
overrideState: 1
value: 1
EdgeWidth:
overrideState: 1
value: 0.05
EdgeNeonFade:
overrideState: 1
value: 0.1
BackgroundFade:
overrideState: 1
value: 1
Brigtness:
overrideState: 1
value: 0.2
BackgroundColor:
overrideState: 0
value: {r: 0, g: 0, b: 0, a: 1}
--- !u!114 &8762005197904913450
MonoBehaviour:
m_ObjectHideFlags: 3

View file

@ -253,6 +253,10 @@ MonoBehaviour:
m_LigatureGlyphID: 9451
- m_ComponentGlyphIDs: 320000004b000000
m_LigatureGlyphID: 9331
- m_ComponentGlyphIDs: 270000002200000039000000
m_LigatureGlyphID: 8279
- m_ComponentGlyphIDs: 2b0000002a00000034000000
m_LigatureGlyphID: 8280
m_GlyphPairAdjustmentRecords:
- m_FirstAdjustmentRecord:
m_GlyphIndex: 9
@ -2744,6 +2748,276 @@ MonoBehaviour:
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: -1093390048
- m_FirstAdjustmentRecord:
m_GlyphIndex: 39
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -7.2000003
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 13
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 39
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -7.2000003
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 15
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 39
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -5.4
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 34
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 39
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -5.4
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 162
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 39
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -5.4
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 163
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 39
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -5.4
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 164
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 39
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -5.4
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 165
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 39
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -5.4
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 166
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 39
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -5.4
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 167
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 43
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -3.6000001
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 13
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 43
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -3.6000001
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 15
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 43
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -3.6000001
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 34
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 43
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -3.6000001
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 162
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 43
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -3.6000001
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 163
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 43
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -3.6000001
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 164
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 43
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -3.6000001
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 165
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 43
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -3.6000001
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 166
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 43
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -3.6000001
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 167
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
m_MarkToBaseAdjustmentRecords: []
m_MarkToMarkAdjustmentRecords: []
m_ShouldReimportFontFeatures: 0

File diff suppressed because one or more lines are too long

View file

@ -370,6 +370,10 @@ MonoBehaviour:
m_LigatureGlyphID: 9817
- m_ComponentGlyphIDs: 19000000100000001a000000
m_LigatureGlyphID: 9805
- m_ComponentGlyphIDs: e8030000ef030000c4030000ae030000ef030000
m_LigatureGlyphID: 11956
- m_ComponentGlyphIDs: e8030000dc030000
m_LigatureGlyphID: 11955
m_GlyphPairAdjustmentRecords:
- m_FirstAdjustmentRecord:
m_GlyphIndex: 79
@ -7571,6 +7575,261 @@ MonoBehaviour:
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1334653216
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1000
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -14.400001
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 634
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1000
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -14.400001
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 635
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1000
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -10.8
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 636
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1000
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -10.8
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 637
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1000
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 1.8000001
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 660
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1000
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -2.7
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 928
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1000
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -1.8000001
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 939
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1000
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -1.8000001
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 955
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1000
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -9
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 970
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1000
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 1.8000001
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 981
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1000
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 1.8000001
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 982
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1000
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -3.6000001
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 988
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1000
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -7.2000003
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 999
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1000
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: -60
m_SecondAdjustmentRecord:
m_GlyphIndex: 944
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1000
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: -40
m_SecondAdjustmentRecord:
m_GlyphIndex: 966
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1000
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: -80
m_SecondAdjustmentRecord:
m_GlyphIndex: 7887
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1000
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: -140
m_SecondAdjustmentRecord:
m_GlyphIndex: 7888
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 1946038560
m_MarkToBaseAdjustmentRecords: []
m_MarkToMarkAdjustmentRecords: []
m_ShouldReimportFontFeatures: 0

File diff suppressed because it is too large Load diff

View file

@ -87,6 +87,6 @@ Material:
- _ZWrite: 1
m_Colors:
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 0.9921569, g: 0.7686275, b: 0.9921569, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View file

@ -65,7 +65,7 @@ Material:
- _MainTex:
m_Texture: {fileID: 2800000, guid: 42ac679b050de8c4288fbafb9d353498, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Offset: {x: 0, y: -0.013172884}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 53060b147886931488ba4a4b3c5eb9f3
guid: c8acac2b02dd6fe4e9f6b17af06b1032
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000

View file

@ -83,6 +83,6 @@ Material:
- _ZWrite: 1
m_Colors:
- _AddColor: {r: 0, g: 0, b: 0, a: 1}
- _Color: {r: 0.9528302, g: 0.87130237, b: 0.7775454, a: 1}
- _Color: {r: 0.9529412, g: 0.87058824, b: 0.7764706, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View file

@ -87,6 +87,6 @@ Material:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _ColorAlpha: {r: 1, g: 1, b: 1, a: 1}
- _ColorBravo: {r: 1, g: 1, b: 1, a: 1}
- _ColorDelta: {r: 0.03921569, g: 0.0627451, b: 0.2352941, a: 1}
- _ColorDelta: {r: 0.039215688, g: 0.0627451, b: 0.23529412, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View file

@ -500,9 +500,9 @@ namespace HeavenStudio.Games
newArch.appearBeat = beat;
newArch.gameObject.SetActive(true);
if (crouch) {
archBasic.CueCrouch(beat);
archBasic.CueCrouch(beat+25);
} else {
newArch.CueDuck(beat);
newArch.CueDuck(beat+25);
}
}
@ -511,7 +511,7 @@ namespace HeavenStudio.Games
Wall newWall = Instantiate(wallBasic, transform);
newWall.appearBeat = beat;
newWall.gameObject.SetActive(true);
newWall.CueJump(beat);
newWall.CueJump(beat+25);
}

View file

@ -1096,6 +1096,7 @@ namespace HeavenStudio
}),
}
},
new GameAction("colorGrading", "Color Grading")
{
resizable = true,
@ -1128,6 +1129,124 @@ namespace HeavenStudio
}),
}
},
new GameAction("gaussBlur", "Gaussian Blur")
{
resizable = true,
parameters = new()
{
new("intenStart", new EntityTypes.Float(0f, 5f, 0f), "Start Intensity", "Set the intensity at the start of the event."),
new("intenEnd", new EntityTypes.Float(0f, 5f, 1f), "End Intensity", "Set the intensity 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.Linear, new string[] { "intenStart" })
}),
}
},
new GameAction("retroTv", "Retro TV")
{
resizable = true,
parameters = new()
{
new("intenStart", new EntityTypes.Float(0f, 1f, 0f), "Start Distortion", "Set the distortion at the start of the event."),
new("intenEnd", new EntityTypes.Float(0f, 1f, 0.2f), "End Distortion", "Set the distortion at the end of the event."),
new("rgbStart", new EntityTypes.Float(0f, 1f, 1f), "Start RGB Blend", "Set the RGB blend at the start of the event."),
new("rgbEnd", new EntityTypes.Float(0f, 1f, 1f), "End RGB Blend", "Set the RGB blend at the end of the event."),
new("bottomStart", new EntityTypes.Float(0f, 1f, 0f), "Start Bottom Collapse", "Set the bottom collapse at the start of the event."),
new("bottomEnd", new EntityTypes.Float(0f, 1f, 0.02f), "End Bottom Collapse", "Set the bottom collapse at the end of the event."),
new("noiseStart", new EntityTypes.Float(0f, 1f, 0f), "Start Noise", "Set the noise at the start of the event."),
new("noiseEnd", new EntityTypes.Float(0f, 1f, 0.3f), "End Noise", "Set the noise knee 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[] { "intenStart", "rgbStart", "bottomStart", "noiseStart"})
}),
}
},
new GameAction("scanJitter", "Scan Line Jitter")
{
resizable = true,
parameters = new()
{
new("intenStart", new EntityTypes.Float(0f, 1f, 0f), "Start Intensity", "Set the intensity at the start of the event."),
new("intenEnd", new EntityTypes.Float(0f, 1f, 0.1f), "End Intensity", "Set the intensity 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[] { "intenStart" })
}),
}
},
new GameAction("analogNoise", "Analog Noise")
{
resizable = true,
parameters = new()
{
new("intenStart", new EntityTypes.Float(0f, 1f, 0f), "Start Speed", "Set the speed at the start of the event."),
new("intenEnd", new EntityTypes.Float(0f, 1f, 0.5f), "End Speed", "Set the speed at the end of the event."),
new("fadingStart", new EntityTypes.Float(0f, 1f, 0f), "Start Fading", "Set the fading at the start of the event."),
new("fadingEnd", new EntityTypes.Float(0f, 1f, 0.1f), "End Fading", "Set the fading at the end of the event."),
new("thresholdStart", new EntityTypes.Float(0f, 1f, 0f), "Start Threshold", "Set the threshold at the start of the event."),
new("thresholdEnd", new EntityTypes.Float(0f, 1f, 0.8f), "End Threshold", "Set the threshold 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[] { "intenStart", "fadingStart", "thresholdStart"})
}),
}
},
new GameAction("screenJump", "Screen Jump")
{
resizable = true,
parameters = new()
{
new("intenStart", new EntityTypes.Float(0f, 1f, 0f), "Start Intensity", "Set the intensity at the start of the event."),
new("intenEnd", new EntityTypes.Float(0f, 1f, 0.01f), "End Intensity", "Set the intensity 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[] { "intenStart" })
}),
}
},
new GameAction("sobelNeon", "Neon")
{
resizable = true,
parameters = new()
{
new("intenStart", new EntityTypes.Float(0.1f, 1f, 0.1f), "Start Intensity", "Set the edge fade at the start of the event."),
new("intenEnd", new EntityTypes.Float(0.1f, 1f, 1f), "End Intensity", "Set the edge fade at the end of the event."),
new("edgeWidthStart", new EntityTypes.Float(0.05f, 5f, 0.05f), "Start Edge Width", "Set the edge width at the start of the event."),
new("edgeWidthEnd", new EntityTypes.Float(0.05f, 5f, 2f), "End Edge Width", "Set the edge width at the end of the event."),
new("bgFadeStart", new EntityTypes.Float(0f, 1f, 0f), "Start Background Presence", "Set the background presence at the start of the event."),
new("bgFadeEnd", new EntityTypes.Float(0f, 1f, 0f), "End Background Presence", "Set the background presence at the end of the event."),
new("brightnessStart", new EntityTypes.Float(0f, 2f, 0f), "Start Brightness", "Set the brightness at the start of the event."),
new("brightnessEnd", new EntityTypes.Float(0f, 2f, 1f), "End Brightness", "Set the brightness 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[] { "intenStart", "edgeWidthStart", "bgFadeStart", "brightnessStart" })
}),
}
},
new GameAction("screenTiling", "Tile Screen")
{
resizable = true,
@ -1159,7 +1278,9 @@ namespace HeavenStudio
new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "xScrollStart", "yScrollStart" })
}),
}
}
},
}),
new Minigame("advanced", "Advanced", "", false, true, new List<GameAction>()

View file

@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
using XPostProcessing;
namespace HeavenStudio
{
@ -17,10 +18,19 @@ namespace HeavenStudio
private List<RiqEntity> _lensDs = new();
private List<RiqEntity> _grains = new();
private List<RiqEntity> _colorGradings = new();
private List<RiqEntity> _retroTvs = new();
private List<RiqEntity> _scanJitters = new();
private List<RiqEntity> _gaussBlurs = new();
private List<RiqEntity> _analogNoises = new();
private List<RiqEntity> _screenJumps = new();
private List<RiqEntity> _sobelNeons = new();
private void Awake()
{
_volume = GetComponent<PostProcessVolume>();
UpdateRetroTV();
UpdateAnalogNoise();
UpdateSobelNeons();
}
private void Start()
@ -36,6 +46,12 @@ namespace HeavenStudio
_lensDs = EventCaller.GetAllInGameManagerList("vfx", new string[] { "lensD" });
_grains = EventCaller.GetAllInGameManagerList("vfx", new string[] { "grain" });
_colorGradings = EventCaller.GetAllInGameManagerList("vfx", new string[] { "colorGrading" });
_retroTvs = EventCaller.GetAllInGameManagerList("vfx", new string[] { "retroTv" });
_scanJitters = EventCaller.GetAllInGameManagerList("vfx", new string[] {"scanJitter"});
_gaussBlurs = EventCaller.GetAllInGameManagerList("vfx", new string[] {"gaussBlur"});
_analogNoises = EventCaller.GetAllInGameManagerList("vfx", new string[] {"analogNoise"});
_screenJumps = EventCaller.GetAllInGameManagerList("vfx", new string[] {"screenJump"});
_sobelNeons = EventCaller.GetAllInGameManagerList("vfx", new string[] {"sobelNeon"});
UpdateVignette();
UpdateChromaticAbberations();
@ -43,6 +59,13 @@ namespace HeavenStudio
UpdateLensDistortions();
UpdateGrain();
UpdateColorGrading();
UpdateRetroTV();
UpdateScanJitter();
UpdateGaussBlur();
UpdateAnalogNoise();
UpdateScreenJumps();
UpdateSobelNeons();
}
private void Update()
@ -53,6 +76,13 @@ namespace HeavenStudio
UpdateLensDistortions();
UpdateGrain();
UpdateColorGrading();
UpdateRetroTV();
UpdateScanJitter();
UpdateGaussBlur();
UpdateAnalogNoise();
UpdateScreenJumps();
UpdateSobelNeons();
}
private void UpdateVignette()
@ -223,6 +253,145 @@ namespace HeavenStudio
}
}
private void UpdateRetroTV()
{
if (!_volume.profile.TryGetSettings<CRT>(out var t)) return;
t.enabled.Override(false);
foreach (var e in _retroTvs)
{
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);
t.enabled.Override(newIntensity != 0);
if (!t.enabled) continue;
t.distort.Override(newIntensity);
float newRGBBlend = func(e["rgbStart"], e["rgbEnd"], clampNormal);
t.RGBBlend.Override(newRGBBlend);
float newBottomCollapse = func(e["bottomStart"], e["bottomEnd"], clampNormal);
t.BottomCollapse.Override(newBottomCollapse);
float newNoiseAmount = func(e["noiseStart"], e["noiseEnd"], clampNormal);
t.NoiseAmount.Override(newNoiseAmount);
}
}
private void UpdateScanJitter()
{
if (!_volume.profile.TryGetSettings<GlitchScanLineJitter>(out var j)) return;
j.enabled.Override(false);
foreach (var e in _scanJitters)
{
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);
j.enabled.Override(newIntensity != 0);
if (!j.enabled) continue;
j.JitterIndensity.Override(newIntensity);
}
}
private void UpdateGaussBlur()
{
if (!_volume.profile.TryGetSettings<GaussianBlur>(out var g)) return;
g.enabled.Override(false);
foreach (var e in _gaussBlurs)
{
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.BlurRadius.Override(newIntensity);
}
}
private void UpdateAnalogNoise()
{
if (!_volume.profile.TryGetSettings<GlitchAnalogNoise>(out var n)) return;
n.enabled.Override(false);
foreach (var e in _analogNoises)
{
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);
n.enabled.Override(newIntensity != 0);
if (!n.enabled) continue;
n.NoiseSpeed.Override(newIntensity);
float newFading = func(e["fadingStart"], e["fadingEnd"], clampNormal);
n.NoiseFading.Override(newFading);
float newThreshold = func(e["thresholdStart"], e["thresholdEnd"], clampNormal);
n.LuminanceJitterThreshold.Override(newThreshold);
}
}
private void UpdateScreenJumps()
{
if (!_volume.profile.TryGetSettings<GlitchScreenJump>(out var sj)) return;
sj.enabled.Override(false);
foreach (var e in _screenJumps)
{
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);
sj.enabled.Override(newIntensity != 0);
if (!sj.enabled) continue;
sj.ScreenJumpIndensity.Override(newIntensity);
}
}
private void UpdateSobelNeons()
{
if (!_volume.profile.TryGetSettings<EdgeDetectionSobelNeonV2>(out var sn)) return;
sn.enabled.Override(false);
foreach (var e in _sobelNeons)
{
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);
sn.enabled.Override(newIntensity != 0.1);
if (!sn.enabled) continue;
sn.EdgeNeonFade.Override(newIntensity);
float newEdgeWidth = func(e["edgeWidthStart"], e["edgeWidthEnd"], clampNormal);
sn.EdgeWidth.Override(newEdgeWidth);
float newBgFade = func(e["bgFadeStart"], e["bgFadeEnd"], clampNormal);
sn.BackgroundFade.Override(newBgFade);
float newBrightness = func(e["brightnessStart"], e["brightnessEnd"], clampNormal);
sn.Brigtness.Override(newBrightness);
}
}
private Color ColorEase(Color start, Color end, float time, Util.EasingFunction.Function func)
{
float newR = func(start.r, end.r, time);

View file

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

View file

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

View file

@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class BackgroundManager : MonoBehaviour
{
public ScreenCaptureManager screenCaptureManager;
public ImageEffectController imageEffectController;
public RawImage backgroundImage;
public void CaptureAndSetBackground()
{
Texture2D capturedScreen = screenCaptureManager.CaptureScreen();
RenderTexture rt = RenderTexture.GetTemporary(capturedScreen.width,
capturedScreen.height);
Graphics.Blit(capturedScreen, rt, imageEffectController.effectMaterial);
Texture2D processedTexture = new Texture2D(capturedScreen.width,
capturedScreen.height, TextureFormat.RGB24, false);
RenderTexture.active = rt;
processedTexture.ReadPixels(new Rect(0, 0, capturedScreen.width,
capturedScreen.height), 0, 0);
processedTexture.Apply();
RenderTexture.active = null;
backgroundImage.texture = processedTexture;
RenderTexture.ReleaseTemporary(rt);
}
}

View file

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

View file

@ -0,0 +1,46 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class EffectSettingsUI : MonoBehaviour
{
public ImageEffectController imageEffectController;
public BackgroundManager backgroundManager;
public Slider impastoSlider;
public Slider impastoSlider2;
public Slider blurSlider;
public Slider vignetteSlider;
public Slider vignetteSlider2;
public Button captureBtn;
private void Start()
{
impastoSlider.onValueChanged.AddListener(UpdateImpastoIntensity);
impastoSlider2.onValueChanged.AddListener(UpdateImpastoNormalIntensity);
vignetteSlider2.onValueChanged.AddListener(UpdateVignetteSmoothness);
blurSlider.onValueChanged.AddListener(UpdateBlurIntensity);
vignetteSlider.onValueChanged.AddListener(UpdateVignetteIntensity);
captureBtn.onClick.AddListener(() => backgroundManager.CaptureAndSetBackground());
}
private void UpdateImpastoIntensity(float value)
{
imageEffectController.impastoIntensity = value;
}
private void UpdateImpastoNormalIntensity(float value)
{
imageEffectController.normalInfluence = value;
}
private void UpdateVignetteSmoothness(float value)
{
imageEffectController.vignetteSmoothness = value;
}
private void UpdateBlurIntensity(float value)
{
imageEffectController.blurIntensity = value;
}
private void UpdateVignetteIntensity(float value)
{
imageEffectController.vignetteIntensity = value;
}
}

View file

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

View file

@ -0,0 +1,31 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ImageEffectController : MonoBehaviour
{
public ScreenCaptureManager screenCaptureManager;
public Material effectMaterial;
public float impastoIntensity;
public float normalInfluence;
public float blurIntensity;
public float vignetteIntensity = 0.1357143f;
public float vignetteSmoothness = 0.3328571f;
#if UNITY_EDITOR
private void Awake()
{
Application.targetFrameRate = 60;
}
#endif
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
effectMaterial.SetFloat("_Radius", impastoIntensity);
effectMaterial.SetFloat("_NormalWeight", normalInfluence);
effectMaterial.SetFloat("_BlurSize", blurIntensity);
effectMaterial.SetFloat("_VignetteIntensity", vignetteIntensity);
effectMaterial.SetFloat("_VignetteSmoothness", vignetteSmoothness);
Graphics.Blit(source, destination, effectMaterial);
}
}

View file

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

View file

@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ScreenCaptureManager : MonoBehaviour
{
public Texture2D CaptureScreen()
{
RenderTexture rt = new RenderTexture(Screen.width, Screen.height, 24);
Camera.main.targetTexture = rt;
Camera.main.Render();
Camera.main.targetTexture = null;
Texture2D screenShot = new Texture2D(Screen.width, Screen.height,
TextureFormat.RGB24, false);
RenderTexture.active = rt;
screenShot.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
screenShot.Apply();
RenderTexture.active = null;
Destroy(rt);
return screenShot;
}
}

View file

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

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Vladislav Sobolev
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

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

View file

@ -0,0 +1,193 @@
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "Unlit/Oil Painting"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
_NormalMap ("Normal Map", 2D) = "bump" {}
_NormalWeight ("Normal Weight", Range(0, 10)) = 0.5
_Radius ("Radius", Range(0, 10)) = 0
[KeywordEnum(Low, Medium, High)] _Samples ("Sample amount", Float) = 0
_BlurSize("Blur Size", Range(0, 0.1)) = 0
_StandardDeviation("Standard Deviation", Range(0, 0.1)) = 0.02
_VignetteIntensity("Vignette Intensity", Range(0, 1)) = 0.5
_VignetteSmoothness("Vignette Smoothness", Range(0, 1)) = 0.2
}
SubShader
{
Blend SrcAlpha OneMinusSrcAlpha
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 3.0
#include "UnityCG.cginc"
#define PI 3.14159265359
#define E 2.71828182846
#pragma multi_compile _SAMPLES_LOW _SAMPLES_MEDIUM _SAMPLES_HIGH
float _BlurSize;
float _StandardDeviation;
float _VignetteIntensity;
float _VignetteSmoothness;
float _NormalWeight;
#if _SAMPLES_LOW
#define SAMPLES 10
#elif _SAMPLES_MEDIUM
#define SAMPLES 30
#else
#define SAMPLES 100
#endif
struct v2f
{
float4 pos : SV_POSITION;
half2 uv : TEXCOORD0;
};
sampler2D _MainTex;
sampler2D _NormalMap;
float4 _MainTex_ST;
float vignette(float2 uv, float intensity, float smoothness)
{
float2 position = uv - 0.5;
float distance = length(position);
float vignette = smoothstep(smoothness, smoothness - intensity, distance);
return vignette;
}
v2f vert(appdata_base v)
{
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
return o;
}
int _Radius;
float4 _MainTex_TexelSize;
float4 frag(v2f i) : SV_Target
{
float3 normal = UnpackNormal(tex2D(_NormalMap, i.uv));
half2 uv = i.uv;
float3 col;
float4 color = tex2D(_MainTex, uv);
//kuwahara with normal influence
float3 mean[4] = {
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0}
};
float3 sigma[4] = {
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0}
};
float2 start[4] = {{-_Radius, -_Radius}, {-_Radius, 0}, {0, -_Radius}, {0, 0}};
float2 pos;
float normalInfluence;
for (int k = 0; k < 4; k++)
{
for (int i = 0; i <= _Radius; i++)
{
for (int j = 0; j <= _Radius; j++)
{
float2 kernelDirection = float2(i - 1, j - 1);
kernelDirection = normalize(kernelDirection);
normalInfluence = dot(normal, kernelDirection);
//float weightedVariance = variance + normalInfluence * _NormalWeight;
pos = float2(i, j) + start[k];
col = tex2Dlod(_MainTex, float4(
uv + float2(pos.x * _MainTex_TexelSize.x, pos.y * _MainTex_TexelSize.y),
0., 0.)).rgb;
mean[k] += col;
sigma[k] += col * col;
}
}
}
float sigma2;
float n = pow(_Radius + 1, 2);
float min = 1;
for (int l = 0; l < 4; l++)
{
mean[l] /= n;
sigma[l] = abs(sigma[l] / n - mean[l] * mean[l]);
sigma2 = sigma[l].r + sigma[l].g + sigma[l].b;
if (sigma2 < min + normalInfluence * _NormalWeight)
{
min = sigma2;
color.rgb = mean[l].rgb;
}
}
// blur
//failsafe so we can use turn off the blur by setting the deviation to 0
if (_StandardDeviation != 0)
{
float invAspect = _ScreenParams.y / _ScreenParams.x;
float sum = SAMPLES;
float sum2 = SAMPLES;
float3 col2;
//iterate over blur samples
for (float index = 0; index < SAMPLES; index++)
{
//get the offset of the sample
float offset = (index / (SAMPLES - 1) - 0.5) * _BlurSize;
//get uv coordinate of sample
float2 uv = i.uv + float2(0, offset);
//calculate the result of the gaussian function
float stDevSquared = _StandardDeviation * _StandardDeviation;
float gauss = (1 / sqrt(2 * PI * stDevSquared)) * pow(
E, -((offset * offset) / (2 * stDevSquared)));
//add result to sum
sum += gauss;
//multiply color with influence from gaussian function and add it to sum color
col += tex2D(_MainTex, uv) * gauss;
}
//divide the sum of values by the amount of samples
color.rgb = lerp(color.rgb, col / sum, 0.5);
for (float index = 0; index < SAMPLES; index++)
{
//get the offset of the sample
float offset = (index / (SAMPLES - 1) - 0.5) * _BlurSize * invAspect;
//get uv coordinate of sample
float2 uv = i.uv + float2(offset, 0);
//calculate the result of the gaussian function
float stDevSquared = _StandardDeviation * _StandardDeviation;
float gauss = (1 / sqrt(2 * PI * stDevSquared)) * pow(
E, -((offset * offset) / (2 * stDevSquared)));
//add result to sum
sum2 += gauss;
//multiply color with influence from gaussian function and add it to sum color
col2 += tex2D(_MainTex, uv) * gauss;
}
//divide the sum of values by the amount of samples
color.rgb = lerp(color.rgb , col2 / sum2, 0.5);
}
float vignetteEffect = vignette(i.uv, _VignetteIntensity, _VignetteSmoothness);
color.rgb = color.rgb * vignetteEffect;
return color;
}
ENDCG
}
}
}

View file

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 92fecb803ac20af4aab71465faad523f
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,2 @@
# OilPainting
Oil painting post processing unity shader for built in and URP

View file

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

View file

@ -0,0 +1,44 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Unlit_Oil Painting
m_Shader: {fileID: 4800000, guid: 92fecb803ac20af4aab71465faad523f, type: 3}
m_ValidKeywords:
- _SAMPLES_HIGH
m_InvalidKeywords:
- GAUSS
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 2800000, guid: 023c8550f7a88674fb7be5f5e728fb63, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BlurSize: 0.021428572
- _Gauss: 1
- _NormalWeight: 10
- _Radius: 10
- _Samples: 2
- _StandardDeviation: 0.0323
- _VignetteIntensity: 0.24285714
- _VignetteSmoothness: 0.72571427
m_Colors: []
m_BuildTextureStacks: []

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b70e4fc141adae1499fe1f5678ad1315
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 KiB

View file

@ -0,0 +1,135 @@
fileFormatVersion: 2
guid: 023c8550f7a88674fb7be5f5e728fb63
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View file

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

View file

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

View file

@ -0,0 +1,70 @@
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.Rendering.PostProcessing;
using UnityEngine;
public class XPostProcessingEditorUtility : Editor
{
#region Collape Hierarchy相关工具函数
public static void Collapse(GameObject go, bool collapse)
{
if (go == null || go.transform == null)
{
return;
}
// bail out immediately if the go doesn't have children
if (go.transform.childCount == 0) return;
// get a reference to the hierarchy window
var hierarchy = GetFocusedWindow("Hierarchy");
// select our go
SelectObject(go);
// create a new key event (RightArrow for collapsing, LeftArrow for folding)
var key = new Event { keyCode = collapse ? KeyCode.RightArrow : KeyCode.LeftArrow, type = EventType.KeyDown };
// finally, send the window the event
hierarchy.SendEvent(key);
}
public static void SelectObject(Object obj)
{
Selection.activeObject = obj;
}
public static EditorWindow GetFocusedWindow(string window)
{
FocusOnWindow(window);
return EditorWindow.focusedWindow;
}
public static void FocusOnWindow(string window)
{
EditorApplication.ExecuteMenuItem("Window/" + window);
}
#endregion
public static readonly string DISPLAY_TITLE_PREFIX = "X-" ;
public static string GetEnumName(SerializedParameterOverride prop)
{
return " (" + prop.value.enumDisplayNames[prop.value.intValue] + ")";
}
public static string GetEnumNameEX(SerializedParameterOverride prop)
{
return ((prop.overrideState.boolValue) ? " (" + prop.value.enumDisplayNames[prop.value.intValue] + ")" : string.Empty);
}
[MenuItem("Windows/OpenFrameDebugger %F")]
public static void OpenFrameDebugger()
{
EditorApplication.ExecuteMenuItem("Window/Frame Debugger");
}
}

View file

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

View file

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

View file

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

View file

@ -0,0 +1,103 @@

//----------------------------------------------------------------------------------------------------------
// 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(AuroraVignetteRenderer), PostProcessEvent.AfterStack, "X-PostProcessing/Vignette/AuroraVignette")]
public class AuroraVignette : PostProcessEffectSettings
{
[Range(0.0f, 1.0f)]
public FloatParameter vignetteArea = new FloatParameter { value = 0.8f };
[Range(0.0f, 1.0f)]
public FloatParameter vignetteSmothness = new FloatParameter { value = 0.5f };
[Range(0.0f, 1.0f)]
public FloatParameter vignetteFading = new FloatParameter { value = 1f };
[Range(0.1f, 1f)]
public FloatParameter colorChange = new FloatParameter { value = 0.1f };
[Range(0.0f, 2.0f)]
public FloatParameter colorFactorR = new FloatParameter { value = 1.0f };
[Range(0.0f, 2.0f)]
public FloatParameter colorFactorG = new FloatParameter { value = 1.0f };
[Range(0.0f, 2.0f)]
public FloatParameter colorFactorB = new FloatParameter { value = 1.0f };
[Range(-2.0f, 2.0f)]
public FloatParameter flowSpeed = new FloatParameter { value = 1.0f };
}
public sealed class AuroraVignetteRenderer : PostProcessEffectRenderer<AuroraVignette>
{
private Shader shader;
private float TimeX = 1.0f;
private const string PROFILER_TAG = "X-AuroraVignette";
public override void Init()
{
shader = Shader.Find("Hidden/X-PostProcessing/AuroraVignette");
}
public override void Release()
{
base.Release();
}
static class ShaderIDs
{
internal static readonly int vignetteArea = Shader.PropertyToID("_VignetteArea");
internal static readonly int vignetteSmothness = Shader.PropertyToID("_VignetteSmothness");
internal static readonly int colorChange = Shader.PropertyToID("_ColorChange");
internal static readonly int colorFactor = Shader.PropertyToID("_ColorFactor");
internal static readonly int TimeX = Shader.PropertyToID("_TimeX");
internal static readonly int vignetteFading = Shader.PropertyToID("_Fading");
}
public override void Render(PostProcessRenderContext context)
{
CommandBuffer cmd = context.command;
PropertySheet sheet = context.propertySheets.Get(shader);
cmd.BeginSample(PROFILER_TAG);
TimeX += Time.deltaTime;
if (TimeX > 100)
{
TimeX = 0;
}
sheet.properties.SetFloat(ShaderIDs.vignetteArea, settings.vignetteArea);
sheet.properties.SetFloat(ShaderIDs.vignetteSmothness, settings.vignetteSmothness);
sheet.properties.SetFloat(ShaderIDs.colorChange, settings.colorChange * 10f);
sheet.properties.SetVector(ShaderIDs.colorFactor, new Vector3(settings.colorFactorR, settings.colorFactorG, settings.colorFactorB));
sheet.properties.SetFloat(ShaderIDs.TimeX, TimeX * settings.flowSpeed);
sheet.properties.SetFloat(ShaderIDs.vignetteFading, settings.vignetteFading);
cmd.BlitFullscreenTriangle(context.source, context.destination, sheet, 0);
cmd.EndSample(PROFILER_TAG);
}
}
}

View file

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

View file

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

View file

@ -0,0 +1,71 @@

//----------------------------------------------------------------------------------------------------------
// 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(AuroraVignette))]
public sealed class AuroraVignetteEditor : PostProcessEffectEditor<AuroraVignette>
{
SerializedParameterOverride vignetteArea;
SerializedParameterOverride vignetteSmothness;
SerializedParameterOverride vignetteFading;
SerializedParameterOverride colorChange;
SerializedParameterOverride colorFactorR;
SerializedParameterOverride colorFactorG;
SerializedParameterOverride colorFactorB;
SerializedParameterOverride flowSpeed;
public override void OnEnable()
{
vignetteArea = FindParameterOverride(x => x.vignetteArea);
vignetteSmothness = FindParameterOverride(x => x.vignetteSmothness);
vignetteFading = FindParameterOverride(x => x.vignetteFading);
colorChange = FindParameterOverride(x => x.colorChange);
colorFactorR = FindParameterOverride(x => x.colorFactorR);
colorFactorG = FindParameterOverride(x => x.colorFactorG);
colorFactorB = FindParameterOverride(x => x.colorFactorB);
flowSpeed = FindParameterOverride(x => x.flowSpeed);
}
public override string GetDisplayTitle()
{
return XPostProcessingEditorUtility.DISPLAY_TITLE_PREFIX + base.GetDisplayTitle();
}
public override void OnInspectorGUI()
{
EditorUtilities.DrawHeaderLabel("Vignette");
PropertyField(vignetteFading);
PropertyField(vignetteArea);
PropertyField(vignetteSmothness);
EditorUtilities.DrawHeaderLabel("Speed");
PropertyField(flowSpeed);
EditorUtilities.DrawHeaderLabel("Color Adjustment");
PropertyField(colorChange);
PropertyField(colorFactorR);
PropertyField(colorFactorG);
PropertyField(colorFactorB);
}
}
}

View file

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

View file

@ -0,0 +1,16 @@
# AuroraVignette
## Source Code List
- [Shader Code](Shader/AuroraVignette.shader)
- [C# Code](AuroraVignette.cs)
- [Editor Code](Editor/AuroraVignetteEditor.cs)
## Property
![](https://raw.githubusercontent.com/QianMo/X-PostProcessing-Gallery/master/Media/Vignette/AuroraVignette/AuroraVignetteProperty.png)
## Gallery
![](https://raw.githubusercontent.com/QianMo/X-PostProcessing-Gallery/master/Media/Vignette/AuroraVignette/AuroraVignette.png)
![](https://raw.githubusercontent.com/QianMo/X-PostProcessing-Gallery/master/Media/Vignette/AuroraVignette/AuroraVignette.gif)

View file

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

View file

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

View file

@ -0,0 +1,62 @@

//----------------------------------------------------------------------------------------------------------
// 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/AuroraVignette"
{
HLSLINCLUDE
#include "../../../Shaders/StdLib.hlsl"
#include "../../../Shaders/XPostProcessing.hlsl"
uniform half _VignetteArea;
uniform half _VignetteSmothness;
uniform half _ColorChange;
uniform half4 _Color;
uniform half _TimeX;
uniform half3 _ColorFactor;
uniform half _Fading;
half4 Frag(VaryingsDefault i): SV_Target
{
float2 uv = i.texcoord;
float2 uv0 = uv - float2(0.5 + 0.5 * sin(1.4 * 6.28 * uv.x + 2.8 * _TimeX), 0.5);
float3 wave = float3(0.5 * (cos(sqrt(dot(uv0, uv0)) * 5.6) + 1.0), cos(4.62 * dot(uv, uv) + _TimeX), cos(distance(uv, float2(1.6 * cos(_TimeX * 2.0), 1.0 * sin(_TimeX * 1.7))) * 1.3));
half waveFactor = dot(wave, _ColorFactor) / _ColorChange;
half vignetteIndensity = 1.0 - smoothstep(_VignetteArea, _VignetteArea - 0.05 - _VignetteSmothness, length(float2(0.5, 0.5) - uv));
half3 AuroraColor = half3
(
_ColorFactor.r * 0.5 * (sin(1.28 * waveFactor + _TimeX * 3.45) + 1.0),
_ColorFactor.g * 0.5 * (sin(1.28 * waveFactor + _TimeX * 3.15) + 1.0),
_ColorFactor.b * 0.4 * (sin(1.28 * waveFactor + _TimeX * 1.26) + 1.0)
);
half3 finalColor = lerp(SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv).rgb, AuroraColor, vignetteIndensity * _Fading);
return half4(finalColor, 1.0);
}
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: 7de134a73c0f46849a4590aa389fcab2
ShaderImporter:
externalObjects: {}
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

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

View file

@ -0,0 +1,87 @@

//----------------------------------------------------------------------------------------------------------
// 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(BokehBlurRenderer), PostProcessEvent.AfterStack, "X-PostProcessing/Blur/BokehBlur")]
public class BokehBlur : PostProcessEffectSettings
{
[Range(0f, 3f)]
public FloatParameter BlurRadius = new FloatParameter { value = 1f };
[Range(8, 128)]
public IntParameter Iteration = new IntParameter { value = 32 };
[Range(1, 10)]
public FloatParameter RTDownScaling = new FloatParameter { value = 2 };
}
public sealed class BokehBlurRenderer : PostProcessEffectRenderer<BokehBlur>
{
private const string PROFILER_TAG = "X-BokehBlur";
private Shader shader;
private Vector4 mGoldenRot = new Vector4();
public override void Init()
{
shader = Shader.Find("Hidden/X-PostProcessing/BokehBlur");
// Precompute rotations
float c = Mathf.Cos(2.39996323f);
float s = Mathf.Sin(2.39996323f);
mGoldenRot.Set(c, s, -s, c);
}
public override void Release()
{
base.Release();
}
static class ShaderIDs
{
internal static readonly int GoldenRot = Shader.PropertyToID("_GoldenRot");
internal static readonly int Params = Shader.PropertyToID("_Params");
internal static readonly int BufferRT1 = Shader.PropertyToID("_BufferRT1");
}
public override void Render(PostProcessRenderContext context)
{
CommandBuffer cmd = context.command;
PropertySheet sheet = context.propertySheets.Get(shader);
cmd.BeginSample(PROFILER_TAG);
int RTWidth = (int)(context.screenWidth / settings.RTDownScaling);
int RTHeight = (int)(context.screenHeight / settings.RTDownScaling);
cmd.GetTemporaryRT(ShaderIDs.BufferRT1, RTWidth, RTHeight, 0, FilterMode.Bilinear);
// downsample screen copy into smaller RT
context.command.BlitFullscreenTriangle(context.source, ShaderIDs.BufferRT1);
sheet.properties.SetVector(ShaderIDs.GoldenRot, mGoldenRot);
sheet.properties.SetVector(ShaderIDs.Params, new Vector4(settings.Iteration, settings.BlurRadius, 1f / context.width, 1f / context.height));
cmd.BlitFullscreenTriangle(ShaderIDs.BufferRT1, context.destination, sheet, 0);
cmd.ReleaseTemporaryRT(ShaderIDs.BufferRT1);
cmd.EndSample(PROFILER_TAG);
}
}
}

View file

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

View file

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

View file

@ -0,0 +1,51 @@
//----------------------------------------------------------------------------------------------------------
// 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(BokehBlur))]
public sealed class BokehBlurEditor : PostProcessEffectEditor<BokehBlur>
{
SerializedParameterOverride BlurRadius;
SerializedParameterOverride Iteration;
SerializedParameterOverride RTDownScaling;
public override void OnEnable()
{
BlurRadius = FindParameterOverride(x => x.BlurRadius);
Iteration = FindParameterOverride(x => x.Iteration);
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(RTDownScaling);
}
}
}

View file

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

View file

@ -0,0 +1,15 @@
# Bokeh Blur
## Source Code List
- [Shader Code](Shader/BokehBlur.shader)
- [C# Code](BokehBlur.cs)
- [Editor Code](Editor/BokehBlurEditor.cs)
## Property
![](https://raw.githubusercontent.com/QianMo/X-PostProcessing-Gallery/master/Media/Blur/BokehBlur/BokehBlurProperty.png)
## Gallery
![](https://raw.githubusercontent.com/QianMo/X-PostProcessing-Gallery/master/Media/Blur/BokehBlur/BokehBlur.jpg)
![](https://raw.githubusercontent.com/QianMo/X-PostProcessing-Gallery/master/Media/Blur/BokehBlur/BokehBlur.gif)

View file

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

View file

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

View file

@ -0,0 +1,71 @@

//----------------------------------------------------------------------------------------------------------
// 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
//----------------------------------------------------------------------------------------------------------
// reference : https://www.shadertoy.com/view/4d2Xzw
Shader "Hidden/X-PostProcessing/BokehBlur"
{
HLSLINCLUDE
#include "../../../Shaders/StdLib.hlsl"
#include "../../../Shaders/XPostProcessing.hlsl"
half4 _GoldenRot;
half4 _Params;
#define _Iteration _Params.x
#define _Radius _Params.y
#define _PixelSize _Params.zw
half4 BokehBlur(VaryingsDefault i)
{
half2x2 rot = half2x2(_GoldenRot);
half4 accumulator = 0.0;
half4 divisor = 0.0;
half r = 1.0;
half2 angle = half2(0.0, _Radius);
for (int j = 0; j < _Iteration; j++)
{
r += 1.0 / r;
angle = mul(rot, angle);
half4 bokeh = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, float2(i.texcoord + _PixelSize * (r - 1.0) * angle));
accumulator += bokeh * bokeh;
divisor += bokeh;
}
return accumulator / divisor;
}
half4 Frag(VaryingsDefault i): SV_Target
{
return BokehBlur(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: 9800d8b6c0e16c34d9b7b55758a26141
ShaderImporter:
externalObjects: {}
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

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

View file

@ -0,0 +1,101 @@

//----------------------------------------------------------------------------------------------------------
// 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(BoxBlurRenderer), PostProcessEvent.AfterStack, "X-PostProcessing/Blur/BoxBlur")]
public class BoxBlur : PostProcessEffectSettings
{
[Range(0f, 5f)]
public FloatParameter BlurRadius = new FloatParameter { value = 3f };
[Range(1, 20)]
public IntParameter Iteration = new IntParameter { value = 6 };
[Range(1, 8)]
public FloatParameter RTDownScaling = new FloatParameter { value = 2 };
}
public sealed class BoxBlurRenderer : PostProcessEffectRenderer<BoxBlur>
{
private Shader shader;
private const string PROFILER_TAG = "X-BoxBlur";
public override void Init()
{
shader = Shader.Find("Hidden/X-PostProcessing/BoxBlur");
}
public override void Release()
{
base.Release();
}
static class ShaderIDs
{
internal static readonly int BlurRadius = Shader.PropertyToID("_BlurOffset");
internal static readonly int BufferRT1 = Shader.PropertyToID("_BufferRT1");
internal static readonly int BufferRT2 = Shader.PropertyToID("_BufferRT2");
}
public override void Render(PostProcessRenderContext context)
{
CommandBuffer cmd = context.command;
PropertySheet sheet = context.propertySheets.Get(shader);
cmd.BeginSample(PROFILER_TAG);
int RTWidth = (int) (context.screenWidth / settings.RTDownScaling);
int RTHeight = (int) (context.screenHeight / settings.RTDownScaling);
cmd.GetTemporaryRT(ShaderIDs.BufferRT1, RTWidth, RTHeight, 0, FilterMode.Bilinear);
cmd.GetTemporaryRT(ShaderIDs.BufferRT2, RTWidth, RTHeight, 0, FilterMode.Bilinear);
// downsample screen copy into smaller RT
context.command.BlitFullscreenTriangle(context.source, ShaderIDs.BufferRT1);
for (int i = 0; i < settings.Iteration; i++)
{
if (settings.Iteration > 20)
{
return;
}
Vector4 BlurRadius = new Vector4(settings.BlurRadius / (float)context.screenWidth, settings.BlurRadius / (float)context.screenHeight, 0, 0);
// RT1 -> RT2
sheet.properties.SetVector(ShaderIDs.BlurRadius, BlurRadius);
context.command.BlitFullscreenTriangle(ShaderIDs.BufferRT1, ShaderIDs.BufferRT2, sheet, 0);
// RT2 -> RT1
sheet.properties.SetVector(ShaderIDs.BlurRadius, BlurRadius);
context.command.BlitFullscreenTriangle(ShaderIDs.BufferRT2, ShaderIDs.BufferRT1, sheet, 0);
}
// Render blurred texture in blend pass
cmd.BlitFullscreenTriangle(ShaderIDs.BufferRT1, context.destination, sheet, 1);
// release
cmd.ReleaseTemporaryRT(ShaderIDs.BufferRT1);
cmd.ReleaseTemporaryRT(ShaderIDs.BufferRT2);
cmd.EndSample(PROFILER_TAG);
}
}
}

View file

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

View file

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

View file

@ -0,0 +1,50 @@

//----------------------------------------------------------------------------------------------------------
// 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(BoxBlur))]
public sealed class BoxBlurEditor : PostProcessEffectEditor<BoxBlur>
{
SerializedParameterOverride BlurRadius;
SerializedParameterOverride Iteration;
SerializedParameterOverride RTDownScaling;
public override void OnEnable()
{
BlurRadius = FindParameterOverride(x => x.BlurRadius);
Iteration = FindParameterOverride(x => x.Iteration);
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(RTDownScaling);
}
}
}

View file

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

View file

@ -0,0 +1,16 @@
# Box Blur
## Source Code List
- [Shader Code](Shader/BoxBlur.shader)
- [C# Code](BoxBlur.cs)
- [Editor Code](Editor/BoxBlurEditor.cs)
## Property
![](https://raw.githubusercontent.com/QianMo/X-PostProcessing-Gallery/master/Media/Blur/BoxBlur/BoxBlurProperty.png)
## Gallery
![](https://raw.githubusercontent.com/QianMo/X-PostProcessing-Gallery/master/Media/Blur/BoxBlur/BoxBlur.png)
![](https://raw.githubusercontent.com/QianMo/X-PostProcessing-Gallery/master/Media/Blur/BoxBlur/BoxBlur.gif)

View file

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

View file

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

View file

@ -0,0 +1,74 @@

//----------------------------------------------------------------------------------------------------------
// 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/BoxBlur"
{
HLSLINCLUDE
#include "../../../Shaders/StdLib.hlsl"
#include "../../../Shaders/XPostProcessing.hlsl"
half4 _BlurOffset;
half4 BoxFilter_4Tap(TEXTURE2D_ARGS(tex, samplerTex), float2 uv, float2 texelSize)
{
float4 d = texelSize.xyxy * float4(-1.0, -1.0, 1.0, 1.0);
half4 s = 0;
s = SAMPLE_TEXTURE2D(tex, samplerTex, uv + d.xy) * 0.25h; // 1 MUL
s += SAMPLE_TEXTURE2D(tex, samplerTex, uv + d.zy) * 0.25h; // 1 MAD
s += SAMPLE_TEXTURE2D(tex, samplerTex, uv + d.xw) * 0.25h; // 1 MAD
s += SAMPLE_TEXTURE2D(tex, samplerTex, uv + d.zw) * 0.25h; // 1 MAD
return s;
}
float4 FragBoxBlur(VaryingsDefault i): SV_Target
{
return BoxFilter_4Tap(TEXTURE2D_PARAM(_MainTex, sampler_MainTex), i.texcoord, _BlurOffset.xy).rgba;
}
float4 FragCombine(VaryingsDefault i): SV_Target
{
return SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoordStereo);
}
ENDHLSL
SubShader
{
Cull Off ZWrite Off ZTest Always
Pass
{
HLSLPROGRAM
#pragma vertex VertDefault
#pragma fragment FragBoxBlur
ENDHLSL
}
Pass
{
HLSLPROGRAM
#pragma vertex VertDefault
#pragma fragment FragCombine
ENDHLSL
}
}
}

View file

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

View file

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

View file

@ -0,0 +1,64 @@

//----------------------------------------------------------------------------------------------------------
// 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.PostProcessing;
namespace XPostProcessing
{
[Serializable]
[PostProcess(typeof(ColorAdjustmentBleachBypassRenderer), PostProcessEvent.AfterStack, "X-PostProcessing/ColorAdjustment/BleachBypass")]
public class ColorAdjustmentBleachBypass : PostProcessEffectSettings
{
[Range(0.0f, 1.0f)]
public FloatParameter Indensity = new FloatParameter { value = 0.5f };
}
public sealed class ColorAdjustmentBleachBypassRenderer : PostProcessEffectRenderer<ColorAdjustmentBleachBypass>
{
private Shader shader;
private const string PROFILER_TAG = "X-ColorAdjustmentBleachBypass";
public override void Init()
{
shader = Shader.Find("Hidden/X-PostProcessing/ColorAdjustment/BleachBypass");
}
public override void Release()
{
base.Release();
}
static class ShaderIDs
{
internal static readonly int Indensity = Shader.PropertyToID("_Indensity");
}
public override void Render(PostProcessRenderContext context)
{
context.command.BeginSample(PROFILER_TAG);
PropertySheet sheet = context.propertySheets.Get(shader);
sheet.properties.SetFloat(ShaderIDs.Indensity, settings.Indensity);
context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0);
context.command.EndSample(PROFILER_TAG);
}
}
}

View file

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

View file

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

View file

@ -0,0 +1,45 @@

//----------------------------------------------------------------------------------------------------------
// 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(ColorAdjustmentBleachBypass))]
public sealed class ColorAdjustmentBleachBypassEditor : PostProcessEffectEditor<ColorAdjustmentBleachBypass>
{
SerializedParameterOverride Indensity;
public override void OnEnable()
{
Indensity = FindParameterOverride(x => x.Indensity);
}
public override string GetDisplayTitle()
{
return XPostProcessingEditorUtility.DISPLAY_TITLE_PREFIX + base.GetDisplayTitle();
}
public override void OnInspectorGUI()
{
PropertyField(Indensity);
}
}
}

View file

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

View file

@ -0,0 +1,16 @@

# ColorAdjustmentBleachBypass
## Source Code List
- [Shader Code](Shader/ColorAdjustmentBleachBypass.shader)
- [C# Code](ColorAdjustmentBleachBypass.cs)
- [Editor Code](Editor/ColorAdjustmentBleachBypassEditor.cs)
## Property
![](https://raw.githubusercontent.com/QianMo/X-PostProcessing-Gallery/master/Media/ColorAdjustment/ColorAdjustmentBleachBypass/ColorAdjustmentBleachBypassProperty.png)
## Gallery
![](https://raw.githubusercontent.com/QianMo/X-PostProcessing-Gallery/master/Media/ColorAdjustment/ColorAdjustmentBleachBypass/ColorAdjustmentBleachBypass.png)
![](https://raw.githubusercontent.com/QianMo/X-PostProcessing-Gallery/master/Media/ColorAdjustment/ColorAdjustmentBleachBypass/ColorAdjustmentBleachBypass.gif)

View file

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

View file

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

View file

@ -0,0 +1,58 @@

//----------------------------------------------------------------------------------------------------------
// 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/ColorAdjustment/BleachBypass"
{
HLSLINCLUDE
#include "../../../Shaders/StdLib.hlsl"
#include "../../../Shaders/XPostProcessing.hlsl"
uniform half _Indensity;
half luminance(half3 color)
{
return dot(color, half3(0.222, 0.707, 0.071));
}
//reference : https://developer.download.nvidia.com/shaderlibrary/webpages/shader_library.html
half4 Frag(VaryingsDefault i): SV_Target
{
half4 color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord);
half lum = luminance(color.rgb);
half3 blend = half3(lum, lum, lum);
half L = min(1.0, max(0.0, 10.0 * (lum - 0.45)));
half3 result1 = 2.0 * color.rgb * blend;
half3 result2 = 1.0 - 2.0 * (1.0 - blend) * (1.0 - color.rgb);
half3 newColor = lerp(result1, result2, L);
return lerp(color, half4(newColor, color.a), _Indensity);
}
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: bbafedd278d3c9d4fb9d0d5a83ee1ccd
ShaderImporter:
externalObjects: {}
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

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

View file

@ -0,0 +1,62 @@

//----------------------------------------------------------------------------------------------------------
// 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(ColorAdjustmentBrightnessRenderer), PostProcessEvent.AfterStack, "X-PostProcessing/ColorAdjustment/Brightness")]
public class ColorAdjustmentBrightness : PostProcessEffectSettings
{
[Range(-0.9f ,1f)]
public FloatParameter brightness = new FloatParameter { value = 0f };
}
public sealed class ColorAdjustmentBrightnessRenderer : PostProcessEffectRenderer<ColorAdjustmentBrightness>
{
private Shader shader;
private const string PROFILER_TAG = "X-ColorAdjustmentBrightness";
public override void Init()
{
shader = Shader.Find("Hidden/X-PostProcessing/ColorAdjustment/Brightness");
}
public override void Release()
{
base.Release();
}
static class ShaderIDs
{
internal static readonly int brightness = Shader.PropertyToID("_Brightness");
}
public override void Render(PostProcessRenderContext context)
{
CommandBuffer cmd = context.command;
PropertySheet sheet = context.propertySheets.Get(shader);
cmd.BeginSample(PROFILER_TAG);
sheet.properties.SetFloat(ShaderIDs.brightness, settings.brightness + 1f);
cmd.BlitFullscreenTriangle(context.source, context.destination, sheet, 0);
cmd.EndSample(PROFILER_TAG);
}
}
}

View file

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

View file

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

View file

@ -0,0 +1,45 @@

//----------------------------------------------------------------------------------------------------------
// 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(ColorAdjustmentBrightness))]
public sealed class ColorAdjustmentBrightnessEditor : PostProcessEffectEditor<ColorAdjustmentBrightness>
{
SerializedParameterOverride brightness;
public override void OnEnable()
{
brightness = FindParameterOverride(x => x.brightness);
}
public override string GetDisplayTitle()
{
return XPostProcessingEditorUtility.DISPLAY_TITLE_PREFIX + base.GetDisplayTitle();
}
public override void OnInspectorGUI()
{
PropertyField(brightness);
}
}
}

View file

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

View file

@ -0,0 +1,16 @@

# ColorAdjustmentBrightness
## Source Code List
- [Shader Code](Shader/ColorAdjustmentBrightness.shader)
- [C# Code](ColorAdjustmentBrightness.cs)
- [Editor Code](Editor/ColorAdjustmentBrightnessEditor.cs)
## Property
![](https://raw.githubusercontent.com/QianMo/X-PostProcessing-Gallery/master/Media/ColorAdjustment/ColorAdjustmentBrightness/ColorAdjustmentBrightnessProperty.png)
## Gallery
![](https://raw.githubusercontent.com/QianMo/X-PostProcessing-Gallery/master/Media/ColorAdjustment/ColorAdjustmentBrightness/ColorAdjustmentBrightness.png)
![](https://raw.githubusercontent.com/QianMo/X-PostProcessing-Gallery/master/Media/ColorAdjustment/ColorAdjustmentBrightness/ColorAdjustmentBrightness.gif)

Some files were not shown because too many files have changed in this diff Show more