├── .gitignore ├── CHANGELOG.md ├── CHANGELOG.md.meta ├── LICENSE ├── LICENSE.meta ├── README.md ├── README.md.meta ├── Runtime.meta ├── Runtime ├── API.meta ├── API │ ├── URP.meta │ └── URP │ │ ├── Configuring.cs │ │ └── Configuring.cs.meta ├── Core.meta ├── Core │ ├── URP.meta │ └── URP │ │ ├── HiddenURPFunctionality.cs │ │ ├── HiddenURPFunctionality.cs.meta │ │ ├── OpenedURPFunctionality.cs │ │ ├── OpenedURPFunctionality.cs.meta │ │ ├── URPAssetConfiguring.cs │ │ └── URPAssetConfiguring.cs.meta ├── inc8877.GraphicsConfigurator.asmdef └── inc8877.GraphicsConfigurator.asmdef.meta ├── Tests.meta ├── Tests ├── Runtime.meta └── Runtime │ ├── GraphicsConfiguratorTest.cs │ ├── GraphicsConfiguratorTest.cs.meta │ ├── inc8877.GraphicsConfigurator.Tests.asmdef │ └── inc8877.GraphicsConfigurator.Tests.asmdef.meta ├── package.json └── package.json.meta /.gitignore: -------------------------------------------------------------------------------- 1 | *.DS_Store -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | --- 4 | 5 | ## v1.1.1 6 | 7 | ### Compatible URP versions 8 | 9 | - 11.0.0 10 | 11 | ### Added 12 | 13 | - CHANGELOG 14 | 15 | ### Changed 16 | 17 | - URPAssetConfiguring.targetAsset encapsulation level (init from constructor, otherwise `readonly`) 18 | 19 | --- 20 | 21 | ## 1.1.0 22 | 23 | ### Compatible URP versions 24 | 25 | - 11.0.0 26 | 27 | ### Added 28 | 29 | - AdditionalLightsShadowResolution tiers 30 | - ColorGradingMode 31 | - ColorGradingLutSize 32 | - UseFastSRGBLinearConversion 33 | - ShaderVariantLogLevel 34 | 35 | --- 36 | 37 | ## 1.0.0 38 | 39 | ### Compatible URP versions 40 | 41 | - 10.3.2 42 | - 10.3.1 43 | 44 | ### Features in this release: 45 | 46 | - editing private URP parameters 47 | - manage active URP at runtime 48 | - manage a specific URP -------------------------------------------------------------------------------- /CHANGELOG.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b15cf9fb3270245dab4a20d9b99fbe4a 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Volodymyr Bozhko 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b288c5d56d3be410380eab7068abf441 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 | # GraphicsConfigurator 6 | 7 | [![openupm](https://img.shields.io/npm/v/com.inc8877.graphicsconfigurator?label=openupm®istry_uri=https://package.openupm.com)](https://openupm.com/packages/com.inc8877.graphicsconfigurator/) 8 | [![Codacy Badge](https://app.codacy.com/project/badge/Grade/f6b7fb15b9f24273b303c3b79409cbfb)](https://www.codacy.com/gh/inc8877/GraphicsConfigurator/dashboard?utm_source=github.com&utm_medium=referral&utm_content=inc8877/GraphicsConfigurator&utm_campaign=Badge_Grade) 9 | 10 | API for managing URP asset parameters, including hacking of parameters that are forbidden to change. 11 | 12 | ## Table of Contents 13 | 14 | - [GraphicsConfigurator](#graphicsconfigurator) 15 | - [Table of Contents](#table-of-contents) 16 | - [Download](#download) 17 | - [How to use](#how-to-use) 18 | - [Installation](#installation) 19 | - [Install via OpenUPM](#install-via-openupm) 20 | - [Install via Git URL](#install-via-git-url) 21 | - [Include GraphicsConfigurator `.dll` into the project](#include-graphicsconfigurator-dll-into-the-project) 22 | - [Examples](#examples) 23 | - [Tested devices](#tested-devices) 24 | - [Known issues](#known-issues) 25 | 26 |
Problem 27 |

28 | 29 | Unity closed access to change important parameters such as shadows casting, shadow resolution, lighting modes, etc. 30 | 31 | If you want to give the user the ability to customize the resolution of shadows, then the suggestion from unit sounds like this: ***"create multiple assets and rearrange them"*** 32 | 33 | If you follow this way, you will have to create hundreds of pipeline assets to give users the ability to customize the graphics settings. 34 | 35 | At the moment the Unity dev team does not disclose the reasons why they closed the ability to change many important parameters. 36 |

37 |
38 | 39 |
Solution 40 |

41 | Create a wrapper to bypass the restrictions to modify private parameters. 42 |

