├── .gitignore ├── Editor.meta ├── Editor ├── GradientDrawer.cs ├── GradientDrawer.cs.meta ├── GradientMap.Editor.asmdef ├── GradientMap.Editor.asmdef.meta ├── OptionalDrawer.cs ├── OptionalDrawer.cs.meta ├── PassDrawer.cs └── PassDrawer.cs.meta ├── LICENSE.md ├── LICENSE.md.meta ├── README.md ├── README.md.meta ├── Runtime.meta ├── Runtime ├── Common.meta ├── Common │ ├── GradientParameter.cs │ ├── GradientParameter.cs.meta │ ├── GradientValue.cs │ ├── GradientValue.cs.meta │ ├── Optional.cs │ ├── Optional.cs.meta │ ├── RenderTarget.cs │ ├── RenderTarget.cs.meta │ ├── ShaderNameAttribute.cs │ ├── ShaderNameAttribute.cs.meta │ ├── Utils.cs │ ├── Utils.cs.meta │ ├── VolFx.Pass.cs │ └── VolFx.Pass.cs.meta ├── GradientMap.Runtime.asmdef ├── GradientMap.Runtime.asmdef.meta ├── GradientMap.cs ├── GradientMap.cs.meta ├── GradientMap.meta └── GradientMap │ ├── GradientMap.shader │ ├── GradientMap.shader.meta │ ├── GradientMapPass.cs │ ├── GradientMapPass.cs.meta │ ├── GradientMapVol.cs │ └── GradientMapVol.cs.meta ├── Samples~ ├── GradientMap.unity ├── GradientMap.unity.meta ├── GradientMap_A.asset ├── GradientMap_A.asset.meta ├── GradientMap_B.asset ├── GradientMap_B.asset.meta ├── Play.playable ├── Play.playable.meta ├── Sleeping Knife.png ├── Sleeping Knife.png.meta ├── UrpGradientMap.asset ├── UrpGradientMap.asset.meta ├── UrpGradientMap_Renderer.asset └── UrpGradientMap_Renderer.asset.meta ├── package.json └── package.json.meta /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | Readme.docx 3 | Readme.docx.meta 4 | Readme.pdf 5 | Readme.pdf.meta 6 | Samples 7 | Samples.meta -------------------------------------------------------------------------------- /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c53e4db15a5769a40bf1b0ac2573ec93 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/GradientDrawer.cs: -------------------------------------------------------------------------------- 1 | #if !VOL_FX 2 | 3 | using UnityEditor; 4 | using UnityEngine; 5 | 6 | // GradientMap © NullTale - https://twitter.com/NullTale/ 7 | namespace VolFx.Editor 8 | { 9 | [CustomPropertyDrawer(typeof(GradientValue))] 10 | public class GradientValueDraver : PropertyDrawer 11 | { 12 | public override float GetPropertyHeight(SerializedProperty property, GUIContent label) 13 | { 14 | return UnityEditor.EditorGUIUtility.singleLineHeight; 15 | } 16 | 17 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 18 | { 19 | var grad = property.FindPropertyRelative("_grad"); 20 | EditorGUI.BeginChangeCheck(); 21 | EditorGUI.PropertyField(position, grad, label); 22 | if (EditorGUI.EndChangeCheck()) 23 | { 24 | var pixels = property.FindPropertyRelative("_pixels"); 25 | var val = _getGradient(grad); 26 | for (var n = 0; n < GradientValue.k_Width; n++) 27 | pixels.GetArrayElementAtIndex(n).colorValue = val.Evaluate(n / (float)(GradientValue.k_Width - 1)); 28 | } 29 | 30 | // ======================================================================= 31 | Gradient _getGradient(SerializedProperty gradientProperty) 32 | { 33 | #if UNITY_2022_1_OR_NEWER 34 | return grad.gradientValue; 35 | #else 36 | System.Reflection.PropertyInfo propertyInfo = typeof(SerializedProperty).GetProperty("gradientValue", 37 | System.Reflection.BindingFlags.Public | 38 | System.Reflection.BindingFlags.NonPublic | 39 | System.Reflection.BindingFlags.Instance); 40 | 41 | return propertyInfo.GetValue(gradientProperty, null) as Gradient; 42 | #endif 43 | } 44 | } 45 | } 46 | } 47 | 48 | #endif -------------------------------------------------------------------------------- /Editor/GradientDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 72b1e131406b445aa6e2ce063afb75d7 3 | timeCreated: 1699541999 -------------------------------------------------------------------------------- /Editor/GradientMap.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "GradientMap.Editor", 3 | "rootNamespace": "", 4 | "references": [ 5 | "GUID:2697366c92a0c3d4e91df16bd8adabd2" 6 | ], 7 | "includePlatforms": [ 8 | "Editor" 9 | ], 10 | "excludePlatforms": [], 11 | "allowUnsafeCode": false, 12 | "overrideReferences": false, 13 | "precompiledReferences": [], 14 | "autoReferenced": true, 15 | "defineConstraints": [], 16 | "versionDefines": [ 17 | { 18 | "name": "www.nulltale.volfx", 19 | "expression": "1", 20 | "define": "VOL_FX" 21 | } 22 | ], 23 | "noEngineReferences": false 24 | } -------------------------------------------------------------------------------- /Editor/GradientMap.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f8ca4120d580fd246b375e40a94a260b 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor/OptionalDrawer.cs: -------------------------------------------------------------------------------- 1 | #if !VOL_FX 2 | 3 | using UnityEditor; 4 | using UnityEditorInternal; 5 | using UnityEngine; 6 | 7 | // GradientMap © NullTale - https://twitter.com/NullTale/ 8 | namespace VolFx.Editor 9 | { 10 | [CustomPropertyDrawer(typeof(Optional<>))] 11 | public class OptionalDrawer : PropertyDrawer 12 | { 13 | private const float k_ToggleWidth = 18; 14 | 15 | // ======================================================================= 16 | public override float GetPropertyHeight(SerializedProperty property, GUIContent label) 17 | { 18 | var valueProperty = property.FindPropertyRelative("value"); 19 | return EditorGUI.GetPropertyHeight(valueProperty); 20 | } 21 | 22 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 23 | { 24 | var valueProperty = property.FindPropertyRelative("value"); 25 | var enabledProperty = property.FindPropertyRelative("enabled"); 26 | 27 | position.width -= k_ToggleWidth; 28 | using (new EditorGUI.DisabledGroupScope(!enabledProperty.boolValue)) 29 | { 30 | // hardcore fix!#@ (for some reason PropertyField working with LayerMask in new unity version) 31 | if (valueProperty.propertyType == SerializedPropertyType.LayerMask) 32 | valueProperty.intValue = InternalEditorUtility.ConcatenatedLayersMaskToLayerMask(EditorGUI.MaskField(position, label, InternalEditorUtility.LayerMaskToConcatenatedLayersMask(valueProperty.intValue), InternalEditorUtility.layers)); 33 | else 34 | EditorGUI.PropertyField(position, valueProperty, label, true); 35 | } 36 | 37 | var indent = EditorGUI.indentLevel; 38 | EditorGUI.indentLevel = 0; 39 | 40 | var togglePos = new Rect(position.x + position.width + EditorGUIUtility.standardVerticalSpacing, position.y, k_ToggleWidth, EditorGUIUtility.singleLineHeight); 41 | EditorGUI.PropertyField(togglePos, enabledProperty, GUIContent.none); 42 | 43 | EditorGUI.indentLevel = indent; 44 | } 45 | } 46 | } 47 | 48 | #endif -------------------------------------------------------------------------------- /Editor/OptionalDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e79eac202acf4554d8e43c3187a7b63a 3 | timeCreated: 1697616861 -------------------------------------------------------------------------------- /Editor/PassDrawer.cs: -------------------------------------------------------------------------------- 1 | #if !VOL_FX 2 | 3 | using System; 4 | using UnityEditor; 5 | using UnityEngine; 6 | using Object = UnityEngine.Object; 7 | 8 | // GradientMap © NullTale - https://x.com/NullTale 9 | namespace VolFx.Editor 10 | { 11 | [CustomPropertyDrawer(typeof(VolFx.Pass), true)] 12 | public class PassDrawer : PropertyDrawer 13 | { 14 | // ======================================================================= 15 | public override float GetPropertyHeight(SerializedProperty property, GUIContent label) 16 | { 17 | return GetObjectReferenceHeight(property); 18 | } 19 | 20 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 21 | { 22 | var pass = property.objectReferenceValue; 23 | if (pass == null) 24 | { 25 | pass = ScriptableObject.CreateInstance(fieldInfo.FieldType); 26 | pass.hideFlags = HideFlags.HideInHierarchy | HideFlags.HideInInspector; 27 | 28 | if (string.IsNullOrEmpty(AssetDatabase.GetAssetPath(property.serializedObject.targetObject)) == false) 29 | { 30 | AssetDatabase.AddObjectToAsset(pass, property.serializedObject.targetObject); 31 | property.objectReferenceValue = pass; 32 | 33 | EditorUtility.SetDirty(property.serializedObject.targetObject); 34 | EditorUtility.SetDirty(pass); 35 | 36 | property.serializedObject.ApplyModifiedPropertiesWithoutUndo(); 37 | AssetDatabase.SaveAssets(); 38 | } 39 | } 40 | 41 | DrawObjectReference(property, position); 42 | } 43 | 44 | // ======================================================================= 45 | public static float GetObjectReferenceHeight(SerializedProperty element) 46 | { 47 | return GetObjectReferenceHeight(element.objectReferenceValue, element.isExpanded); 48 | } 49 | 50 | public static float GetObjectReferenceHeight(Object obj, bool isExpanded, Predicate filter = null) 51 | { 52 | if (obj == null) 53 | return EditorGUIUtility.singleLineHeight; 54 | 55 | using var so = new SerializedObject(obj); 56 | var totalHeight = 0f; 57 | 58 | using (var iterator = so.GetIterator()) 59 | { 60 | if (iterator.NextVisible(true)) 61 | { 62 | do 63 | { 64 | var childProperty = so.FindProperty(iterator.name); 65 | 66 | if (childProperty.name.Equals("m_Script", System.StringComparison.Ordinal)) 67 | continue; 68 | 69 | if (childProperty.name.Equals("_active", System.StringComparison.Ordinal)) 70 | continue; 71 | 72 | if (filter != null && filter.Invoke(childProperty) == false) 73 | continue; 74 | 75 | // if (NaughtyAttributes.Editor.PropertyUtility.IsVisible(childProperty) == false) 76 | // continue; 77 | 78 | totalHeight += EditorGUI.GetPropertyHeight(childProperty); 79 | } 80 | while (iterator.NextVisible(false)); 81 | } 82 | } 83 | 84 | totalHeight += EditorGUIUtility.standardVerticalSpacing; 85 | return totalHeight; 86 | } 87 | 88 | public static void DrawObjectReference(SerializedProperty element, Rect position) 89 | { 90 | DrawObjectReference(element.objectReferenceValue, element.isExpanded, position); 91 | } 92 | 93 | public static void DrawObjectReference(Object obj, bool isExpanded, Rect position, bool decorativeBox = false, Predicate filter = null) 94 | { 95 | if (obj == null) 96 | return; 97 | 98 | using var so = new SerializedObject(obj); 99 | 100 | EditorGUI.BeginChangeCheck(); 101 | 102 | using (var iterator = so.GetIterator()) 103 | { 104 | var yOffset = EditorGUIUtility.standardVerticalSpacing; 105 | if (iterator.NextVisible(true)) 106 | { 107 | do 108 | { 109 | var childProperty = so.FindProperty(iterator.name); 110 | if (filter != null && filter.Invoke(childProperty) == false) 111 | continue; 112 | 113 | if (childProperty.name.Equals("m_Script", StringComparison.Ordinal)) 114 | continue; 115 | 116 | if (childProperty.name.Equals("_active", System.StringComparison.Ordinal)) 117 | continue; 118 | 119 | var childHeight = EditorGUI.GetPropertyHeight(childProperty); 120 | var childRect = new Rect() 121 | { 122 | x = position.x, 123 | y = position.y + yOffset, 124 | width = position.width, 125 | height = childHeight 126 | }; 127 | 128 | EditorGUI.PropertyField(childRect, iterator, true); 129 | 130 | yOffset += childHeight + EditorGUIUtility.standardVerticalSpacing; 131 | } 132 | while (iterator.NextVisible(false)); 133 | } 134 | 135 | if (decorativeBox) 136 | { 137 | var pos = position; 138 | pos.x = 0f; 139 | pos.y += EditorGUIUtility.singleLineHeight; 140 | pos.width += 100f; 141 | pos.height = yOffset - EditorGUIUtility.singleLineHeight; 142 | 143 | GUI.Box(pos, GUIContent.none); 144 | } 145 | 146 | if (EditorGUI.EndChangeCheck()) 147 | so.ApplyModifiedProperties(); 148 | } 149 | } 150 | 151 | [InitializeOnLoadMethod] 152 | public static void CopyrightInfo() 153 | { 154 | var type = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name.Replace(".Editor", ""); 155 | var link = "https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/270020"; 156 | 157 | var ssc = SessionState.GetInt($"CopyrightInfo_{type}_33", UnityEngine.Random.Range(3, 7 + 1)); 158 | SessionState.SetInt($"CopyrightInfo_{type}_33", ssc + 1); 159 | 160 | if (SessionState.GetBool($"CopyrightInfo_{type}", false) == false || ssc == 333) 161 | { 162 | Debug.Log($"• You are using a Non-Commercial version of {type} developed by NullTale.\n" + 163 | "When using this version, please remember to specify Author Attribution according to the Licence used.\n" + 164 | "------------- - - - - - -\n" + 165 | $"A full use Licence can be acquired on Asset Store or negotiated with the Author in cases of special licensing.\n \n"); 166 | 167 | SessionState.SetBool($"CopyrightInfo_{type}", true); 168 | } 169 | } 170 | } 171 | } 172 | 173 | #endif 174 | -------------------------------------------------------------------------------- /Editor/PassDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9f034f5e139407d4b83c2fed2d5c06e1 3 | timeCreated: 1697620992 -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2023 NullTale
2 | License for Non-Commercial Use with Author Attribution
3 | 4 | • For commercial use, consider purchasing a license from the Asset Store, or contact the author.
5 | 6 | • This product cannot be used in any commercial projects or activities with monetization purposes.
7 | • You may not sell, publish, or distribute the source code or any modifications of this product as your own.
8 | • The source code cannot be used to create other tools, be ported to other engines, or included in any commercial product.
9 | • Attribution ("Copyright (c) 2023 NullTale") must be retained in the final version of the product, including in executable or distributed forms.
10 | 11 | • You are free to use this product in non-commercial jam games, studies, and applications.
12 | • You may tweak or modify the product for personal use, without the right to distribute.
13 | 14 | • Any violation of the terms of this license may result in legal consequences.
15 | 16 | The software is provided "as is," without warranty of any kind, express or implied.
17 | The author disclaims any responsibility for illegal use and is not liable for any consequences arising from such use.
18 | 19 | ml: nulltale@gmail.com
20 | sm: https://x.com/nulltale
21 | ds: https://discord.gg/CkdQvtA5un
22 | -------------------------------------------------------------------------------- /LICENSE.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 15dbee7603a6c0c48a8c42471567197b 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Gradient Map 2 | Dev by NullTale
3 | [![Itch](https://img.shields.io/badge/Web-Itch?logo=Itch.io&color=white)](https://nulltale.itch.io) 4 | [![Twitter](https://img.shields.io/badge/Twitter-Twitter?logo=X&color=red)](https://twitter.com/NullTale) 5 | [![Tg](https://img.shields.io/badge/Tg-Telegram?logo=telegram&color=white)](https://t.me/nulltalescape)
6 | [![Asset Store](https://img.shields.io/badge/Asset%20Store-asd?logo=Unity&color=blue)](https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/270020) 7 | 8 | GradientMap post effect for Unity Urp, controlled via volume profile
9 | Works as render feature or a pass for selective post processing [VolFx](https://github.com/NullTale/VolFx) 10 | 11 | The concept is taken from graphic editors when an image a colored
12 | by gradient from their grayscale values ([gradietn map](https://www.bcit.cc/cms/lib04/NJ03000372/Centricity/Domain/299/p6_howto_use_gradient_maps%2018.pdf) in photoshop) 13 | 14 | ![_cover](https://github.com/NullTale/GradientMapFilter/assets/1497430/18cf6991-1486-49f8-bd38-099fe50ef500)
15 | > gradietn alpha - color of the original image 16 | 17 | ## Part of Artwork Project 18 | 19 | * [Vhs](https://github.com/NullTale/VhsFx) 20 | * [OldMovie](https://github.com/NullTale/OldMovieFx) 21 | * [GradientMap] 22 | * [Outline](https://github.com/NullTale/OutlineFilter) 23 | * [Flow](https://github.com/NullTale/FlowFx) 24 | * [Pixelation](https://github.com/NullTale/PixelationFx) 25 | * [Ascii](https://github.com/NullTale/AsciiFx) 26 | * [Dither](https://github.com/NullTale/DitherFx) 27 | * ... 28 | 29 | ## Usage 30 | Install via Unity [PackageManager](https://docs.unity3d.com/Manual/upm-ui-giturl.html)
31 | Add `GradientMap` RenderFeature to the UrpRenderer 32 | ``` 33 | https://github.com/NullTale/GradientMapFilter.git 34 | ``` 35 | 36 | Gradients a support runtime blending and can be used for palette swapping,
37 | creating short fx events or static pulsing of light as in the example. 38 | 39 | ![_animation](https://github.com/NullTale/GradientMapFilter/assets/1497430/206d8a47-4285-4ccb-9ca0-124184576afc) 40 | > example can be found in the project samples 41 | 42 | #### GradientMap like effect from Cult of the Lamb 43 | 44 | https://github.com/NullTale/GradientMapFilter/assets/1497430/84de70d6-fdfb-4b95-bf1c-afd46600bd98 45 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6042b2e1794724b479fa19ccb7fd00f5 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 967f419d80c69d14b9c62bf1b229f494 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Common.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 21be95d367ea98e4c990e5b432b4ee21 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Common/GradientParameter.cs: -------------------------------------------------------------------------------- 1 | #if !VOL_FX 2 | 3 | using System; 4 | using UnityEngine.Rendering; 5 | 6 | // GradientMap © NullTale - https://twitter.com/NullTale/ 7 | namespace VolFx 8 | { 9 | [Serializable] 10 | public class GradientParameter : VolumeParameter 11 | { 12 | public GradientParameter(GradientValue value, bool overrideState) : base(value, overrideState) { } 13 | 14 | public override void Interp(GradientValue from, GradientValue to, float t) 15 | { 16 | m_Value.Blend(from, to, t); 17 | } 18 | 19 | public override void SetValue(VolumeParameter parameter) 20 | { 21 | m_Value.SetValue(((VolumeParameter)parameter).value); 22 | } 23 | } 24 | } 25 | 26 | #endif -------------------------------------------------------------------------------- /Runtime/Common/GradientParameter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58cca4a72dd44e73a9e0a4bc9325f0cf 3 | timeCreated: 1699541999 -------------------------------------------------------------------------------- /Runtime/Common/GradientValue.cs: -------------------------------------------------------------------------------- 1 | #if !VOL_FX 2 | 3 | using System; 4 | using UnityEngine; 5 | 6 | // GradientMap © NullTale - https://twitter.com/NullTale/ 7 | namespace VolFx 8 | { 9 | [Serializable] 10 | public class GradientValue 11 | { 12 | public const int k_Width = 32; 13 | 14 | public Gradient _grad; 15 | public Color[] _pixels; 16 | 17 | internal bool _build; 18 | 19 | public static GradientValue White 20 | { 21 | get 22 | { 23 | var grad = new Gradient(); 24 | grad.SetKeys(new []{new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f)}, new GradientAlphaKey[]{new GradientAlphaKey(1f, 0f), new GradientAlphaKey(1f, 0f)}); 25 | 26 | return new GradientValue(grad); 27 | } 28 | } 29 | 30 | // ======================================================================= 31 | public void Build(GradientMode _mode) 32 | { 33 | _build = true; 34 | 35 | _grad.mode = _mode; 36 | _pixels = new Color[k_Width]; 37 | 38 | for (var x = 0; x < k_Width; x++) 39 | _pixels[x] = _grad.Evaluate(x / (float)(k_Width - 1)); 40 | } 41 | 42 | internal void SetValue(GradientValue val) 43 | { 44 | if (val._build == false) 45 | val.Build(val._grad.mode); 46 | 47 | _grad = val._grad; 48 | val._pixels.CopyTo(_pixels, 0); 49 | } 50 | 51 | public void Blend(GradientValue a, GradientValue b, float t) 52 | { 53 | _build = true; 54 | 55 | for (var x = 0; x < k_Width; x++) 56 | _pixels[x] = Color.LerpUnclamped(a._pixels[x], b._pixels[x], t); 57 | 58 | _grad.mode = t < .5f ? a._grad.mode : b._grad.mode; 59 | } 60 | 61 | public Texture2D GetTexture(ref Texture2D tex) 62 | { 63 | if (tex == null) 64 | { 65 | tex = new Texture2D(GradientValue.k_Width, 1, TextureFormat.RGBA32, false); 66 | tex.wrapMode = TextureWrapMode.Clamp; 67 | tex.filterMode = FilterMode.Bilinear; 68 | } 69 | 70 | tex.SetPixels(_pixels); 71 | tex.Apply(); 72 | 73 | return tex; 74 | } 75 | 76 | public GradientValue(Gradient grad) 77 | { 78 | _grad = grad; 79 | _pixels = new Color[k_Width]; 80 | for (var n = 0; n < k_Width; n++) 81 | _pixels[n] = grad.Evaluate(n / (float)(k_Width - 1)); 82 | } 83 | } 84 | } 85 | 86 | #endif -------------------------------------------------------------------------------- /Runtime/Common/GradientValue.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 65ffb3334aa7452d849681768ac0b92a 3 | timeCreated: 1699541999 -------------------------------------------------------------------------------- /Runtime/Common/Optional.cs: -------------------------------------------------------------------------------- 1 | #if !VOL_FX 2 | 3 | using System; 4 | using UnityEngine; 5 | 6 | // GradientMap © NullTale - https://twitter.com/NullTale/ 7 | namespace VolFx 8 | { 9 | [Serializable] 10 | public sealed class Optional 11 | { 12 | [SerializeField] 13 | internal bool enabled; 14 | 15 | [SerializeField] 16 | internal T value = default!; 17 | 18 | public bool Enabled 19 | { 20 | get => enabled; 21 | set => enabled = value; 22 | } 23 | 24 | public T Value 25 | { 26 | get => value; 27 | set => this.value = value; 28 | } 29 | 30 | // ======================================================================= 31 | public Optional(bool enabled) 32 | { 33 | this.enabled = enabled; 34 | } 35 | 36 | public Optional(T value, bool enabled) 37 | { 38 | this.enabled = enabled; 39 | this.value = value; 40 | } 41 | 42 | public T GetValue(T disabledValue) 43 | { 44 | return enabled ? value : disabledValue; 45 | } 46 | 47 | public T GetValueOrDefault() 48 | { 49 | return enabled ? value : default; 50 | } 51 | 52 | public T GetValueOrDefault(T fallback) 53 | { 54 | return enabled ? value : fallback; 55 | } 56 | 57 | public static implicit operator bool(Optional opt) 58 | { 59 | return opt.enabled; 60 | } 61 | 62 | public static implicit operator T(Optional opt) 63 | { 64 | return opt.value; 65 | } 66 | } 67 | } 68 | 69 | #endif -------------------------------------------------------------------------------- /Runtime/Common/Optional.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5e57f1764c1aa484f8c3f6bfcd1046f9 3 | timeCreated: 1697616851 -------------------------------------------------------------------------------- /Runtime/Common/RenderTarget.cs: -------------------------------------------------------------------------------- 1 | #if !VOL_FX 2 | 3 | using UnityEngine; 4 | using UnityEngine.Rendering; 5 | 6 | // GradientMap © NullTale - https://twitter.com/NullTale/ 7 | namespace VolFx 8 | { 9 | public class RenderTarget 10 | { 11 | public RTHandle Handle; 12 | public int Id; 13 | private bool _allocated; 14 | 15 | // ======================================================================= 16 | public RenderTarget Allocate(RenderTexture rt, string name) 17 | { 18 | Handle = RTHandles.Alloc(rt, name); 19 | Id = Shader.PropertyToID(name); 20 | return this; 21 | } 22 | 23 | public RenderTarget Allocate(string name) 24 | { 25 | Handle = RTHandles.Alloc(name, name: name); 26 | Id = Shader.PropertyToID(name); 27 | return this; 28 | } 29 | 30 | public void Get(CommandBuffer cmd, in RenderTextureDescriptor desc) 31 | { 32 | _allocated = true; 33 | cmd.GetTemporaryRT(Id, desc); 34 | } 35 | 36 | public void Get(CommandBuffer cmd, in RenderTextureDescriptor desc, FilterMode filter) 37 | { 38 | _allocated = true; 39 | cmd.GetTemporaryRT(Id, desc, filter); 40 | } 41 | 42 | public void Release(CommandBuffer cmd) 43 | { 44 | if (_allocated == false) 45 | return; 46 | 47 | _allocated = false; 48 | cmd.ReleaseTemporaryRT(Id); 49 | } 50 | 51 | public static implicit operator RTHandle(RenderTarget rt) => rt.Handle; 52 | } 53 | } 54 | 55 | #endif -------------------------------------------------------------------------------- /Runtime/Common/RenderTarget.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3d890e809a9f18a4ca73a59eaaebb9a6 3 | timeCreated: 1697618098 -------------------------------------------------------------------------------- /Runtime/Common/ShaderNameAttribute.cs: -------------------------------------------------------------------------------- 1 | #if !VOL_FX 2 | 3 | using System; 4 | 5 | // GradientMap © NullTale - https://twitter.com/NullTale/ 6 | namespace VolFx 7 | { 8 | /// 9 | /// Used to get shader link for pass material 10 | /// 11 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] 12 | public class ShaderNameAttribute : Attribute 13 | { 14 | public string _name; 15 | 16 | public ShaderNameAttribute(string name) 17 | { 18 | _name = name; 19 | } 20 | } 21 | } 22 | 23 | #endif -------------------------------------------------------------------------------- /Runtime/Common/ShaderNameAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d32804264108c9844b0844582e7ad3ac 3 | timeCreated: 1697614508 -------------------------------------------------------------------------------- /Runtime/Common/Utils.cs: -------------------------------------------------------------------------------- 1 | #if !VOL_FX 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using UnityEngine; 6 | using UnityEngine.Rendering; 7 | using Random = UnityEngine.Random; 8 | 9 | // GradientMap © NullTale - https://twitter.com/NullTale/ 10 | namespace VolFx 11 | { 12 | public static class Utils 13 | { 14 | public static int s_MainTexId = Shader.PropertyToID("_MainTex"); 15 | 16 | private static Mesh s_FullscreenQuad; 17 | private static Mesh s_FullscreenTriangle; 18 | public static Mesh FullscreenMesh 19 | { 20 | get 21 | { 22 | _initFullScreenMeshes(); 23 | return s_FullscreenTriangle; 24 | } 25 | } 26 | 27 | public static Matrix4x4 s_IndentityInvert = new Matrix4x4(new Vector4(1, 0, 0, 0), new Vector4(0, -1, 0, 0), new Vector4(0, 0, 1, 0), new Vector4(0, 0, 0, 1)); 28 | 29 | // ======================================================================= 30 | private static void _initFullScreenMeshes() 31 | { 32 | // quad 33 | if (s_FullscreenQuad == null) 34 | { 35 | s_FullscreenQuad = new Mesh { name = "Fullscreen Quad" }; 36 | s_FullscreenQuad.SetVertices(new List 37 | { 38 | new Vector3(-1.0f, -1.0f, 0.0f), 39 | new Vector3(-1.0f, 1.0f, 0.0f), 40 | new Vector3(1.0f, -1.0f, 0.0f), 41 | new Vector3(1.0f, 1.0f, 0.0f) 42 | }); 43 | 44 | s_FullscreenQuad.SetUVs(0, new List 45 | { 46 | new Vector2(0.0f, 1f), 47 | new Vector2(0.0f, 0f), 48 | new Vector2(1.0f, 1f), 49 | new Vector2(1.0f, 0f) 50 | }); 51 | 52 | s_FullscreenQuad.SetIndices(new[] { 0, 1, 2, 2, 1, 3 }, MeshTopology.Triangles, 0, false); 53 | s_FullscreenQuad.UploadMeshData(true); 54 | } 55 | 56 | // triangle 57 | if (s_FullscreenTriangle == null) 58 | { 59 | s_FullscreenTriangle = new Mesh() { name = "Fullscreen Triangle" }; 60 | s_FullscreenTriangle.vertices = _verts(0f); 61 | s_FullscreenTriangle.uv = _texCoords(); 62 | s_FullscreenTriangle.triangles = new int[3] { 0, 1, 2 }; 63 | 64 | s_FullscreenTriangle.UploadMeshData(true); 65 | 66 | // ----------------------------------------------------------------------- 67 | Vector3[] _verts(float z) 68 | { 69 | var r = new Vector3[3]; 70 | for (var i = 0; i < 3; i++) 71 | { 72 | var uv = new Vector2((i << 1) & 2, i & 2); 73 | r[i] = new Vector3(uv.x * 2f - 1f, uv.y * 2f - 1f, z); 74 | } 75 | 76 | return r; 77 | } 78 | 79 | Vector2[] _texCoords() 80 | { 81 | var r = new Vector2[3]; 82 | for (var i = 0; i < 3; i++) 83 | { 84 | if (SystemInfo.graphicsUVStartsAtTop) 85 | r[i] = new Vector2((i << 1) & 2, 1.0f - (i & 2)); 86 | else 87 | r[i] = new Vector2((i << 1) & 2, i & 2); 88 | } 89 | 90 | return r; 91 | } 92 | } 93 | } 94 | 95 | public static void Blit(CommandBuffer cmd, RTHandle source, RTHandle destination, Material material, int pass = 0, bool invert = false) 96 | { 97 | cmd.SetGlobalTexture(s_MainTexId, source); 98 | cmd.SetRenderTarget(destination, 0); 99 | cmd.DrawMesh(FullscreenMesh, invert ? s_IndentityInvert : Matrix4x4.identity, material, 0, pass); 100 | } 101 | 102 | public static Vector2 ToNormal(this float rad) 103 | { 104 | return new Vector2(Mathf.Cos(rad), Mathf.Sin(rad)); 105 | } 106 | 107 | public static float Round(this float f) 108 | { 109 | return Mathf.Round(f); 110 | } 111 | 112 | public static float Clamp01(this float f) 113 | { 114 | return Mathf.Clamp01(f); 115 | } 116 | 117 | public static float OneMinus(this float f) 118 | { 119 | return 1f - f; 120 | } 121 | 122 | public static float Remap(this float f, float min, float max) 123 | { 124 | return min + (max - min) * f; 125 | } 126 | 127 | public static Color Color() 128 | { 129 | return new Color(Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f), 130 | Random.Range(0.0f, 1.0f), 1.0f); 131 | } 132 | 133 | public static Vector3 WithZ(this Vector3 vector, float z) 134 | { 135 | return new Vector3(vector.x, vector.y, z); 136 | } 137 | 138 | public static Vector2 To2DXY(this Vector3 vector) 139 | { 140 | return new Vector2(vector.x, vector.y); 141 | } 142 | 143 | public static Vector3 To3DXZ(this Vector2 vector) 144 | { 145 | return vector.To3DXZ(0); 146 | } 147 | 148 | public static Vector3 To3DXZ(this Vector2 vector, float y) 149 | { 150 | return new Vector3(vector.x, y, vector.y); 151 | } 152 | 153 | public static Vector3 To3DXY(this Vector2 vector, float z) 154 | { 155 | return new Vector3(vector.x, vector.y, z); 156 | } 157 | 158 | public static Vector2 ToVector2XY(this float value) 159 | { 160 | return new Vector2(value, value); 161 | } 162 | 163 | public static Color MulA(this Color color, float a) 164 | { 165 | return new Color(color.r, color.g, color.b, color.a * a); 166 | } 167 | 168 | public static Rect GetRect(this Texture2D texture) 169 | { 170 | return new Rect(0, 0, texture.width, texture.height); 171 | } 172 | 173 | public static int RoundToInt(this float f) 174 | { 175 | return Mathf.RoundToInt(f); 176 | } 177 | 178 | public static TKey MaxOrDefault(this IEnumerable source, Func selector, TSource noOptionsValue = default) 179 | { 180 | var result = source.MaxOrDefault(selector, Comparer.Default, noOptionsValue); 181 | if (Equals(result, default)) 182 | return default; 183 | 184 | return selector(result); 185 | } 186 | 187 | public static TSource MaxOrDefault(this IEnumerable source, Func selector, IComparer comparer, TSource fallback = default) 188 | { 189 | using (var sourceIterator = source.GetEnumerator()) 190 | { 191 | if (sourceIterator.MoveNext() == false) 192 | return fallback; 193 | 194 | var max = sourceIterator.Current; 195 | var maxKey = selector(max); 196 | 197 | while (sourceIterator.MoveNext()) 198 | { 199 | var candidate = sourceIterator.Current; 200 | var candidateProjected = selector(candidate); 201 | 202 | if (comparer.Compare(candidateProjected, maxKey) > 0) 203 | { 204 | max = candidate; 205 | maxKey = candidateProjected; 206 | } 207 | } 208 | return max; 209 | } 210 | } 211 | } 212 | } 213 | 214 | #endif -------------------------------------------------------------------------------- /Runtime/Common/Utils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dc74c71a726a10b4587a9f693d3d08b7 3 | timeCreated: 1697614648 -------------------------------------------------------------------------------- /Runtime/Common/VolFx.Pass.cs: -------------------------------------------------------------------------------- 1 | #if !VOL_FX 2 | 3 | using System; 4 | using System.IO; 5 | using System.Linq; 6 | using UnityEngine; 7 | using UnityEngine.Rendering; 8 | using UnityEngine.Rendering.Universal; 9 | 10 | // GradientMap © NullTale - https://twitter.com/NullTale/ 11 | namespace VolFx 12 | { 13 | public static class VolFx 14 | { 15 | [Serializable] 16 | public abstract class Pass : ScriptableObject 17 | { 18 | [NonSerialized] 19 | public GradientMap _owner; 20 | [SerializeField] 21 | internal bool _active = true; 22 | [SerializeField] [HideInInspector] 23 | private Shader _shader; 24 | protected Material _material; 25 | private bool _isActive; 26 | 27 | protected VolumeStack Stack => VolumeManager.instance.stack; 28 | 29 | protected virtual bool Invert => false; 30 | 31 | // ======================================================================= 32 | internal bool IsActive 33 | { 34 | get => _isActive && _active && _material != null; 35 | set => _isActive = value; 36 | } 37 | 38 | public void SetActive(bool isActive) 39 | { 40 | _active = isActive; 41 | } 42 | 43 | internal void _init() 44 | { 45 | #if UNITY_EDITOR 46 | #if !UNITY_2022_1_OR_NEWER 47 | Debug.LogError($"{System.Reflection.Assembly.GetExecutingAssembly().GetName().Name} require Unity 2022 or higher"); 48 | #endif 49 | if (_shader == null || _material == null) 50 | { 51 | var shaderName = GetType().GetCustomAttributes(typeof(ShaderNameAttribute), true).FirstOrDefault() as ShaderNameAttribute; 52 | if (shaderName != null) 53 | { 54 | _shader = Shader.Find(shaderName._name); 55 | UnityEditor.EditorUtility.SetDirty(this); 56 | } 57 | } 58 | #endif 59 | 60 | if (_shader != null) 61 | _material = new Material(_shader); 62 | 63 | Init(); 64 | } 65 | 66 | public virtual void Invoke(CommandBuffer cmd, RTHandle source, RTHandle dest, ScriptableRenderContext context, ref RenderingData renderingData) 67 | { 68 | Utils.Blit(cmd, source, dest, _material, 0, Invert); 69 | } 70 | 71 | public void Validate() 72 | { 73 | #if UNITY_EDITOR 74 | if (_shader == null || _editorValidate) 75 | { 76 | var shaderName = GetType().GetCustomAttributes(typeof(ShaderNameAttribute), true).FirstOrDefault() as ShaderNameAttribute; 77 | if (shaderName != null) 78 | { 79 | _shader = Shader.Find(shaderName._name); 80 | var assetPath = UnityEditor.AssetDatabase.GetAssetPath(_shader); 81 | if (string.IsNullOrEmpty(assetPath) == false) 82 | _editorSetup(Path.GetDirectoryName(assetPath), Path.GetFileNameWithoutExtension(assetPath)); 83 | 84 | UnityEditor.EditorUtility.SetDirty(this); 85 | } 86 | } 87 | 88 | if ((_material == null || _material.shader != _shader) && _shader != null) 89 | { 90 | _material = new Material(_shader); 91 | Init(); 92 | } 93 | #endif 94 | 95 | IsActive = Validate(_material); 96 | } 97 | 98 | /// 99 | /// called to initialize pass when material is created 100 | /// 101 | public virtual void Init() 102 | { 103 | } 104 | 105 | /// 106 | /// called each frame to check is render is required and setup render material 107 | /// 108 | public abstract bool Validate(Material mat); 109 | 110 | /// 111 | /// frame clean up function used if implemented custom Invoke function to release resources 112 | /// 113 | public virtual void Cleanup(CommandBuffer cmd) 114 | { 115 | } 116 | 117 | /// 118 | /// used for optimization purposes, returns true if we need to call _editorSetup function 119 | /// 120 | protected virtual bool _editorValidate => false; 121 | 122 | /// 123 | /// editor validation function, used to gather additional references 124 | /// 125 | protected virtual void _editorSetup(string folder, string asset) 126 | { 127 | } 128 | } 129 | } 130 | } 131 | 132 | #endif -------------------------------------------------------------------------------- /Runtime/Common/VolFx.Pass.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f5835092ffcff9a4684c477d34745166 3 | timeCreated: 1697796247 -------------------------------------------------------------------------------- /Runtime/GradientMap.Runtime.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "GradientMap.Runtime", 3 | "rootNamespace": "", 4 | "references": [ 5 | "GUID:df380645f10b7bc4b97d4f5eb6303d95", 6 | "GUID:15fc0a57446b3144c949da3e2b9737a9", 7 | "GUID:dc4014d4779276744964fcb5a4a453d9", 8 | "GUID:90b40cd545ffe604cb2f7e5fae44f47c" 9 | ], 10 | "includePlatforms": [], 11 | "excludePlatforms": [], 12 | "allowUnsafeCode": false, 13 | "overrideReferences": false, 14 | "precompiledReferences": [], 15 | "autoReferenced": true, 16 | "defineConstraints": [], 17 | "versionDefines": [ 18 | { 19 | "name": "www.nulltale.volfx", 20 | "expression": "1", 21 | "define": "VOL_FX" 22 | }, 23 | { 24 | "name": "www.nulltale.artistictools", 25 | "expression": "1", 26 | "define": "ARTISTIC_TOOLS" 27 | } 28 | ], 29 | "noEngineReferences": false 30 | } -------------------------------------------------------------------------------- /Runtime/GradientMap.Runtime.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2697366c92a0c3d4e91df16bd8adabd2 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime/GradientMap.cs: -------------------------------------------------------------------------------- 1 | #if !VOL_FX 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | using UnityEngine; 6 | using UnityEngine.Rendering; 7 | using UnityEngine.Rendering.Universal; 8 | 9 | // GradientMap © NullTale - https://twitter.com/NullTale/ 10 | namespace VolFx 11 | { 12 | public class GradientMap : ScriptableRendererFeature 13 | { 14 | protected static List k_ShaderTags; 15 | 16 | public static int s_BlitTexId = Shader.PropertyToID("_BlitTexture"); 17 | public static int s_BlitScaleBiasId = Shader.PropertyToID("_BlitScaleBias"); 18 | 19 | [Tooltip("When to execute")] 20 | public RenderPassEvent _event = RenderPassEvent.AfterRenderingPostProcessing; 21 | 22 | public GradientMapPass _pass; 23 | 24 | [HideInInspector] 25 | public Shader _blitShader; 26 | 27 | [NonSerialized] 28 | public Material _blit; 29 | 30 | [NonSerialized] 31 | public PassExecution _execution; 32 | 33 | // ======================================================================= 34 | public class PassExecution : ScriptableRenderPass 35 | { 36 | public GradientMap _owner; 37 | private RenderTarget _output; 38 | 39 | // ======================================================================= 40 | public void Init() 41 | { 42 | renderPassEvent = _owner._event; 43 | 44 | _output = new RenderTarget().Allocate(_owner.name); 45 | } 46 | 47 | public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) 48 | { 49 | _owner._pass.Validate(); 50 | if (_owner._pass.IsActive == false) 51 | return; 52 | 53 | // allocate stuff 54 | var cmd = CommandBufferPool.Get(_owner.name); 55 | ref var cameraData = ref renderingData.cameraData; 56 | ref var desc = ref cameraData.cameraTargetDescriptor; 57 | _output.Get(cmd, in desc); 58 | 59 | var source = _getCameraTex(ref renderingData); 60 | 61 | // draw post process chain 62 | _owner._pass.Invoke(cmd, source, _output.Handle, context, ref renderingData); 63 | _owner.Blit(cmd, _output.Handle, source); 64 | 65 | context.ExecuteCommandBuffer(cmd); 66 | cmd.Clear(); 67 | CommandBufferPool.Release(cmd); 68 | 69 | // ----------------------------------------------------------------------- 70 | RTHandle _getCameraTex(ref RenderingData renderingData) 71 | { 72 | ref var cameraData = ref renderingData.cameraData; 73 | #if UNITY_2022_1_OR_NEWER 74 | return cameraData.renderer.cameraColorTargetHandle; 75 | #else 76 | return RTHandles.Alloc(cameraData.renderer.cameraColorTarget); 77 | #endif 78 | } 79 | } 80 | 81 | public override void FrameCleanup(CommandBuffer cmd) 82 | { 83 | _output.Release(cmd); 84 | _output.Release(cmd); 85 | _owner._pass.Cleanup(cmd); 86 | } 87 | } 88 | 89 | // ======================================================================= 90 | public void Blit(CommandBuffer cmd, RTHandle source, RTHandle destination) 91 | { 92 | cmd.SetGlobalVector(s_BlitScaleBiasId, new Vector4(1, 1, 0)); 93 | cmd.SetGlobalTexture(s_BlitTexId, source); 94 | cmd.SetRenderTarget(destination, 0); 95 | cmd.DrawMesh(Utils.FullscreenMesh, Matrix4x4.identity, _blit, 0, 0); 96 | } 97 | 98 | public override void Create() 99 | { 100 | #if UNITY_EDITOR 101 | _blitShader = Shader.Find("Hidden/Universal Render Pipeline/Blit"); 102 | 103 | UnityEditor.EditorUtility.SetDirty(this); 104 | #endif 105 | _blit = new Material(_blitShader); 106 | _execution = new PassExecution() { _owner = this }; 107 | _execution.Init(); 108 | 109 | if (_pass != null) 110 | _pass._init(); 111 | 112 | if (k_ShaderTags == null) 113 | { 114 | k_ShaderTags = new List(new[] 115 | { 116 | new ShaderTagId("SRPDefaultUnlit"), 117 | new ShaderTagId("UniversalForward"), 118 | new ShaderTagId("UniversalForwardOnly") 119 | }); 120 | } 121 | } 122 | 123 | private void Reset() 124 | { 125 | #if UNITY_EDITOR 126 | if (_pass != null) 127 | { 128 | UnityEditor.AssetDatabase.RemoveObjectFromAsset(_pass); 129 | UnityEditor.AssetDatabase.SaveAssets(); 130 | _pass = null; 131 | } 132 | #endif 133 | } 134 | 135 | public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) 136 | { 137 | if (renderingData.cameraData.cameraType != CameraType.Game) 138 | return; 139 | #if UNITY_EDITOR 140 | if (_blit == null) 141 | _blit = new Material(_blitShader); 142 | 143 | if (_pass == null) 144 | return; 145 | #endif 146 | renderer.EnqueuePass(_execution); 147 | } 148 | 149 | private void OnDestroy() 150 | { 151 | #if UNITY_EDITOR 152 | if (_pass != null) 153 | { 154 | UnityEditor.AssetDatabase.RemoveObjectFromAsset(_pass); 155 | UnityEditor.AssetDatabase.SaveAssets(); 156 | _pass = null; 157 | } 158 | #endif 159 | } 160 | } 161 | } 162 | 163 | #endif -------------------------------------------------------------------------------- /Runtime/GradientMap.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ce35fadec2d801e408a542f6c6d075d1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/GradientMap.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 342a86d1065c437085a98c561cd2e451 3 | timeCreated: 1699541924 -------------------------------------------------------------------------------- /Runtime/GradientMap/GradientMap.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/Vol/GradientMap" 2 | { 3 | Properties 4 | { 5 | _Intensity("Intensity", Float) = 1 6 | _Mask("Mask", Vector) = (0,0,0,0) 7 | [NoScaleOffset] 8 | _GradientTex("Gradient", 2D) = "red" {} 9 | } 10 | 11 | SubShader 12 | { 13 | name "Gradient Map" 14 | 15 | Tags { "RenderType"="Opaque" "RenderPipeline" = "UniversalPipeline" } 16 | LOD 0 17 | 18 | ZTest Always 19 | ZWrite Off 20 | ZClip false 21 | Cull Off 22 | 23 | Pass 24 | { 25 | HLSLPROGRAM 26 | 27 | #pragma vertex vert 28 | #pragma fragment frag 29 | 30 | float _Intensity; 31 | float4 _Mask; 32 | 33 | sampler2D _MainTex; 34 | sampler2D _GradientTex; 35 | 36 | struct vert_in 37 | { 38 | float4 vertex : POSITION; 39 | float2 uv : TEXCOORD0; 40 | }; 41 | 42 | struct frag_in 43 | { 44 | float4 vertex : SV_POSITION; 45 | float2 uv : TEXCOORD0; 46 | }; 47 | 48 | frag_in vert (vert_in v) 49 | { 50 | frag_in o; 51 | o.vertex = v.vertex; 52 | o.uv = v.uv; 53 | return o; 54 | } 55 | 56 | half luma(half3 rgb) 57 | { 58 | return dot(rgb, half3(.299, .587, .114)); 59 | } 60 | 61 | half4 frag (frag_in i) : SV_Target 62 | { 63 | half4 initial = tex2D(_MainTex, i.uv); 64 | half val = luma(initial.rgb); 65 | half4 result = tex2D(_GradientTex, float2(val, 0)); 66 | half mask = step(_Mask.x, val) * step(val, _Mask.y); 67 | 68 | return half4(lerp(initial.rgb, result.rgb, _Intensity * result.a * mask), initial.a); 69 | } 70 | ENDHLSL 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /Runtime/GradientMap/GradientMap.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a514e8b11f1f2c84fbf65a67aef20247 3 | timeCreated: 1699541924 -------------------------------------------------------------------------------- /Runtime/GradientMap/GradientMapPass.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | // GradientMap © NullTale - https://twitter.com/NullTale/ 4 | namespace VolFx 5 | { 6 | [ShaderName("Hidden/Vol/GradientMap")] 7 | public class GradientMapPass : VolFx.Pass 8 | { 9 | private static readonly int s_Intensity = Shader.PropertyToID("_Intensity"); 10 | private static readonly int s_Gradient = Shader.PropertyToID("_GradientTex"); 11 | private static readonly int s_Weights = Shader.PropertyToID("_Weights"); 12 | private static readonly int s_Mask = Shader.PropertyToID("_Mask"); 13 | 14 | private Texture2D _tex; 15 | 16 | // ======================================================================= 17 | public override bool Validate(Material mat) 18 | { 19 | var settings = Stack.GetComponent(); 20 | 21 | if (settings.IsActive() == false) 22 | return false; 23 | 24 | if (_tex == null) 25 | { 26 | _tex = new Texture2D(GradientValue.k_Width, 1, TextureFormat.RGBA32, false); 27 | _tex.wrapMode = TextureWrapMode.Clamp; 28 | } 29 | 30 | var grad = settings.m_Gradient.value; 31 | _tex.filterMode = grad._grad.mode == GradientMode.Fixed ? FilterMode.Point : FilterMode.Bilinear; 32 | _tex.SetPixels(grad._pixels); 33 | _tex.Apply(); 34 | 35 | mat.SetTexture(s_Gradient, _tex); 36 | mat.SetFloat(s_Intensity, settings.m_Weight.value); 37 | var mask = settings.m_Mask.value; 38 | if (mask.x == mask.y) 39 | mask.x += 0.01f; 40 | mat.SetVector(s_Mask, mask); 41 | 42 | return true; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Runtime/GradientMap/GradientMapPass.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd2a4b3d690f2bf4e86dd31042741bd9 3 | timeCreated: 1699541924 -------------------------------------------------------------------------------- /Runtime/GradientMap/GradientMapVol.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Rendering; 4 | using UnityEngine.Rendering.Universal; 5 | 6 | // GradientMap © NullTale - https://twitter.com/NullTale/ 7 | namespace VolFx 8 | { 9 | [Serializable, VolumeComponentMenu("VolFx/Gradient Map")] 10 | public sealed class GradientMapVol : VolumeComponent, IPostProcessComponent 11 | { 12 | public static GradientValue Default 13 | { 14 | get 15 | { 16 | var grad = new Gradient(); 17 | grad.SetKeys(new []{new GradientColorKey(Color.black, 0f), new GradientColorKey(Color.white, 1f)}, new GradientAlphaKey[]{new GradientAlphaKey(0f, 0f), new GradientAlphaKey(0f, 0f)}); 18 | 19 | return new GradientValue(grad); 20 | } 21 | } 22 | 23 | public ClampedFloatParameter m_Weight = new ClampedFloatParameter(0, 0, 1f); 24 | public GradientParameter m_Gradient = new GradientParameter(Default, false); 25 | public FloatRangeParameter m_Mask = new FloatRangeParameter(new Vector2(0, 1), 0, 1); 26 | 27 | // ======================================================================= 28 | public bool IsActive() => active && m_Weight.value > 0; 29 | 30 | public bool IsTileCompatible() => false; 31 | } 32 | } -------------------------------------------------------------------------------- /Runtime/GradientMap/GradientMapVol.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 879d36677dce8fc44b9cdab1a838d2d1 3 | timeCreated: 1699541924 -------------------------------------------------------------------------------- /Samples~/GradientMap.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 3 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 12 47 | m_GIWorkflowMode: 1 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 0 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 512 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 256 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 1 83 | m_PVRDenoiserTypeDirect: 1 84 | m_PVRDenoiserTypeIndirect: 1 85 | m_PVRDenoiserTypeAO: 1 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 1 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_LightingSettings: {fileID: 0} 102 | --- !u!196 &4 103 | NavMeshSettings: 104 | serializedVersion: 2 105 | m_ObjectHideFlags: 0 106 | m_BuildSettings: 107 | serializedVersion: 3 108 | agentTypeID: 0 109 | agentRadius: 0.5 110 | agentHeight: 2 111 | agentSlope: 45 112 | agentClimb: 0.4 113 | ledgeDropHeight: 0 114 | maxJumpAcrossDistance: 0 115 | minRegionArea: 2 116 | manualCellSize: 0 117 | cellSize: 0.16666667 118 | manualTileSize: 0 119 | tileSize: 256 120 | buildHeightMesh: 0 121 | maxJobWorkers: 0 122 | preserveTilesOutsideBounds: 0 123 | debug: 124 | m_Flags: 0 125 | m_NavMeshData: {fileID: 0} 126 | --- !u!1 &779545139 127 | GameObject: 128 | m_ObjectHideFlags: 0 129 | m_CorrespondingSourceObject: {fileID: 0} 130 | m_PrefabInstance: {fileID: 0} 131 | m_PrefabAsset: {fileID: 0} 132 | serializedVersion: 6 133 | m_Component: 134 | - component: {fileID: 779545142} 135 | - component: {fileID: 779545141} 136 | - component: {fileID: 779545140} 137 | - component: {fileID: 779545143} 138 | m_Layer: 0 139 | m_Name: Camera 140 | m_TagString: MainCamera 141 | m_Icon: {fileID: 0} 142 | m_NavMeshLayer: 0 143 | m_StaticEditorFlags: 0 144 | m_IsActive: 1 145 | --- !u!81 &779545140 146 | AudioListener: 147 | m_ObjectHideFlags: 0 148 | m_CorrespondingSourceObject: {fileID: 0} 149 | m_PrefabInstance: {fileID: 0} 150 | m_PrefabAsset: {fileID: 0} 151 | m_GameObject: {fileID: 779545139} 152 | m_Enabled: 1 153 | --- !u!20 &779545141 154 | Camera: 155 | m_ObjectHideFlags: 0 156 | m_CorrespondingSourceObject: {fileID: 0} 157 | m_PrefabInstance: {fileID: 0} 158 | m_PrefabAsset: {fileID: 0} 159 | m_GameObject: {fileID: 779545139} 160 | m_Enabled: 1 161 | serializedVersion: 2 162 | m_ClearFlags: 2 163 | m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} 164 | m_projectionMatrixMode: 1 165 | m_GateFitMode: 2 166 | m_FOVAxisMode: 0 167 | m_Iso: 200 168 | m_ShutterSpeed: 0.005 169 | m_Aperture: 16 170 | m_FocusDistance: 10 171 | m_FocalLength: 50 172 | m_BladeCount: 5 173 | m_Curvature: {x: 2, y: 11} 174 | m_BarrelClipping: 0.25 175 | m_Anamorphism: 0 176 | m_SensorSize: {x: 36, y: 24} 177 | m_LensShift: {x: 0, y: 0} 178 | m_NormalizedViewPortRect: 179 | serializedVersion: 2 180 | x: 0 181 | y: 0 182 | width: 1 183 | height: 1 184 | near clip plane: 0.3 185 | far clip plane: 1000 186 | field of view: 60 187 | orthographic: 1 188 | orthographic size: 5.32 189 | m_Depth: -1 190 | m_CullingMask: 191 | serializedVersion: 2 192 | m_Bits: 4294967295 193 | m_RenderingPath: -1 194 | m_TargetTexture: {fileID: 0} 195 | m_TargetDisplay: 0 196 | m_TargetEye: 3 197 | m_HDR: 1 198 | m_AllowMSAA: 1 199 | m_AllowDynamicResolution: 0 200 | m_ForceIntoRT: 0 201 | m_OcclusionCulling: 1 202 | m_StereoConvergence: 10 203 | m_StereoSeparation: 0.022 204 | --- !u!4 &779545142 205 | Transform: 206 | m_ObjectHideFlags: 0 207 | m_CorrespondingSourceObject: {fileID: 0} 208 | m_PrefabInstance: {fileID: 0} 209 | m_PrefabAsset: {fileID: 0} 210 | m_GameObject: {fileID: 779545139} 211 | serializedVersion: 2 212 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 213 | m_LocalPosition: {x: 0, y: 0, z: -10} 214 | m_LocalScale: {x: 1, y: 1, z: 1} 215 | m_ConstrainProportionsScale: 0 216 | m_Children: [] 217 | m_Father: {fileID: 0} 218 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 219 | --- !u!114 &779545143 220 | MonoBehaviour: 221 | m_ObjectHideFlags: 0 222 | m_CorrespondingSourceObject: {fileID: 0} 223 | m_PrefabInstance: {fileID: 0} 224 | m_PrefabAsset: {fileID: 0} 225 | m_GameObject: {fileID: 779545139} 226 | m_Enabled: 1 227 | m_EditorHideFlags: 0 228 | m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} 229 | m_Name: 230 | m_EditorClassIdentifier: 231 | m_RenderShadows: 1 232 | m_RequiresDepthTextureOption: 2 233 | m_RequiresOpaqueTextureOption: 2 234 | m_CameraType: 0 235 | m_Cameras: [] 236 | m_RendererIndex: -1 237 | m_VolumeLayerMask: 238 | serializedVersion: 2 239 | m_Bits: 1 240 | m_VolumeTrigger: {fileID: 0} 241 | m_VolumeFrameworkUpdateModeOption: 2 242 | m_RenderPostProcessing: 1 243 | m_Antialiasing: 0 244 | m_AntialiasingQuality: 2 245 | m_StopNaN: 0 246 | m_Dithering: 0 247 | m_ClearDepth: 1 248 | m_AllowXRRendering: 1 249 | m_AllowHDROutput: 1 250 | m_UseScreenCoordOverride: 0 251 | m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0} 252 | m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} 253 | m_RequiresDepthTexture: 0 254 | m_RequiresColorTexture: 0 255 | m_Version: 2 256 | m_TaaSettings: 257 | quality: 3 258 | frameInfluence: 0.1 259 | jitterScale: 1 260 | mipBias: 0 261 | varianceClampScale: 0.9 262 | contrastAdaptiveSharpening: 0 263 | --- !u!1 &834110885 264 | GameObject: 265 | m_ObjectHideFlags: 0 266 | m_CorrespondingSourceObject: {fileID: 0} 267 | m_PrefabInstance: {fileID: 0} 268 | m_PrefabAsset: {fileID: 0} 269 | serializedVersion: 6 270 | m_Component: 271 | - component: {fileID: 834110887} 272 | - component: {fileID: 834110886} 273 | m_Layer: 0 274 | m_Name: Vol_A 275 | m_TagString: Untagged 276 | m_Icon: {fileID: 0} 277 | m_NavMeshLayer: 0 278 | m_StaticEditorFlags: 0 279 | m_IsActive: 1 280 | --- !u!114 &834110886 281 | MonoBehaviour: 282 | m_ObjectHideFlags: 0 283 | m_CorrespondingSourceObject: {fileID: 0} 284 | m_PrefabInstance: {fileID: 0} 285 | m_PrefabAsset: {fileID: 0} 286 | m_GameObject: {fileID: 834110885} 287 | m_Enabled: 1 288 | m_EditorHideFlags: 0 289 | m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3} 290 | m_Name: 291 | m_EditorClassIdentifier: 292 | m_IsGlobal: 1 293 | priority: 0 294 | blendDistance: 0 295 | weight: 1 296 | sharedProfile: {fileID: 11400000, guid: e713a1387bb2f3d41b03367acb4b07eb, type: 2} 297 | --- !u!4 &834110887 298 | Transform: 299 | m_ObjectHideFlags: 0 300 | m_CorrespondingSourceObject: {fileID: 0} 301 | m_PrefabInstance: {fileID: 0} 302 | m_PrefabAsset: {fileID: 0} 303 | m_GameObject: {fileID: 834110885} 304 | serializedVersion: 2 305 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 306 | m_LocalPosition: {x: 0, y: 0, z: 0} 307 | m_LocalScale: {x: 1, y: 1, z: 1} 308 | m_ConstrainProportionsScale: 0 309 | m_Children: [] 310 | m_Father: {fileID: 1890857912} 311 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 312 | --- !u!1 &1480456818 313 | GameObject: 314 | m_ObjectHideFlags: 0 315 | m_CorrespondingSourceObject: {fileID: 0} 316 | m_PrefabInstance: {fileID: 0} 317 | m_PrefabAsset: {fileID: 0} 318 | serializedVersion: 6 319 | m_Component: 320 | - component: {fileID: 1480456819} 321 | - component: {fileID: 1480456820} 322 | m_Layer: 0 323 | m_Name: Vol_B 324 | m_TagString: Untagged 325 | m_Icon: {fileID: 0} 326 | m_NavMeshLayer: 0 327 | m_StaticEditorFlags: 0 328 | m_IsActive: 1 329 | --- !u!4 &1480456819 330 | Transform: 331 | m_ObjectHideFlags: 0 332 | m_CorrespondingSourceObject: {fileID: 0} 333 | m_PrefabInstance: {fileID: 0} 334 | m_PrefabAsset: {fileID: 0} 335 | m_GameObject: {fileID: 1480456818} 336 | serializedVersion: 2 337 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 338 | m_LocalPosition: {x: 0, y: 0, z: 0} 339 | m_LocalScale: {x: 1, y: 1, z: 1} 340 | m_ConstrainProportionsScale: 0 341 | m_Children: [] 342 | m_Father: {fileID: 1890857912} 343 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 344 | --- !u!114 &1480456820 345 | MonoBehaviour: 346 | m_ObjectHideFlags: 0 347 | m_CorrespondingSourceObject: {fileID: 0} 348 | m_PrefabInstance: {fileID: 0} 349 | m_PrefabAsset: {fileID: 0} 350 | m_GameObject: {fileID: 1480456818} 351 | m_Enabled: 1 352 | m_EditorHideFlags: 0 353 | m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3} 354 | m_Name: 355 | m_EditorClassIdentifier: 356 | m_IsGlobal: 1 357 | priority: 1 358 | blendDistance: 0 359 | weight: 1 360 | sharedProfile: {fileID: 11400000, guid: 15c9771675e4c2e48840c8e7f62be90f, type: 2} 361 | --- !u!1 &1890857909 362 | GameObject: 363 | m_ObjectHideFlags: 0 364 | m_CorrespondingSourceObject: {fileID: 0} 365 | m_PrefabInstance: {fileID: 0} 366 | m_PrefabAsset: {fileID: 0} 367 | serializedVersion: 6 368 | m_Component: 369 | - component: {fileID: 1890857912} 370 | - component: {fileID: 1890857911} 371 | - component: {fileID: 1890857910} 372 | m_Layer: 0 373 | m_Name: Play 374 | m_TagString: Untagged 375 | m_Icon: {fileID: 0} 376 | m_NavMeshLayer: 0 377 | m_StaticEditorFlags: 0 378 | m_IsActive: 1 379 | --- !u!95 &1890857910 380 | Animator: 381 | serializedVersion: 5 382 | m_ObjectHideFlags: 0 383 | m_CorrespondingSourceObject: {fileID: 0} 384 | m_PrefabInstance: {fileID: 0} 385 | m_PrefabAsset: {fileID: 0} 386 | m_GameObject: {fileID: 1890857909} 387 | m_Enabled: 1 388 | m_Avatar: {fileID: 0} 389 | m_Controller: {fileID: 0} 390 | m_CullingMode: 0 391 | m_UpdateMode: 0 392 | m_ApplyRootMotion: 0 393 | m_LinearVelocityBlending: 0 394 | m_StabilizeFeet: 0 395 | m_WarningMessage: 396 | m_HasTransformHierarchy: 1 397 | m_AllowConstantClipSamplingOptimization: 1 398 | m_KeepAnimatorStateOnDisable: 0 399 | m_WriteDefaultValuesOnDisable: 0 400 | --- !u!320 &1890857911 401 | PlayableDirector: 402 | m_ObjectHideFlags: 0 403 | m_CorrespondingSourceObject: {fileID: 0} 404 | m_PrefabInstance: {fileID: 0} 405 | m_PrefabAsset: {fileID: 0} 406 | m_GameObject: {fileID: 1890857909} 407 | m_Enabled: 1 408 | serializedVersion: 3 409 | m_PlayableAsset: {fileID: 11400000, guid: 0ad7ea9941096ff459ecbb7791f27dfc, type: 2} 410 | m_InitialState: 1 411 | m_WrapMode: 1 412 | m_DirectorUpdateMode: 1 413 | m_InitialTime: 0 414 | m_SceneBindings: 415 | - key: {fileID: -3320811672403554, guid: 0ad7ea9941096ff459ecbb7791f27dfc, type: 2} 416 | value: {fileID: 1890857910} 417 | m_ExposedReferences: 418 | m_References: [] 419 | --- !u!4 &1890857912 420 | Transform: 421 | m_ObjectHideFlags: 0 422 | m_CorrespondingSourceObject: {fileID: 0} 423 | m_PrefabInstance: {fileID: 0} 424 | m_PrefabAsset: {fileID: 0} 425 | m_GameObject: {fileID: 1890857909} 426 | serializedVersion: 2 427 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 428 | m_LocalPosition: {x: 0, y: 0, z: 0} 429 | m_LocalScale: {x: 1, y: 1, z: 1} 430 | m_ConstrainProportionsScale: 0 431 | m_Children: 432 | - {fileID: 834110887} 433 | - {fileID: 1480456819} 434 | m_Father: {fileID: 0} 435 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 436 | --- !u!1 &1913219295 437 | GameObject: 438 | m_ObjectHideFlags: 0 439 | m_CorrespondingSourceObject: {fileID: 0} 440 | m_PrefabInstance: {fileID: 0} 441 | m_PrefabAsset: {fileID: 0} 442 | serializedVersion: 6 443 | m_Component: 444 | - component: {fileID: 1913219297} 445 | - component: {fileID: 1913219296} 446 | m_Layer: 0 447 | m_Name: Sleeping Knife 448 | m_TagString: Untagged 449 | m_Icon: {fileID: 0} 450 | m_NavMeshLayer: 0 451 | m_StaticEditorFlags: 0 452 | m_IsActive: 1 453 | --- !u!212 &1913219296 454 | SpriteRenderer: 455 | m_ObjectHideFlags: 0 456 | m_CorrespondingSourceObject: {fileID: 0} 457 | m_PrefabInstance: {fileID: 0} 458 | m_PrefabAsset: {fileID: 0} 459 | m_GameObject: {fileID: 1913219295} 460 | m_Enabled: 1 461 | m_CastShadows: 0 462 | m_ReceiveShadows: 0 463 | m_DynamicOccludee: 1 464 | m_StaticShadowCaster: 0 465 | m_MotionVectors: 1 466 | m_LightProbeUsage: 1 467 | m_ReflectionProbeUsage: 1 468 | m_RayTracingMode: 0 469 | m_RayTraceProcedural: 0 470 | m_RenderingLayerMask: 1 471 | m_RendererPriority: 0 472 | m_Materials: 473 | - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} 474 | m_StaticBatchInfo: 475 | firstSubMesh: 0 476 | subMeshCount: 0 477 | m_StaticBatchRoot: {fileID: 0} 478 | m_ProbeAnchor: {fileID: 0} 479 | m_LightProbeVolumeOverride: {fileID: 0} 480 | m_ScaleInLightmap: 1 481 | m_ReceiveGI: 1 482 | m_PreserveUVs: 0 483 | m_IgnoreNormalsForChartDetection: 0 484 | m_ImportantGI: 0 485 | m_StitchLightmapSeams: 1 486 | m_SelectedEditorRenderState: 0 487 | m_MinimumChartSize: 4 488 | m_AutoUVMaxDistance: 0.5 489 | m_AutoUVMaxAngle: 89 490 | m_LightmapParameters: {fileID: 0} 491 | m_SortingLayerID: 0 492 | m_SortingLayer: 0 493 | m_SortingOrder: 0 494 | m_Sprite: {fileID: 21300000, guid: aaa55f1529862e64aa168378e2189a33, type: 3} 495 | m_Color: {r: 1, g: 1, b: 1, a: 1} 496 | m_FlipX: 0 497 | m_FlipY: 0 498 | m_DrawMode: 0 499 | m_Size: {x: 6.4, y: 7.4} 500 | m_AdaptiveModeThreshold: 0.5 501 | m_SpriteTileMode: 0 502 | m_WasSpriteAssigned: 1 503 | m_MaskInteraction: 0 504 | m_SpriteSortPoint: 0 505 | --- !u!4 &1913219297 506 | Transform: 507 | m_ObjectHideFlags: 0 508 | m_CorrespondingSourceObject: {fileID: 0} 509 | m_PrefabInstance: {fileID: 0} 510 | m_PrefabAsset: {fileID: 0} 511 | m_GameObject: {fileID: 1913219295} 512 | serializedVersion: 2 513 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 514 | m_LocalPosition: {x: 0, y: 0, z: 0} 515 | m_LocalScale: {x: 1.38, y: 1.38, z: 1.38} 516 | m_ConstrainProportionsScale: 1 517 | m_Children: [] 518 | m_Father: {fileID: 0} 519 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 520 | --- !u!1660057539 &9223372036854775807 521 | SceneRoots: 522 | m_ObjectHideFlags: 0 523 | m_Roots: 524 | - {fileID: 779545142} 525 | - {fileID: 1913219297} 526 | - {fileID: 1890857912} 527 | -------------------------------------------------------------------------------- /Samples~/GradientMap.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 20771dd1d6ab6704e850eb3811203061 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/GradientMap_A.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3} 13 | m_Name: GradientMap_A 14 | m_EditorClassIdentifier: 15 | components: 16 | - {fileID: 6313348977172487301} 17 | --- !u!114 &6313348977172487301 18 | MonoBehaviour: 19 | m_ObjectHideFlags: 3 20 | m_CorrespondingSourceObject: {fileID: 0} 21 | m_PrefabInstance: {fileID: 0} 22 | m_PrefabAsset: {fileID: 0} 23 | m_GameObject: {fileID: 0} 24 | m_Enabled: 1 25 | m_EditorHideFlags: 0 26 | m_Script: {fileID: 11500000, guid: 5e3b43e232564d52b710c4bdc0cd6e42, type: 3} 27 | m_Name: GradientMapVol 28 | m_EditorClassIdentifier: 29 | active: 1 30 | m_Weight: 31 | m_OverrideState: 1 32 | m_Value: 1 33 | m_Gradient: 34 | m_OverrideState: 1 35 | m_Value: 36 | _grad: 37 | serializedVersion: 2 38 | key0: {r: 0, g: 0, b: 0, a: 1} 39 | key1: {r: 0.2264151, g: 0.2264151, b: 0.2264151, a: 1} 40 | key2: {r: 1, g: 0.4009434, b: 0.4009434, a: 0.67058825} 41 | key3: {r: 1, g: 1, b: 1, a: 0} 42 | key4: {r: 1, g: 0.74986094, b: 0.2688679, a: 0} 43 | key5: {r: 1, g: 0.6839622, b: 0.6839622, a: 0} 44 | key6: {r: 1, g: 0.6839622, b: 0.6839622, a: 0} 45 | key7: {r: 0, g: 0, b: 0, a: 0} 46 | ctime0: 13591 47 | ctime1: 27368 48 | ctime2: 57343 49 | ctime3: 65535 50 | ctime4: 59950 51 | ctime5: 65535 52 | ctime6: 65535 53 | ctime7: 0 54 | atime0: 0 55 | atime1: 65535 56 | atime2: 65535 57 | atime3: 65535 58 | atime4: 0 59 | atime5: 0 60 | atime6: 0 61 | atime7: 0 62 | m_Mode: 1 63 | m_ColorSpace: 0 64 | m_NumColorKeys: 4 65 | m_NumAlphaKeys: 2 66 | _pixels: 67 | - {r: 0, g: 0, b: 0, a: 1} 68 | - {r: 0, g: 0, b: 0, a: 1} 69 | - {r: 0, g: 0, b: 0, a: 1} 70 | - {r: 0, g: 0, b: 0, a: 1} 71 | - {r: 0, g: 0, b: 0, a: 1} 72 | - {r: 0, g: 0, b: 0, a: 1} 73 | - {r: 0, g: 0, b: 0, a: 1} 74 | - {r: 0.2264151, g: 0.2264151, b: 0.2264151, a: 1} 75 | - {r: 0.2264151, g: 0.2264151, b: 0.2264151, a: 1} 76 | - {r: 0.2264151, g: 0.2264151, b: 0.2264151, a: 1} 77 | - {r: 0.2264151, g: 0.2264151, b: 0.2264151, a: 1} 78 | - {r: 0.2264151, g: 0.2264151, b: 0.2264151, a: 1} 79 | - {r: 0.2264151, g: 0.2264151, b: 0.2264151, a: 1} 80 | - {r: 1, g: 0.4009434, b: 0.4009434, a: 1} 81 | - {r: 1, g: 0.4009434, b: 0.4009434, a: 1} 82 | - {r: 1, g: 0.4009434, b: 0.4009434, a: 1} 83 | - {r: 1, g: 0.4009434, b: 0.4009434, a: 1} 84 | - {r: 1, g: 0.4009434, b: 0.4009434, a: 1} 85 | - {r: 1, g: 0.4009434, b: 0.4009434, a: 1} 86 | - {r: 1, g: 0.4009434, b: 0.4009434, a: 1} 87 | - {r: 1, g: 0.4009434, b: 0.4009434, a: 1} 88 | - {r: 1, g: 0.4009434, b: 0.4009434, a: 1} 89 | - {r: 1, g: 0.4009434, b: 0.4009434, a: 1} 90 | - {r: 1, g: 0.4009434, b: 0.4009434, a: 1} 91 | - {r: 1, g: 0.4009434, b: 0.4009434, a: 1} 92 | - {r: 1, g: 0.4009434, b: 0.4009434, a: 1} 93 | - {r: 1, g: 0.4009434, b: 0.4009434, a: 1} 94 | - {r: 1, g: 0.4009434, b: 0.4009434, a: 1} 95 | - {r: 1, g: 1, b: 1, a: 1} 96 | - {r: 1, g: 1, b: 1, a: 1} 97 | - {r: 1, g: 1, b: 1, a: 1} 98 | - {r: 1, g: 1, b: 1, a: 1} 99 | m_Mask: 100 | m_OverrideState: 1 101 | m_Value: {x: 0, y: 1} 102 | -------------------------------------------------------------------------------- /Samples~/GradientMap_A.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e713a1387bb2f3d41b03367acb4b07eb 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/GradientMap_B.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3} 13 | m_Name: GradientMap_B 14 | m_EditorClassIdentifier: 15 | components: 16 | - {fileID: 6313348977172487301} 17 | --- !u!114 &6313348977172487301 18 | MonoBehaviour: 19 | m_ObjectHideFlags: 3 20 | m_CorrespondingSourceObject: {fileID: 0} 21 | m_PrefabInstance: {fileID: 0} 22 | m_PrefabAsset: {fileID: 0} 23 | m_GameObject: {fileID: 0} 24 | m_Enabled: 1 25 | m_EditorHideFlags: 0 26 | m_Script: {fileID: 11500000, guid: 5e3b43e232564d52b710c4bdc0cd6e42, type: 3} 27 | m_Name: GradientMapVol 28 | m_EditorClassIdentifier: 29 | active: 1 30 | m_Weight: 31 | m_OverrideState: 1 32 | m_Value: 1 33 | m_Gradient: 34 | m_OverrideState: 1 35 | m_Value: 36 | _grad: 37 | serializedVersion: 2 38 | key0: {r: 0, g: 0.007843138, b: 0.047058824, a: 1} 39 | key1: {r: 0.49411765, g: 0.14032944, b: 0.15448095, a: 1} 40 | key2: {r: 1, g: 0.5665299, b: 0.2783019, a: 0.67058825} 41 | key3: {r: 1, g: 0.97149736, b: 0.6650944, a: 0} 42 | key4: {r: 1, g: 1, b: 1, a: 0} 43 | key5: {r: 1, g: 0.6839622, b: 0.6839622, a: 0} 44 | key6: {r: 1, g: 0.6839622, b: 0.6839622, a: 0} 45 | key7: {r: 0, g: 0, b: 0, a: 0} 46 | ctime0: 2048 47 | ctime1: 9495 48 | ctime2: 24017 49 | ctime3: 30906 50 | ctime4: 45986 51 | ctime5: 65535 52 | ctime6: 65535 53 | ctime7: 0 54 | atime0: 0 55 | atime1: 65535 56 | atime2: 65535 57 | atime3: 65535 58 | atime4: 0 59 | atime5: 0 60 | atime6: 0 61 | atime7: 0 62 | m_Mode: 2 63 | m_ColorSpace: 0 64 | m_NumColorKeys: 5 65 | m_NumAlphaKeys: 2 66 | _pixels: 67 | - {r: 0, g: 0.007843138, b: 0.04705883, a: 1} 68 | - {r: 0, g: 0.007843138, b: 0.04705883, a: 1} 69 | - {r: 0.10588236, g: 0.04705883, b: 0.08627451, a: 1} 70 | - {r: 0.2509804, g: 0.09019608, b: 0.11764707, a: 1} 71 | - {r: 0.41176474, g: 0.1254902, b: 0.14509805, a: 1} 72 | - {r: 0.5294118, g: 0.17254902, b: 0.16470589, a: 1} 73 | - {r: 0.6, g: 0.23137257, b: 0.18431373, a: 1} 74 | - {r: 0.6745098, g: 0.29411766, b: 0.20392159, a: 1} 75 | - {r: 0.74509805, g: 0.35686275, b: 0.21960786, a: 1} 76 | - {r: 0.8196079, g: 0.4156863, b: 0.2392157, a: 1} 77 | - {r: 0.8941177, g: 0.4784314, b: 0.25490198, a: 1} 78 | - {r: 0.9725491, g: 0.54509807, b: 0.27058825, a: 1} 79 | - {r: 1.0086613, g: 0.6509804, b: 0.36078432, a: 1} 80 | - {r: 1.0142889, g: 0.7725491, b: 0.4784314, a: 1} 81 | - {r: 1.0092001, g: 0.8980393, b: 0.59607846, a: 1} 82 | - {r: 1, g: 0.9725491, b: 0.6862745, a: 1} 83 | - {r: 1, g: 0.97647065, b: 0.73333335, a: 1} 84 | - {r: 1, g: 0.9843138, b: 0.7843138, a: 1} 85 | - {r: 1, g: 0.98823535, b: 0.8313726, a: 1} 86 | - {r: 1, g: 0.9921569, b: 0.87843144, a: 1} 87 | - {r: 1, g: 0.9960785, b: 0.9215687, a: 1} 88 | - {r: 1, g: 0.9960785, b: 0.9686275, a: 1} 89 | - {r: 1, g: 1, b: 1, a: 1} 90 | - {r: 1, g: 1, b: 1, a: 1} 91 | - {r: 1, g: 1, b: 1, a: 1} 92 | - {r: 1, g: 1, b: 1, a: 1} 93 | - {r: 1, g: 1, b: 1, a: 1} 94 | - {r: 1, g: 1, b: 1, a: 1} 95 | - {r: 1, g: 1, b: 1, a: 1} 96 | - {r: 1, g: 1, b: 1, a: 1} 97 | - {r: 1, g: 1, b: 1, a: 1} 98 | - {r: 1, g: 1, b: 1, a: 1} 99 | m_Mask: 100 | m_OverrideState: 1 101 | m_Value: {x: 0, y: 1} 102 | -------------------------------------------------------------------------------- /Samples~/GradientMap_B.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 15c9771675e4c2e48840c8e7f62be90f 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/Play.playable: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &-3320811672403554 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 1 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: d21dcc2386d650c4597f3633c75a1f98, type: 3} 13 | m_Name: Animation Track 14 | m_EditorClassIdentifier: 15 | m_Version: 3 16 | m_AnimClip: {fileID: 0} 17 | m_Locked: 0 18 | m_Muted: 0 19 | m_CustomPlayableFullTypename: 20 | m_Curves: {fileID: 0} 21 | m_Parent: {fileID: 11400000} 22 | m_Children: [] 23 | m_Clips: [] 24 | m_Markers: 25 | m_Objects: [] 26 | m_InfiniteClipPreExtrapolation: 1 27 | m_InfiniteClipPostExtrapolation: 1 28 | m_InfiniteClipOffsetPosition: {x: 0, y: 0, z: 0} 29 | m_InfiniteClipOffsetEulerAngles: {x: 0, y: 0, z: 0} 30 | m_InfiniteClipTimeOffset: 0 31 | m_InfiniteClipRemoveOffset: 0 32 | m_InfiniteClipApplyFootIK: 1 33 | mInfiniteClipLoop: 0 34 | m_MatchTargetFields: 63 35 | m_Position: {x: 0, y: 0, z: 0} 36 | m_EulerAngles: {x: 0, y: 0, z: 0} 37 | m_AvatarMask: {fileID: 0} 38 | m_ApplyAvatarMask: 1 39 | m_TrackOffset: 0 40 | m_InfiniteClip: {fileID: 4946639484665714765} 41 | m_OpenClipOffsetRotation: {x: 0, y: 0, z: 0, w: 1} 42 | m_Rotation: {x: 0, y: 0, z: 0, w: 1} 43 | m_ApplyOffsets: 0 44 | --- !u!114 &11400000 45 | MonoBehaviour: 46 | m_ObjectHideFlags: 0 47 | m_CorrespondingSourceObject: {fileID: 0} 48 | m_PrefabInstance: {fileID: 0} 49 | m_PrefabAsset: {fileID: 0} 50 | m_GameObject: {fileID: 0} 51 | m_Enabled: 1 52 | m_EditorHideFlags: 0 53 | m_Script: {fileID: 11500000, guid: bfda56da833e2384a9677cd3c976a436, type: 3} 54 | m_Name: Play 55 | m_EditorClassIdentifier: 56 | m_Version: 0 57 | m_Tracks: 58 | - {fileID: -3320811672403554} 59 | m_FixedDuration: 0 60 | m_EditorSettings: 61 | m_Framerate: 60 62 | m_ScenePreview: 1 63 | m_DurationMode: 0 64 | m_MarkerTrack: {fileID: 0} 65 | --- !u!74 &4946639484665714765 66 | AnimationClip: 67 | m_ObjectHideFlags: 0 68 | m_CorrespondingSourceObject: {fileID: 0} 69 | m_PrefabInstance: {fileID: 0} 70 | m_PrefabAsset: {fileID: 0} 71 | m_Name: Recorded 72 | serializedVersion: 7 73 | m_Legacy: 0 74 | m_Compressed: 0 75 | m_UseHighQualityCurve: 1 76 | m_RotationCurves: [] 77 | m_CompressedRotationCurves: [] 78 | m_EulerCurves: [] 79 | m_PositionCurves: [] 80 | m_ScaleCurves: [] 81 | m_FloatCurves: 82 | - serializedVersion: 2 83 | curve: 84 | serializedVersion: 2 85 | m_Curve: 86 | - serializedVersion: 3 87 | time: 0 88 | value: 0 89 | inSlope: 0 90 | outSlope: 0 91 | tangentMode: 136 92 | weightedMode: 0 93 | inWeight: 0.33333334 94 | outWeight: 0.33333334 95 | - serializedVersion: 3 96 | time: 0.75 97 | value: 1 98 | inSlope: 0 99 | outSlope: 0 100 | tangentMode: 136 101 | weightedMode: 0 102 | inWeight: 0.33333334 103 | outWeight: 0.33333334 104 | - serializedVersion: 3 105 | time: 2.2 106 | value: 0 107 | inSlope: 0 108 | outSlope: 0 109 | tangentMode: 136 110 | weightedMode: 0 111 | inWeight: 0.33333334 112 | outWeight: 0.33333334 113 | m_PreInfinity: 2 114 | m_PostInfinity: 2 115 | m_RotationOrder: 4 116 | attribute: weight 117 | path: Vol_B 118 | classID: 114 119 | script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3} 120 | flags: 0 121 | m_PPtrCurves: [] 122 | m_SampleRate: 60 123 | m_WrapMode: 0 124 | m_Bounds: 125 | m_Center: {x: 0, y: 0, z: 0} 126 | m_Extent: {x: 0, y: 0, z: 0} 127 | m_ClipBindingConstant: 128 | genericBindings: 129 | - serializedVersion: 2 130 | path: 4127750464 131 | attribute: 130897217 132 | script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3} 133 | typeID: 114 134 | customType: 0 135 | isPPtrCurve: 0 136 | isIntCurve: 0 137 | isSerializeReferenceCurve: 0 138 | pptrCurveMapping: [] 139 | m_AnimationClipSettings: 140 | serializedVersion: 2 141 | m_AdditiveReferencePoseClip: {fileID: 0} 142 | m_AdditiveReferencePoseTime: 0 143 | m_StartTime: 0 144 | m_StopTime: 2.2 145 | m_OrientationOffsetY: 0 146 | m_Level: 0 147 | m_CycleOffset: 0 148 | m_HasAdditiveReferencePose: 0 149 | m_LoopTime: 0 150 | m_LoopBlend: 0 151 | m_LoopBlendOrientation: 0 152 | m_LoopBlendPositionY: 0 153 | m_LoopBlendPositionXZ: 0 154 | m_KeepOriginalOrientation: 0 155 | m_KeepOriginalPositionY: 1 156 | m_KeepOriginalPositionXZ: 0 157 | m_HeightFromFeet: 0 158 | m_Mirror: 0 159 | m_EditorCurves: 160 | - serializedVersion: 2 161 | curve: 162 | serializedVersion: 2 163 | m_Curve: 164 | - serializedVersion: 3 165 | time: 0 166 | value: 0 167 | inSlope: 0 168 | outSlope: 0 169 | tangentMode: 136 170 | weightedMode: 0 171 | inWeight: 0.33333334 172 | outWeight: 0.33333334 173 | - serializedVersion: 3 174 | time: 0.75 175 | value: 1 176 | inSlope: 0 177 | outSlope: 0 178 | tangentMode: 136 179 | weightedMode: 0 180 | inWeight: 0.33333334 181 | outWeight: 0.33333334 182 | - serializedVersion: 3 183 | time: 2.2 184 | value: 0 185 | inSlope: 0 186 | outSlope: 0 187 | tangentMode: 136 188 | weightedMode: 0 189 | inWeight: 0.33333334 190 | outWeight: 0.33333334 191 | m_PreInfinity: 2 192 | m_PostInfinity: 2 193 | m_RotationOrder: 4 194 | attribute: weight 195 | path: Vol_B 196 | classID: 114 197 | script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3} 198 | flags: 0 199 | m_EulerEditorCurves: [] 200 | m_HasGenericRootTransform: 0 201 | m_HasMotionFloatCurves: 0 202 | m_Events: [] 203 | -------------------------------------------------------------------------------- /Samples~/Play.playable.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0ad7ea9941096ff459ecbb7791f27dfc 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/Sleeping Knife.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NullTale/GradientMapFilter/15a8728f782e06cf53fe1e59fad1e1b48837ae88/Samples~/Sleeping Knife.png -------------------------------------------------------------------------------- /Samples~/Sleeping Knife.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aaa55f1529862e64aa168378e2189a33 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 12 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | flipGreenChannel: 0 24 | isReadable: 0 25 | streamingMipmaps: 0 26 | streamingMipmapsPriority: 0 27 | vTOnly: 0 28 | ignoreMipmapLimit: 0 29 | grayScaleToAlpha: 0 30 | generateCubemap: 6 31 | cubemapConvolution: 0 32 | seamlessCubemap: 0 33 | textureFormat: 1 34 | maxTextureSize: 2048 35 | textureSettings: 36 | serializedVersion: 2 37 | filterMode: 1 38 | aniso: 1 39 | mipBias: 0 40 | wrapU: 1 41 | wrapV: 1 42 | wrapW: 1 43 | nPOTScale: 0 44 | lightmap: 0 45 | compressionQuality: 50 46 | spriteMode: 1 47 | spriteExtrude: 1 48 | spriteMeshType: 1 49 | alignment: 0 50 | spritePivot: {x: 0.5, y: 0.5} 51 | spritePixelsToUnits: 100 52 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 53 | spriteGenerateFallbackPhysicsShape: 1 54 | alphaUsage: 1 55 | alphaIsTransparency: 1 56 | spriteTessellationDetail: -1 57 | textureType: 8 58 | textureShape: 1 59 | singleChannelComponent: 0 60 | flipbookRows: 1 61 | flipbookColumns: 1 62 | maxTextureSizeSet: 0 63 | compressionQualitySet: 0 64 | textureFormatSet: 0 65 | ignorePngGamma: 0 66 | applyGammaDecoding: 0 67 | swizzle: 50462976 68 | cookieLightType: 0 69 | platformSettings: 70 | - serializedVersion: 3 71 | buildTarget: DefaultTexturePlatform 72 | maxTextureSize: 2048 73 | resizeAlgorithm: 0 74 | textureFormat: -1 75 | textureCompression: 0 76 | compressionQuality: 50 77 | crunchedCompression: 0 78 | allowsAlphaSplitting: 0 79 | overridden: 0 80 | ignorePlatformSupport: 0 81 | androidETC2FallbackOverride: 0 82 | forceMaximumCompressionQuality_BC6H_BC7: 0 83 | - serializedVersion: 3 84 | buildTarget: WebGL 85 | maxTextureSize: 2048 86 | resizeAlgorithm: 0 87 | textureFormat: -1 88 | textureCompression: 1 89 | compressionQuality: 50 90 | crunchedCompression: 0 91 | allowsAlphaSplitting: 0 92 | overridden: 0 93 | ignorePlatformSupport: 0 94 | androidETC2FallbackOverride: 0 95 | forceMaximumCompressionQuality_BC6H_BC7: 0 96 | - serializedVersion: 3 97 | buildTarget: Standalone 98 | maxTextureSize: 2048 99 | resizeAlgorithm: 0 100 | textureFormat: -1 101 | textureCompression: 1 102 | compressionQuality: 50 103 | crunchedCompression: 0 104 | allowsAlphaSplitting: 0 105 | overridden: 0 106 | ignorePlatformSupport: 0 107 | androidETC2FallbackOverride: 0 108 | forceMaximumCompressionQuality_BC6H_BC7: 0 109 | - serializedVersion: 3 110 | buildTarget: Server 111 | maxTextureSize: 2048 112 | resizeAlgorithm: 0 113 | textureFormat: -1 114 | textureCompression: 1 115 | compressionQuality: 50 116 | crunchedCompression: 0 117 | allowsAlphaSplitting: 0 118 | overridden: 0 119 | ignorePlatformSupport: 0 120 | androidETC2FallbackOverride: 0 121 | forceMaximumCompressionQuality_BC6H_BC7: 0 122 | spriteSheet: 123 | serializedVersion: 2 124 | sprites: [] 125 | outline: [] 126 | physicsShape: [] 127 | bones: [] 128 | spriteID: 5e97eb03825dee720800000000000000 129 | internalID: 0 130 | vertices: [] 131 | indices: 132 | edges: [] 133 | weights: [] 134 | secondaryTextures: [] 135 | nameFileIdTable: {} 136 | mipmapLimitGroupName: 137 | pSDRemoveMatte: 0 138 | userData: 139 | assetBundleName: 140 | assetBundleVariant: 141 | -------------------------------------------------------------------------------- /Samples~/UrpGradientMap.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: bf2edee5c58d82540a51f03df9d42094, type: 3} 13 | m_Name: UrpGradientMap 14 | m_EditorClassIdentifier: 15 | k_AssetVersion: 11 16 | k_AssetPreviousVersion: 11 17 | m_RendererType: 1 18 | m_RendererData: {fileID: 0} 19 | m_RendererDataList: 20 | - {fileID: 11400000, guid: 581ff705e52199145ad63a18920d3722, type: 2} 21 | m_DefaultRendererIndex: 0 22 | m_RequireDepthTexture: 0 23 | m_RequireOpaqueTexture: 0 24 | m_OpaqueDownsampling: 1 25 | m_SupportsTerrainHoles: 1 26 | m_SupportsHDR: 1 27 | m_HDRColorBufferPrecision: 0 28 | m_MSAA: 1 29 | m_RenderScale: 1 30 | m_UpscalingFilter: 0 31 | m_FsrOverrideSharpness: 0 32 | m_FsrSharpness: 0.92 33 | m_EnableLODCrossFade: 1 34 | m_LODCrossFadeDitheringType: 1 35 | m_ShEvalMode: 0 36 | m_MainLightRenderingMode: 1 37 | m_MainLightShadowsSupported: 1 38 | m_MainLightShadowmapResolution: 2048 39 | m_AdditionalLightsRenderingMode: 1 40 | m_AdditionalLightsPerObjectLimit: 4 41 | m_AdditionalLightShadowsSupported: 0 42 | m_AdditionalLightsShadowmapResolution: 2048 43 | m_AdditionalLightsShadowResolutionTierLow: 256 44 | m_AdditionalLightsShadowResolutionTierMedium: 512 45 | m_AdditionalLightsShadowResolutionTierHigh: 1024 46 | m_ReflectionProbeBlending: 0 47 | m_ReflectionProbeBoxProjection: 0 48 | m_ShadowDistance: 50 49 | m_ShadowCascadeCount: 1 50 | m_Cascade2Split: 0.25 51 | m_Cascade3Split: {x: 0.1, y: 0.3} 52 | m_Cascade4Split: {x: 0.067, y: 0.2, z: 0.467} 53 | m_CascadeBorder: 0.2 54 | m_ShadowDepthBias: 1 55 | m_ShadowNormalBias: 1 56 | m_AnyShadowsSupported: 1 57 | m_SoftShadowsSupported: 0 58 | m_ConservativeEnclosingSphere: 1 59 | m_NumIterationsEnclosingSphere: 64 60 | m_SoftShadowQuality: 2 61 | m_AdditionalLightsCookieResolution: 2048 62 | m_AdditionalLightsCookieFormat: 3 63 | m_UseSRPBatcher: 1 64 | m_SupportsDynamicBatching: 0 65 | m_MixedLightingSupported: 1 66 | m_SupportsLightCookies: 1 67 | m_SupportsLightLayers: 0 68 | m_DebugLevel: 0 69 | m_StoreActionsOptimization: 0 70 | m_EnableRenderGraph: 0 71 | m_UseAdaptivePerformance: 1 72 | m_ColorGradingMode: 0 73 | m_ColorGradingLutSize: 32 74 | m_UseFastSRGBLinearConversion: 0 75 | m_SupportDataDrivenLensFlare: 1 76 | m_ShadowType: 1 77 | m_LocalShadowsSupported: 0 78 | m_LocalShadowsAtlasResolution: 256 79 | m_MaxPixelLights: 0 80 | m_ShadowAtlasResolution: 256 81 | m_VolumeFrameworkUpdateMode: 0 82 | m_Textures: 83 | blueNoise64LTex: {fileID: 2800000, guid: e3d24661c1e055f45a7560c033dbb837, type: 3} 84 | bayerMatrixTex: {fileID: 2800000, guid: f9ee4ed84c1d10c49aabb9b210b0fc44, type: 3} 85 | m_PrefilteringModeMainLightShadows: 1 86 | m_PrefilteringModeAdditionalLight: 4 87 | m_PrefilteringModeAdditionalLightShadows: 1 88 | m_PrefilterXRKeywords: 0 89 | m_PrefilteringModeForwardPlus: 1 90 | m_PrefilteringModeDeferredRendering: 1 91 | m_PrefilteringModeScreenSpaceOcclusion: 1 92 | m_PrefilterDebugKeywords: 0 93 | m_PrefilterWriteRenderingLayers: 0 94 | m_PrefilterHDROutput: 0 95 | m_PrefilterSSAODepthNormals: 0 96 | m_PrefilterSSAOSourceDepthLow: 0 97 | m_PrefilterSSAOSourceDepthMedium: 0 98 | m_PrefilterSSAOSourceDepthHigh: 0 99 | m_PrefilterSSAOInterleaved: 0 100 | m_PrefilterSSAOBlueNoise: 0 101 | m_PrefilterSSAOSampleCountLow: 0 102 | m_PrefilterSSAOSampleCountMedium: 0 103 | m_PrefilterSSAOSampleCountHigh: 0 104 | m_PrefilterDBufferMRT1: 0 105 | m_PrefilterDBufferMRT2: 0 106 | m_PrefilterDBufferMRT3: 0 107 | m_PrefilterScreenCoord: 0 108 | m_PrefilterNativeRenderPass: 0 109 | m_ShaderVariantLogLevel: 0 110 | m_ShadowCascades: 0 111 | -------------------------------------------------------------------------------- /Samples~/UrpGradientMap.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 15a4139c595a1ca429a8ff9ae7e865e0 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/UrpGradientMap_Renderer.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: de640fe3d0db1804a85f9fc8f5cadab6, type: 3} 13 | m_Name: UrpGradientMap_Renderer 14 | m_EditorClassIdentifier: 15 | debugShaders: 16 | debugReplacementPS: {fileID: 4800000, guid: cf852408f2e174538bcd9b7fda1c5ae7, type: 3} 17 | hdrDebugViewPS: {fileID: 4800000, guid: 573620ae32aec764abd4d728906d2587, type: 3} 18 | m_RendererFeatures: 19 | - {fileID: 331210092684023404} 20 | m_RendererFeatureMap: 6c967410d3b19804 21 | m_UseNativeRenderPass: 0 22 | postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2} 23 | xrSystemData: {fileID: 11400000, guid: 60e1133243b97e347b653163a8c01b64, type: 2} 24 | shaders: 25 | blitPS: {fileID: 4800000, guid: c17132b1f77d20942aa75f8429c0f8bc, type: 3} 26 | copyDepthPS: {fileID: 4800000, guid: d6dae50ee9e1bfa4db75f19f99355220, type: 3} 27 | screenSpaceShadowPS: {fileID: 0} 28 | samplingPS: {fileID: 4800000, guid: 04c410c9937594faa893a11dceb85f7e, type: 3} 29 | stencilDeferredPS: {fileID: 4800000, guid: e9155b26e1bc55942a41e518703fe304, type: 3} 30 | fallbackErrorPS: {fileID: 4800000, guid: e6e9a19c3678ded42a3bc431ebef7dbd, type: 3} 31 | fallbackLoadingPS: {fileID: 4800000, guid: 7f888aff2ac86494babad1c2c5daeee2, type: 3} 32 | materialErrorPS: {fileID: 4800000, guid: 5fd9a8feb75a4b5894c241777f519d4e, type: 3} 33 | coreBlitPS: {fileID: 4800000, guid: 93446b5c5339d4f00b85c159e1159b7c, type: 3} 34 | coreBlitColorAndDepthPS: {fileID: 4800000, guid: d104b2fc1ca6445babb8e90b0758136b, type: 3} 35 | blitHDROverlay: {fileID: 4800000, guid: a89bee29cffa951418fc1e2da94d1959, type: 3} 36 | cameraMotionVector: {fileID: 4800000, guid: c56b7e0d4c7cb484e959caeeedae9bbf, type: 3} 37 | objectMotionVector: {fileID: 4800000, guid: 7b3ede40266cd49a395def176e1bc486, type: 3} 38 | dataDrivenLensFlare: {fileID: 4800000, guid: 6cda457ac28612740adb23da5d39ea92, type: 3} 39 | m_AssetVersion: 2 40 | m_OpaqueLayerMask: 41 | serializedVersion: 2 42 | m_Bits: 4294967295 43 | m_TransparentLayerMask: 44 | serializedVersion: 2 45 | m_Bits: 4294967295 46 | m_DefaultStencilState: 47 | overrideStencilState: 0 48 | stencilReference: 0 49 | stencilCompareFunction: 8 50 | passOperation: 2 51 | failOperation: 0 52 | zFailOperation: 0 53 | m_ShadowTransparentReceive: 1 54 | m_RenderingMode: 0 55 | m_DepthPrimingMode: 0 56 | m_CopyDepthMode: 1 57 | m_AccurateGbufferNormals: 0 58 | m_IntermediateTextureMode: 1 59 | --- !u!114 &331210092684023404 60 | MonoBehaviour: 61 | m_ObjectHideFlags: 0 62 | m_CorrespondingSourceObject: {fileID: 0} 63 | m_PrefabInstance: {fileID: 0} 64 | m_PrefabAsset: {fileID: 0} 65 | m_GameObject: {fileID: 0} 66 | m_Enabled: 1 67 | m_EditorHideFlags: 0 68 | m_Script: {fileID: 11500000, guid: ce35fadec2d801e408a542f6c6d075d1, type: 3} 69 | m_Name: GradientMap 70 | m_EditorClassIdentifier: 71 | m_Active: 1 72 | _event: 600 73 | _pass: {fileID: 657582378739906986} 74 | _blitShader: {fileID: 4800000, guid: c17132b1f77d20942aa75f8429c0f8bc, type: 3} 75 | --- !u!114 &657582378739906986 76 | MonoBehaviour: 77 | m_ObjectHideFlags: 3 78 | m_CorrespondingSourceObject: {fileID: 0} 79 | m_PrefabInstance: {fileID: 0} 80 | m_PrefabAsset: {fileID: 0} 81 | m_GameObject: {fileID: 0} 82 | m_Enabled: 1 83 | m_EditorHideFlags: 0 84 | m_Script: {fileID: 11500000, guid: c2c8d156cebe46b383a5291e7e5d4ba2, type: 3} 85 | m_Name: 86 | m_EditorClassIdentifier: 87 | _active: 1 88 | _shader: {fileID: 4800000, guid: 5c8038ea0b6f4d94abca9e7bf5c15beb, type: 3} 89 | -------------------------------------------------------------------------------- /Samples~/UrpGradientMap_Renderer.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 581ff705e52199145ad63a18920d3722 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "www.nulltale.gradientmap", 3 | "displayName": "GradientMap", 4 | "version": "1.1.0", 5 | "unity": "2022.1", 6 | "description": "GradientMap post processing for unity Urp", 7 | "documentationUrl": "https://github.com/NullTale/GradientMapFilter", 8 | "licensesUrl": "https://github.com/NullTale/GradientMapFilter/blob/master/LICENSE.md", 9 | "author": { 10 | "name": "NullTale", 11 | "email": "nulltale@gmail.com", 12 | "url": "https://twitter.com/NullTale" 13 | }, 14 | "dependencies": { 15 | "com.unity.render-pipelines.universal": "14.0.6" 16 | }, 17 | "hideInEditor": false, 18 | "samples": [ 19 | { 20 | "displayName": "Sample Scene", 21 | "description": "", 22 | "path": "Samples~" 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 04e91415506f24943b3a3f2e9569224c 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------