mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 13:37:40 +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:
8
Assets/X-PostProcessing/Effects/AuroraVignette.meta
Normal file
8
Assets/X-PostProcessing/Effects/AuroraVignette.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8f91fb3d4cd4364e9a5b53e585c9155
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
103
Assets/X-PostProcessing/Effects/AuroraVignette/AuroraVignette.cs
Normal file
103
Assets/X-PostProcessing/Effects/AuroraVignette/AuroraVignette.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5af098a6abaa43e41a2a97a9351f5957
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2adfefa1549f2d747bd0ccbddad303b6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97c9a4be14619274cbd2468d65e0b1d3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
16
Assets/X-PostProcessing/Effects/AuroraVignette/README.md
Normal file
16
Assets/X-PostProcessing/Effects/AuroraVignette/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
# AuroraVignette
|
||||
|
||||
## Source Code List
|
||||
- [Shader Code](Shader/AuroraVignette.shader)
|
||||
- [C# Code](AuroraVignette.cs)
|
||||
- [Editor Code](Editor/AuroraVignetteEditor.cs)
|
||||
|
||||
|
||||
## Property
|
||||

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

|
||||
|
||||

|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b1760853c4cb0f44688c7129e00140c3
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c4419eb66e407464397106198c0e714c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7de134a73c0f46849a4590aa389fcab2
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/X-PostProcessing/Effects/BokehBlur.meta
Normal file
8
Assets/X-PostProcessing/Effects/BokehBlur.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8fbdcb05f0ba11245914dc13d01ef05d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
87
Assets/X-PostProcessing/Effects/BokehBlur/BokehBlur.cs
Normal file
87
Assets/X-PostProcessing/Effects/BokehBlur/BokehBlur.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
11
Assets/X-PostProcessing/Effects/BokehBlur/BokehBlur.cs.meta
Normal file
11
Assets/X-PostProcessing/Effects/BokehBlur/BokehBlur.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 84ae5393ade3f4847ab851805bcf1777
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/X-PostProcessing/Effects/BokehBlur/Editor.meta
Normal file
8
Assets/X-PostProcessing/Effects/BokehBlur/Editor.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c950f1c0d9478f44a4e2fa94c2a01e1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3863883dc6dbf9f43a8c8cfe23b33ba4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
15
Assets/X-PostProcessing/Effects/BokehBlur/README.md
Normal file
15
Assets/X-PostProcessing/Effects/BokehBlur/README.md
Normal 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
|
||||

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

|
||||
|
||||

|
7
Assets/X-PostProcessing/Effects/BokehBlur/README.md.meta
Normal file
7
Assets/X-PostProcessing/Effects/BokehBlur/README.md.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 574ee3dc98fb922468f659240a7f45fc
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/X-PostProcessing/Effects/BokehBlur/Shader.meta
Normal file
8
Assets/X-PostProcessing/Effects/BokehBlur/Shader.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e7b572c0a276b454a966f54b6343e8e9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9800d8b6c0e16c34d9b7b55758a26141
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/X-PostProcessing/Effects/BoxBlur.meta
Normal file
8
Assets/X-PostProcessing/Effects/BoxBlur.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65833bbdfbd307448a2c235bdac8fd33
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
101
Assets/X-PostProcessing/Effects/BoxBlur/BoxBlur.cs
Normal file
101
Assets/X-PostProcessing/Effects/BoxBlur/BoxBlur.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
11
Assets/X-PostProcessing/Effects/BoxBlur/BoxBlur.cs.meta
Normal file
11
Assets/X-PostProcessing/Effects/BoxBlur/BoxBlur.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0ad87ed76c4e75846a28e3a301084ed7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/X-PostProcessing/Effects/BoxBlur/Editor.meta
Normal file
8
Assets/X-PostProcessing/Effects/BoxBlur/Editor.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c2753ddd19315da46bc8ee29381bf046
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 92805384c671b88469299e1fecc6ec49
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
16
Assets/X-PostProcessing/Effects/BoxBlur/README.md
Normal file
16
Assets/X-PostProcessing/Effects/BoxBlur/README.md
Normal 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
|
||||

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

|
||||
|
||||

|
7
Assets/X-PostProcessing/Effects/BoxBlur/README.md.meta
Normal file
7
Assets/X-PostProcessing/Effects/BoxBlur/README.md.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07f92ac6ceb9f52428797c8d5e3763ab
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/X-PostProcessing/Effects/BoxBlur/Shader.meta
Normal file
8
Assets/X-PostProcessing/Effects/BoxBlur/Shader.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e0ac6666a22b374cb3bf0370eaabe14
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8aa214df2a97e0849925b069cedda597
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a722036b2f742e34aba6d68f784066aa
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2638595d43b44334d88d398c2ff5a6ad
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b094988c3490b184d81f36b9a9c6f650
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88278f3ae9f415b4aa38c9097dafee28
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,16 @@
|
||||
|
||||
# ColorAdjustmentBleachBypass
|
||||
|
||||
## Source Code List
|
||||
- [Shader Code](Shader/ColorAdjustmentBleachBypass.shader)
|
||||
- [C# Code](ColorAdjustmentBleachBypass.cs)
|
||||
- [Editor Code](Editor/ColorAdjustmentBleachBypassEditor.cs)
|
||||
|
||||
|
||||
## Property
|
||||

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

|
||||
|
||||

|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b335087f30a281342936cc1b98c88907
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d7038e813b5a0c74c81334e1824bced3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bbafedd278d3c9d4fb9d0d5a83ee1ccd
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8188b11e914929748ae65b9d47a46aab
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ccd02f4c3282cc343bb7d404d538e601
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 482859c18c1521e4eb64d886bde30472
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 020cd58b993afe444a5c0256e9fac0c2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,16 @@
|
||||
|
||||
# ColorAdjustmentBrightness
|
||||
|
||||
## Source Code List
|
||||
- [Shader Code](Shader/ColorAdjustmentBrightness.shader)
|
||||
- [C# Code](ColorAdjustmentBrightness.cs)
|
||||
- [Editor Code](Editor/ColorAdjustmentBrightnessEditor.cs)
|
||||
|
||||
|
||||
## Property
|
||||

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

|
||||
|
||||

|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ec6fed4122724a49a28933868454742
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e75acac72dae804baa6d6b827bde3ab
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,41 @@
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
// 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/Brightness"
|
||||
{
|
||||
SubShader
|
||||
{
|
||||
Cull Off ZWrite Off ZTest Always
|
||||
|
||||
Pass
|
||||
{
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex VertDefault
|
||||
#pragma fragment Frag
|
||||
|
||||
#include "../../../Shaders/StdLib.hlsl"
|
||||
#include "../../../Shaders/XPostProcessing.hlsl"
|
||||
|
||||
uniform half _Brightness;
|
||||
|
||||
|
||||
half4 Frag(VaryingsDefault i) : SV_Target
|
||||
{
|
||||
|
||||
half3 sceneColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord).rgb;
|
||||
return half4(sceneColor * _Brightness, 1.0);
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 72af43b5091ce9848bd00bede713710a
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c5ea544ae25ed1646aa49d8b269196d0
|
||||
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;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.PostProcessing;
|
||||
|
||||
|
||||
namespace XPostProcessing
|
||||
{
|
||||
|
||||
[Serializable]
|
||||
[PostProcess(typeof(ColorAdjustmentContrastRenderer), PostProcessEvent.AfterStack, "X-PostProcessing/ColorAdjustment/Contrast")]
|
||||
public class ColorAdjustmentContrast : PostProcessEffectSettings
|
||||
{
|
||||
|
||||
[Range(-1.0f, 2.0f)]
|
||||
public FloatParameter contrast = new FloatParameter { value = 0.2f };
|
||||
|
||||
}
|
||||
|
||||
public sealed class ColorAdjustmentContrastRenderer : PostProcessEffectRenderer<ColorAdjustmentContrast>
|
||||
{
|
||||
private Shader shader;
|
||||
private const string PROFILER_TAG = "X-ColorAdjustmentContrast";
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
shader = Shader.Find("Hidden/X-PostProcessing/ColorAdjustment/Contrast");
|
||||
}
|
||||
|
||||
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("_Contrast", settings.contrast + 1);
|
||||
|
||||
|
||||
context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0);
|
||||
cmd.EndSample(PROFILER_TAG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a053027361353e04db3a200d1a0eb315
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba7a9f7f5e6cd3d41b90fa84db84ce05
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,46 @@
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
// 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(ColorAdjustmentContrast))]
|
||||
public sealed class ColorAdjustmentContrastEditor : PostProcessEffectEditor<ColorAdjustmentContrast>
|
||||
{
|
||||
|
||||
SerializedParameterOverride contrast;
|
||||
|
||||
|
||||
public override void OnEnable()
|
||||
{
|
||||
contrast = FindParameterOverride(x => x.contrast);
|
||||
}
|
||||
|
||||
public override string GetDisplayTitle()
|
||||
{
|
||||
return XPostProcessingEditorUtility.DISPLAY_TITLE_PREFIX + base.GetDisplayTitle();
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
EditorUtilities.DrawHeaderLabel("Core Property");
|
||||
PropertyField(contrast);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 705035905280deb4f85779897b91cc2a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,16 @@
|
||||
|
||||
# ColorAdjustmentContrast
|
||||
|
||||
## Source Code List
|
||||
- [Shader Code](Shader/ColorAdjustmentContrast.shader)
|
||||
- [C# Code](ColorAdjustmentContrast.cs)
|
||||
- [Editor Code](Editor/ColorAdjustmentContrastEditor.cs)
|
||||
|
||||
|
||||
## Property
|
||||

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

|
||||
|
||||

|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b04971144e3e1b64e990c00081da3571
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 278b4bee710370248b36817a27e2e372
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,53 @@
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
// 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/Contrast"
|
||||
{
|
||||
SubShader
|
||||
{
|
||||
Cull Off ZWrite Off ZTest Always
|
||||
|
||||
Pass
|
||||
{
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex VertDefault
|
||||
#pragma fragment Frag
|
||||
|
||||
#include "../../../Shaders/StdLib.hlsl"
|
||||
#include "../../../Shaders/XPostProcessing.hlsl"
|
||||
|
||||
|
||||
uniform half _Contrast;
|
||||
|
||||
|
||||
half3 ColorAdjustment_Contrast(half3 In, half Contrast)
|
||||
{
|
||||
half midpoint = 0.21763h;//pow(0.5, 2.2);
|
||||
half3 Out = (In - midpoint) * Contrast + midpoint;
|
||||
return Out;
|
||||
}
|
||||
|
||||
half4 Frag(VaryingsDefault i) : SV_Target
|
||||
{
|
||||
|
||||
half4 finalColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord);
|
||||
|
||||
finalColor.rgb = ColorAdjustment_Contrast(finalColor.rgb , _Contrast);
|
||||
|
||||
return finalColor;
|
||||
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dcad391fdc4ec1c4ca95088ca579f19a
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 130768225b8332546abf36bbcc642352
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,68 @@
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
// 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(ColorAdjustmentContrastV2Renderer), PostProcessEvent.AfterStack, "X-PostProcessing/ColorAdjustment/ContrastV2")]
|
||||
public class ColorAdjustmentContrastV2 : PostProcessEffectSettings
|
||||
{
|
||||
|
||||
[Range(-1.0f, 5.0f)]
|
||||
public FloatParameter Contrast = new FloatParameter { value = 0.2f };
|
||||
|
||||
[Range(-1.0f, 1.0f)]
|
||||
public FloatParameter ContrastFactorR = new FloatParameter { value = 0.0f };
|
||||
|
||||
[Range(-1.0f, 1.0f)]
|
||||
public FloatParameter ContrastFactorG = new FloatParameter { value = 0.0f };
|
||||
|
||||
[Range(-1.0f, 1.0f)]
|
||||
public FloatParameter ContrastFactorB = new FloatParameter { value = 0.0f };
|
||||
|
||||
}
|
||||
|
||||
public sealed class ColorAdjustmentContrastV2Renderer : PostProcessEffectRenderer<ColorAdjustmentContrastV2>
|
||||
{
|
||||
private Shader shader;
|
||||
private const string PROFILER_TAG = "X-ColorAdjustmentContrastV2";
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
shader = Shader.Find("Hidden/X-PostProcessing/ColorAdjustment/ContrastV2");
|
||||
}
|
||||
|
||||
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("_Contrast", settings.Contrast + 1);
|
||||
sheet.properties.SetVector("_ContrastFactorRGB", new Vector3(settings.ContrastFactorR, settings.ContrastFactorG , settings.ContrastFactorB));
|
||||
|
||||
|
||||
cmd.BlitFullscreenTriangle(context.source, context.destination, sheet, 0);
|
||||
cmd.EndSample(PROFILER_TAG);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 104ed5ad0e6ca124fab5c8515b49855d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bbf32e87d53725849b516b33b324f922
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,60 @@
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
// 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(ColorAdjustmentContrastV2))]
|
||||
public sealed class ColorAdjustmentContrastV2Editor : PostProcessEffectEditor<ColorAdjustmentContrastV2>
|
||||
{
|
||||
|
||||
SerializedParameterOverride Contrast;
|
||||
SerializedParameterOverride ContrastFactorR;
|
||||
SerializedParameterOverride ContrastFactorG;
|
||||
SerializedParameterOverride ContrastFactorB;
|
||||
|
||||
|
||||
public override void OnEnable()
|
||||
{
|
||||
|
||||
Contrast = FindParameterOverride(x => x.Contrast);
|
||||
ContrastFactorR = FindParameterOverride(x => x.ContrastFactorR);
|
||||
ContrastFactorG = FindParameterOverride(x => x.ContrastFactorG);
|
||||
ContrastFactorB = FindParameterOverride(x => x.ContrastFactorB);
|
||||
}
|
||||
|
||||
public override string GetDisplayTitle()
|
||||
{
|
||||
return XPostProcessingEditorUtility.DISPLAY_TITLE_PREFIX + base.GetDisplayTitle();
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
EditorUtilities.DrawHeaderLabel("Core Property");
|
||||
PropertyField(Contrast);
|
||||
|
||||
EditorUtilities.DrawHeaderLabel("RGB Channel");
|
||||
|
||||
PropertyField(ContrastFactorR);
|
||||
PropertyField(ContrastFactorG);
|
||||
PropertyField(ContrastFactorB);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aee52c2d6a502e0469af691adaee766f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,16 @@
|
||||
|
||||
# ColorAdjustmentContrastV2
|
||||
|
||||
## Source Code List
|
||||
- [Shader Code](Shader/ColorAdjustmentContrastV2.shader)
|
||||
- [C# Code](ColorAdjustmentContrastV2.cs)
|
||||
- [Editor Code](Editor/ColorAdjustmentContrastV2Editor.cs)
|
||||
|
||||
|
||||
## Property
|
||||

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

|
||||
|
||||

|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c3cc72efd61563a45b743bfe2742edf1
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d70343f88a6557f4894708cc80d76797
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
|
||||
Shader "Hidden/X-PostProcessing/ColorAdjustment/ContrastV2"
|
||||
{
|
||||
SubShader
|
||||
{
|
||||
Cull Off ZWrite Off ZTest Always
|
||||
|
||||
Pass
|
||||
{
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex VertDefault
|
||||
#pragma fragment Frag
|
||||
|
||||
#include "../../../Shaders/StdLib.hlsl"
|
||||
#include "../../../Shaders/XPostProcessing.hlsl"
|
||||
|
||||
|
||||
uniform half _Contrast;
|
||||
uniform half3 _ContrastFactorRGB;
|
||||
|
||||
half3 ColorAdjustment_Contrast_V2(float3 In, half3 ContrastFactor, float Contrast)
|
||||
{
|
||||
half3 Out = (In - ContrastFactor) * Contrast + ContrastFactor;
|
||||
return Out;
|
||||
}
|
||||
|
||||
half4 Frag(VaryingsDefault i) : SV_Target
|
||||
{
|
||||
|
||||
half4 finalColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord);
|
||||
|
||||
finalColor.rgb = ColorAdjustment_Contrast_V2(finalColor.rgb , _ContrastFactorRGB,_Contrast);
|
||||
|
||||
return finalColor;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4927ffb2887aa1f4f903af98e6c634e2
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9900223ed74486748be34917b69043ab
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,61 @@
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
// X-PostProcessing Library
|
||||
// https://github.com/QianMo/X-PostProcessing-Library
|
||||
// Copyright (C) 2020 QianMo. All rights reserved.
|
||||
// Licensed under the MIT License
|
||||
// You may not use this file except in compliance with the License.You may obtain a copy of the License at
|
||||
// http://opensource.org/licenses/MIT
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.PostProcessing;
|
||||
|
||||
|
||||
namespace XPostProcessing
|
||||
{
|
||||
|
||||
[Serializable]
|
||||
[PostProcess(typeof(ColorAdjustmentContrastV3Renderer), PostProcessEvent.AfterStack, "X-PostProcessing/ColorAdjustment/ContrastV3")]
|
||||
public class ColorAdjustmentContrastV3 : PostProcessEffectSettings
|
||||
{
|
||||
|
||||
|
||||
[DisplayName("Contrast Wheel"),ColorWheel(ColorWheelAttribute.Mode.Contrast)]
|
||||
public Vector4Parameter contrast = new Vector4Parameter { value = new Vector4(1f, 1f, 1f, -0.1f) };
|
||||
}
|
||||
|
||||
public sealed class ColorAdjustmentContrastV3Renderer : PostProcessEffectRenderer<ColorAdjustmentContrastV3>
|
||||
{
|
||||
private const string PROFILER_TAG = "X-ColorAdjustmentContrastV3";
|
||||
|
||||
private Shader shader;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
shader = Shader.Find("Hidden/X-PostProcessing/ColorAdjustment/ContrastV3");
|
||||
}
|
||||
|
||||
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.SetVector("_Contrast", settings.contrast);
|
||||
|
||||
|
||||
cmd.BlitFullscreenTriangle(context.source, context.destination, sheet, 0);
|
||||
cmd.EndSample(PROFILER_TAG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5d3b86966fb6624497fe2c2495da9a3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 06bd6cdd028cdec4aa6bb7e4037d12e3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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(ColorAdjustmentContrastV3))]
|
||||
public sealed class ColorAdjustmentContrastV3Editor : PostProcessEffectEditor<ColorAdjustmentContrastV3>
|
||||
{
|
||||
|
||||
SerializedParameterOverride contrast;
|
||||
|
||||
|
||||
public override void OnEnable()
|
||||
{
|
||||
contrast = FindParameterOverride(x => x.contrast);
|
||||
}
|
||||
|
||||
public override string GetDisplayTitle()
|
||||
{
|
||||
return XPostProcessingEditorUtility.DISPLAY_TITLE_PREFIX + base.GetDisplayTitle();
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
//GUILayout.Space(100f);
|
||||
PropertyField(contrast);
|
||||
GUILayout.Space(100f);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2667bce5bcaac074899d5c8b7e0720ce
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,16 @@
|
||||
|
||||
# ColorAdjustmentContrastV3
|
||||
|
||||
## Source Code List
|
||||
- [Shader Code](Shader/ColorAdjustmentContrastV3.shader)
|
||||
- [C# Code](ColorAdjustmentContrastV3.cs)
|
||||
- [Editor Code](Editor/ColorAdjustmentContrastV3Editor.cs)
|
||||
|
||||
|
||||
## Property
|
||||

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

|
||||
|
||||

|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5d25855fa2984c4ab6ec023bd87703b
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b48a79b95216a647b6f97775177eb98
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,49 @@
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
// 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/ContrastV3"
|
||||
{
|
||||
SubShader
|
||||
{
|
||||
Cull Off ZWrite Off ZTest Always
|
||||
|
||||
Pass
|
||||
{
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex VertDefault
|
||||
#pragma fragment Frag
|
||||
|
||||
#include "../../../Shaders/StdLib.hlsl"
|
||||
#include "../../../Shaders/XPostProcessing.hlsl"
|
||||
|
||||
|
||||
uniform half4 _Contrast;
|
||||
|
||||
half3 ColorAdjustment_Contrast_V3(float3 In, half3 ContrastFactor, float Contrast)
|
||||
{
|
||||
half3 Out = (In - ContrastFactor) * Contrast + ContrastFactor;
|
||||
return Out;
|
||||
}
|
||||
|
||||
half4 Frag(VaryingsDefault i) : SV_Target
|
||||
{
|
||||
|
||||
half4 finalColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord);
|
||||
|
||||
finalColor.rgb = ColorAdjustment_Contrast_V3(finalColor.rgb , half3(_Contrast.x, _Contrast.y, _Contrast.z),1- (_Contrast.w ));
|
||||
return finalColor;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c066218fdb9bbdc4aa87233e51731ed4
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/X-PostProcessing/Effects/ColorAdjustmentHue.meta
Normal file
8
Assets/X-PostProcessing/Effects/ColorAdjustmentHue.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e75cf712d693331479a21b7364750771
|
||||
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;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.PostProcessing;
|
||||
|
||||
|
||||
namespace XPostProcessing
|
||||
{
|
||||
|
||||
[Serializable]
|
||||
[PostProcess(typeof(ColorAdjustmentHueRenderer), PostProcessEvent.AfterStack, "X-PostProcessing/ColorAdjustment/Hue")]
|
||||
public class ColorAdjustmentHue : PostProcessEffectSettings
|
||||
{
|
||||
|
||||
[Range(-180.0f, 180.0f)]
|
||||
public FloatParameter HueDegree = new FloatParameter { value = 20f };
|
||||
}
|
||||
|
||||
public sealed class ColorAdjustmentHueRenderer : PostProcessEffectRenderer<ColorAdjustmentHue>
|
||||
{
|
||||
private Shader shader;
|
||||
|
||||
private const string PROFILER_TAG = "X-ColorAdjustmentHue";
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
shader = Shader.Find("Hidden/X-PostProcessing/ColorAdjustment/Hue");
|
||||
}
|
||||
|
||||
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("_HueDegree", settings.HueDegree);
|
||||
|
||||
context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0);
|
||||
cmd.EndSample(PROFILER_TAG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 323a24a5eeee79d4a8bc92be48fd79bc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7b6dbf9b22a3704ea99d049ea2d46ce
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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(ColorAdjustmentHue))]
|
||||
public sealed class ColorAdjustmentHueEditor : PostProcessEffectEditor<ColorAdjustmentHue>
|
||||
{
|
||||
|
||||
SerializedParameterOverride HueDegree;
|
||||
|
||||
|
||||
public override void OnEnable()
|
||||
{
|
||||
HueDegree = FindParameterOverride(x => x.HueDegree);
|
||||
}
|
||||
|
||||
public override string GetDisplayTitle()
|
||||
{
|
||||
return XPostProcessingEditorUtility.DISPLAY_TITLE_PREFIX + base.GetDisplayTitle();
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
PropertyField(HueDegree);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d96de24c28de9b64abe757c040133f4a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
16
Assets/X-PostProcessing/Effects/ColorAdjustmentHue/README.md
Normal file
16
Assets/X-PostProcessing/Effects/ColorAdjustmentHue/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
# ColorAdjustmentHue
|
||||
|
||||
## Source Code List
|
||||
- [Shader Code](Shader/ColorAdjustmentHue.shader)
|
||||
- [C# Code](ColorAdjustmentHue.cs)
|
||||
- [Editor Code](Editor/ColorAdjustmentHueEditor.cs)
|
||||
|
||||
|
||||
## Property
|
||||

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

|
||||
|
||||

|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d2b4c42a398b8514d9255bd19a9d5ca0
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b290ca852a9b1044e855ada67a94cb95
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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/ColorAdjustment/Hue"
|
||||
{
|
||||
SubShader
|
||||
{
|
||||
Cull Off ZWrite Off ZTest Always
|
||||
|
||||
Pass
|
||||
{
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex VertDefault
|
||||
#pragma fragment Frag
|
||||
|
||||
#include "../../../Shaders/StdLib.hlsl"
|
||||
#include "../../../Shaders/XPostProcessing.hlsl"
|
||||
|
||||
|
||||
|
||||
uniform half _HueDegree;
|
||||
|
||||
|
||||
half3 Hue_Degree(float3 In, float Offset)
|
||||
{
|
||||
float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
float4 P = lerp(float4(In.bg, K.wz), float4(In.gb, K.xy), step(In.b, In.g));
|
||||
float4 Q = lerp(float4(P.xyw, In.r), float4(In.r, P.yzx), step(P.x, In.r));
|
||||
float D = Q.x - min(Q.w, Q.y);
|
||||
float E = 1e-10;
|
||||
float3 hsv = float3(abs(Q.z + (Q.w - Q.y) / (6.0 * D + E)), D / (Q.x + E), Q.x);
|
||||
|
||||
float hue = hsv.x + Offset / 360;
|
||||
hsv.x = (hue < 0)
|
||||
? hue + 1
|
||||
: (hue > 1)
|
||||
? hue - 1
|
||||
: hue;
|
||||
|
||||
float4 K2 = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
float3 P2 = abs(frac(hsv.xxx + K2.xyz) * 6.0 - K2.www);
|
||||
half3 Out = hsv.z * lerp(K2.xxx, saturate(P2 - K2.xxx), hsv.y);
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
half4 Frag(VaryingsDefault i) : SV_Target
|
||||
{
|
||||
|
||||
//half3 col = 0.5 + 0.5 * cos(_Time.y + i.texcoord.xyx + float3(0, 2, 4));
|
||||
|
||||
half4 sceneColor = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord);
|
||||
|
||||
//half3 finalColor = lerp(sceneColor.rgb, col, _Float1 *0.1);
|
||||
|
||||
return half4(Hue_Degree(sceneColor, _HueDegree), 1.0);
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd123a4d4b19bc44387f5cd7a964b09b
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c53f9c30b8594940b51a504243d5eb4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user