43 |
44 | 45 | ## Download 46 | 47 | | URP | LINK | 48 | | :------------: | :---------------------------------------------------------------------------------: | 49 | | 11.0.0 | [:arrow_down:](https://github.com/inc8877/GraphicsConfigurator/releases/tag/v1.1.1) | 50 | | 10.3.1, 10.3.2 | [:arrow_down:](https://github.com/inc8877/GraphicsConfigurator/releases/tag/v1.0.0) | 51 | 52 | ## How to use 53 | 54 | 1. Add wrapper to your project ([installation](#installation)) 55 | 2. Include wrapper library in code ([how](#examples)) 56 | 3. Change any parameters of the URP Asset in one line. In the bag :clap: 57 | 58 | ## Installation 59 | 60 | ### Install via OpenUPM 61 | 62 | The package is available on the [openupm](https://openupm.com) registry. It's recommended to install it via [openupm-cli](https://github.com/openupm/openupm-cli). 63 | 64 | ```c# 65 | openupm add com.inc8877.graphicsconfigurator 66 | ``` 67 | 68 | ### Install via Git URL 69 | 70 | Open `Packages/manifest.json` with your favorite text editor. Add the following line to the dependencies block. 71 | 72 | ```c# 73 | { 74 | "dependencies": { 75 | "com.inc8877.graphicsconfigurator": "https://github.com/inc8877/GraphicsConfigurator.git", 76 | } 77 | } 78 | ``` 79 | 80 | ### Include GraphicsConfigurator `.dll` into the project 81 | 82 | Add `.dll` to your project, you can find it in [every release](https://github.com/inc8877/GraphicsConfigurator/releases). You can find a suitable version [here](#download) 83 | 84 | ## Examples 85 | 86 | First, plugin necessary libraries 87 | 88 | ```c# 89 | using GraphicsConfigurator.API.URP; 90 | using UnityEngine.Rendering.Universal; 91 | using ShadowResolution = UnityEngine.Rendering.Universal.ShadowResolution; 92 | ``` 93 | 94 |
To change the active URP Asset, you need to do the following: 95 | 96 | ```c# 97 | // ... 98 | // code somewhere 99 | Configuring.CurrentURPA.OpaqueDownsampling(Downsampling._4xBox); 100 | Configuring.CurrentURPA.AntiAliasing(MsaaQuality._4x); 101 | 102 | Configuring.CurrentURPA.MainLightMode(LightRenderingMode.PerPixel); 103 | Configuring.CurrentURPA.MainLightShadowsCasting(true); 104 | Configuring.CurrentURPA.MainLightShadowResolution(ShadowResolution._1024); 105 | // ... 106 | ``` 107 | 108 |
If you want to work with a specific URP Asset, do it like this: 109 | 110 | ```c# 111 | private URPAssetConfiguring URPA = new URPAssetConfiguring(target); 112 | 113 | // ... 114 | // code somewhere 115 | URPA.MainLightShadowsCasting(true); 116 | URPA.Cascade3Split(new Vector2(0.1f, 0.3f)); 117 | // ... 118 | ``` 119 | 120 | ## Tested devices 121 | 122 | | CPU | GPU | OS | Graphics API | Backend | .Net | 123 | | :-------: | :-----------------: | :------------: | :----------: | :-----: | :---: | 124 | | SD 855 | Adreno 640 | Android 10.3.8 | Vulkan | IL2CPP | 4.x | 125 | | SD 845 | Adreno 630 | Android 10.3.7 | Vulkan | IL2CPP | 4.x | 126 | | i7 6700HQ | AMD Randeon Pro 450 | macOS 11.2.1 | Metal | IL2CPP | 4.x | 127 | 128 | ## Known issues 129 | 130 | - When there is a change in the additional light rendering mode with the display of the target asset in the inspector, 131 | then the mode changes briefly, after which it has the parameters that were set before the change was attempted. 132 | This happens only in editor mode, it is not observed in assemblies. 133 | If, in editor mode, you try to change the rendering mode of the additional light and do not display the target asset in the inspector, 134 | then everything is successful. 135 | Presumably the problem lies in the way the asset editor works. 136 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1abc393e8fd6940f88a6868def8ed7e4 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c5d58218a61f40b49f56940d2c224b8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/API.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e38b1c763796a4432ad3f6e051ef40bf 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/API/URP.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1445310a8fb7448c39cdd194846657eb 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/API/URP/Configuring.cs: -------------------------------------------------------------------------------- 1 | using GraphicsConfigurator.Core.URP; 2 | using UnityEngine.Rendering.Universal; 3 | 4 | namespace GraphicsConfigurator.API.URP 5 | { 6 | public static class Configuring 7 | { 8 | /// 9 | /// Managing the active pipeline asset 10 | /// 11 | public static URPAssetConfiguring CurrentURPA 12 | { 13 | get 14 | { 15 | m_URPAConfiguring.targetAsset = UniversalRenderPipeline.asset; 16 | return m_URPAConfiguring; 17 | } 18 | 19 | } 20 | private static readonly URPAssetConfiguring m_URPAConfiguring = new URPAssetConfiguring(UniversalRenderPipeline.asset); 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Runtime/API/URP/Configuring.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5e2a86493ad274556b2e5572207b0b60 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Core.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5fb8338a6f1894f21a32e5184ef336e6 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Core/URP.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aa54b37b588ef4e95bcfb8dfb3dc05cf 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Core/URP/HiddenURPFunctionality.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using UnityEngine; 4 | using UnityEngine.Rendering.Universal; 5 | using ShadowResolution = UnityEngine.Rendering.Universal.ShadowResolution; 6 | 7 | namespace GraphicsConfigurator.Core.URP 8 | { 9 | internal static partial class URPFunctionality 10 | { 11 | 12 | #region FieldsInfo 13 | 14 | private static readonly Type pipelineAssetType = typeof(UniversalRenderPipelineAsset); 15 | private const BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic; 16 | 17 | private static readonly FieldInfo m_OpaqueDownsampling = getFieldInfo("m_OpaqueDownsampling"); 18 | private static readonly FieldInfo m_SupportsTerrainHoles = getFieldInfo("m_SupportsTerrainHoles"); 19 | private static readonly FieldInfo m_MSAA = getFieldInfo("m_MSAA"); 20 | private static readonly FieldInfo m_MainLightRenderingMode = getFieldInfo("m_MainLightRenderingMode"); 21 | private static readonly FieldInfo m_MainLightShadowsSupported = getFieldInfo("m_MainLightShadowsSupported"); 22 | private static readonly FieldInfo m_MainLightShadowmapResolution = getFieldInfo("m_MainLightShadowmapResolution"); 23 | private static readonly FieldInfo m_AdditionalLightsRenderingMode = getFieldInfo("m_AdditionalLightsRenderingMode"); 24 | private static readonly FieldInfo m_AdditionalLightShadowsSupported = getFieldInfo("m_AdditionalLightShadowsSupported"); 25 | private static readonly FieldInfo m_AdditionalLightsShadowmapResolution = getFieldInfo("m_AdditionalLightsShadowmapResolution"); 26 | private static readonly FieldInfo m_AdditionalLightsShadowResolutionTierLow = getFieldInfo("m_AdditionalLightsShadowResolutionTierLow"); 27 | private static readonly FieldInfo m_AdditionalLightsShadowResolutionTierMedium = getFieldInfo("m_AdditionalLightsShadowResolutionTierMedium"); 28 | private static readonly FieldInfo m_AdditionalLightsShadowResolutionTierHigh = getFieldInfo("m_AdditionalLightsShadowResolutionTierHigh"); 29 | private static readonly FieldInfo m_Cascade2Split = getFieldInfo("m_Cascade2Split"); 30 | private static readonly FieldInfo m_Cascade3Split = getFieldInfo("m_Cascade3Split"); 31 | private static readonly FieldInfo m_Cascade4Split = getFieldInfo("m_Cascade4Split"); 32 | private static readonly FieldInfo m_SoftShadowsSupported = getFieldInfo("m_SoftShadowsSupported"); 33 | private static readonly FieldInfo m_UseFastSRGBLinearConversion = getFieldInfo("m_UseFastSRGBLinearConversion"); 34 | private static readonly FieldInfo m_MixedLightingSupported = getFieldInfo("m_MixedLightingSupported"); 35 | 36 | private static FieldInfo getFieldInfo(string name) => pipelineAssetType.GetField(name, flags); 37 | 38 | #endregion 39 | 40 | #region General 41 | 42 | internal static Downsampling opaqueDownsampling(UniversalRenderPipelineAsset asset, Downsampling downsampling, 43 | bool activateOpaqueTexture = false) 44 | { 45 | if (activateOpaqueTexture) asset.supportsCameraOpaqueTexture = true; 46 | 47 | m_OpaqueDownsampling.SetValue(asset, downsampling); 48 | return asset.opaqueDownsampling; 49 | } 50 | 51 | internal static bool supportsTerrainHoles(UniversalRenderPipelineAsset asset, bool state) 52 | { 53 | m_SupportsTerrainHoles.SetValue(asset, state); 54 | return asset.supportsTerrainHoles; 55 | } 56 | 57 | #endregion 58 | 59 | #region Quality 60 | 61 | internal static MsaaQuality msaaQuality(UniversalRenderPipelineAsset asset, MsaaQuality quality) 62 | { 63 | m_MSAA.SetValue(asset, quality); 64 | return (MsaaQuality)asset.msaaSampleCount; 65 | } 66 | 67 | #endregion 68 | 69 | #region Lighting 70 | 71 | internal static LightRenderingMode mainLightRenderingMode(UniversalRenderPipelineAsset asset, 72 | LightRenderingMode mode) 73 | { 74 | if (mode == LightRenderingMode.PerVertex) 75 | throw new Exception("Main light rendering mode can not be 'PerVertex'"); 76 | 77 | m_MainLightRenderingMode.SetValue(asset, mode); 78 | return asset.mainLightRenderingMode; 79 | } 80 | 81 | internal static bool supportsMainLightShadows(UniversalRenderPipelineAsset asset, bool state) 82 | { 83 | m_MainLightShadowsSupported.SetValue(asset, state); 84 | return asset.supportsMainLightShadows; 85 | } 86 | 87 | internal static ShadowResolution mainLightShadowmapResolution(UniversalRenderPipelineAsset asset, 88 | ShadowResolution resolution) 89 | { 90 | m_MainLightShadowmapResolution.SetValue(asset, resolution); 91 | return (ShadowResolution)asset.mainLightShadowmapResolution; 92 | } 93 | 94 | internal static LightRenderingMode additionalLightsRenderingMode(UniversalRenderPipelineAsset asset, 95 | LightRenderingMode mode) 96 | { 97 | m_AdditionalLightsRenderingMode.SetValue(asset, mode); 98 | return asset.additionalLightsRenderingMode; 99 | } 100 | 101 | internal static bool supportsAdditionalLightShadows(UniversalRenderPipelineAsset asset, bool state) 102 | { 103 | m_AdditionalLightShadowsSupported.SetValue(asset, state); 104 | return asset.supportsAdditionalLightShadows; 105 | } 106 | 107 | internal static ShadowResolution additionalLightsShadowmapResolution(UniversalRenderPipelineAsset asset, 108 | ShadowResolution resolution) 109 | { 110 | m_AdditionalLightsShadowmapResolution.SetValue(asset, resolution); 111 | return (ShadowResolution)asset.additionalLightsShadowmapResolution; 112 | } 113 | 114 | internal static int additionalLightsShadowResolutionTierLow(UniversalRenderPipelineAsset asset, int resolution) 115 | { 116 | m_AdditionalLightsShadowResolutionTierLow.SetValue(asset, resolution); 117 | return asset.additionalLightsShadowResolutionTierLow; 118 | } 119 | 120 | internal static int additionalLightsShadowResolutionTierMedium(UniversalRenderPipelineAsset asset, int resolution) 121 | { 122 | m_AdditionalLightsShadowResolutionTierMedium.SetValue(asset, resolution); 123 | return asset.additionalLightsShadowResolutionTierMedium; 124 | } 125 | 126 | internal static int additionalLightsShadowResolutionTierHigh(UniversalRenderPipelineAsset asset, int resolution) 127 | { 128 | m_AdditionalLightsShadowResolutionTierHigh.SetValue(asset, resolution); 129 | return asset.additionalLightsShadowResolutionTierHigh; 130 | } 131 | 132 | #endregion 133 | 134 | #region Shadows 135 | 136 | internal static float cascade2Split(UniversalRenderPipelineAsset asset, float value) 137 | { 138 | m_Cascade2Split.SetValue(asset, value); 139 | return asset.cascade2Split; 140 | } 141 | 142 | internal static Vector2 cascade3Split(UniversalRenderPipelineAsset asset, Vector2 value) 143 | { 144 | m_Cascade3Split.SetValue(asset, value); 145 | return asset.cascade3Split; 146 | } 147 | 148 | internal static Vector3 cascade4Split(UniversalRenderPipelineAsset asset, Vector3 value) 149 | { 150 | m_Cascade4Split.SetValue(asset, value); 151 | return asset.cascade4Split; 152 | } 153 | 154 | internal static bool supportsSoftShadows(UniversalRenderPipelineAsset asset, bool state) 155 | { 156 | m_SoftShadowsSupported.SetValue(asset, state); 157 | return asset.supportsSoftShadows; 158 | } 159 | 160 | #endregion 161 | 162 | #region Post-processing 163 | 164 | internal static bool useFastSRGBLinearConversion(UniversalRenderPipelineAsset asset, bool state) 165 | { 166 | m_UseFastSRGBLinearConversion.SetValue(asset, state); 167 | return asset.useFastSRGBLinearConversion; 168 | } 169 | 170 | #endregion 171 | 172 | #region Advanced 173 | 174 | internal static bool supportsMixedLighting(UniversalRenderPipelineAsset asset, bool state) 175 | { 176 | m_MixedLightingSupported.SetValue(asset, state); 177 | return asset.supportsMixedLighting; 178 | } 179 | 180 | #endregion 181 | 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /Runtime/Core/URP/HiddenURPFunctionality.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f87ed1e15d0934393ac950a464f19e64 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Core/URP/OpenedURPFunctionality.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine.Rendering.Universal; 2 | 3 | namespace GraphicsConfigurator.Core.URP 4 | { 5 | internal static partial class URPFunctionality 6 | { 7 | 8 | #region General 9 | 10 | internal static bool depthTextureActivity(UniversalRenderPipelineAsset asset, bool state) => 11 | asset.supportsCameraDepthTexture = state; 12 | 13 | internal static bool opaqueTextureActivity(UniversalRenderPipelineAsset asset, bool state) => 14 | asset.supportsCameraOpaqueTexture = state; 15 | 16 | #endregion 17 | 18 | #region Quality 19 | 20 | internal static bool hdrActivity(UniversalRenderPipelineAsset asset, bool state) => 21 | asset.supportsHDR = state; 22 | 23 | internal static float renderScale(UniversalRenderPipelineAsset asset, float scale) => 24 | asset.renderScale = scale; 25 | 26 | #endregion 27 | 28 | #region Lighting 29 | 30 | internal static int additionalLightsCount(UniversalRenderPipelineAsset asset, int count) => 31 | asset.maxAdditionalLightsCount = count; 32 | 33 | #endregion 34 | 35 | #region Shadows 36 | 37 | internal static float shadowDistance(UniversalRenderPipelineAsset asset, float distance) => 38 | asset.shadowDistance = distance; 39 | 40 | internal static int shadowCascadeCount(UniversalRenderPipelineAsset asset, int count) => 41 | asset.shadowCascadeCount = count; 42 | 43 | internal static float shadowDepthBias(UniversalRenderPipelineAsset asset, float bias) => 44 | asset.shadowDepthBias = bias; 45 | 46 | internal static float shadowNormalBias(UniversalRenderPipelineAsset asset, float bias) => 47 | asset.shadowNormalBias = bias; 48 | 49 | #endregion 50 | 51 | #region Post-processing 52 | 53 | internal static ColorGradingMode colorGradingMode(UniversalRenderPipelineAsset asset, ColorGradingMode mode) => 54 | asset.colorGradingMode = mode; 55 | 56 | internal static int colorGradingLutSize(UniversalRenderPipelineAsset asset, int size) => 57 | asset.colorGradingLutSize = size; 58 | 59 | #endregion 60 | 61 | #region Advanced 62 | 63 | internal static bool useSRPBatcher(UniversalRenderPipelineAsset asset, bool state) => 64 | asset.useSRPBatcher = state; 65 | 66 | internal static bool supportsDynamicBatching(UniversalRenderPipelineAsset asset, bool state) => 67 | asset.supportsDynamicBatching = state; 68 | 69 | internal static ShaderVariantLogLevel shaderVariantLogLevel(UniversalRenderPipelineAsset asset, 70 | ShaderVariantLogLevel logLevel) => asset.shaderVariantLogLevel = logLevel; 71 | 72 | #endregion 73 | 74 | } 75 | } -------------------------------------------------------------------------------- /Runtime/Core/URP/OpenedURPFunctionality.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 170cb35cd85544ae5a9b5b1b2d9d3280 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Core/URP/URPAssetConfiguring.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Rendering.Universal; 3 | using ShadowResolution = UnityEngine.Rendering.Universal.ShadowResolution; 4 | 5 | namespace GraphicsConfigurator.Core.URP 6 | { 7 | public class URPAssetConfiguring 8 | { 9 | 10 | #region Constructor 11 | 12 | public URPAssetConfiguring(UniversalRenderPipelineAsset asset) 13 | { 14 | targetAsset = asset; 15 | } 16 | 17 | public UniversalRenderPipelineAsset targetAsset { get; internal set; } 18 | 19 | #endregion 20 | 21 | #region General 22 | 23 | public bool DepthTexture(bool state) => URPFunctionality.depthTextureActivity(targetAsset, state); 24 | 25 | public bool OpaqueTexture(bool state) => URPFunctionality.opaqueTextureActivity(targetAsset, state); 26 | 27 | public Downsampling OpaqueDownsampling(Downsampling downsampling) => 28 | URPFunctionality.opaqueDownsampling(targetAsset, downsampling); 29 | 30 | public bool TerrainHoles(bool state) => URPFunctionality.supportsTerrainHoles(targetAsset, state); 31 | 32 | #endregion 33 | 34 | #region Quality 35 | 36 | public bool HDR(bool state) => URPFunctionality.hdrActivity(targetAsset, state); 37 | 38 | public MsaaQuality AntiAliasing(MsaaQuality quality) => URPFunctionality.msaaQuality(targetAsset, quality); 39 | 40 | public float RenderScale(float scale) => URPFunctionality.renderScale(targetAsset, scale); 41 | 42 | #endregion 43 | 44 | #region Lighting 45 | 46 | // Main directional light Settings 47 | public LightRenderingMode MainLightMode(LightRenderingMode mode) => 48 | URPFunctionality.mainLightRenderingMode(targetAsset, mode); 49 | 50 | public bool MainLightShadowsCasting(bool state) => 51 | URPFunctionality.supportsMainLightShadows(targetAsset, state); 52 | 53 | public ShadowResolution MainLightShadowResolution(ShadowResolution resolution) => 54 | URPFunctionality.mainLightShadowmapResolution(targetAsset, resolution); 55 | 56 | // Additional lights settings 57 | public LightRenderingMode AdditionalLightsMode(LightRenderingMode mode) => 58 | URPFunctionality.additionalLightsRenderingMode(targetAsset, mode); 59 | 60 | /// 61 | /// (Per Object Limit) 62 | /// 63 | /// 64 | /// 65 | public int MaxAdditionalLightsCount(int count) => URPFunctionality.additionalLightsCount(targetAsset, count); 66 | 67 | public bool AdditionalLightsShadowsCasting(bool state) => 68 | URPFunctionality.supportsAdditionalLightShadows(targetAsset, state); 69 | 70 | /// 71 | /// (Shadow Atlas Resolution) 72 | /// 73 | /// 74 | /// 75 | public ShadowResolution AddtionalLightShadowResolution(ShadowResolution resolution) => 76 | URPFunctionality.additionalLightsShadowmapResolution(targetAsset, resolution); 77 | 78 | public int AdditionalLightsShadowResolutionTierLow(int resolution) => 79 | URPFunctionality.additionalLightsShadowResolutionTierLow(targetAsset, resolution); 80 | 81 | public int AdditionalLightsShadowResolutionTierMedium(int resolution) => 82 | URPFunctionality.additionalLightsShadowResolutionTierMedium(targetAsset, resolution); 83 | 84 | public int additionalLightsShadowResolutionTierHigh(int resolution) => 85 | URPFunctionality.additionalLightsShadowResolutionTierHigh(targetAsset, resolution); 86 | 87 | #endregion 88 | 89 | #region Shadows 90 | 91 | public float ShadowDistance(float distance) => URPFunctionality.shadowDistance(targetAsset, distance); 92 | 93 | public int CascadeCount(int count) => URPFunctionality.shadowCascadeCount(targetAsset, count); 94 | 95 | public float Cascade2Split(float value) => URPFunctionality.cascade2Split(targetAsset, value); 96 | 97 | public Vector2 Cascade3Split(Vector2 value) => URPFunctionality.cascade3Split(targetAsset, value); 98 | 99 | public Vector3 Cascade4Split(Vector3 value) => URPFunctionality.cascade4Split(targetAsset, value); 100 | 101 | public float DepthBias(float bias) => URPFunctionality.shadowDepthBias(targetAsset, bias); 102 | 103 | public float NormalBias(float bias) => URPFunctionality.shadowNormalBias(targetAsset, bias); 104 | 105 | public bool SoftShadows(bool state) => URPFunctionality.supportsSoftShadows(targetAsset, state); 106 | 107 | #endregion 108 | 109 | #region Post-processing 110 | 111 | public ColorGradingMode ColorGradingMode(ColorGradingMode mode) => 112 | URPFunctionality.colorGradingMode(targetAsset, mode); 113 | 114 | public int ColorGradingLutSize(int size) => 115 | URPFunctionality.colorGradingLutSize(targetAsset, size); 116 | 117 | public bool UseFastSRGBLinearConversion(bool state) => 118 | URPFunctionality.useFastSRGBLinearConversion(targetAsset, state); 119 | 120 | #endregion 121 | 122 | #region Advanced 123 | 124 | public bool SRPBatcher(bool state) => URPFunctionality.useSRPBatcher(targetAsset, state); 125 | 126 | public bool DynamicBatching(bool state) => URPFunctionality.supportsDynamicBatching(targetAsset, state); 127 | 128 | public bool MixedLighting(bool state) => URPFunctionality.supportsMixedLighting(targetAsset, state); 129 | 130 | public ShaderVariantLogLevel ShaderVariantLogLevel(ShaderVariantLogLevel logLevel) => 131 | URPFunctionality.shaderVariantLogLevel(targetAsset, logLevel); 132 | 133 | #endregion 134 | 135 | } 136 | } -------------------------------------------------------------------------------- /Runtime/Core/URP/URPAssetConfiguring.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 906bdf7d85c4d42539707be3e8a9face 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/inc8877.GraphicsConfigurator.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "inc8877.GraphicsConfigurator", 3 | "rootNamespace": "", 4 | "references": [ 5 | "GUID:15fc0a57446b3144c949da3e2b9737a9" 6 | ], 7 | "includePlatforms": [], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": false, 10 | "overrideReferences": false, 11 | "precompiledReferences": [], 12 | "autoReferenced": true, 13 | "defineConstraints": [], 14 | "versionDefines": [], 15 | "noEngineReferences": false 16 | } -------------------------------------------------------------------------------- /Runtime/inc8877.GraphicsConfigurator.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a03e49e43e64d4271980a02c0676e63c 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Tests.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b75242b2755eb415db6c3b87431e4041 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Tests/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5bd59f29f5fa947768dad42b6b2e0fc2 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Tests/Runtime/GraphicsConfiguratorTest.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using GraphicsConfigurator.API.URP; 3 | using UnityEngine; 4 | using UnityEngine.Rendering.Universal; 5 | using UnityEngine.TestTools; 6 | using ShadowResolution = UnityEngine.Rendering.Universal.ShadowResolution; 7 | 8 | namespace GraphicsConfigurator.Tests 9 | { 10 | public class GraphicsConfiguratorTest 11 | { 12 | [UnityTest] 13 | public IEnumerator ForwardPass() 14 | { 15 | Configuring.CurrentURPA.TerrainHoles(true); 16 | yield return new WaitForSeconds(0.5f); 17 | 18 | Configuring.CurrentURPA.HDR(true); 19 | yield return new WaitForSeconds(0.5f); 20 | 21 | Configuring.CurrentURPA.AntiAliasing(MsaaQuality._2x); 22 | yield return new WaitForSeconds(0.5f); 23 | 24 | Configuring.CurrentURPA.MainLightMode(LightRenderingMode.PerPixel); 25 | yield return new WaitForSeconds(0.5f); 26 | 27 | Configuring.CurrentURPA.MainLightShadowsCasting(true); 28 | yield return new WaitForSeconds(0.5f); 29 | 30 | Configuring.CurrentURPA.MainLightShadowResolution(ShadowResolution._2048); 31 | yield return new WaitForSeconds(0.5f); 32 | 33 | Configuring.CurrentURPA.AdditionalLightsMode(LightRenderingMode.PerPixel); 34 | yield return new WaitForSeconds(0.5f); 35 | 36 | Configuring.CurrentURPA.MaxAdditionalLightsCount(4); 37 | yield return new WaitForSeconds(0.5f); 38 | 39 | Configuring.CurrentURPA.AdditionalLightsShadowsCasting(true); 40 | yield return new WaitForSeconds(0.5f); 41 | 42 | Configuring.CurrentURPA.AddtionalLightShadowResolution(ShadowResolution._2048); 43 | yield return new WaitForSeconds(0.5f); 44 | 45 | Configuring.CurrentURPA.ShadowDistance(100); 46 | yield return new WaitForSeconds(0.5f); 47 | 48 | Configuring.CurrentURPA.CascadeCount(4); 49 | yield return new WaitForSeconds(0.5f); 50 | 51 | Configuring.CurrentURPA.Cascade4Split(new Vector3(.1f, .3f, .7f)); 52 | yield return new WaitForSeconds(0.5f); 53 | 54 | Configuring.CurrentURPA.DepthBias(1f); 55 | yield return new WaitForSeconds(0.5f); 56 | 57 | Configuring.CurrentURPA.NormalBias(1f); 58 | yield return new WaitForSeconds(0.5f); 59 | 60 | Configuring.CurrentURPA.SoftShadows(true); 61 | yield return new WaitForSeconds(0.5f); 62 | 63 | Configuring.CurrentURPA.AdditionalLightsShadowResolutionTierLow(512); 64 | yield return new WaitForSeconds(0.5f); 65 | 66 | Configuring.CurrentURPA.AdditionalLightsShadowResolutionTierMedium(1024); 67 | yield return new WaitForSeconds(0.5f); 68 | 69 | Configuring.CurrentURPA.additionalLightsShadowResolutionTierHigh(2048); 70 | yield return new WaitForSeconds(0.5f); 71 | 72 | Configuring.CurrentURPA.ColorGradingMode(ColorGradingMode.HighDynamicRange); 73 | yield return new WaitForSeconds(0.5f); 74 | 75 | Configuring.CurrentURPA.ColorGradingLutSize(128); 76 | yield return new WaitForSeconds(0.5f); 77 | 78 | Configuring.CurrentURPA.UseFastSRGBLinearConversion(true); 79 | yield return new WaitForSeconds(0.5f); 80 | 81 | Configuring.CurrentURPA.SRPBatcher(true); 82 | yield return new WaitForSeconds(0.5f); 83 | 84 | Configuring.CurrentURPA.DynamicBatching(true); 85 | yield return new WaitForSeconds(0.5f); 86 | 87 | Configuring.CurrentURPA.MixedLighting(true); 88 | yield return new WaitForSeconds(0.5f); 89 | 90 | Configuring.CurrentURPA.ShaderVariantLogLevel(ShaderVariantLogLevel.OnlyUniversalRPShaders); 91 | yield return new WaitForSeconds(0.5f); 92 | 93 | } 94 | 95 | [UnityTest] 96 | public IEnumerator BackwardPass() 97 | { 98 | Configuring.CurrentURPA.TerrainHoles(false); 99 | yield return new WaitForSeconds(0.5f); 100 | 101 | Configuring.CurrentURPA.HDR(false); 102 | yield return new WaitForSeconds(0.5f); 103 | 104 | Configuring.CurrentURPA.AntiAliasing(MsaaQuality.Disabled); 105 | yield return new WaitForSeconds(0.5f); 106 | 107 | Configuring.CurrentURPA.MainLightMode(LightRenderingMode.Disabled); 108 | yield return new WaitForSeconds(0.5f); 109 | 110 | Configuring.CurrentURPA.MainLightShadowsCasting(false); 111 | yield return new WaitForSeconds(0.5f); 112 | 113 | Configuring.CurrentURPA.MainLightShadowResolution(ShadowResolution._256); 114 | yield return new WaitForSeconds(0.5f); 115 | 116 | Configuring.CurrentURPA.AdditionalLightsMode(LightRenderingMode.Disabled); 117 | yield return new WaitForSeconds(0.5f); 118 | 119 | Configuring.CurrentURPA.MaxAdditionalLightsCount(0); 120 | yield return new WaitForSeconds(0.5f); 121 | 122 | Configuring.CurrentURPA.AdditionalLightsShadowsCasting(false); 123 | yield return new WaitForSeconds(0.5f); 124 | 125 | Configuring.CurrentURPA.AddtionalLightShadowResolution(ShadowResolution._256); 126 | yield return new WaitForSeconds(0.5f); 127 | 128 | Configuring.CurrentURPA.ShadowDistance(0); 129 | yield return new WaitForSeconds(0.5f); 130 | 131 | Configuring.CurrentURPA.CascadeCount(1); 132 | yield return new WaitForSeconds(0.5f); 133 | 134 | Configuring.CurrentURPA.DepthBias(0f); 135 | yield return new WaitForSeconds(0.5f); 136 | 137 | Configuring.CurrentURPA.NormalBias(0f); 138 | yield return new WaitForSeconds(0.5f); 139 | 140 | Configuring.CurrentURPA.SoftShadows(false); 141 | yield return new WaitForSeconds(0.5f); 142 | 143 | Configuring.CurrentURPA.AdditionalLightsShadowResolutionTierLow(256); 144 | yield return new WaitForSeconds(0.5f); 145 | 146 | Configuring.CurrentURPA.AdditionalLightsShadowResolutionTierMedium(512); 147 | yield return new WaitForSeconds(0.5f); 148 | 149 | Configuring.CurrentURPA.additionalLightsShadowResolutionTierHigh(1024); 150 | yield return new WaitForSeconds(0.5f); 151 | 152 | Configuring.CurrentURPA.ColorGradingMode(ColorGradingMode.LowDynamicRange); 153 | yield return new WaitForSeconds(0.5f); 154 | 155 | Configuring.CurrentURPA.ColorGradingLutSize(32); 156 | yield return new WaitForSeconds(0.5f); 157 | 158 | Configuring.CurrentURPA.UseFastSRGBLinearConversion(false); 159 | yield return new WaitForSeconds(0.5f); 160 | 161 | Configuring.CurrentURPA.SRPBatcher(false); 162 | yield return new WaitForSeconds(0.5f); 163 | 164 | Configuring.CurrentURPA.DynamicBatching(false); 165 | yield return new WaitForSeconds(0.5f); 166 | 167 | Configuring.CurrentURPA.MixedLighting(false); 168 | yield return new WaitForSeconds(0.5f); 169 | 170 | Configuring.CurrentURPA.ShaderVariantLogLevel(ShaderVariantLogLevel.Disabled); 171 | yield return new WaitForSeconds(0.5f); 172 | } 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /Tests/Runtime/GraphicsConfiguratorTest.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 964716b9bc13f4b2ba3863c2f249b17e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tests/Runtime/inc8877.GraphicsConfigurator.Tests.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "inc8877.GraphicsConfigurator.Tests", 3 | "rootNamespace": "", 4 | "references": [ 5 | "UnityEngine.TestRunner", 6 | "UnityEditor.TestRunner", 7 | "Unity.RenderPipelines.Universal.Runtime", 8 | "inc8877.GraphicsConfigurator" 9 | ], 10 | "includePlatforms": [], 11 | "excludePlatforms": [], 12 | "allowUnsafeCode": false, 13 | "overrideReferences": true, 14 | "precompiledReferences": [ 15 | "nunit.framework.dll" 16 | ], 17 | "autoReferenced": false, 18 | "defineConstraints": [ 19 | "UNITY_INCLUDE_TESTS" 20 | ], 21 | "versionDefines": [], 22 | "noEngineReferences": false 23 | } -------------------------------------------------------------------------------- /Tests/Runtime/inc8877.GraphicsConfigurator.Tests.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49b3cf7976502475fa696fc7302cba2b 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.inc8877.graphicsconfigurator", 3 | "version": "1.1.1", 4 | "displayName": "GraphicsConfigurator", 5 | "description": "API for managing URP asset parameters, including hacking of parameters that are forbidden to change", 6 | "dependencies": { 7 | "com.unity.render-pipelines.universal": "11.0.0" 8 | }, 9 | "keywords": [ 10 | "universal-render-pipeline", 11 | "configuring", 12 | "settings", 13 | "workaround", 14 | "wrapper" 15 | ], 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/inc8877/GraphicsConfigurator.git" 19 | }, 20 | "author": { 21 | "name": "Volodymyr Bozhko", 22 | "email": "inc8877@gmail.com", 23 | "url": "https://github.com/inc8877" 24 | }, 25 | "license": "MIT" 26 | } 27 | -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 082707243d2164c64ba6935d07980d05 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------