HeavenStudioPlus/Assets/CRTEffects/Scripts/CRTRenderer.cs
wookywok 92962fef26
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>
2024-03-11 21:21:51 +00:00

34 lines
No EOL
1.2 KiB
C#

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();
}
}