├── Kino.meta ├── Grayscale.meta ├── Kino ├── Ramp.meta ├── Contour.meta ├── Isoilne.meta ├── Streak.meta ├── AnalogGlitch.meta ├── DigitalGlitch.meta ├── Ramp │ ├── Ramp.shader.meta │ ├── Ramp.cs.meta │ ├── Ramp.shader │ └── Ramp.cs ├── Contour │ ├── Contour.shader.meta │ ├── Contour.cs.meta │ ├── Contour.shader │ └── Contour.cs ├── Isoilne │ ├── Isoline.shader.meta │ ├── Isoline.cs.meta │ ├── Isoline.cs │ └── Isoline.shader ├── Streak │ ├── Streak.shader.meta │ ├── Streak.cs.meta │ ├── Streak.shader │ └── Streak.cs ├── AnalogGlitch │ ├── AnalogGlitch.shader.meta │ ├── AnalogGlitch.cs.meta │ ├── AnalogGlitch.shader │ └── AnalogGlitch.cs └── DigitalGlitch │ ├── DigitalGlitch.shader.meta │ ├── DigitalGlitch.cs.meta │ ├── DigitalGlitch.shader │ └── DigitalGlitch.cs ├── Reshade.meta ├── ShaderLab.meta ├── Reshade ├── AdaptiveFog.meta ├── Cartoon.meta ├── FakeHDR.meta ├── Technicolor.meta ├── Tonemap.meta ├── Cartoon │ ├── Cartoon.shader.meta │ ├── Cartoon.cs.meta │ ├── Cartoon.cs │ └── Cartoon.shader ├── FakeHDR │ ├── FakeHDR.shader.meta │ ├── FakeHDR.cs.meta │ ├── FakeHDR.cs │ └── FakeHDR.shader ├── Tonemap │ ├── Tonemap.shader.meta │ ├── Tonemap.cs.meta │ ├── Tonemap.shader │ └── Tonemap.cs ├── AdaptiveFog │ ├── AdaptiveFog.shader.meta │ ├── AdaptiveFog.cs.meta │ ├── AdaptiveFog.shader │ └── AdaptiveFog.cs └── Technicolor │ ├── Technicolor.shader.meta │ ├── Technicolor.cs.meta │ ├── Technicolor.shader │ └── Technicolor.cs ├── ShaderLab ├── OilPaint.meta ├── Pencil.meta ├── Pencil │ ├── Pencil.shader.meta │ ├── Pencil.cs.meta │ ├── Pencil.cs │ └── Pencil.shader └── OilPaint │ ├── OilPaint.shader.meta │ ├── OilPaint.cs.meta │ ├── OilPaint.cs │ └── OilPaint.shader ├── Grayscale ├── Grayscale.shader.meta ├── Grayscale.cs.meta ├── Grayscale.shader └── Grayscale.cs ├── LICENSE └── README.md /Kino.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1bfefdff3cbbec848bc398ad1b4e8e31 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Grayscale.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba65f49422216f64c8e37ee519b4e2c5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Kino/Ramp.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 875e019487bc07d46822bce7d10d578b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Reshade.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0b04e76e9ece1b94db998f785c766d3d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ShaderLab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b8737f81b4dec94f9b4de2e1c8bb5a5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Kino/Contour.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6b617b1310f27e846bb3c40f0e6c2151 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Kino/Isoilne.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f643189064fdbd4469168cd7a72f7214 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Kino/Streak.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad275fcff9855ae4489632a8e3ec1338 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Kino/AnalogGlitch.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d9dd4c54cee52d04781681c3747a3603 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Kino/DigitalGlitch.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e80723d874f793c47a590776941f4d75 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Reshade/AdaptiveFog.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 18c30a4a3235d3144b585dec9e561aff 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Reshade/Cartoon.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ac8eea35d03541f40a7f9474a232a969 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Reshade/FakeHDR.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7d915d4bccaa5374d9ab1414a1d15ccd 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Reshade/Technicolor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e336f2dded164d84f84939e722228484 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Reshade/Tonemap.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 45e1aa45d585fce43b5a0d61d66b0646 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ShaderLab/OilPaint.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 43b7899fde7766f4290495b4c78aca2b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ShaderLab/Pencil.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ff2faf82f9899994c959d3110b072875 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Kino/Ramp/Ramp.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ce926f644379285449ad6c4ff81f2fac 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Grayscale/Grayscale.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1200b110dc7a7cd4aa7f3f8849c30ae2 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Kino/Contour/Contour.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d88f67ba539f8ea478c06017817f443e 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Kino/Isoilne/Isoline.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 143f3c5969254734da40dcecf9b4723d 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Kino/Streak/Streak.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a221cc6cae4685c4e8cc71d399068192 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Reshade/Cartoon/Cartoon.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0b00344fa7a162b47b4d840a9c838896 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Reshade/FakeHDR/FakeHDR.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 803f6e3fbb998d64c860be4822981fca 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Reshade/Tonemap/Tonemap.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a102c3b1f5996e64dacbfe121ad31bed 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /ShaderLab/Pencil/Pencil.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aced947eefc4e604eb74adacd572580d 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Kino/AnalogGlitch/AnalogGlitch.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eb90807b1048ed247b4ae7b5d054b09d 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Reshade/AdaptiveFog/AdaptiveFog.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b4894f0ed6e763247840a04c72a3f608 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Reshade/Technicolor/Technicolor.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 00fd970e644e77e419788fd961a4204c 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /ShaderLab/OilPaint/OilPaint.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 879976cf287fdcf4abf6001351f7dac5 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Kino/DigitalGlitch/DigitalGlitch.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d99a63614d5794b44a2acaa03d50f7a0 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Kino/Ramp/Ramp.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4fe485ae3cca6984689132ab07cbd0cf 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Grayscale/Grayscale.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 94b293af54a95c14c9e9ab7fa4b01682 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Kino/Contour/Contour.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1bc8eedd7ee39214bab45aca001243ce 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Kino/Isoilne/Isoline.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1f8c6d62881283a4ab75bee6ae6eb75c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Kino/Streak/Streak.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5098162cd245e7f4abe259b24c823352 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Reshade/Cartoon/Cartoon.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f2858d35f0564d4aa8c482fb12742bb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Reshade/FakeHDR/FakeHDR.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b62f0be977c79ff408c217d5b6cbe810 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Reshade/Tonemap/Tonemap.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4d16f964a58aa6f4386cda09e1ceade7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ShaderLab/Pencil/Pencil.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 692afd57ae3744d4a8cab7a5b275a141 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Kino/AnalogGlitch/AnalogGlitch.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e31544cabac1b6f42856b38f6a9308a2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Reshade/AdaptiveFog/AdaptiveFog.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f2b0f6b8c93dc044ea0394d8208f38d8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Reshade/Technicolor/Technicolor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d49df8b3f7e90924e8e7a891d09fedd9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ShaderLab/OilPaint/OilPaint.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fff588725a229ed46a558e4b4160173b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Kino/DigitalGlitch/DigitalGlitch.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 943c7ee392bdfac468997d8e2d873cfb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Grayscale/Grayscale.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/PostProcessing/Grayscale" 2 | { 3 | HLSLINCLUDE 4 | 5 | #include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl" 6 | 7 | TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex); 8 | float _Blend; 9 | 10 | float4 Frag(VaryingsDefault i) : SV_Target 11 | { 12 | float4 color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord); 13 | float luminance = dot(color.rgb, float3(0.2126729, 0.7151522, 0.0721750)); 14 | color.rgb = lerp(color.rgb, luminance.xxx, _Blend.xxx); 15 | return color; 16 | } 17 | 18 | ENDHLSL 19 | 20 | SubShader 21 | { 22 | Cull Off ZWrite Off ZTest Always 23 | 24 | Pass 25 | { 26 | HLSLPROGRAM 27 | #pragma vertex VertDefault 28 | #pragma fragment Frag 29 | ENDHLSL 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /ShaderLab/OilPaint/OilPaint.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Rendering.PostProcessing; 4 | 5 | [Serializable] 6 | [PostProcess(typeof(OilPaintRenderer), PostProcessEvent.AfterStack, "Custom/ShaderLab/OilPaint")] 7 | public sealed class OilPaint : PostProcessEffectSettings 8 | { 9 | [Range(0, 16), Tooltip("Brush Radius")] 10 | public IntParameter radius = new IntParameter { value = 1 }; 11 | } 12 | 13 | public sealed class OilPaintRenderer : PostProcessEffectRenderer 14 | { 15 | static class ShaderPropertyID 16 | { 17 | internal static readonly int Radius = Shader.PropertyToID("_Radius"); 18 | } 19 | 20 | public override void Render(PostProcessRenderContext context) 21 | { 22 | var sheet = context.propertySheets.Get(Shader.Find("Hidden/PostProcessing/OilPaint")); 23 | sheet.properties.SetFloat(ShaderPropertyID.Radius, settings.radius); 24 | context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Grayscale/Grayscale.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Rendering.PostProcessing; 4 | 5 | [Serializable] 6 | [PostProcess(typeof(GrayscaleRenderer), PostProcessEvent.AfterStack, "Custom/Grayscale")] 7 | public sealed class Grayscale : PostProcessEffectSettings 8 | { 9 | [Range(0f, 1f), Tooltip("Grayscale effect intensity.")] 10 | public FloatParameter blend = new FloatParameter { value = 0.5f }; 11 | } 12 | 13 | public sealed class GrayscaleRenderer : PostProcessEffectRenderer 14 | { 15 | static class ShaderPropertyID 16 | { 17 | internal static readonly int Blend = Shader.PropertyToID("_Blend"); 18 | } 19 | 20 | public override void Render(PostProcessRenderContext context) 21 | { 22 | var sheet = context.propertySheets.Get(Shader.Find("Hidden/PostProcessing/Grayscale")); 23 | 24 | sheet.properties.SetFloat(ShaderPropertyID.Blend, settings.blend); 25 | 26 | context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0); 27 | } 28 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 8izips 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Reshade/Cartoon/Cartoon.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Rendering.PostProcessing; 4 | 5 | [Serializable] 6 | [PostProcess(typeof(CartoonRenderer), PostProcessEvent.AfterStack, "Custom/Reshade/Cartoon")] 7 | public sealed class Cartoon : PostProcessEffectSettings 8 | { 9 | [Range(0.1f, 10f), Tooltip("Amount of effect you want")] 10 | public FloatParameter power = new FloatParameter { value = 1.5f }; 11 | [Range(0.1f, 6f), Tooltip("Edge Slope")] 12 | public FloatParameter edgeSlope = new FloatParameter { value = 1.5f }; 13 | 14 | } 15 | 16 | public sealed class CartoonRenderer : PostProcessEffectRenderer 17 | { 18 | static class ShaderPropertyID 19 | { 20 | internal static readonly int Power = Shader.PropertyToID("_Power"); 21 | internal static readonly int EdgeSlope = Shader.PropertyToID("_EdgeSlope"); 22 | } 23 | 24 | public override void Render(PostProcessRenderContext context) 25 | { 26 | var sheet = context.propertySheets.Get(Shader.Find("Hidden/PostProcessing/Cartoon")); 27 | 28 | sheet.properties.SetFloat(ShaderPropertyID.Power, settings.power); 29 | sheet.properties.SetFloat(ShaderPropertyID.EdgeSlope, settings.edgeSlope); 30 | 31 | context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Kino/DigitalGlitch/DigitalGlitch.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/PostProcessing/DigitalGlitch" 2 | { 3 | HLSLINCLUDE 4 | 5 | #include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl" 6 | 7 | TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex); 8 | TEXTURE2D_SAMPLER2D(_NoiseTex, sampler_NoiseTex); 9 | TEXTURE2D_SAMPLER2D(_TrashTex, sampler_TrashTex); 10 | 11 | float _Intensity; 12 | 13 | float4 Frag(VaryingsDefault i) : SV_Target 14 | { 15 | float4 glitch = SAMPLE_TEXTURE2D(_NoiseTex, sampler_NoiseTex, i.texcoord); 16 | 17 | float thresh = 1.001 - _Intensity * 1.001; 18 | float w_d = step(thresh, pow(glitch.z, 2.5)); 19 | float w_f = step(thresh, pow(glitch.w, 2.5)); 20 | float w_c = step(thresh, pow(glitch.z, 3.5)); 21 | 22 | float2 uv = frac(i.texcoord + glitch.xy * w_d); 23 | float4 source = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv); 24 | float4 trash = SAMPLE_TEXTURE2D(_TrashTex, sampler_TrashTex, uv); 25 | float3 color = lerp(source, trash, w_f).rgb; 26 | float3 neg = saturate(color.grb + (1 - dot(color, 1)) * 0.5); 27 | color = lerp(color, neg, w_c); 28 | 29 | return float4(color, source.a); 30 | } 31 | 32 | ENDHLSL 33 | 34 | SubShader 35 | { 36 | Cull Off ZWrite Off ZTest Always 37 | 38 | Pass 39 | { 40 | HLSLPROGRAM 41 | #pragma vertex VertDefault 42 | #pragma fragment Frag 43 | ENDHLSL 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Reshade/Technicolor/Technicolor.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/PostProcessing/Technicolor" 2 | { 3 | HLSLINCLUDE 4 | 5 | #include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl" 6 | 7 | TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex); 8 | float4 _MainTex_TexelSize; 9 | 10 | float4 _ColorStrength; 11 | float _Brightness; 12 | float _Saturation; 13 | float _Strength; 14 | 15 | float4 Frag(VaryingsDefault i) : SV_Target 16 | { 17 | float3 color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord).rgb; 18 | 19 | float3 temp = 1.0 - color; 20 | float3 target = temp.grg; 21 | float3 target2 = temp.bbr; 22 | float3 temp2 = color * target; 23 | temp2 *= target2; 24 | 25 | temp = temp2 * _ColorStrength; 26 | temp2 *= _Brightness; 27 | 28 | target = temp.grg; 29 | target2 = temp.bbr; 30 | 31 | temp = color - target; 32 | temp += temp2; 33 | temp2 = temp - target2; 34 | 35 | color = lerp(color, temp2, _Strength); 36 | color = lerp(dot(color, 0.333), color, _Saturation); 37 | 38 | return float4(color, 1.0); 39 | } 40 | 41 | ENDHLSL 42 | 43 | SubShader 44 | { 45 | Cull Off ZWrite Off ZTest Always 46 | 47 | Pass 48 | { 49 | HLSLPROGRAM 50 | #pragma vertex VertDefault 51 | #pragma fragment Frag 52 | ENDHLSL 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Kino/AnalogGlitch/AnalogGlitch.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/PostProcessing/AnalogGlitch" 2 | { 3 | HLSLINCLUDE 4 | 5 | #include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl" 6 | 7 | TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex); 8 | 9 | float2 _ScanLineJitter; // (displacement, threshold) 10 | float2 _VerticalJump; // (amount, time) 11 | float _HorizontalShake; 12 | float2 _ColorDrift; // (amount, time) 13 | 14 | float nrand(float x, float y) 15 | { 16 | return frac(sin(dot(float2(x, y), float2(12.9898, 78.233))) * 43758.5453); 17 | } 18 | 19 | float4 Frag(VaryingsDefault i) : SV_Target 20 | { 21 | float u = i.texcoord.x; 22 | float v = i.texcoord.y; 23 | 24 | // Scan line jitter 25 | float jitter = nrand(v, _Time.x) * 2 - 1; 26 | jitter *= step(_ScanLineJitter.y, abs(jitter)) * _ScanLineJitter.x; 27 | 28 | // Vertical jump 29 | float jump = lerp(v, frac(v + _VerticalJump.y), _VerticalJump.x); 30 | 31 | // Horizontal shake 32 | float shake = (nrand(_Time.x, 2) - 0.5) * _HorizontalShake; 33 | 34 | // Color drift 35 | float drift = sin(jump + _ColorDrift.y) * _ColorDrift.x; 36 | 37 | float4 src1 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, frac(float2(u + jitter + shake, jump))); 38 | float4 src2 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, frac(float2(u + jitter + shake + drift, jump))); 39 | 40 | return float4(src1.r, src2.g, src1.b, 1); 41 | } 42 | 43 | ENDHLSL 44 | 45 | SubShader 46 | { 47 | Cull Off ZWrite Off ZTest Always 48 | 49 | Pass 50 | { 51 | HLSLPROGRAM 52 | #pragma vertex VertDefault 53 | #pragma fragment Frag 54 | ENDHLSL 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /Reshade/FakeHDR/FakeHDR.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Rendering.PostProcessing; 4 | 5 | [Serializable] 6 | [PostProcess(typeof(FakeHDRRenderer), PostProcessEvent.AfterStack, "Custom/Reshade/FakeHDR")] 7 | public sealed class FakeHDR : PostProcessEffectSettings 8 | { 9 | [Range(0f, 8f), Tooltip("Power")] 10 | public FloatParameter power = new FloatParameter { value = 1.3f }; 11 | 12 | [Range(0f, 8f), Tooltip("Radius 1")] 13 | public FloatParameter radius1 = new FloatParameter { value = 0.793f }; 14 | 15 | [Range(0f, 8f), Tooltip("Raising this seems to make the effect stronger and also brighter.")] 16 | public FloatParameter radius2 = new FloatParameter { value = 0.87f }; 17 | } 18 | 19 | public sealed class FakeHDRRenderer : PostProcessEffectRenderer 20 | { 21 | static class ShaderPropertyID 22 | { 23 | internal static readonly int HDRPower = Shader.PropertyToID("_HDRPower"); 24 | internal static readonly int Radius1 = Shader.PropertyToID("_Radius1"); 25 | internal static readonly int Radius2 = Shader.PropertyToID("_Radius2"); 26 | } 27 | 28 | public override void Render(PostProcessRenderContext context) 29 | { 30 | var sheet = context.propertySheets.Get(Shader.Find("Hidden/PostProcessing/FakeHDR")); 31 | 32 | sheet.properties.SetFloat(ShaderPropertyID.HDRPower, settings.power); 33 | sheet.properties.SetFloat(ShaderPropertyID.Radius1, settings.radius1); 34 | sheet.properties.SetFloat(ShaderPropertyID.Radius2, settings.radius2); 35 | 36 | context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ShaderLab/Pencil/Pencil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Rendering.PostProcessing; 4 | 5 | [Serializable] 6 | [PostProcess(typeof(PencilRenderer), PostProcessEvent.AfterStack, "Custom/ShaderLab/Pencil")] 7 | public sealed class Pencil : PostProcessEffectSettings 8 | { 9 | [Range(0.00001f, 0.01f), Tooltip("Gradient Threshold")] 10 | public FloatParameter gradThreshold = new FloatParameter { value = 0.01f }; 11 | [Range(0f, 1f), Tooltip("Color Threshold")] 12 | public FloatParameter colorThreshold = new FloatParameter { value = 0.5f }; 13 | [Range(0f, 100f)] 14 | public FloatParameter sensivity = new FloatParameter { value = 10f }; 15 | } 16 | 17 | public sealed class PencilRenderer : PostProcessEffectRenderer 18 | { 19 | static class ShaderPropertyID 20 | { 21 | internal static readonly int GradThreshold = Shader.PropertyToID("_GradThreshold"); 22 | internal static readonly int ColorThreshold = Shader.PropertyToID("_ColorThreshold"); 23 | internal static readonly int Sensivity = Shader.PropertyToID("_Sensivity"); 24 | } 25 | 26 | public override void Render(PostProcessRenderContext context) 27 | { 28 | var sheet = context.propertySheets.Get(Shader.Find("Hidden/PostProcessing/Pencil")); 29 | 30 | sheet.properties.SetFloat(ShaderPropertyID.GradThreshold, settings.gradThreshold); 31 | sheet.properties.SetFloat(ShaderPropertyID.ColorThreshold, settings.colorThreshold); 32 | sheet.properties.SetFloat(ShaderPropertyID.Sensivity, settings.sensivity); 33 | 34 | context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Reshade/Tonemap/Tonemap.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/PostProcessing/Tonemap" 2 | { 3 | HLSLINCLUDE 4 | 5 | #include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl" 6 | 7 | TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex); 8 | float4 _MainTex_TexelSize; 9 | 10 | float _Gamma; 11 | float _Exposure; 12 | float _Saturation; 13 | float _Bleach; 14 | float _Defog; 15 | float4 _DefogColor; 16 | 17 | float4 Frag(VaryingsDefault i) : SV_Target 18 | { 19 | float3 color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord).rgb; 20 | color = saturate(color - _Defog * _DefogColor * 2.55); // Defog 21 | color *= pow(2.0, _Exposure); // Exposure 22 | color = pow(abs(color), _Gamma); // Gamma 23 | 24 | const float3 coefLuma = float3(0.2126, 0.7152, 0.0722); 25 | float lum = dot(coefLuma, color); 26 | 27 | float L = saturate(10.0 * (lum - 0.45)); 28 | float3 A2 = _Bleach * color; 29 | 30 | float3 result1 = 2.0f * color * lum; 31 | float3 result2 = 1.0f - 2.0f * (1.0f - lum) * (1.0f - color); 32 | 33 | float3 newColor = lerp(result1, result2, L); 34 | float3 mixRGB = A2 * newColor; 35 | color += ((1.0f - A2) * mixRGB); 36 | 37 | float3 middlegray = dot(color, (1.0 / 3.0)); 38 | float3 diffcolor = color - middlegray; 39 | color = (color + diffcolor * _Saturation) / (1 + (diffcolor * _Saturation)); // Saturation 40 | 41 | return float4(color, 1.0); 42 | } 43 | 44 | ENDHLSL 45 | 46 | SubShader 47 | { 48 | Cull Off ZWrite Off ZTest Always 49 | 50 | Pass 51 | { 52 | HLSLPROGRAM 53 | #pragma vertex VertDefault 54 | #pragma fragment Frag 55 | ENDHLSL 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Reshade/Cartoon/Cartoon.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/PostProcessing/Cartoon" 2 | { 3 | HLSLINCLUDE 4 | 5 | #include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl" 6 | 7 | TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex); 8 | float4 _MainTex_TexelSize; 9 | 10 | float _Power; 11 | float _EdgeSlope; 12 | 13 | float4 Frag(VaryingsDefault i) : SV_Target 14 | { 15 | float3 color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord).rgb; 16 | 17 | float3 CoefLuma2 = float3(0.2126, 0.7152, 0.0722); //Values to calculate luma with 18 | 19 | float3 color1 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + _MainTex_TexelSize.xy).rgb; 20 | float diff1 = dot(CoefLuma2, color1); 21 | float3 color2 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord - _MainTex_TexelSize.xy).rgb; 22 | diff1 = dot(float4(CoefLuma2, -1.0), float4(color2, diff1)); 23 | 24 | float3 color3 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + float2(_MainTex_TexelSize.x, -_MainTex_TexelSize.y)).rgb; 25 | float diff2 = dot(CoefLuma2, color3); 26 | float3 color4 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + float2(-_MainTex_TexelSize.x, _MainTex_TexelSize.y)).rgb; 27 | diff2 = dot(float4(CoefLuma2, -1.0), float4(color4, diff2)); 28 | 29 | float edge = dot(float2(diff1, diff2), float2(diff1, diff2)); 30 | color -= pow(abs(edge), _EdgeSlope) * _Power; 31 | 32 | return saturate(float4(color, 1.0)); 33 | } 34 | 35 | ENDHLSL 36 | 37 | SubShader 38 | { 39 | Cull Off ZWrite Off ZTest Always 40 | 41 | Pass 42 | { 43 | HLSLPROGRAM 44 | #pragma vertex VertDefault 45 | #pragma fragment Frag 46 | ENDHLSL 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Reshade/Technicolor/Technicolor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Rendering.PostProcessing; 4 | 5 | [Serializable] 6 | [PostProcess(typeof(TechnicolorRenderer), PostProcessEvent.BeforeStack, "Custom/Reshade/Technicolor")] 7 | public sealed class Technicolor : PostProcessEffectSettings 8 | { 9 | [Tooltip("Higher means darker and more intense colors")] 10 | public ColorParameter colorStrength = new ColorParameter { value = new Color(0.2f, 0.2f, 0.2f) }; 11 | [Range(0.5f, 1.5f), Tooltip("Higher means brighter image")] 12 | public FloatParameter brightness = new FloatParameter { value = 1f }; 13 | [Range(0f, 1.5f), Tooltip("Additional saturation control since this effect tends to oversaturate the image")] 14 | public FloatParameter saturation = new FloatParameter { value = 1f }; 15 | [Range(0f, 1f)] 16 | public FloatParameter strength = new FloatParameter { value = 1f }; 17 | } 18 | 19 | public sealed class TechnicolorRenderer : PostProcessEffectRenderer 20 | { 21 | static class ShaderPropertyID 22 | { 23 | internal static readonly int ColorStrength = Shader.PropertyToID("_ColorStrength"); 24 | internal static readonly int Brightness = Shader.PropertyToID("_Brightness"); 25 | internal static readonly int Saturation = Shader.PropertyToID("_Saturation"); 26 | internal static readonly int Strength = Shader.PropertyToID("_Strength"); 27 | } 28 | 29 | public override void Render(PostProcessRenderContext context) 30 | { 31 | var sheet = context.propertySheets.Get(Shader.Find("Hidden/PostProcessing/Technicolor")); 32 | 33 | sheet.properties.SetColor(ShaderPropertyID.ColorStrength, settings.colorStrength); 34 | sheet.properties.SetFloat(ShaderPropertyID.Brightness, settings.brightness); 35 | sheet.properties.SetFloat(ShaderPropertyID.Saturation, settings.saturation); 36 | sheet.properties.SetFloat(ShaderPropertyID.Strength, settings.strength); 37 | 38 | context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Kino/Ramp/Ramp.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/PostProcessing/Ramp" 2 | { 3 | HLSLINCLUDE 4 | 5 | #include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl" 6 | 7 | TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex); 8 | 9 | float4 _Color1; 10 | float4 _Color2; 11 | float2 _Direction; 12 | 13 | #if _LINEAR 14 | float3 srgb_to_linear(float3 c) 15 | { 16 | return c * (c * (c * 0.305306011 + 0.682171111) + 0.012522878); 17 | } 18 | 19 | float3 linear_to_srgb(float3 c) 20 | { 21 | return max(1.055 * pow(c, 0.416666667) - 0.055, 0.0); 22 | } 23 | #endif 24 | 25 | float4 Frag(VaryingsDefault i) : SV_Target 26 | { 27 | float4 src = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord); 28 | float3 c_a = src.rgb; 29 | float3 grad1 = _Color1.rgb; 30 | float3 grad2 = _Color2.rgb; 31 | 32 | #if _LINEAR 33 | c_a = linear_to_srgb(c_a); 34 | grad1 = linear_to_srgb(grad1); 35 | grad2 = linear_to_srgb(grad2); 36 | #endif 37 | 38 | float param = dot(i.texcoord - 0.5, _Direction); 39 | float3 c_b = lerp(grad1, grad2, param + 0.5); 40 | 41 | #if _MULTIPLY 42 | float3 c_f = c_a * c_b; 43 | 44 | #elif _SCREEN 45 | float3 c_f = 1.0 - (1.0 - c_a) * (1.0 - c_b); 46 | 47 | #elif _SOFTLIGHT 48 | float3 c_u = c_a * c_b * 2.0 + (1.0 - c_b * 2.0) * c_a * c_a; 49 | float3 c_d = (1.0 - c_b) * c_a * 2.0 + (c_b * 2.0 - 1.0) * sqrt(c_a); 50 | float3 c_f = lerp(c_u, c_d, c_b > 0.5); 51 | 52 | #else 53 | float3 c_u = c_a * c_b * 2.0; 54 | float3 c_d = 1.0 - (1.0 - c_a) * (1.0 - c_b) * 2.0; 55 | 56 | #if _OVERLAY 57 | float3 c_f = lerp(c_u, c_d, c_a > 0.5); 58 | 59 | #else // _HARDLIGHT 60 | float3 c_f = lerp(c_u, c_d, c_b > 0.5); 61 | 62 | #endif 63 | #endif 64 | 65 | #if _LINEAR 66 | c_f = srgb_to_linear(c_f); 67 | #endif 68 | 69 | return float4(c_f, src.a); 70 | } 71 | 72 | ENDHLSL 73 | 74 | SubShader 75 | { 76 | ZTest Always Cull Off ZWrite Off 77 | 78 | Pass 79 | { 80 | HLSLPROGRAM 81 | #pragma vertex VertDefault 82 | #pragma fragment Frag 83 | #pragma multi_compile _MULTIPLY _SCREEN _OVERLAY _HARDLIGHT _SOFTLIGHT 84 | #pragma multi_compile _ _LINEAR 85 | ENDHLSL 86 | } 87 | } 88 | } -------------------------------------------------------------------------------- /ShaderLab/OilPaint/OilPaint.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/PostProcessing/OilPaint" 2 | { 3 | HLSLINCLUDE 4 | 5 | #include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl" 6 | 7 | TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex); 8 | float4 _MainTex_TexelSize; 9 | 10 | float _Radius; 11 | 12 | float4 Frag(VaryingsDefault i) : SV_Target 13 | { 14 | float2 texcoord = i.texcoord; 15 | float3 mean[4] = { 16 | { 0, 0, 0 }, 17 | { 0, 0, 0 }, 18 | { 0, 0, 0 }, 19 | { 0, 0, 0 } 20 | }; 21 | 22 | float3 sigma[4] = { 23 | { 0, 0, 0 }, 24 | { 0, 0, 0 }, 25 | { 0, 0, 0 }, 26 | { 0, 0, 0 } 27 | }; 28 | 29 | float2 start[4] = { { -_Radius, -_Radius },{ -_Radius, 0 },{ 0, -_Radius },{ 0, 0 } }; 30 | 31 | for (int k = 0; k < 4; k++) { 32 | for (int i = 0; i <= _Radius; i++) { 33 | for (int j = 0; j <= _Radius; j++) { 34 | float2 pos = float2(i, j) + start[k]; 35 | float3 col = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, texcoord + float2(pos.x * _MainTex_TexelSize.x, pos.y * _MainTex_TexelSize.y)).rgb; 36 | mean[k] += col; 37 | sigma[k] += col * col; 38 | } 39 | } 40 | } 41 | 42 | float sigma2; 43 | 44 | float n = pow(_Radius + 1, 2); 45 | float4 color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord); 46 | float min = 1; 47 | 48 | for (int l = 0; l < 4; l++) { 49 | mean[l] /= n; 50 | sigma[l] = abs(sigma[l] / n - mean[l] * mean[l]); 51 | sigma2 = sigma[l].r + sigma[l].g + sigma[l].b; 52 | 53 | if (sigma2 < min) { 54 | min = sigma2; 55 | color.rgb = mean[l].rgb; 56 | } 57 | } 58 | return color; 59 | } 60 | 61 | ENDHLSL 62 | 63 | SubShader 64 | { 65 | Cull Off ZWrite Off ZTest Always 66 | 67 | Pass 68 | { 69 | HLSLPROGRAM 70 | #pragma vertex VertDefault 71 | #pragma fragment Frag 72 | ENDHLSL 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PostProcessingEffects 2 | Integrated effects from different sources into unity Post-processing Stack v2 format 3 | 4 | # Effect List 5 | 6 | original screenshot without Effect 7 | 8 | 9 | Grayscale : from [unity tutorial](https://github.com/Unity-Technologies/PostProcessing/wiki/Writing-Custom-Effects) 10 | 11 | ## Kino : from [keijiro's repositry](https://github.com/keijiro) 12 | 13 |
ScreenShots 14 | 15 | | Effect | ScreenShot | 16 | ----|---- 17 | | AnalogGlitch | | 18 | | Contour | | 19 | | DigitalGlitch | | 20 | | Isoline | | 21 | | Ramp | | 22 | | Streak | | 23 |
24 | 25 | ## Reshade : from [crosire's repositry](https://github.com/crosire/reshade-shaders) 26 | 27 |
ScreenShots 28 | 29 | | Effect | ScreenShot | 30 | ----|---- 31 | | AdaptiveFog | | 32 | | Cartoon | | 33 | | FakeHDR | | 34 | | Technicolor | | 35 | | Tonemap | | 36 |
37 | 38 | ## ShaderLab : from [shaderlab example](http://www.shaderslab.com) 39 | 40 |
ScreenShots 41 | 42 | | Effect | ScreenShot | 43 | ----|---- 44 | | OilPaint | | 45 | | Pencil | | 46 |
47 | -------------------------------------------------------------------------------- /Kino/AnalogGlitch/AnalogGlitch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Rendering.PostProcessing; 4 | 5 | [Serializable] 6 | [PostProcess(typeof(AnalogGlitchRenderer), PostProcessEvent.BeforeStack, "Custom/Kino/AnalogGlitch")] 7 | public class AnalogGlitch : PostProcessEffectSettings 8 | { 9 | [Range(0, 1), Tooltip("Scan line jitter")] 10 | public FloatParameter scanLineJitter = new FloatParameter { value = 0 }; 11 | 12 | [Range(0, 1), Tooltip("Vertical jump")] 13 | public FloatParameter verticalJump = new FloatParameter { value = 0 }; 14 | 15 | [Range(0, 1), Tooltip("Vertical jump")] 16 | public FloatParameter horizontalShake = new FloatParameter { value = 0 }; 17 | 18 | [Range(0, 1), Tooltip("Color Drift")] 19 | public FloatParameter colorDrift = new FloatParameter { value = 0 }; 20 | } 21 | 22 | public sealed class AnalogGlitchRenderer : PostProcessEffectRenderer 23 | { 24 | static class ShaderPropertyID 25 | { 26 | internal static readonly int ScanLineJitter = Shader.PropertyToID("_ScanLineJitter"); 27 | internal static readonly int VerticalJump = Shader.PropertyToID("_VerticalJump"); 28 | internal static readonly int HorizontalShake = Shader.PropertyToID("_HorizontalShake"); 29 | internal static readonly int ColorDrift = Shader.PropertyToID("_ColorDrift"); 30 | } 31 | 32 | float verticalJumpTime; 33 | public override void Render(PostProcessRenderContext context) 34 | { 35 | var sheet = context.propertySheets.Get(Shader.Find("Hidden/PostProcessing/AnalogGlitch")); 36 | 37 | verticalJumpTime += Time.deltaTime * settings.verticalJump * 11.3f; 38 | 39 | var sl_thresh = Mathf.Clamp01(1.0f - settings.scanLineJitter * 1.2f); 40 | var sl_disp = 0.002f + Mathf.Pow(settings.scanLineJitter, 3) * 0.05f; 41 | var vj = new Vector2(settings.verticalJump, verticalJumpTime); 42 | var cd = new Vector2(settings.colorDrift * 0.04f, Time.time * 606.11f); 43 | 44 | sheet.properties.SetVector(ShaderPropertyID.ScanLineJitter, new Vector2(sl_disp, sl_thresh)); 45 | sheet.properties.SetVector(ShaderPropertyID.VerticalJump, vj); 46 | sheet.properties.SetFloat(ShaderPropertyID.HorizontalShake, settings.horizontalShake * 0.2f); 47 | sheet.properties.SetVector(ShaderPropertyID.ColorDrift, cd); 48 | 49 | context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Reshade/Tonemap/Tonemap.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Rendering.PostProcessing; 4 | 5 | [Serializable] 6 | [PostProcess(typeof(TonemapRenderer), PostProcessEvent.AfterStack, "Custom/Reshade/Tonemap")] 7 | public sealed class Tonemap : PostProcessEffectSettings 8 | { 9 | [Range(0f, 2f), Tooltip("Adjust midtones. 1.000 is neutral. ")] 10 | public FloatParameter gamma = new FloatParameter { value = 1.0f }; 11 | [Range(-1f, 1f), Tooltip("Adjust exposure")] 12 | public FloatParameter exposure = new FloatParameter { value = 0.0f }; 13 | [Range(-1f, 1f), Tooltip("Adjust saturation")] 14 | public FloatParameter saturation = new FloatParameter { value = 0.0f }; 15 | [Range(0f, 1f), Tooltip("Brightens the shadows and fades the colors")] 16 | public FloatParameter bleach = new FloatParameter { value = 0.0f }; 17 | [Range(0f, 1f), Tooltip("How much of the color tint to remove")] 18 | public FloatParameter defog = new FloatParameter { value = 0.0f }; 19 | [ColorUsage(false), Tooltip("Defog Color")] 20 | public ColorParameter defogColor = new ColorParameter { value = Color.blue }; 21 | } 22 | 23 | public sealed class TonemapRenderer : PostProcessEffectRenderer 24 | { 25 | static class ShaderPropertyID 26 | { 27 | internal static readonly int Gamma = Shader.PropertyToID("_Gamma"); 28 | internal static readonly int Exposure = Shader.PropertyToID("_Exposure"); 29 | internal static readonly int Saturation = Shader.PropertyToID("_Saturation"); 30 | internal static readonly int Bleach = Shader.PropertyToID("_Bleach"); 31 | internal static readonly int Defog = Shader.PropertyToID("_Defog"); 32 | internal static readonly int DefogColor = Shader.PropertyToID("_DefogColor"); 33 | } 34 | 35 | public override void Render(PostProcessRenderContext context) 36 | { 37 | var sheet = context.propertySheets.Get(Shader.Find("Hidden/PostProcessing/Tonemap")); 38 | 39 | sheet.properties.SetFloat(ShaderPropertyID.Gamma, settings.gamma); 40 | sheet.properties.SetFloat(ShaderPropertyID.Exposure, settings.exposure); 41 | sheet.properties.SetFloat(ShaderPropertyID.Saturation, settings.saturation); 42 | sheet.properties.SetFloat(ShaderPropertyID.Bleach, settings.bleach); 43 | sheet.properties.SetFloat(ShaderPropertyID.Defog, settings.defog); 44 | sheet.properties.SetColor(ShaderPropertyID.DefogColor, settings.defogColor); 45 | 46 | context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Reshade/AdaptiveFog/AdaptiveFog.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/PostProcessing/AdaptiveFog" 2 | { 3 | HLSLINCLUDE 4 | 5 | #include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl" 6 | 7 | TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex); 8 | float4 _MainTex_TexelSize; 9 | TEXTURE2D_SAMPLER2D(_CameraDepthTexture, sampler_CameraDepthTexture); 10 | 11 | float _BloomThreshold; 12 | float _BloomPower; 13 | float _BloomWidth; 14 | float4 _FogColor; 15 | float _MaxFogFactor; 16 | float _FogCurve; 17 | float _FogStart; 18 | 19 | float4 Frag(VaryingsDefault i) : SV_Target 20 | { 21 | float4 color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord); 22 | float depth = LinearEyeDepth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, sampler_CameraDepthTexture, i.texcoord).r); 23 | 24 | float3 blurColor2 = 0; 25 | float3 blurtemp = 0; 26 | float maxDistance = 8 * _BloomWidth; 27 | float curDistance = 0; 28 | float sampleCount = 25.0; 29 | float2 blurtempvalue = i.texcoord * _MainTex_TexelSize * _BloomWidth; 30 | float2 bloomSample = float2(2.5, -2.5); 31 | float2 bloomSampleValue; 32 | 33 | for (bloomSample.x = (2.5); bloomSample.x > -2.0; bloomSample.x = bloomSample.x - 1.0) 34 | { 35 | bloomSampleValue.x = bloomSample.x * blurtempvalue.x; 36 | float2 distancetemp = bloomSample.x * bloomSample.x * _BloomWidth; 37 | 38 | for (bloomSample.y = (-2.5); bloomSample.y < 2.0; bloomSample.y = bloomSample.y + 1.0) 39 | { 40 | distancetemp.y = bloomSample.y * bloomSample.y; 41 | curDistance = (distancetemp.y * _BloomWidth) + distancetemp.x; 42 | bloomSampleValue.y = bloomSample.y * blurtempvalue.y; 43 | blurtemp = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + bloomSampleValue).rgb; 44 | blurColor2.rgb += lerp(blurtemp.rgb, color.rgb, sqrt(curDistance / maxDistance)); 45 | } 46 | } 47 | blurColor2.rgb = (blurColor2.rgb / (sampleCount - (_BloomPower - _BloomThreshold * 5))); 48 | 49 | float bloomAmount = (dot(color.rgb, float3(0.299f, 0.587f, 0.114f))); 50 | float4 blurColor = float4(blurColor2.rgb * (_BloomPower + 4.0), 1.0); 51 | blurColor = saturate(lerp(color, blurColor, bloomAmount)); 52 | 53 | float fogFactor = clamp(saturate(depth - _FogStart) * _FogCurve, 0.0, _MaxFogFactor); 54 | 55 | return lerp(color, lerp(blurColor, _FogColor, fogFactor), fogFactor); 56 | } 57 | 58 | ENDHLSL 59 | 60 | SubShader 61 | { 62 | Cull Off ZWrite Off ZTest Always 63 | 64 | Pass 65 | { 66 | HLSLPROGRAM 67 | #pragma vertex VertDefault 68 | #pragma fragment Frag 69 | ENDHLSL 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Kino/Ramp/Ramp.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Rendering.PostProcessing; 4 | 5 | [Serializable] 6 | [PostProcess(typeof(RampRenderer), PostProcessEvent.BeforeStack, "Custom/Kino/Ramp")] 7 | public class Ramp : PostProcessEffectSettings 8 | { 9 | [Tooltip("Color1")] 10 | public ColorParameter color1 = new ColorParameter { value = Color.blue }; 11 | [Tooltip("Color2")] 12 | public ColorParameter color2 = new ColorParameter { value = Color.red }; 13 | [Range(-180, 180), Tooltip("Angle")] 14 | public FloatParameter angle = new FloatParameter { value = 90 }; 15 | [Range(0, 1), Tooltip("Opacity")] 16 | public FloatParameter opacity = new FloatParameter { value = 1 }; 17 | 18 | public enum BlendMode 19 | { 20 | Multiply = 0, 21 | Screen, 22 | Overlay, 23 | HardLight, 24 | SoftLight 25 | } 26 | [SerializeField] 27 | public BlendMode blendMode = BlendMode.Overlay; 28 | } 29 | 30 | public sealed class RampRenderer : PostProcessEffectRenderer 31 | { 32 | static class ShaderPropertyID 33 | { 34 | internal static readonly int Color1 = Shader.PropertyToID("_Color1"); 35 | internal static readonly int Color2 = Shader.PropertyToID("_Color2"); 36 | internal static readonly int Direction = Shader.PropertyToID("_Direction"); 37 | } 38 | 39 | static string[] _blendModeKeywords = { 40 | "_MULTIPLY", 41 | "_SCREEN", 42 | "_OVERLAY", 43 | "_HARDLIGHT", 44 | "_SOFTLIGHT" 45 | }; 46 | public override void Render(PostProcessRenderContext context) 47 | { 48 | var sheet = context.propertySheets.Get(Shader.Find("Hidden/PostProcessing/Ramp")); 49 | 50 | Color color0; 51 | if (settings.blendMode == Ramp.BlendMode.Multiply) 52 | color0 = Color.white; 53 | else if (settings.blendMode == Ramp.BlendMode.Multiply) 54 | color0 = Color.black; 55 | else 56 | color0 = Color.gray; 57 | 58 | sheet.properties.SetColor(ShaderPropertyID.Color1, Color.Lerp(color0, settings.color1, settings.opacity)); 59 | sheet.properties.SetColor(ShaderPropertyID.Color2, Color.Lerp(color0, settings.color2, settings.opacity)); 60 | var phi = Mathf.Deg2Rad * settings.angle; 61 | var dir = new Vector2(Mathf.Cos(phi), Mathf.Sin(phi)); 62 | sheet.properties.SetVector(ShaderPropertyID.Direction, dir); 63 | 64 | sheet.ClearKeywords(); 65 | sheet.EnableKeyword(_blendModeKeywords[(int)settings.blendMode]); 66 | if (QualitySettings.activeColorSpace == ColorSpace.Linear) 67 | sheet.EnableKeyword("_LINEAR"); 68 | 69 | context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0); 70 | } 71 | } -------------------------------------------------------------------------------- /ShaderLab/Pencil/Pencil.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/PostProcessing/Pencil" 2 | { 3 | HLSLINCLUDE 4 | 5 | #include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl" 6 | 7 | TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex); 8 | float4 _MainTex_TexelSize; 9 | 10 | float _GradThreshold; 11 | float _ColorThreshold; 12 | float _Sensivity; 13 | 14 | struct v2f { 15 | float4 pos : SV_POSITION; 16 | float4 screenuv : TEXCOORD0; 17 | }; 18 | 19 | float4 ComputeScreenPos(float4 pos) 20 | { 21 | float4 o = pos * 0.5f; 22 | o.xy = float2(o.x, o.y * _ProjectionParams.x) + o.w; 23 | o.zw = pos.zw; 24 | return o; 25 | } 26 | 27 | v2f Vert(AttributesDefault v) 28 | { 29 | v2f o; 30 | o.pos = float4(v.vertex.xy, 0.0, 1.0); 31 | o.screenuv = ComputeScreenPos(o.pos); 32 | return o; 33 | } 34 | 35 | #define PI2 6.28318530717959 36 | #define RANGE 16.0 37 | #define STEP 2.0 38 | #define ANGLENUM 4.0 39 | #define GRADTHRESH 0.01 40 | 41 | float4 getCol(float2 pos) 42 | { 43 | return SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, pos / _ScreenParams.xy); 44 | } 45 | 46 | float getVal(float2 pos) 47 | { 48 | float4 c = getCol(pos); 49 | return dot(c.xyz, float3(0.2126, 0.7152, 0.0722)); 50 | } 51 | 52 | float2 getGrad(float2 pos, float delta) 53 | { 54 | float2 d = float2(delta, 0.0); 55 | return float2(getVal(pos + d.xy) - getVal(pos - d.xy), 56 | getVal(pos + d.yx) - getVal(pos - d.yx)) / delta / 2.0; 57 | } 58 | 59 | void pR(inout float2 p, float a) { 60 | p = cos(a) * p + sin(a) * float2(p.y, -p.x); 61 | } 62 | 63 | float4 Frag(v2f i) : SV_Target 64 | { 65 | float2 screenuv = i.screenuv.xy / i.screenuv.w; 66 | float2 screenPos = float2(i.screenuv.x * _ScreenParams.x, i.screenuv.y * _ScreenParams.y); 67 | float weight = 1.0; 68 | 69 | for (int j = 0; j < ANGLENUM; j++) 70 | { 71 | float2 dir = float2(1.0, 0.0); 72 | pR(dir, j * PI2 / (2.0 * ANGLENUM)); 73 | 74 | float2 grad = float2(-dir.y, dir.x); 75 | 76 | for (int i = -RANGE; i <= RANGE; i += STEP) 77 | { 78 | float2 b = normalize(dir); 79 | float2 pos2 = screenPos + float2(b.x, b.y) * i; 80 | 81 | if (pos2.y < 0.0 || pos2.x < 0.0 || pos2.x > _ScreenParams.x || pos2.y > _ScreenParams.y) 82 | continue; 83 | 84 | float2 g = getGrad(pos2, 1.0); 85 | 86 | if (sqrt(dot(g,g)) < _GradThreshold) 87 | continue; 88 | 89 | weight -= pow(abs(dot(normalize(grad), normalize(g))), _Sensivity) / floor((2.0 * RANGE + 1.0) / STEP) / ANGLENUM; 90 | } 91 | } 92 | 93 | float4 col = getCol(screenPos); 94 | float4 background = lerp(col, float4(1.0, 1.0, 1.0, 1.0), _ColorThreshold); 95 | 96 | return lerp(float4(0.0, 0.0, 0.0, 0.0), background, weight); 97 | } 98 | 99 | ENDHLSL 100 | 101 | SubShader 102 | { 103 | Cull Off ZWrite Off ZTest Always 104 | 105 | Pass 106 | { 107 | HLSLPROGRAM 108 | #pragma vertex Vert 109 | #pragma fragment Frag 110 | ENDHLSL 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /Kino/DigitalGlitch/DigitalGlitch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Rendering.PostProcessing; 4 | using Random = UnityEngine.Random; 5 | 6 | [Serializable] 7 | [PostProcess(typeof(DigitalGlitchRenderer), PostProcessEvent.BeforeStack, "Custom/Kino/DigitalGlitch")] 8 | public class DigitalGlitch : PostProcessEffectSettings 9 | { 10 | [Range(0, 1), Tooltip("Intensity")] 11 | public FloatParameter intensity = new FloatParameter { value = 0 }; 12 | } 13 | 14 | public sealed class DigitalGlitchRenderer : PostProcessEffectRenderer 15 | { 16 | static class ShaderPropertyID 17 | { 18 | internal static readonly int Intensity = Shader.PropertyToID("_Intensity"); 19 | internal static readonly int NoiseTex = Shader.PropertyToID("_NoiseTex"); 20 | internal static readonly int TrashTex = Shader.PropertyToID("_TrashTex"); 21 | } 22 | 23 | Texture2D noiseTexture; 24 | RenderTexture trashFrame1; 25 | RenderTexture trashFrame2; 26 | public override void Init() 27 | { 28 | noiseTexture = new Texture2D(64, 32, TextureFormat.ARGB32, false); 29 | noiseTexture.hideFlags = HideFlags.DontSave; 30 | noiseTexture.wrapMode = TextureWrapMode.Clamp; 31 | noiseTexture.filterMode = FilterMode.Point; 32 | 33 | trashFrame1 = new RenderTexture(Screen.width, Screen.height, 0); 34 | trashFrame2 = new RenderTexture(Screen.width, Screen.height, 0); 35 | trashFrame1.hideFlags = HideFlags.DontSave; 36 | trashFrame2.hideFlags = HideFlags.DontSave; 37 | } 38 | 39 | Color GetRandomColor() 40 | { 41 | return new Color(Random.value, Random.value, Random.value, Random.value); 42 | } 43 | 44 | void UpdateNoiseTexture() 45 | { 46 | var color = GetRandomColor(); 47 | for (int y = 0; y < noiseTexture.height; y++) { 48 | for (int x = 0; x < noiseTexture.width; x++) { 49 | if (Random.value > 0.89f) 50 | color = GetRandomColor(); 51 | noiseTexture.SetPixel(x, y, color); 52 | } 53 | } 54 | 55 | noiseTexture.Apply(); 56 | } 57 | 58 | float verticalJumpTime; 59 | public override void Render(PostProcessRenderContext context) 60 | { 61 | var sheet = context.propertySheets.Get(Shader.Find("Hidden/PostProcessing/DigitalGlitch")); 62 | 63 | if (Random.value > Mathf.Lerp(0.9f, 0.5f, settings.intensity)) 64 | UpdateNoiseTexture(); 65 | 66 | var frameCount = Time.frameCount; 67 | if (frameCount % 13 == 0) 68 | context.command.Blit(context.source, trashFrame1); 69 | if (frameCount % 73 == 0) 70 | context.command.Blit(context.source, trashFrame2); 71 | var trashFrame = Random.value > 0.5f ? trashFrame1 : trashFrame2; 72 | 73 | sheet.properties.SetFloat(ShaderPropertyID.Intensity, settings.intensity); 74 | sheet.properties.SetTexture(ShaderPropertyID.NoiseTex, noiseTexture); 75 | sheet.properties.SetTexture(ShaderPropertyID.TrashTex, trashFrame); 76 | sheet.EnableKeyword("APPLY_FORWARD_FOG"); 77 | context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /Reshade/FakeHDR/FakeHDR.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/PostProcessing/FakeHDR" 2 | { 3 | HLSLINCLUDE 4 | 5 | #include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl" 6 | 7 | TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex); 8 | float4 _MainTex_TexelSize; 9 | float _HDRPower; 10 | float _Radius1; 11 | float _Radius2; 12 | 13 | float4 Frag(VaryingsDefault i) : SV_Target 14 | { 15 | float3 color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord).rgb; 16 | 17 | float3 bloom_sum1 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + float2(1.5, -1.5) * _Radius1 * _MainTex_TexelSize.x).rgb; 18 | bloom_sum1 += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + float2(-1.5, -1.5) * _Radius1 * _MainTex_TexelSize.xy).rgb; 19 | bloom_sum1 += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + float2(1.5, -1.5) * _Radius1 * _MainTex_TexelSize.xy).rgb; 20 | bloom_sum1 += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + float2(-1.5, 1.5) * _Radius1 * _MainTex_TexelSize.xy).rgb; 21 | bloom_sum1 += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + float2(0.0, -2.5) * _Radius1 * _MainTex_TexelSize.xy).rgb; 22 | bloom_sum1 += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + float2(0.0, 2.5) * _Radius1 * _MainTex_TexelSize.xy).rgb; 23 | bloom_sum1 += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + float2(-2.5, 0.0) * _Radius1 * _MainTex_TexelSize.xy).rgb; 24 | bloom_sum1 += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + float2(2.5, 0.0) * _Radius1 * _MainTex_TexelSize.xy).rgb; 25 | bloom_sum1 *= 0.005; 26 | 27 | float3 bloom_sum2 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + float2(1.5, -1.5) * _Radius2 * _MainTex_TexelSize.x).rgb; 28 | bloom_sum2 += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + float2(-1.5, -1.5) * _Radius2 * _MainTex_TexelSize.xy).rgb; 29 | bloom_sum2 += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + float2(1.5, -1.5) * _Radius2 * _MainTex_TexelSize.xy).rgb; 30 | bloom_sum2 += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + float2(-1.5, 1.5) * _Radius2 * _MainTex_TexelSize.xy).rgb; 31 | bloom_sum2 += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + float2(0.0, -2.5) * _Radius2 * _MainTex_TexelSize.xy).rgb; 32 | bloom_sum2 += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + float2(0.0, 2.5) * _Radius2 * _MainTex_TexelSize.xy).rgb; 33 | bloom_sum2 += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + float2(-2.5, 0.0) * _Radius2 * _MainTex_TexelSize.xy).rgb; 34 | bloom_sum2 += SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord + float2(2.5, 0.0) * _Radius2 * _MainTex_TexelSize.xy).rgb; 35 | bloom_sum2 *= 0.010; 36 | 37 | float dist = _Radius2 - _Radius1; 38 | float3 hdr = (color + (bloom_sum2 - bloom_sum1)) * dist; 39 | float3 blend = hdr + color; 40 | color = saturate(pow(abs(blend), abs(_HDRPower)) + hdr); 41 | 42 | return float4(color, 1.0); 43 | } 44 | 45 | ENDHLSL 46 | 47 | SubShader 48 | { 49 | Cull Off ZWrite Off ZTest Always 50 | 51 | Pass 52 | { 53 | HLSLPROGRAM 54 | #pragma vertex VertDefault 55 | #pragma fragment Frag 56 | ENDHLSL 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Reshade/AdaptiveFog/AdaptiveFog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Rendering.PostProcessing; 4 | 5 | [Serializable] 6 | [PostProcess(typeof(AdaptiveFogRenderer), PostProcessEvent.BeforeStack, "Custom/Reshade/AdaptiveFog")] 7 | public sealed class AdaptiveFog : PostProcessEffectSettings 8 | { 9 | [Tooltip("Color of the fog")] 10 | public ColorParameter fogColor = new ColorParameter { value = new Color(0.9f, 0.9f, 0.9f) }; 11 | [Range(0f, 1f), Tooltip("The maximum fog factor. 1.0 makes distant objects completely fogged out, a lower factor will shimmer them through the fog")] 12 | public FloatParameter maxFogFactor = new FloatParameter { value = 0.5f }; 13 | [Range(0f, 175f), Tooltip("The curve how quickly distant objects get fogged. A low value will make the fog appear just slightly. A high value will make the fog kick in rather quickly. The max value in the rage makes it very hard in general to view any objects outside fog")] 14 | public FloatParameter fogCurve = new FloatParameter { value = 1.5f }; 15 | [Range(0f, 1f), Tooltip("Start of the fog. 0.0 is at the camera, 1.0 is at the horizon, 0.5 is halfway towards the horizon. Before this point no fog will appear")] 16 | public FloatParameter fogStart = new FloatParameter { value = 0.05f }; 17 | [Range(0f, 50f), Tooltip("Threshold for what is a bright light (that causes bloom) and what isn't")] 18 | public FloatParameter bloomThreshold = new FloatParameter { value = 10.25f }; 19 | [Range(0f, 100f), Tooltip("Strength of the bloom")] 20 | public FloatParameter bloomPower = new FloatParameter { value = 10.0f }; 21 | [Range(0f, 1f), Tooltip("Width of the bloom")] 22 | public FloatParameter bloomWidth = new FloatParameter { value = 0.2f }; 23 | } 24 | 25 | public sealed class AdaptiveFogRenderer : PostProcessEffectRenderer 26 | { 27 | static class ShaderPropertyID 28 | { 29 | internal static readonly int FogColor = Shader.PropertyToID("_FogColor"); 30 | internal static readonly int MaxFogFactor = Shader.PropertyToID("_MaxFogFactor"); 31 | internal static readonly int FogCurve = Shader.PropertyToID("_FogCurve"); 32 | internal static readonly int FogStart = Shader.PropertyToID("_FogStart"); 33 | internal static readonly int BloomThreshold = Shader.PropertyToID("_BloomThreshold"); 34 | internal static readonly int BloomPower = Shader.PropertyToID("_BloomPower"); 35 | internal static readonly int BloomWidth = Shader.PropertyToID("_BloomWidth"); 36 | } 37 | 38 | public override DepthTextureMode GetCameraFlags() 39 | { 40 | return DepthTextureMode.Depth; 41 | } 42 | 43 | public override void Render(PostProcessRenderContext context) 44 | { 45 | var sheet = context.propertySheets.Get(Shader.Find("Hidden/PostProcessing/AdaptiveFog")); 46 | 47 | sheet.properties.SetColor(ShaderPropertyID.FogColor, settings.fogColor); 48 | sheet.properties.SetFloat(ShaderPropertyID.MaxFogFactor, settings.maxFogFactor); 49 | sheet.properties.SetFloat(ShaderPropertyID.FogCurve, settings.fogCurve); 50 | sheet.properties.SetFloat(ShaderPropertyID.FogStart, settings.fogStart); 51 | sheet.properties.SetFloat(ShaderPropertyID.BloomThreshold, settings.bloomThreshold); 52 | sheet.properties.SetFloat(ShaderPropertyID.BloomPower, settings.bloomPower); 53 | sheet.properties.SetFloat(ShaderPropertyID.BloomWidth, settings.bloomWidth); 54 | 55 | context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Kino/Isoilne/Isoline.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Rendering.PostProcessing; 4 | 5 | 6 | [Serializable] 7 | [PostProcess(typeof(IsolineRenderer), PostProcessEvent.BeforeStack, "Custom/Kino/Isoline")] 8 | public class Isoline : PostProcessEffectSettings 9 | { 10 | // Contour Detection 11 | public Vector3Parameter baseAxis = new Vector3Parameter { value = Vector3.up }; 12 | public FloatParameter lineInterval = new FloatParameter { value = 1 }; 13 | public FloatParameter lineOffset = new FloatParameter { value = 0 }; 14 | public FloatParameter lineScroll = new FloatParameter { value = 0 }; 15 | 16 | // Line Style 17 | [ColorUsage(true, true)] 18 | public ColorParameter lineColor = new ColorParameter { value = new Color(1.5f, 0.2f, 0.2f, 1) }; 19 | public FloatParameter lineWidth = new FloatParameter { value = 1.5f }; 20 | [Range(0, 1)] 21 | public FloatParameter sourceContribution = new FloatParameter { value = 0 }; 22 | public ColorParameter backgroundColor = new ColorParameter { value = new Color(0, 0, 0, 0) }; 23 | 24 | // Color Modulation 25 | [Range(0, 1)] 26 | public FloatParameter modulationStrength = new FloatParameter { value = 0 }; 27 | [Range(0, 1)] 28 | public FloatParameter modulationFrequency = new FloatParameter { value = 0.1f }; 29 | [Range(0, 1)] 30 | public FloatParameter modulationWidth = new FloatParameter { value = 0.1f }; 31 | public FloatParameter modulationOffset = new FloatParameter { value = 0 }; 32 | public FloatParameter modulationScroll = new FloatParameter { value = 1 }; 33 | } 34 | 35 | public sealed class IsolineRenderer : PostProcessEffectRenderer 36 | { 37 | static class ShaderPropertyID 38 | { 39 | internal static readonly int InverseView = Shader.PropertyToID("_InverseView"); 40 | internal static readonly int LineColor = Shader.PropertyToID("_LineColor"); 41 | internal static readonly int BackgroundColor = Shader.PropertyToID("_BackgroundColor"); 42 | internal static readonly int ContourAxis = Shader.PropertyToID("_ContourAxis"); 43 | internal static readonly int ContourParams = Shader.PropertyToID("_ContourParams"); 44 | internal static readonly int ModParams = Shader.PropertyToID("_ModParams"); 45 | } 46 | 47 | public override DepthTextureMode GetCameraFlags() 48 | { 49 | return DepthTextureMode.Depth; 50 | } 51 | 52 | Vector4 MakeVector(Vector3 v, float w) 53 | { 54 | return new Vector4(v.x, v.y, v.z, w); 55 | } 56 | 57 | public override void Render(PostProcessRenderContext context) 58 | { 59 | var sheet = context.propertySheets.Get(Shader.Find("Hidden/PostProcessing/Isoline")); 60 | 61 | sheet.properties.SetMatrix(ShaderPropertyID.InverseView, context.camera.cameraToWorldMatrix); 62 | sheet.properties.SetColor(ShaderPropertyID.LineColor, settings.lineColor); 63 | sheet.properties.SetColor(ShaderPropertyID.BackgroundColor, settings.backgroundColor); 64 | 65 | var offs = Time.time * settings.lineScroll + settings.lineOffset; 66 | sheet.properties.SetVector(ShaderPropertyID.ContourAxis, MakeVector(settings.baseAxis.value.normalized, -offs)); 67 | sheet.properties.SetVector(ShaderPropertyID.ContourParams, new Vector4(settings.lineInterval, settings.lineScroll, settings.lineWidth, settings.sourceContribution)); 68 | 69 | offs = Time.time * settings.modulationScroll + settings.modulationOffset; 70 | sheet.properties.SetVector(ShaderPropertyID.ModParams, new Vector4(settings.modulationStrength, settings.modulationFrequency, settings.modulationWidth, -offs)); 71 | 72 | context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0); 73 | } 74 | } -------------------------------------------------------------------------------- /Kino/Streak/Streak.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/PostProcessing/Streak" 2 | { 3 | HLSLINCLUDE 4 | 5 | #include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl" 6 | 7 | TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex); 8 | TEXTURE2D_SAMPLER2D(_HighTex, sampler_HighTex); 9 | 10 | float4 _MainTex_TexelSize; 11 | float _Threshold; 12 | float _Stretch; 13 | float _Intensity; 14 | half3 _Color; 15 | 16 | // Prefilter: Shrink horizontally and apply threshold. 17 | half4 FragPrefilter(VaryingsDefault i) : SV_Target 18 | { 19 | // Actually this should be 1, but we assume you need more blur... 20 | const float vscale = 1.5; 21 | const float dy = _MainTex_TexelSize.y * vscale / 2; 22 | 23 | float2 uv = i.texcoord; 24 | half3 c0 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, float2(uv.x, uv.y - dy)).rgb; 25 | half3 c1 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, float2(uv.x, uv.y + dy)).rgb; 26 | half3 c = (c0 + c1) / 2; 27 | 28 | float br = max(c.r, max(c.g, c.b)); 29 | c *= max(0, br - _Threshold) / max(br, 1e-5); 30 | 31 | return half4(c, 1); 32 | } 33 | 34 | // Downsampler 35 | half4 FragDownsample(VaryingsDefault i) : SV_Target 36 | { 37 | // Actually this should be 1, but we assume you need more blur... 38 | const float hscale = 1.25; 39 | const float dx = _MainTex_TexelSize.x * hscale; 40 | 41 | float2 uv = i.texcoord; 42 | float u0 = uv.x - dx * 5; 43 | float u1 = uv.x - dx * 3; 44 | float u2 = uv.x - dx * 1; 45 | float u3 = uv.x + dx * 1; 46 | float u4 = uv.x + dx * 3; 47 | float u5 = uv.x + dx * 5; 48 | 49 | half3 c0 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, float2(u0, uv.y)).rgb; 50 | half3 c1 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, float2(u1, uv.y)).rgb; 51 | half3 c2 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, float2(u2, uv.y)).rgb; 52 | half3 c3 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, float2(u3, uv.y)).rgb; 53 | half3 c4 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, float2(u4, uv.y)).rgb; 54 | half3 c5 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, float2(u5, uv.y)).rgb; 55 | 56 | // Simple box filter 57 | half3 c = (c0 + c1 + c2 + c3 + c4 + c5) / 6; 58 | 59 | return half4(c, 1); 60 | } 61 | 62 | // Upsampler 63 | half4 FragUpsample(VaryingsDefault i) : SV_Target 64 | { 65 | half3 c0 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord).rgb / 4; 66 | half3 c1 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord).rgb / 2; 67 | half3 c2 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord).rgb / 4; 68 | half3 c3 = SAMPLE_TEXTURE2D(_HighTex, sampler_HighTex, i.texcoord).rgb; 69 | return half4(lerp(c3, c0 + c1 + c2, _Stretch), 1); 70 | } 71 | 72 | // Final composition 73 | half4 FragComposition(VaryingsDefault i) : SV_Target 74 | { 75 | half3 c0 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord).rgb / 4; 76 | half3 c1 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord).rgb / 2; 77 | half3 c2 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord).rgb / 4; 78 | half3 c3 = SAMPLE_TEXTURE2D(_HighTex, sampler_HighTex, i.texcoord).rgb; 79 | half3 cf = (c0 + c1 + c2) * _Color * _Intensity * 5; 80 | return half4(cf + c3, 1); 81 | } 82 | 83 | ENDHLSL 84 | 85 | SubShader 86 | { 87 | Cull Off ZWrite Off ZTest Always 88 | Pass 89 | { 90 | HLSLPROGRAM 91 | #pragma vertex VertDefault 92 | #pragma fragment FragPrefilter 93 | ENDHLSL 94 | } 95 | Pass 96 | { 97 | HLSLPROGRAM 98 | #pragma vertex VertDefault 99 | #pragma fragment FragDownsample 100 | ENDHLSL 101 | } 102 | Pass 103 | { 104 | HLSLPROGRAM 105 | #pragma vertex VertDefault 106 | #pragma fragment FragUpsample 107 | ENDHLSL 108 | } 109 | Pass 110 | { 111 | HLSLPROGRAM 112 | #pragma vertex VertDefault 113 | #pragma fragment FragComposition 114 | ENDHLSL 115 | } 116 | } 117 | } -------------------------------------------------------------------------------- /Kino/Contour/Contour.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/PostProcessing/Contour" 2 | { 3 | HLSLINCLUDE 4 | 5 | #include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl" 6 | 7 | TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex); 8 | float4 _MainTex_TexelSize; 9 | TEXTURE2D_SAMPLER2D(_CameraDepthTexture, sampler_CameraDepthTexture); 10 | TEXTURE2D_SAMPLER2D(_CameraGBufferTexture2, sampler_CameraGBufferTexture2); 11 | 12 | float4 _Color; 13 | float4 _Background; 14 | 15 | float _Threshold; 16 | float _InvRange; 17 | 18 | float _ColorSensitivity; 19 | float _DepthSensitivity; 20 | float _NormalSensitivity; 21 | float _InvFallOff; 22 | 23 | float4 Frag(VaryingsDefault i) : SV_Target 24 | { 25 | // Source color 26 | float4 c0 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord); 27 | 28 | // Four sample points of the roberts cross operator 29 | float2 uv0 = i.texcoord; // TL 30 | float2 uv1 = i.texcoord + _MainTex_TexelSize.xy; // BR 31 | float2 uv2 = i.texcoord + float2(_MainTex_TexelSize.x, 0); // TR 32 | float2 uv3 = i.texcoord + float2(0, _MainTex_TexelSize.y); // BL 33 | 34 | float edge = 0; 35 | 36 | #ifdef _CONTOUR_COLOR 37 | // Color samples 38 | float3 c1 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv1).rgb; 39 | float3 c2 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv2).rgb; 40 | float3 c3 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv3).rgb; 41 | 42 | // Roberts cross operator 43 | float3 cg1 = c1 - c0; 44 | float3 cg2 = c3 - c2; 45 | float cg = sqrt(dot(cg1, cg1) + dot(cg2, cg2)); 46 | 47 | edge = cg * _ColorSensitivity; 48 | #endif 49 | 50 | #ifdef _CONTOUR_DEPTH 51 | // Depth samples 52 | float zs0 = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, sampler_CameraDepthTexture, uv0); 53 | float zs1 = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, sampler_CameraDepthTexture, uv1); 54 | float zs2 = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, sampler_CameraDepthTexture, uv2); 55 | float zs3 = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, sampler_CameraDepthTexture, uv3); 56 | 57 | // Calculate fall-off parameter from the depth of the nearest point 58 | float zm = min(min(min(zs0, zs1), zs2), zs3); 59 | float falloff = 1.0 - saturate(LinearEyeDepth(zm) * _InvFallOff); 60 | 61 | // Convert to linear depth values. 62 | float z0 = Linear01Depth(zs0); 63 | float z1 = Linear01Depth(zs1); 64 | float z2 = Linear01Depth(zs2); 65 | float z3 = Linear01Depth(zs3); 66 | 67 | // Roberts cross operator 68 | float zg1 = z1 - z0; 69 | float zg2 = z3 - z2; 70 | float zg = sqrt(zg1 * zg1 + zg2 * zg2); 71 | 72 | edge = max(edge, zg * falloff * _DepthSensitivity / Linear01Depth(zm)); 73 | #endif 74 | 75 | #ifdef _CONTOUR_NORMAL 76 | // Normal samples from the G-buffer 77 | float3 n0 = SAMPLE_TEXTURE2D(_CameraGBufferTexture2, sampler_CameraGBufferTexture2, uv0).rgb; 78 | float3 n1 = SAMPLE_TEXTURE2D(_CameraGBufferTexture2, sampler_CameraGBufferTexture2, uv1).rgb; 79 | float3 n2 = SAMPLE_TEXTURE2D(_CameraGBufferTexture2, sampler_CameraGBufferTexture2, uv2).rgb; 80 | float3 n3 = SAMPLE_TEXTURE2D(_CameraGBufferTexture2, sampler_CameraGBufferTexture2, uv3).rgb; 81 | 82 | // Roberts cross operator 83 | float3 ng1 = n1 - n0; 84 | float3 ng2 = n3 - n2; 85 | float ng = sqrt(dot(ng1, ng1) + dot(ng2, ng2)); 86 | 87 | edge = max(edge, ng * _NormalSensitivity); 88 | #endif 89 | 90 | // Thresholding 91 | edge = saturate((edge - _Threshold) * _InvRange); 92 | 93 | float3 cb = lerp(c0.rgb, _Background.rgb, _Background.a); 94 | float3 co = lerp(cb, _Color.rgb, edge * _Color.a); 95 | return float4(co, c0.a); 96 | } 97 | 98 | ENDHLSL 99 | 100 | SubShader 101 | { 102 | ZTest Always Cull Off ZWrite Off 103 | 104 | Pass 105 | { 106 | HLSLPROGRAM 107 | #pragma vertex VertDefault 108 | #pragma fragment Frag 109 | #pragma multi_compile _ _CONTOUR_COLOR 110 | #pragma multi_compile _ _CONTOUR_DEPTH 111 | #pragma multi_compile _ _CONTOUR_NORMAL 112 | ENDHLSL 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /Kino/Contour/Contour.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Rendering.PostProcessing; 4 | 5 | [Serializable] 6 | [PostProcess(typeof(ContourRenderer), PostProcessEvent.BeforeStack, "Custom/Kino/Contour")] 7 | public class Contour : PostProcessEffectSettings 8 | { 9 | [Tooltip("Line Color")] 10 | public ColorParameter lineColor = new ColorParameter { value = Color.black }; 11 | [Tooltip("Background Color")] 12 | public ColorParameter bgColor = new ColorParameter { value = new Color(1, 1, 1, 0) }; 13 | [Range(0, 1), Tooltip("Lower Threshold")] 14 | public FloatParameter lowerThreshold = new FloatParameter { value = 0.05f }; 15 | [Range(0, 1), Tooltip("Upper Threshold")] 16 | public FloatParameter upperThreshold = new FloatParameter { value = 0.5f }; 17 | [Range(0, 1), Tooltip("Color Sensitivity")] 18 | public FloatParameter colorSensitivity = new FloatParameter { value = 0 }; 19 | [Range(0, 1), Tooltip("Depth Sensitivity")] 20 | public FloatParameter depthSensitivity = new FloatParameter { value = 0.5f }; 21 | [Range(0, 1), Tooltip("Normal Sensitivity")] 22 | public FloatParameter normalSensitivity = new FloatParameter { value = 0 }; 23 | [Tooltip("Falloff Depth")] 24 | public FloatParameter falloffDepth = new FloatParameter { value = 40 }; 25 | } 26 | 27 | public sealed class ContourRenderer : PostProcessEffectRenderer 28 | { 29 | static class ShaderPropertyID 30 | { 31 | internal static readonly int Color = Shader.PropertyToID("_Color"); 32 | internal static readonly int Background = Shader.PropertyToID("_Background"); 33 | internal static readonly int Threshold = Shader.PropertyToID("_Threshold"); 34 | internal static readonly int InvRange = Shader.PropertyToID("_InvRange"); 35 | internal static readonly int ColorSensitivity = Shader.PropertyToID("_ColorSensitivity"); 36 | internal static readonly int DepthSensitivity = Shader.PropertyToID("_DepthSensitivity"); 37 | internal static readonly int NormalSensitivity = Shader.PropertyToID("_NormalSensitivity"); 38 | internal static readonly int InvFallOff = Shader.PropertyToID("_InvFallOff"); 39 | } 40 | 41 | public override DepthTextureMode GetCameraFlags() 42 | { 43 | if (settings.normalSensitivity > 0) 44 | return DepthTextureMode.DepthNormals; 45 | if (settings.depthSensitivity > 0) 46 | return DepthTextureMode.Depth; 47 | 48 | return DepthTextureMode.None; 49 | } 50 | 51 | public override void Render(PostProcessRenderContext context) 52 | { 53 | var sheet = context.propertySheets.Get(Shader.Find("Hidden/PostProcessing/Contour")); 54 | 55 | sheet.properties.SetColor(ShaderPropertyID.Color, settings.lineColor); 56 | sheet.properties.SetColor(ShaderPropertyID.Background, settings.bgColor); 57 | sheet.properties.SetFloat(ShaderPropertyID.Threshold, settings.lowerThreshold); 58 | sheet.properties.SetFloat(ShaderPropertyID.InvRange, 1 / (settings.upperThreshold - settings.lowerThreshold)); 59 | sheet.properties.SetFloat(ShaderPropertyID.ColorSensitivity, settings.colorSensitivity); 60 | sheet.properties.SetFloat(ShaderPropertyID.DepthSensitivity, settings.depthSensitivity * 2); 61 | sheet.properties.SetFloat(ShaderPropertyID.NormalSensitivity, settings.normalSensitivity); 62 | sheet.properties.SetFloat(ShaderPropertyID.InvFallOff, 1 / settings.falloffDepth); 63 | 64 | if (settings.colorSensitivity > 0) 65 | sheet.EnableKeyword("_CONTOUR_COLOR"); 66 | else 67 | sheet.DisableKeyword("_CONTOUR_COLOR"); 68 | 69 | if (settings.depthSensitivity > 0) 70 | sheet.EnableKeyword("_CONTOUR_DEPTH"); 71 | else 72 | sheet.DisableKeyword("_CONTOUR_DEPTH"); 73 | 74 | if (settings.normalSensitivity > 0) 75 | sheet.EnableKeyword("_CONTOUR_NORMAL"); 76 | else 77 | sheet.DisableKeyword("_CONTOUR_NORMAL"); 78 | 79 | context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Kino/Streak/Streak.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Rendering.PostProcessing; 4 | 5 | [Serializable] 6 | [PostProcess(typeof(StreakRenderer), PostProcessEvent.BeforeStack, "Custom/Kino/Streak")] 7 | public sealed class Streak : PostProcessEffectSettings 8 | { 9 | [Range(0, 5)] public FloatParameter threshold = new FloatParameter { value = 0.75f }; 10 | [Range(0, 1)] public FloatParameter stretch = new FloatParameter { value = 0.5f }; 11 | [Range(0, 1)] public FloatParameter intensity = new FloatParameter { value = 0.25f }; 12 | [ColorUsage(false)] public ColorParameter tint = new ColorParameter { value = new Color(0.55f, 0.55f, 1) }; 13 | } 14 | 15 | public sealed class StreakRenderer : PostProcessEffectRenderer 16 | { 17 | static class ShaderPropertyID 18 | { 19 | internal static readonly int Threshold = Shader.PropertyToID("_Threshold"); 20 | internal static readonly int Stretch = Shader.PropertyToID("_Stretch"); 21 | internal static readonly int Intensity = Shader.PropertyToID("_Intensity"); 22 | internal static readonly int Color = Shader.PropertyToID("_Color"); 23 | internal static readonly int HighTex = Shader.PropertyToID("_HighTex"); 24 | } 25 | 26 | const int MaxMipLevel = 16; 27 | int[] _mipWidth; 28 | int[] _rtMipDown; 29 | int[] _rtMipUp; 30 | public override void Init() 31 | { 32 | _mipWidth = new int[MaxMipLevel]; 33 | _rtMipDown = new int[MaxMipLevel]; 34 | _rtMipUp = new int[MaxMipLevel]; 35 | 36 | for (var i = 0; i < MaxMipLevel; i++) { 37 | _rtMipDown[i] = Shader.PropertyToID("_MipDown" + i); 38 | _rtMipUp[i] = Shader.PropertyToID("_MipUp" + i); 39 | } 40 | } 41 | 42 | public override void Render(PostProcessRenderContext context) 43 | { 44 | var cmd = context.command; 45 | cmd.BeginSample("Streak"); 46 | 47 | // Shader uniforms 48 | var sheet = context.propertySheets.Get(Shader.Find("Hidden/PostProcessing/Streak")); 49 | sheet.properties.SetFloat(ShaderPropertyID.Threshold, settings.threshold); 50 | sheet.properties.SetFloat(ShaderPropertyID.Stretch, settings.stretch); 51 | sheet.properties.SetFloat(ShaderPropertyID.Intensity, settings.intensity); 52 | sheet.properties.SetColor(ShaderPropertyID.Color, settings.tint); 53 | 54 | // Calculate the mip widths. 55 | _mipWidth[0] = context.screenWidth; 56 | for (var i = 1; i < MaxMipLevel; i++) 57 | _mipWidth[i] = _mipWidth[i - 1] / 2; 58 | 59 | // Apply the prefilter and store into MIP 0. 60 | var height = context.screenHeight / 2; 61 | context.GetScreenSpaceTemporaryRT( 62 | cmd, _rtMipDown[0], 0, 63 | RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Default, 64 | FilterMode.Bilinear, _mipWidth[0], height 65 | ); 66 | cmd.BlitFullscreenTriangle(context.source, _rtMipDown[0], sheet, 0); 67 | 68 | // Build the MIP pyramid. 69 | var level = 1; 70 | for (; level < MaxMipLevel && _mipWidth[level] > 7; level++) { 71 | context.GetScreenSpaceTemporaryRT( 72 | cmd, _rtMipDown[level], 0, 73 | RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Default, 74 | FilterMode.Bilinear, _mipWidth[level], height 75 | ); 76 | cmd.BlitFullscreenTriangle(_rtMipDown[level - 1], _rtMipDown[level], sheet, 1); 77 | } 78 | 79 | // MIP 0 is not needed at this point. 80 | cmd.ReleaseTemporaryRT(_rtMipDown[level]); 81 | 82 | // Upsample and combine. 83 | var lastRT = _rtMipDown[--level]; 84 | for (level--; level >= 1; level--) { 85 | context.GetScreenSpaceTemporaryRT( 86 | cmd, _rtMipUp[level], 0, 87 | RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Default, 88 | FilterMode.Bilinear, _mipWidth[level], height 89 | ); 90 | cmd.SetGlobalTexture(ShaderPropertyID.HighTex, _rtMipDown[level]); 91 | cmd.BlitFullscreenTriangle(lastRT, _rtMipUp[level], sheet, 2); 92 | 93 | cmd.ReleaseTemporaryRT(_rtMipDown[level]); 94 | cmd.ReleaseTemporaryRT(lastRT); 95 | 96 | lastRT = _rtMipUp[level]; 97 | } 98 | 99 | // Final composition. 100 | cmd.SetGlobalTexture(ShaderPropertyID.HighTex, context.source); 101 | cmd.BlitFullscreenTriangle(lastRT, context.destination, sheet, 3); 102 | 103 | // Cleaning up. 104 | cmd.ReleaseTemporaryRT(lastRT); 105 | cmd.EndSample("Streak"); 106 | } 107 | } -------------------------------------------------------------------------------- /Kino/Isoilne/Isoline.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/PostProcessing/Isoline" 2 | { 3 | HLSLINCLUDE 4 | 5 | #include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl" 6 | #include "Packages/com.unity.postprocessing/PostProcessing/Shaders/Colors.hlsl" 7 | 8 | TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex); 9 | TEXTURE2D_SAMPLER2D(_CameraDepthTexture, sampler_CameraDepthTexture); 10 | 11 | float4x4 _InverseView; 12 | 13 | float4 _LineColor; 14 | float4 _BackgroundColor; 15 | float4 _ContourAxis; 16 | float4 _ContourParams; // interval, scroll, width, source contribution 17 | float4 _ModParams; // strength, frequency, midpoint, offset 18 | 19 | struct VaryingsDepthSupport 20 | { 21 | float4 position : SV_Position; 22 | float2 texcoord : TEXCOORD0; 23 | float3 ray : TEXCOORD1; 24 | }; 25 | 26 | float3 ComputeViewSpacePosition(VaryingsDepthSupport input) 27 | { 28 | // Render settings 29 | float near = _ProjectionParams.y; 30 | float far = _ProjectionParams.z; 31 | float isOrtho = unity_OrthoParams.w; // 0: perspective, 1: orthographic 32 | 33 | // Z buffer sample 34 | float z = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, sampler_CameraDepthTexture, input.texcoord); 35 | 36 | // Far plane exclusion 37 | //#if !defined(EXCLUDE_FAR_PLANE) 38 | //float mask = 1; 39 | #if defined(UNITY_REVERSED_Z) 40 | float mask = z > 0; 41 | #else 42 | float mask = z < 1; 43 | #endif 44 | 45 | // Perspective: view space position = ray * depth 46 | float3 vposPers = input.ray * Linear01Depth(z); 47 | 48 | // Orthographic: linear depth (with reverse-Z support) 49 | #if defined(UNITY_REVERSED_Z) 50 | float depthOrtho = -lerp(far, near, z); 51 | #else 52 | float depthOrtho = -lerp(near, far, z); 53 | #endif 54 | 55 | // Orthographic: view space position 56 | float3 vposOrtho = float3(input.ray.xy, depthOrtho); 57 | 58 | // Result: view space position 59 | return lerp(vposPers, vposOrtho, isOrtho) * mask; 60 | } 61 | 62 | float4x4 unity_CameraInvProjection; 63 | // Vertex shader that procedurally outputs a full screen triangle 64 | VaryingsDepthSupport VertexDepthSupport(uint vertexID : SV_VertexID) 65 | { 66 | // Render settings 67 | float far = _ProjectionParams.z; 68 | float2 orthoSize = unity_OrthoParams.xy; 69 | float isOrtho = unity_OrthoParams.w; // 0: perspective, 1: orthographic 70 | 71 | // Vertex ID -> clip space vertex position 72 | float x = (vertexID != 1) ? -1 : 3; 73 | float y = (vertexID == 2) ? -3 : 1; 74 | float3 vpos = float3(x, y, 1.0); 75 | 76 | // Perspective: view space vertex position of the far plane 77 | float3 rayPers = mul(unity_CameraInvProjection, vpos.xyzz * far).xyz; 78 | 79 | // Orthographic: view space vertex position 80 | float3 rayOrtho = float3(orthoSize * vpos.xy, 0); 81 | 82 | VaryingsDepthSupport o; 83 | o.position = float4(vpos.x, vpos.y, 1, 1); 84 | o.texcoord = (vpos.xy + 1) / 2; 85 | o.ray = lerp(rayPers, rayOrtho, isOrtho); 86 | return o; 87 | } 88 | 89 | float2 Contour(VaryingsDepthSupport input) 90 | { 91 | const float Width = _ContourParams.z; 92 | 93 | // Depth to world space conversion 94 | float3 vpos = ComputeViewSpacePosition(input); 95 | float3 wpos = mul(_InverseView, float4(vpos, 1)).xyz; 96 | 97 | // Potential value and derivatives 98 | float pot = (dot(_ContourAxis.xyz, wpos) + _ContourAxis.w) / _ContourParams.x; 99 | 100 | // Contour detection 101 | float fw = fwidth(pot); 102 | float fww = fw * Width; 103 | float ct = saturate((abs(1 - frac(pot) * 2) - 1 + fww) / fww); 104 | 105 | // Frequency filter 106 | ct = lerp(ct, 0, smoothstep(0.25, 0.5, fw)); 107 | 108 | return float2(pot, ct); 109 | } 110 | 111 | float Modulation(float pot) 112 | { 113 | const float Strength = _ModParams.x; 114 | const float Frequency = _ModParams.y; 115 | const float Thresh = 1 - _ModParams.z; 116 | const float Midpoint = lerp(Thresh, 1, 0.95); 117 | const float Offset = _ModParams.w; 118 | 119 | float x = frac(pot * Frequency + Offset); 120 | float cv_in = smoothstep(Thresh, Midpoint, x); 121 | float cv_out = smoothstep(0, 1 - Midpoint, 1 - x); 122 | 123 | return lerp(1, cv_in * cv_out, Strength); 124 | } 125 | 126 | float3 BlendContour(half3 source, half contour) 127 | { 128 | const float SourceContrib = _ContourParams.w; 129 | 130 | float3 bg = lerp(source, _BackgroundColor.rgb, _BackgroundColor.a); 131 | float3 ln = _LineColor.rgb * lerp(1, Luminance(source), SourceContrib); 132 | 133 | return bg + ln * contour; 134 | } 135 | 136 | float4 FragmentIsoline(VaryingsDepthSupport input) : SV_Target 137 | { 138 | float2 contour = Contour(input); 139 | float4 color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.texcoord); 140 | color.rgb = BlendContour(color.rgb, contour.y * Modulation(contour.x)); 141 | return color; 142 | } 143 | 144 | ENDHLSL 145 | 146 | SubShader 147 | { 148 | Cull Off ZWrite Off ZTest Always 149 | Pass 150 | { 151 | HLSLPROGRAM 152 | #pragma vertex VertexDepthSupport 153 | #pragma fragment FragmentIsoline 154 | ENDHLSL 155 | } 156 | } 157 | } --------------------------------------------------------------------------------