mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-13 14:07:37 +02:00
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:
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 86bcc55eef39d1544bd172308495afb9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,59 @@
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
// 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(RapidVignette))]
|
||||
public sealed class RapidVignetteEditor : PostProcessEffectEditor<RapidVignette>
|
||||
{
|
||||
|
||||
SerializedParameterOverride vignetteType;
|
||||
SerializedParameterOverride vignetteIndensity;
|
||||
SerializedParameterOverride vignetteCenter;
|
||||
SerializedParameterOverride vignetteColor;
|
||||
|
||||
|
||||
|
||||
public override void OnEnable()
|
||||
{
|
||||
vignetteType = FindParameterOverride(x => x.vignetteType);
|
||||
vignetteIndensity = FindParameterOverride(x => x.vignetteIndensity);
|
||||
vignetteCenter = FindParameterOverride(x => x.vignetteCenter);
|
||||
vignetteColor = FindParameterOverride(x => x.vignetteColor);
|
||||
}
|
||||
|
||||
public override string GetDisplayTitle()
|
||||
{
|
||||
return XPostProcessingEditorUtility.DISPLAY_TITLE_PREFIX + base.GetDisplayTitle();
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
|
||||
PropertyField(vignetteType);
|
||||
PropertyField(vignetteIndensity);
|
||||
PropertyField(vignetteCenter);
|
||||
if (vignetteType.value.enumValueIndex == 1)
|
||||
{
|
||||
PropertyField(vignetteColor);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1675f5210afe2a44ab7c3c92b90ec83f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
16
Assets/X-PostProcessing/Effects/RapidVignette/README.md
Normal file
16
Assets/X-PostProcessing/Effects/RapidVignette/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
# RapidVignette
|
||||
|
||||
## Source Code List
|
||||
- [Shader Code](Shader/RapidVignette.shader)
|
||||
- [C# Code](RapidVignette.cs)
|
||||
- [Editor Code](Editor/RapidVignetteEditor.cs)
|
||||
|
||||
|
||||
## Property
|
||||

|
||||
|
||||
## Gallery
|
||||

|
||||
|
||||

|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c66b962bf62fb8546afa888ec9987845
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,82 @@
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
// 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
|
||||
{
|
||||
|
||||
public enum VignetteType
|
||||
{
|
||||
ClassicMode = 0,
|
||||
ColorMode = 1,
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class VignetteTypeParameter : ParameterOverride<VignetteType> { }
|
||||
|
||||
|
||||
|
||||
[Serializable]
|
||||
[PostProcess(typeof(RapidVignetteRenderer), PostProcessEvent.AfterStack, "X-PostProcessing/Vignette/RapidVignette")]
|
||||
public class RapidVignette : PostProcessEffectSettings
|
||||
{
|
||||
public VignetteTypeParameter vignetteType = new VignetteTypeParameter { value = VignetteType.ClassicMode };
|
||||
|
||||
[Range(0.0f, 5.0f)]
|
||||
public FloatParameter vignetteIndensity = new FloatParameter { value = 1f };
|
||||
|
||||
public Vector2Parameter vignetteCenter = new Vector2Parameter { value = new Vector2(0.5f, 0.5f) };
|
||||
|
||||
[ColorUsageAttribute(true, true, 0f, 20f, 0.125f, 3f)]
|
||||
public ColorParameter vignetteColor = new ColorParameter { value = new Color(0.1f, 0.8f, 1.0f) };
|
||||
}
|
||||
|
||||
public sealed class RapidVignetteRenderer : PostProcessEffectRenderer<RapidVignette>
|
||||
{
|
||||
private Shader shader;
|
||||
|
||||
private const string PROFILER_TAG = "X-RapidVignette";
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
shader = Shader.Find("Hidden/X-PostProcessing/RapidVignette");
|
||||
}
|
||||
|
||||
public override void Release()
|
||||
{
|
||||
base.Release();
|
||||
}
|
||||
|
||||
public override void Render(PostProcessRenderContext context)
|
||||
{
|
||||
CommandBuffer cmd = context.command;
|
||||
PropertySheet sheet = context.propertySheets.Get(shader);
|
||||
cmd.BeginSample(PROFILER_TAG);
|
||||
|
||||
sheet.properties.SetFloat("_VignetteIndensity", settings.vignetteIndensity);
|
||||
sheet.properties.SetVector("_VignetteCenter", settings.vignetteCenter);
|
||||
|
||||
if (settings.vignetteType.value == VignetteType.ColorMode)
|
||||
{
|
||||
sheet.properties.SetColor("_VignetteColor", settings.vignetteColor);
|
||||
}
|
||||
|
||||
cmd.BlitFullscreenTriangle(context.source, context.destination, sheet, (int)settings.vignetteType.value);
|
||||
cmd.EndSample(PROFILER_TAG);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2b24348132ef15346be9ae6f5fe6e94e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 682097f7a37c9d74eab25dcbb1647977
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,97 @@
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
// 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/RapidVignette"
|
||||
{
|
||||
|
||||
HLSLINCLUDE
|
||||
|
||||
#include "../../../Shaders/StdLib.hlsl"
|
||||
#include "../../../Shaders/XPostProcessing.hlsl"
|
||||
|
||||
struct VertexOutput
|
||||
{
|
||||
float4 vertex: SV_POSITION;
|
||||
float4 texcoord: TEXCOORD0;
|
||||
};
|
||||
|
||||
half _VignetteIndensity;
|
||||
half2 _VignetteCenter;
|
||||
half4 _VignetteColor;
|
||||
|
||||
|
||||
VertexOutput Vert(AttributesDefault v)
|
||||
{
|
||||
VertexOutput o;
|
||||
o.vertex = float4(v.vertex.xy, 0.0, 1.0);
|
||||
o.texcoord.xy = TransformTriangleVertexToUV(v.vertex.xy);
|
||||
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
o.texcoord.xy = o.texcoord.xy * float2(1.0, -1.0) + float2(0.0, 1.0);
|
||||
#endif
|
||||
|
||||
// uv [0, 1] ->[-0.5, 0.5]
|
||||
o.texcoord.zw = o.texcoord.xy - _VignetteCenter;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 Frag(VertexOutput i): SV_Target
|
||||
{
|
||||
float4 finalColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord.xy);
|
||||
|
||||
//求解vignette强度
|
||||
float vignetteIndensity = saturate(1.0 - dot(i.texcoord.zw, i.texcoord.zw) * _VignetteIndensity);
|
||||
|
||||
return vignetteIndensity * finalColor;
|
||||
}
|
||||
|
||||
|
||||
float4 Frag_ColorAdjust(VertexOutput i): SV_Target
|
||||
{
|
||||
float4 finalColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord.xy);
|
||||
|
||||
//求解vignette强度
|
||||
float vignetteIndensity = saturate(1.0 - dot(i.texcoord.zw, i.texcoord.zw) * _VignetteIndensity);
|
||||
|
||||
//基于vignette强度,插值VignetteColor颜色和场景颜色
|
||||
finalColor.rgb = lerp(_VignetteColor.rgb, finalColor.rgb, vignetteIndensity);
|
||||
|
||||
return half4(finalColor.rgb, _VignetteColor.a);
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
|
||||
SubShader
|
||||
{
|
||||
Cull Off ZWrite Off ZTest Always
|
||||
Pass
|
||||
{
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex Vert
|
||||
#pragma fragment Frag
|
||||
|
||||
ENDHLSL
|
||||
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex Vert
|
||||
#pragma fragment Frag_ColorAdjust
|
||||
ENDHLSL
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cdc1050498183344cb753ab4d67a789d
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user