[Add] All in one shader

This commit is contained in:
2026-02-23 22:01:07 +07:00
parent ec0aa86ac2
commit 4f942cd7c0
806 changed files with 401510 additions and 33 deletions
@@ -0,0 +1,49 @@
using System;
using System.IO;
using UnityEditor;
using UnityEngine;
namespace AllIn13DShader
{
public static class URPDefinesFileCreator
{
public static void CreateFile(URPSettings urpSettings, URPSettingsUserPref userPref)
{
string urpDefinesFilePath = Path.Combine(GlobalConfiguration.instance.RootPluginPath, "Shaders/ShaderLibrary/AllIn13DShader_FeaturesURP_Defines.hlsl");
string hlslLibraryTemplatePath = Path.Combine(GlobalConfiguration.instance.RootPluginPath, "Editor/Templates/HLSLLibrary_Template.allIn13DTemplate");
if (!File.Exists(urpDefinesFilePath))
{
Debug.LogError("URP defines file not found");
return;
}
if (!File.Exists(hlslLibraryTemplatePath))
{
Debug.LogError("HLSL library template not found");
return;
}
string fileText = File.ReadAllText(hlslLibraryTemplatePath);
string content = string.Empty;
for (int i = 0; i < userPref.preferences.Length; i++)
{
if (userPref.preferences[i].enabled)
{
string line = string.Format(Constants.DEFINE_LINE_FORMAT, urpSettings.configs[i].shaderDefine);
content += line;
content += "\n";
}
}
fileText = fileText.Replace("<LIBRARY_DEFINE>", "ALLIN13DSHADER_FEATURESURP_DEFINES");
fileText = fileText.Replace("<CONTENT>", content);
fileText = EditorUtils.UnifyEOL(fileText);
File.WriteAllText(urpDefinesFilePath, fileText);
EditorUtility.SetDirty(userPref);
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 7cb7da377e96d0a4eb22d4e1096b0abf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 316173
packageName: All In 1 3D-Shader
packageVersion: 2.72
assetPath: Assets/Plugins/AllIn13DShader/Editor/URP Settings/URPDefinesFileCreator.cs
uploadId: 865720
@@ -0,0 +1,13 @@
using UnityEngine;
namespace AllIn13DShader
{
[System.Serializable]
public class URPFeatureConfig
{
public string shaderDefine;
public bool defaultValue;
[TextArea] public string displayName;
[TextArea] public string tooltip;
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 9acfe1c62a8952a478ff077e760990fb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 316173
packageName: All In 1 3D-Shader
packageVersion: 2.72
assetPath: Assets/Plugins/AllIn13DShader/Editor/URP Settings/URPFeatureConfig.cs
uploadId: 865720
@@ -0,0 +1,20 @@
namespace AllIn13DShader
{
[System.Serializable]
public class URPFeatureUserPref
{
public string id;
public bool enabled;
public URPFeatureUserPref(URPFeatureConfig config)
{
Init(config);
}
public void Init(URPFeatureConfig config)
{
this.id = config.shaderDefine;
this.enabled = config.defaultValue;
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: fa8bf848a0315b948bb27aec4c2cd886
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 316173
packageName: All In 1 3D-Shader
packageVersion: 2.72
assetPath: Assets/Plugins/AllIn13DShader/Editor/URP Settings/URPFeatureUserPref.cs
uploadId: 865720
@@ -0,0 +1,78 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a34d35cf36d0b9649b45a5ba18657d1f, type: 3}
m_Name: URPSettings
m_EditorClassIdentifier: AllIn13DShaderAssemebly.Editor::AllIn13DShader.URPSettings
configs:
- shaderDefine: ALLIN1_GPU_INSTANCING_SUPPORT
defaultValue: 1
displayName: GPU Instancing Support
tooltip: Enables GPU Instancing for better performance when rendering many identical
objects
- shaderDefine: ALLIN1_DOTS_INSTANCING_SUPPORT
defaultValue: 0
displayName: Entities Graphics Instancing Support (and GPU Resident Drawer)
tooltip: Supports Unity Entities Graphics instancing for DOTS-based projects
and GPU Resident Drawer
- shaderDefine: ALLIN1_FOG_SUPPORT
defaultValue: 1
displayName: Fog Support
tooltip: Unity fog system integration for atmospheric effects
- shaderDefine: ALLIN1_LIGHTMAPS_SUPPORT
defaultValue: 1
displayName: Lightmaps Support
tooltip: Enables baked lightmap support for static lighting
- shaderDefine: ALLIN1_ADDITIONAL_LIGHTS_SUPPORT
defaultValue: 1
displayName: Additional Lights Support
tooltip: Support for additional real-time lights beyond main directional light
- shaderDefine: ALLIN1_CAST_SHADOWS_SUPPORT
defaultValue: 1
displayName: Cast Shadows Support
tooltip: Enables shadow casting from materials using this shader
- shaderDefine: ALLIN1_SHADOW_MASK_SUPPORT
defaultValue: 1
displayName: Shadow Mask Support
tooltip: Mixed lighting shadowmask support for hybrid lighting setups
- shaderDefine: ALLIN1_FORWARD_PLUS_SUPPORT_UNITY6
defaultValue: 1
displayName: Forward+ Support (Unity 6+)
tooltip: Forward+ rendering path support (Unity 6+ only)
- shaderDefine: ALLIN1_REFLECTIONS_PROBES_SUPPORT_UNITY6
defaultValue: 0
displayName: Reflection Probes Blending Support (Unity 6+)
tooltip: Probe blending support (Unity 6+ only, if you aren't using more than
1 probe you can disable this)
- shaderDefine: ALLIN1_ADAPTATIVE_PROBE_VOLUMES_UNITY6
defaultValue: 1
displayName: Adaptative Probe Volumes (Unity 6+)
tooltip: Adaptative Probe Volumes support (Unity 6+ only)
- shaderDefine: ALLIN1_SSO_SUPPORT
defaultValue: 1
displayName: Screen Space Ambient Occlusion
tooltip: Screen Space Ambient Occlusion integration
- shaderDefine: ALLIN1_LIGHT_LAYERS_SUPPORT
defaultValue: 0
displayName: Light Layers Support
tooltip: Unity light layer system support (for selective lighting)
- shaderDefine: ALLIN1_DECALS_SUPPORT
defaultValue: 0
displayName: Decals Support
tooltip: Unity decals system support
- shaderDefine: ALLIN1_LIGHT_COOKIES_SUPPORT
defaultValue: 0
displayName: 'Light Cookies '
tooltip: Unity Light Cookies system support
- shaderDefine: ALLIN1_LODCROSSFADE_SUPPORT
defaultValue: 0
displayName: LOD Cross Fade
tooltip: LOD Cross Fade support
@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: cbb6de4f9322b024abf937982abd31f7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 316173
packageName: All In 1 3D-Shader
packageVersion: 2.72
assetPath: Assets/Plugins/AllIn13DShader/Editor/URP Settings/URPSettings.asset
uploadId: 865720
@@ -0,0 +1,28 @@
using UnityEngine;
namespace AllIn13DShader
{
[CreateAssetMenu(menuName = "AllIn13D/URP Settings")]
public class URPSettings : ScriptableObject
{
public const string ASSET_NAME = "URPSettings";
public URPFeatureConfig[] configs;
public URPFeatureConfig FindConfigByID(string id)
{
URPFeatureConfig res = null;
for(int i = 0; i < configs.Length; i++)
{
if(configs[i].shaderDefine == id)
{
res = configs[i];
break;
}
}
return res;
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: a34d35cf36d0b9649b45a5ba18657d1f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 316173
packageName: All In 1 3D-Shader
packageVersion: 2.72
assetPath: Assets/Plugins/AllIn13DShader/Editor/URP Settings/URPSettings.cs
uploadId: 865720
@@ -0,0 +1,94 @@
using System.IO;
using UnityEditor;
using UnityEngine;
namespace AllIn13DShader
{
public class URPSettingsUserPref : ScriptableObject
{
public const string ASSET_NAME = "URPSettingsUserPref";
public URPFeatureUserPref[] preferences;
public void Init(URPSettings urpSettings)
{
preferences = new URPFeatureUserPref[urpSettings.configs.Length];
for(int i = 0; i < urpSettings.configs.Length; i++)
{
preferences[i] = new URPFeatureUserPref(urpSettings.configs[i]);
}
}
public static URPSettingsUserPref InitIfNeeded()
{
URPSettingsUserPref res = null;
res = EditorUtils.FindAsset<URPSettingsUserPref>(ASSET_NAME);
if (res == null)
{
URPSettings urpSettings = EditorUtils.FindAsset<URPSettings>(URPSettings.ASSET_NAME);
res = ScriptableObject.CreateInstance<URPSettingsUserPref>();
res.Init(urpSettings);
string filePath = Path.Combine(GlobalConfiguration.instance.GlobalConfigFolderPath, ASSET_NAME + ".asset");
AssetDatabase.CreateAsset(res, filePath);
URPDefinesFileCreator.CreateFile(urpSettings, res);
AssetDatabase.Refresh();
}
else
{
URPSettings urpSettings = EditorUtils.FindAsset<URPSettings>(URPSettings.ASSET_NAME);
if (res.preferences.Length != urpSettings.configs.Length)
{
res.MatchWithURPSettings(urpSettings);
}
}
return res;
}
public void MatchWithURPSettings(URPSettings urpSettings)
{
for(int i = preferences.Length - 1; i >= 0; i--)
{
URPFeatureConfig urpFeatureConfig = urpSettings.FindConfigByID(preferences[i].id);
if(urpFeatureConfig == null)
{
ArrayUtility.RemoveAt(ref preferences, i);
}
}
for(int i = 0; i < urpSettings.configs.Length; i++)
{
URPFeatureUserPref userPref = FindPreferenceByID(urpSettings.configs[i].shaderDefine);
if(userPref == null)
{
ArrayUtility.Add(ref preferences, new URPFeatureUserPref(urpSettings.configs[i]));
}
}
}
public URPFeatureUserPref FindPreferenceByID(string id)
{
URPFeatureUserPref res = null;
for(int i = 0; i < preferences.Length; i++)
{
if (preferences[i].id == id)
{
res = preferences[i];
break;
}
}
return res;
}
}
}
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 18225d53cd7719c49b6df4340a1549ff
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 316173
packageName: All In 1 3D-Shader
packageVersion: 2.72
assetPath: Assets/Plugins/AllIn13DShader/Editor/URP Settings/URPSettingsUserPref.cs
uploadId: 865720