Import art/VFX asset packs + game-feel systems; normalize texture extensions to lowercase for LFS
Add BefourStudios SciFi environment packs, Gabriel Aguiar VFX, and the ShaderCrew Toon Shader embedded packages, plus combat/enemy/wave/death gameplay systems and supporting vault docs/screenshots. Rename 11 vendor textures from uppercase .PNG/.HDR to lowercase so the case-sensitive Git LFS filters (*.png/*.hdr) match on case-sensitive filesystems (Linux CI, case-sensitive macOS), not just locally where core.ignorecase=true masks the gap. Each .meta moved with its asset so GUID references are preserved. All ~1000 binaries tracked via LFS. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ef9d8a6cad0a1e47aae907b17781540
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
public static class GeneralUtils
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aea506b4076703b4fa375486f01b223a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 269238
|
||||
packageName: The Toon Shader
|
||||
packageVersion: 1.4.2
|
||||
assetPath: Packages/com.shadercrew.the-toon-shader.core/Scripts/Runtime/Common/GeneralUtils.cs
|
||||
uploadId: 919972
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
[System.Serializable]
|
||||
public class PropertyCategorySO
|
||||
{
|
||||
[SerializeField]
|
||||
public bool boolValue;
|
||||
|
||||
[SerializeField]
|
||||
public int propertiesActive;
|
||||
|
||||
public PropertyCategorySO()
|
||||
{
|
||||
propertiesActive = 4;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e0593ea088fb454194e06948d859bc0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 269238
|
||||
packageName: The Toon Shader
|
||||
packageVersion: 1.4.2
|
||||
assetPath: Packages/com.shadercrew.the-toon-shader.core/Scripts/Runtime/Common/PropertyCategorySO.cs
|
||||
uploadId: 919972
|
||||
+495
@@ -0,0 +1,495 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
public static class ReplaceAndSyncUtils
|
||||
{
|
||||
public static void AddTheToonShaderInstancePrefix(Material materialInstance)
|
||||
{
|
||||
string name = materialInstance.name;
|
||||
name = name.Replace(" (Instance)", "");
|
||||
if (!name.Contains(TheToonShaderConstants.THETOONSHADER_INSTANCE_PREFIX))
|
||||
{
|
||||
materialInstance.name = name + " (" + TheToonShaderConstants.THETOONSHADER_INSTANCE_PREFIX + ")";
|
||||
}
|
||||
}
|
||||
|
||||
private static Material getFirstInstancedMaterial(Transform[] transforms)
|
||||
{
|
||||
if (transforms != null && transforms.Length > 0)
|
||||
{
|
||||
foreach (Transform transform in transforms)
|
||||
{
|
||||
if (transform != null)
|
||||
{
|
||||
Renderer renderer = transform.GetComponent<Renderer>();
|
||||
if (renderer != null)
|
||||
{
|
||||
Material[] materials = renderer.sharedMaterials;
|
||||
if (materials != null && materials.Length > 0)
|
||||
{
|
||||
foreach (Material material in materials)
|
||||
{
|
||||
if (IsTheToonShaderMaterial(material))
|
||||
{
|
||||
return material;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets all materials, including the ones in various LOD levels, which are associated with given transforms
|
||||
public static List<Material> GetAllTheToonShaderMaterialsFromTransforms(Transform[] transforms, Material referenceMaterial)
|
||||
{
|
||||
List<Material> materialList = new List<Material>();
|
||||
|
||||
foreach (Transform transform in transforms)
|
||||
{
|
||||
if(transform != null)
|
||||
{
|
||||
//Renderer rendererNonLOD = transform.GetComponent<Renderer>();
|
||||
Renderer[] rendererNonLODArray = transform.GetComponentsInChildren<Renderer>();
|
||||
for (int i = 0; i < rendererNonLODArray.Length; i++)
|
||||
{
|
||||
if (transform.GetComponent<LODGroup>() != null)
|
||||
{
|
||||
foreach (LOD lod in transform.GetComponent<LODGroup>().GetLODs())
|
||||
{
|
||||
foreach (Renderer renderer in lod.renderers)
|
||||
{
|
||||
if (renderer == rendererNonLODArray[i])
|
||||
{
|
||||
rendererNonLODArray[i] = null;
|
||||
}
|
||||
if (renderer != null && renderer.sharedMaterials.Length > 0)
|
||||
{
|
||||
foreach (Material material in renderer.sharedMaterials)
|
||||
{
|
||||
if (material != null && IsTheToonShaderMaterial(material))
|
||||
{
|
||||
if (!materialList.Contains(material))
|
||||
{
|
||||
materialList.Add(material);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rendererNonLODArray[i] != null)
|
||||
{
|
||||
Material[] materials = rendererNonLODArray[i].sharedMaterials;
|
||||
if (materials.Length > 0)
|
||||
{
|
||||
foreach (Material material in materials)
|
||||
{
|
||||
if (material != null && IsTheToonShaderMaterial(material))
|
||||
{
|
||||
if (!materialList.Contains(material))
|
||||
{
|
||||
materialList.Add(material);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return materialList;
|
||||
}
|
||||
|
||||
private static bool IsTheToonShaderMaterial(Material material)
|
||||
{
|
||||
return (material != null && material.HasProperty(TheToonShaderConstants.THETOONSHADER_IDENTIFIER_PROPERTY));
|
||||
|
||||
}
|
||||
public static void SyncKeywords(Material source, Material target)
|
||||
{
|
||||
if (source == null || target == null)
|
||||
return;
|
||||
|
||||
if (source.shader != target.shader)
|
||||
return;
|
||||
//Debug.LogWarning("SyncKeywords: materials use different shaders.");
|
||||
|
||||
target.shaderKeywords = source.shaderKeywords;
|
||||
}
|
||||
|
||||
public static void UpdateTheToonShaderMaterialPropertiesAndKeywords(List<Material> materials, Material referenceMaterial,
|
||||
Dictionary<string, bool> propertyNameToBoolDictionary,
|
||||
bool forceUpdateOfAllPropertiesAndKeywords = false)
|
||||
{
|
||||
if(forceUpdateOfAllPropertiesAndKeywords)
|
||||
{
|
||||
|
||||
//bool doKeywordSync = false; //a bit of a hack, make cleaner 1
|
||||
|
||||
List<string> properties = new List<string>();
|
||||
foreach (string propertyName in ShaderUtils.ALL_PROPERITES)
|
||||
{
|
||||
bool propertyInsideDictionary = propertyNameToBoolDictionary.TryGetValue(propertyName, out bool propertyToggled);
|
||||
if (propertyInsideDictionary && propertyName != null)
|
||||
{
|
||||
if (propertyToggled)
|
||||
{
|
||||
properties.Add(propertyName);
|
||||
////a bit of a hack, make cleaner 2
|
||||
//if(propertyName.Equals("_ShadingMode"))
|
||||
//{
|
||||
// doKeywordSync = true;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
List<string> keywords = ShaderUtils.GetKeywordList(properties);
|
||||
foreach (Material material in materials)
|
||||
{
|
||||
if (properties.Count > 0)
|
||||
{
|
||||
updateMaterialProperties(material, referenceMaterial, properties);
|
||||
}
|
||||
|
||||
//if(doKeywordSync)//a bit of a hack, make cleaner 3
|
||||
//{
|
||||
// updateMaterialKeywords(material, referenceMaterial, ShaderUtils.THETOONSHADER_KEYWORDS_LIST);
|
||||
//}
|
||||
//SyncKeywords(referenceMaterial, material);
|
||||
updateMaterialKeywords(material, referenceMaterial, keywords);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Material firstInstancedMaterial = null;
|
||||
foreach (Material material in materials)
|
||||
{
|
||||
if (IsTheToonShaderMaterial(material))
|
||||
{
|
||||
firstInstancedMaterial = material;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (firstInstancedMaterial != null)
|
||||
{
|
||||
List<string> namesOfChangedProperties = GetNamesOfAllChangedPropertyValues(firstInstancedMaterial, referenceMaterial, propertyNameToBoolDictionary);
|
||||
List<string> namesOfChangedKeywords = GetNamesOfAllChangedKeywordValues(firstInstancedMaterial, referenceMaterial, namesOfChangedProperties);
|
||||
if ((namesOfChangedProperties != null && namesOfChangedProperties.Count > 0) || (namesOfChangedKeywords != null && namesOfChangedKeywords.Count > 0))
|
||||
{
|
||||
foreach (Material material in materials)
|
||||
{
|
||||
if (namesOfChangedProperties.Count > 0)
|
||||
{
|
||||
updateMaterialProperties(material, referenceMaterial, namesOfChangedProperties);
|
||||
}
|
||||
if (namesOfChangedKeywords.Count > 0)
|
||||
{
|
||||
//if(namesOfChangedProperties.Contains("_ShadingMode")) //a bit of a hack, make cleaner 4
|
||||
{
|
||||
updateMaterialKeywords(material, referenceMaterial, namesOfChangedKeywords);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void UpdateTheToonShaderMaterialPropertiesAndKeywords(Transform[] transforms, Material referenceMaterial,
|
||||
Dictionary<string, bool> propertyNameToBoolDictionary,
|
||||
bool forceUpdateOfAllPropertiesAndKeywords = false)
|
||||
{
|
||||
//bool doKeywordSync = false; //a bit of a hack, make cleaner 1
|
||||
|
||||
|
||||
if (forceUpdateOfAllPropertiesAndKeywords)
|
||||
{
|
||||
//Debug.Log("UpdateTheToonShaderMaterialPropertiesAndKeywords forced");
|
||||
List<string> properties = new List<string>();
|
||||
foreach (string propertyName in ShaderUtils.ALL_PROPERITES)
|
||||
{
|
||||
bool propertyInsideDictionary = propertyNameToBoolDictionary.TryGetValue(propertyName, out bool propertyToggled);
|
||||
if (propertyInsideDictionary && propertyName != null)
|
||||
{
|
||||
if (propertyToggled)
|
||||
{
|
||||
properties.Add(propertyName);
|
||||
|
||||
//if (propertyName.Equals("_ShadingMode")) //a bit of a hack, make cleaner 2
|
||||
//{
|
||||
// doKeywordSync = true;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
List<string> keywords = ShaderUtils.GetKeywordList(properties);
|
||||
|
||||
List<Material> allTheToonShaderMaterials = GetAllTheToonShaderMaterialsFromTransforms(transforms, referenceMaterial);
|
||||
//Debug.Log("Toon Shader Count: " + allTheToonShaderMaterials.Count);
|
||||
if (allTheToonShaderMaterials != null && allTheToonShaderMaterials.Count > 0)
|
||||
{
|
||||
foreach (Material material in allTheToonShaderMaterials)
|
||||
{
|
||||
//Debug.Log("Material name: " + material.name);
|
||||
if (properties.Count > 0)
|
||||
{
|
||||
updateMaterialProperties(material, referenceMaterial, properties);
|
||||
}
|
||||
//if (doKeywordSync)//a bit of a hack, make cleaner 3
|
||||
//{
|
||||
// updateMaterialKeywords(material, referenceMaterial, ShaderUtils.THETOONSHADER_KEYWORDS_LIST);
|
||||
//}
|
||||
//SyncKeywords(referenceMaterial, material);
|
||||
updateMaterialKeywords(material, referenceMaterial, keywords);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Debug.Log("UpdateTheToonShaderMaterialPropertiesAndKeywords");
|
||||
|
||||
Material firstInstancedMaterial = getFirstInstancedMaterial(transforms);
|
||||
if (firstInstancedMaterial != null)
|
||||
{
|
||||
List<string> namesOfChangedProperties = GetNamesOfAllChangedPropertyValues(firstInstancedMaterial, referenceMaterial, propertyNameToBoolDictionary);
|
||||
List<string> namesOfChangedKeywords = GetNamesOfAllChangedKeywordValues(firstInstancedMaterial, referenceMaterial, namesOfChangedProperties);
|
||||
if ((namesOfChangedProperties != null && namesOfChangedProperties.Count > 0) || (namesOfChangedKeywords != null && namesOfChangedKeywords.Count > 0))
|
||||
{
|
||||
List<Material> allTheToonShaderMaterials = GetAllTheToonShaderMaterialsFromTransforms(transforms, referenceMaterial);
|
||||
if(allTheToonShaderMaterials != null && allTheToonShaderMaterials.Count > 0)
|
||||
{
|
||||
foreach (Material material in allTheToonShaderMaterials)
|
||||
{
|
||||
if (namesOfChangedProperties.Count > 0)
|
||||
{
|
||||
updateMaterialProperties(material, referenceMaterial, namesOfChangedProperties);
|
||||
}
|
||||
if (namesOfChangedKeywords.Count > 0)
|
||||
{
|
||||
//if (namesOfChangedProperties.Contains("_ShadingMode")) //a bit of a hack, make cleaner 4
|
||||
{
|
||||
updateMaterialKeywords(material, referenceMaterial, namesOfChangedKeywords);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void updateMaterialProperties(Material instancedMaterial, Material referenceMaterial, List<string> namesOfChangedProperties)
|
||||
{
|
||||
if (instancedMaterial != null && referenceMaterial != null && namesOfChangedProperties != null && namesOfChangedProperties.Count > 0)
|
||||
{
|
||||
Shader shader = referenceMaterial.shader;
|
||||
|
||||
foreach (string propertyName in namesOfChangedProperties)
|
||||
{
|
||||
if (referenceMaterial.HasProperty(propertyName) && instancedMaterial.HasProperty(propertyName))
|
||||
{
|
||||
ShaderPropertyType shaderPropertyType = shader.GetPropertyType(shader.FindPropertyIndex(propertyName));
|
||||
|
||||
|
||||
if (shaderPropertyType == ShaderPropertyType.Float || shaderPropertyType == ShaderPropertyType.Range)
|
||||
{
|
||||
|
||||
float value = referenceMaterial.GetFloat(propertyName);
|
||||
instancedMaterial.SetFloat(propertyName, value);
|
||||
}
|
||||
else if (shaderPropertyType == ShaderPropertyType.Color)
|
||||
{
|
||||
Color value = referenceMaterial.GetColor(propertyName);
|
||||
instancedMaterial.SetColor(propertyName, value);
|
||||
}
|
||||
else if (shaderPropertyType == ShaderPropertyType.Texture)
|
||||
{
|
||||
Texture texture = referenceMaterial.GetTexture(propertyName);
|
||||
instancedMaterial.SetTexture(propertyName, texture);
|
||||
Vector2 offset = referenceMaterial.GetTextureOffset(propertyName);
|
||||
instancedMaterial.SetTextureOffset(propertyName, offset);
|
||||
Vector2 scale = referenceMaterial.GetTextureScale(propertyName);
|
||||
instancedMaterial.SetTextureScale(propertyName, scale);
|
||||
}
|
||||
else if (shaderPropertyType == ShaderPropertyType.Vector)
|
||||
{
|
||||
Vector4 vector = referenceMaterial.GetVector(propertyName);
|
||||
instancedMaterial.SetVector(propertyName, vector);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void updateMaterialKeywords(Material instancedMaterial, Material referenceMaterial, List<string> namesOfChangedKeywords)
|
||||
{
|
||||
foreach (string keyword in namesOfChangedKeywords)
|
||||
{
|
||||
bool isKeywordEnabled = referenceMaterial.IsKeywordEnabled(keyword);
|
||||
if (isKeywordEnabled)
|
||||
{
|
||||
instancedMaterial.EnableKeyword(keyword);
|
||||
}
|
||||
else
|
||||
{
|
||||
instancedMaterial.DisableKeyword(keyword);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static List<string> GetNamesOfAllChangedPropertyValues(Material instancedMaterial,
|
||||
Material referenceMaterial,
|
||||
Dictionary<string, bool> propertyNameToBoolDictionary)
|
||||
{
|
||||
if (instancedMaterial != null && referenceMaterial != null)
|
||||
{
|
||||
if (IsTheToonShaderMaterial(instancedMaterial) && IsTheToonShaderMaterial(referenceMaterial))
|
||||
{
|
||||
Shader shader = referenceMaterial.shader;
|
||||
List<string> namesOfChangedProperties = new List<string>();
|
||||
foreach (string propertyName in ShaderUtils.ALL_PROPERITES)
|
||||
{
|
||||
if (referenceMaterial.HasProperty(propertyName) && instancedMaterial.HasProperty(propertyName))
|
||||
{
|
||||
bool propertyInsideDictionary = propertyNameToBoolDictionary.TryGetValue(propertyName, out bool propertyToggled);
|
||||
if (propertyInsideDictionary && propertyName != null)
|
||||
{
|
||||
if (propertyToggled)
|
||||
{
|
||||
ShaderPropertyType shaderPropertyType = shader.GetPropertyType(referenceMaterial.shader.FindPropertyIndex(propertyName));
|
||||
|
||||
if (shaderPropertyType == ShaderPropertyType.Float || shaderPropertyType == ShaderPropertyType.Range)
|
||||
{
|
||||
float instancedValue = instancedMaterial.GetFloat(propertyName);
|
||||
float referenceValue = referenceMaterial.GetFloat(propertyName);
|
||||
if ((instancedValue != referenceValue)) // || force)
|
||||
{
|
||||
namesOfChangedProperties.Add(propertyName);
|
||||
}
|
||||
}
|
||||
else if (shaderPropertyType == ShaderPropertyType.Color)
|
||||
{
|
||||
Color instancedColor = instancedMaterial.GetColor(propertyName);
|
||||
Color referenceColor = referenceMaterial.GetColor(propertyName);
|
||||
if (!instancedColor.Equals(referenceColor))
|
||||
{
|
||||
namesOfChangedProperties.Add(propertyName);
|
||||
}
|
||||
}
|
||||
else if (shaderPropertyType == ShaderPropertyType.Texture)
|
||||
{
|
||||
Texture instancedTexture = instancedMaterial.GetTexture(propertyName);
|
||||
Texture referenceTexture = referenceMaterial.GetTexture(propertyName);
|
||||
if (instancedTexture != null && referenceTexture != null)
|
||||
{
|
||||
if (!String.Equals(instancedTexture.name, referenceTexture.name))
|
||||
{
|
||||
namesOfChangedProperties.Add(propertyName);
|
||||
}
|
||||
else if (instancedMaterial.GetTextureOffset(propertyName) != referenceMaterial.GetTextureOffset(propertyName)
|
||||
|| instancedMaterial.GetTextureScale(propertyName) != referenceMaterial.GetTextureScale(propertyName))
|
||||
{
|
||||
namesOfChangedProperties.Add(propertyName);
|
||||
}
|
||||
}
|
||||
else if ((instancedTexture != null) != (referenceTexture != null))
|
||||
{
|
||||
namesOfChangedProperties.Add(propertyName);
|
||||
}
|
||||
}
|
||||
else if (shaderPropertyType == ShaderPropertyType.Vector)
|
||||
{
|
||||
Vector4 instancedVector = instancedMaterial.GetVector(propertyName);
|
||||
Vector4 referenceVector = referenceMaterial.GetVector(propertyName);
|
||||
|
||||
if (!instancedVector.Equals(referenceVector))
|
||||
{
|
||||
namesOfChangedProperties.Add(propertyName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return namesOfChangedProperties;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
//private static List<string> GetNamesOfAllChangedKeywordValues(Material instancedMaterial, Material referenceMaterial)
|
||||
//{
|
||||
// if (instancedMaterial != null && referenceMaterial != null)
|
||||
// {
|
||||
// if (IsTheToonShaderMaterial(instancedMaterial) && IsTheToonShaderMaterial(referenceMaterial))
|
||||
// {
|
||||
// List<string> namesOfChangedProperties = new List<string>();
|
||||
// //foreach (string keyword in ShaderUtils.THETOONSHADER_KEYWORDS_LIST)
|
||||
// foreach (string keyword in referenceMaterial.shaderKeywords)
|
||||
// {
|
||||
// bool instancedValue = instancedMaterial.IsKeywordEnabled(keyword);
|
||||
// bool referenceValue = referenceMaterial.IsKeywordEnabled(keyword);
|
||||
// if (instancedValue != referenceValue)
|
||||
// {
|
||||
// namesOfChangedProperties.Add(keyword);
|
||||
// }
|
||||
// }
|
||||
// return namesOfChangedProperties;
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
//}
|
||||
|
||||
|
||||
private static List<string> GetNamesOfAllChangedKeywordValues(Material instancedMaterial, Material referenceMaterial, List<string> namesOfChangedProperties)
|
||||
{
|
||||
if (instancedMaterial != null && referenceMaterial != null)
|
||||
{
|
||||
if (IsTheToonShaderMaterial(instancedMaterial) && IsTheToonShaderMaterial(referenceMaterial))
|
||||
{
|
||||
List<string> namesOfChangedKeywords= new List<string>();
|
||||
//foreach (string keyword in ShaderUtils.THETOONSHADER_KEYWORDS_LIST)
|
||||
//foreach (string keyword in referenceMaterial.shaderKeywords)
|
||||
List<string> keywords = ShaderUtils.GetKeywordList(namesOfChangedProperties);
|
||||
foreach (string keyword in keywords)
|
||||
{
|
||||
bool instancedValue = instancedMaterial.IsKeywordEnabled(keyword);
|
||||
bool referenceValue = referenceMaterial.IsKeywordEnabled(keyword);
|
||||
if (instancedValue != referenceValue)
|
||||
{
|
||||
namesOfChangedProperties.Add(keyword);
|
||||
}
|
||||
}
|
||||
return namesOfChangedProperties;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9422680e0ced5164595567e675c07645
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 269238
|
||||
packageName: The Toon Shader
|
||||
packageVersion: 1.4.2
|
||||
assetPath: Packages/com.shadercrew.the-toon-shader.core/Scripts/Runtime/Common/ReplaceAndSyncUtils.cs
|
||||
uploadId: 919972
|
||||
@@ -0,0 +1,784 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
#if USING_URP
|
||||
using UnityEngine.Rendering.Universal;
|
||||
#endif
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
public static class ShaderUtils
|
||||
{
|
||||
|
||||
public enum RenderPipelineOptions
|
||||
{
|
||||
HDRP,
|
||||
URP,
|
||||
BiRP,
|
||||
URP2D,
|
||||
NONE
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static RenderPipelineOptions getCurrentRenderPipeline()
|
||||
{
|
||||
RenderPipelineOptions rp;
|
||||
if (GraphicsSettings.currentRenderPipeline)
|
||||
{
|
||||
if (GraphicsSettings.currentRenderPipeline.GetType().ToString().Contains("HighDefinition"))
|
||||
{
|
||||
rp = RenderPipelineOptions.HDRP;
|
||||
}
|
||||
else
|
||||
{
|
||||
rp = RenderPipelineOptions.URP;
|
||||
}
|
||||
|
||||
#if USING_URP2D && USING_URP
|
||||
UniversalRenderPipelineAsset urpAsset = GraphicsSettings.currentRenderPipeline as UniversalRenderPipelineAsset;
|
||||
ScriptableRenderer renderer = urpAsset.scriptableRenderer;
|
||||
if (renderer.GetType().Name.Contains("Renderer2D"))
|
||||
{
|
||||
rp = RenderPipelineOptions.URP2D;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
rp = RenderPipelineOptions.BiRP;
|
||||
}
|
||||
|
||||
return rp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static readonly Dictionary<string, string> STS_BIRP_SHADER_DICTIONARY = new Dictionary<string, string>
|
||||
{
|
||||
|
||||
#if __I_AM_A_THETOONSHADER_DEV__
|
||||
{ TheToonShaderConstants.TTS_SHADER_DEFAULT_KEY, "Dev/TheToonShaderDev_BiRP_WithOutline"},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STANDARD_WITH_OUTLINE_KEY, "Dev/TheToonShaderDev_BiRP_WithOutline"},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STANDARD_KEY, "Dev/TheToonShaderDev_BiRP"},
|
||||
#else
|
||||
{ TheToonShaderConstants.TTS_SHADER_DEFAULT_KEY, TheToonShaderConstants.TTS_SHADER_NAME_BIRP_WITH_OUTLINE},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STANDARD_WITH_OUTLINE_KEY, TheToonShaderConstants.TTS_SHADER_NAME_BIRP_WITH_OUTLINE},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STANDARD_KEY, TheToonShaderConstants.TTS_SHADER_NAME_BIRP},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STS_KEY, TheToonShaderConstants.TTS_SHADER_NAME_BIRP_WITH_STS},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STS_WITH_OUTLINE_KEY, TheToonShaderConstants.TTS_SHADER_NAME_BIRP_WITH_OUTLINE_AND_STS},
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
//#if USING_HDRP
|
||||
// public static readonly Dictionary<string,string> TTS_HDRP_SHADER_DICTIONARY = new Dictionary<string, string>
|
||||
// {
|
||||
|
||||
//#if UNITY_2023 || UNITY_6000
|
||||
// //{ "HDRP/Unlit", "SeeThroughShader/HDRP/2023/Unlit" },
|
||||
// { "HDRP/Lit", "SeeThroughShader/HDRP/2023/Lit" },
|
||||
// { TheToonShaderConstants.TTS_SHADER_DEFAULT_KEY, "SeeThroughShader/HDRP/2023/Lit" },
|
||||
//#elif UNITY_2022
|
||||
// //{ "HDRP/Unlit", "SeeThroughShader/HDRP/2022/Unlit" },
|
||||
// { "HDRP/Lit", "SeeThroughShader/HDRP/2022/Lit" },
|
||||
// { TheToonShaderConstants.TTS_SHADER_DEFAULT_KEY, "SeeThroughShader/HDRP/2022/Lit" },
|
||||
//#elif UNITY_2021
|
||||
// //{ "HDRP/Unlit", "SeeThroughShader/HDRP/2021/Unlit" },
|
||||
// { "HDRP/Lit", "SeeThroughShader/HDRP/2021/Lit" },
|
||||
// { TheToonShaderConstants.TTS_SHADER_DEFAULT_KEY, "SeeThroughShader/HDRP/2021/Lit" },
|
||||
//#elif UNITY_2020
|
||||
// //{ "HDRP/Unlit", "SeeThroughShader/HDRP/2020/Unlit" },
|
||||
// { "HDRP/Lit", "SeeThroughShader/HDRP/2020/Lit" },
|
||||
// { TheToonShaderConstants.TTS_SHADER_DEFAULT_KEY, "SeeThroughShader/HDRP/2020/Lit" },
|
||||
//#else
|
||||
// //{ "HDRP/Unlit", "SeeThroughShader/HDRP/2019/Unlit" },
|
||||
// { "HDRP/Lit", "SeeThroughShader/HDRP/2019/Lit" },
|
||||
// { TheToonShaderConstants.TTS_SHADER_DEFAULT_KEY, "SeeThroughShader/HDRP/2019/Lit" },
|
||||
//#endif
|
||||
// };
|
||||
//#endif
|
||||
|
||||
|
||||
#if USING_URP
|
||||
public static readonly Dictionary<string, string> TTS_URP_SHADER_DICTIONARY = new Dictionary<string, string>
|
||||
{
|
||||
|
||||
#if __I_AM_A_THETOONSHADER_DEV__
|
||||
{ TheToonShaderConstants.TTS_SHADER_DEFAULT_KEY, "Dev/TheToonShaderDev_URP_WithOutline"},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STANDARD_WITH_OUTLINE_KEY, "Dev/TheToonShaderDev_URP_WithOutline"},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STANDARD_KEY, "Dev/TheToonShaderDev_URP"},
|
||||
#else
|
||||
#if UNITY_6000_3_OR_NEWER
|
||||
{ TheToonShaderConstants.TTS_SHADER_DEFAULT_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_UNITY6_3_WITH_OUTLINE},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STANDARD_WITH_OUTLINE_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_UNITY6_3_WITH_OUTLINE},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STANDARD_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_UNITY6_3},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STS_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_UNITY6_3_WITH_STS},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STS_WITH_OUTLINE_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_UNITY6_3_WITH_OUTLINE_AND_STS},
|
||||
#elif UNITY_2023 || UNITY_6000
|
||||
{ TheToonShaderConstants.TTS_SHADER_DEFAULT_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_UNITY6_WITH_OUTLINE},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STANDARD_WITH_OUTLINE_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_UNITY6_WITH_OUTLINE},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STANDARD_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_UNITY6},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STS_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_UNITY6_WITH_STS},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STS_WITH_OUTLINE_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_UNITY6_WITH_OUTLINE_AND_STS},
|
||||
#elif UNITY_2022
|
||||
{ TheToonShaderConstants.TTS_SHADER_DEFAULT_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_2022_WITH_OUTLINE},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STANDARD_WITH_OUTLINE_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_2022_WITH_OUTLINE},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STANDARD_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_2022},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STS_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_2022_WITH_STS},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STS_WITH_OUTLINE_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_2022_WITH_OUTLINE_AND_STS},
|
||||
#elif UNITY_2021
|
||||
{ TheToonShaderConstants.TTS_SHADER_DEFAULT_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_2021_WITH_OUTLINE},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STANDARD_WITH_OUTLINE_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_2021_WITH_OUTLINE},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STANDARD_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_2021},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STS_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_2021_WITH_STS},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STS_WITH_OUTLINE_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_2021_WITH_OUTLINE_AND_STS},
|
||||
#elif UNITY_2020
|
||||
{ TheToonShaderConstants.TTS_SHADER_DEFAULT_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_2020_WITH_OUTLINE},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STANDARD_WITH_OUTLINE_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_2020_WITH_OUTLINE},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STANDARD_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_2020},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STS_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_2020_WITH_STS},
|
||||
{ TheToonShaderConstants.TTS_SHADER_STS_WITH_OUTLINE_KEY, TheToonShaderConstants.TTS_SHADER_NAME_URP_2020_WITH_OUTLINE_AND_STS},
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
public static readonly Dictionary<string, string> TTS_URP2D_SHADER_DICTIONARY = new Dictionary<string, string>
|
||||
{
|
||||
|
||||
#if __I_AM_A_THETOONSHADER_DEV__
|
||||
{ TheToonShaderConstants.TTS_URP2D_SHADER_STANDARD_KEY, TheToonShaderConstants.TTS_SHADER_FILENAME_2D_SHADERGRAPH}
|
||||
#else
|
||||
{ TheToonShaderConstants.TTS_URP2D_SHADER_STANDARD_KEY, TheToonShaderConstants.TTS_SHADER_FILENAME_2D_SHADERGRAPH}
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static Dictionary<string, string> getUnityToTTSShaderMapping()
|
||||
{
|
||||
Dictionary<string, string> UnityToTTSShaderMapping = null;
|
||||
if (GraphicsSettings.currentRenderPipeline)
|
||||
{
|
||||
if (GraphicsSettings.currentRenderPipeline.GetType().ToString().Contains("HighDefinition"))
|
||||
{
|
||||
//#if USING_HDRP
|
||||
// UnityToTTSShaderMapping = TTS_HDRP_SHADER_DICTIONARY;
|
||||
//#endif
|
||||
}
|
||||
else //UTP
|
||||
{
|
||||
#if USING_URP
|
||||
UniversalRenderPipelineAsset urpAsset = GraphicsSettings.currentRenderPipeline as UniversalRenderPipelineAsset;
|
||||
ScriptableRenderer renderer = urpAsset.scriptableRenderer;
|
||||
if (renderer.GetType().Name.Contains("Renderer2D"))
|
||||
{
|
||||
UnityToTTSShaderMapping = TTS_URP2D_SHADER_DICTIONARY;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
UnityToTTSShaderMapping = TTS_URP_SHADER_DICTIONARY;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UnityToTTSShaderMapping = STS_BIRP_SHADER_DICTIONARY;
|
||||
}
|
||||
|
||||
return UnityToTTSShaderMapping;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static bool IsNativeTTSShader(Shader shader)
|
||||
{
|
||||
if(shader != null)
|
||||
{
|
||||
return IsNativeTTSShader(shader.name);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//public static bool IsNativeTTSShader(string shaderName)
|
||||
//{
|
||||
// if (shaderName != null && !shaderName.Equals(""))
|
||||
// {
|
||||
// if (THETOONSHADER_SHADER_LIST.Contains(shaderName))
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
//}
|
||||
|
||||
public static bool IsNativeTTSShader(string shaderName)
|
||||
{
|
||||
if (shaderName != null && !shaderName.Equals(""))
|
||||
{
|
||||
if (getUnityToTTSShaderMapping().ContainsValue(shaderName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public class UnityVersionRenderPipelineShaderInfo
|
||||
{
|
||||
public string unityVersion;
|
||||
public string renderPipeline;
|
||||
public string versionAndRPCorrectedShader;
|
||||
public string shaderFolder;
|
||||
|
||||
|
||||
public UnityVersionRenderPipelineShaderInfo(string unityVersion, string renderPipeline, string shader, string shaderFolder)
|
||||
{
|
||||
this.unityVersion = unityVersion;
|
||||
this.renderPipeline = renderPipeline;
|
||||
this.versionAndRPCorrectedShader = shader;
|
||||
this.shaderFolder = shaderFolder;
|
||||
}
|
||||
}
|
||||
public static UnityVersionRenderPipelineShaderInfo getUnityVersionAndRenderPipelineCorrectedShaderString()
|
||||
{
|
||||
string unityVersion;
|
||||
string renderPipeline;
|
||||
string shaderString;
|
||||
string shaderFolder;
|
||||
unityVersion = Application.unityVersion;
|
||||
if (GraphicsSettings.currentRenderPipeline)
|
||||
{
|
||||
if (GraphicsSettings.currentRenderPipeline.GetType().ToString().Contains("HighDefinition"))
|
||||
{
|
||||
renderPipeline = "HDRP";
|
||||
//if (unityVersion.Substring(0, 4).Equals("2019"))
|
||||
//{
|
||||
// shaderString = "TheToonShader/HDRP/TheToonShader_HDRP2019";
|
||||
// shaderFolder = "TheToonShader/HDRP/...";
|
||||
//}
|
||||
//else if (unityVersion.Substring(0, 4).Equals("2020"))
|
||||
//{
|
||||
// shaderString = "TheToonShader/HDRP/TheToonShader_HDRP2020";
|
||||
// shaderFolder = "TheToonShader/HDRP/...";
|
||||
//}
|
||||
//else if (unityVersion.Substring(0, 4).Equals("2021"))
|
||||
//{
|
||||
// shaderString = "TheToonShader/HDRP/TheToonShader_HDRP2021";
|
||||
// shaderFolder = "TheToonShader/HDRP/...";
|
||||
//}
|
||||
//else if (unityVersion.Substring(0, 4).Equals("2022"))
|
||||
//{
|
||||
// shaderString = "TheToonShader/HDRP/TheToonShader_HDRP2022";
|
||||
// shaderFolder = "TheToonShader/HDRP/...";
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// shaderString = "TheToonShader/HDRP/TheToonShader_HDRP2023";
|
||||
// shaderFolder = "TheToonShader/HDRP/...";
|
||||
//}
|
||||
shaderString = "unsupported";
|
||||
shaderFolder = "unsupported";
|
||||
}
|
||||
else
|
||||
{
|
||||
renderPipeline = "URP";
|
||||
if (unityVersion.Substring(0, 4).Equals("2020"))
|
||||
{
|
||||
shaderString = "TheToonShader/URP/2020/TheToonShader";
|
||||
shaderFolder = "TheToonShader/URP/2020/...";
|
||||
}
|
||||
else if (unityVersion.Substring(0, 4).Equals("2021"))
|
||||
{
|
||||
shaderString = "TheToonShader/URP/2021/TheToonShader";
|
||||
shaderFolder = "TheToonShader/URP/2021/...";
|
||||
}
|
||||
else if (unityVersion.Substring(0, 4).Equals("2022"))
|
||||
{
|
||||
shaderString = "TheToonShader/URP/2022/TheToonShader";
|
||||
shaderFolder = "TheToonShader/URP/2022/...";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (unityVersion.StartsWith("6000"))
|
||||
{
|
||||
int minor = int.Parse(unityVersion.Split('.')[1]);
|
||||
|
||||
if (minor < 3)
|
||||
{
|
||||
shaderString = "TheToonShader/URP/Unity6/TheToonShader";
|
||||
shaderFolder = "TheToonShader/URP/Unity6/...";
|
||||
}
|
||||
else
|
||||
{
|
||||
shaderString = "TheToonShader/URP/Unity6_3/TheToonShader";
|
||||
shaderFolder = "TheToonShader/URP/Unity6_3/...";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
shaderString = "unsupported";
|
||||
shaderFolder = "unsupported";
|
||||
}
|
||||
|
||||
}
|
||||
shaderString = "Dev/TheToonShaderDev_URP";
|
||||
#if __I_AM_A_THETOONSHADER_DEV_
|
||||
shaderString = "Dev/TheToonShaderDev_URP";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
renderPipeline = "Built-in RP";
|
||||
shaderString = "TheToonShader/URP/TheToonShader_BiRP";
|
||||
#if __I_AM_A_THETOONSHADER_DEV_
|
||||
shaderString = "Dev/TheToonShaderDev_BiRP";
|
||||
#endif
|
||||
shaderFolder = "TheToonShader/BiRP/...";
|
||||
}
|
||||
|
||||
return new UnityVersionRenderPipelineShaderInfo(unityVersion, renderPipeline, shaderString, shaderFolder);
|
||||
}
|
||||
|
||||
|
||||
public static List<string> SURFACEOPTIONS_PROPERTIES_LIST = new List<string>
|
||||
{
|
||||
"_Cutoff",
|
||||
"_Surface", "_Blend", "_Cull", "_AlphaClip", "_ReceiveShadows",
|
||||
};
|
||||
|
||||
public static Dictionary<string, List<string>> SURFACEOPTIONSANDINPUTS_CATEGORIES = new Dictionary<string, List<string>>
|
||||
{
|
||||
{ "Surface Options", SURFACEOPTIONS_PROPERTIES_LIST}, {"Surface Inputs", SURFACEOPTIONS_PROPERTIES_LIST}
|
||||
};
|
||||
|
||||
|
||||
|
||||
//public static readonly List<string> ALL_PROPERTIES_LIST = SURFACEOPTIONSANDINPUTS_PROPERTIES_LIST.Concat(TOONSHADING_PROPERTIES_LIST)
|
||||
// .Concat(STYLING_PROPERTIES_LIST)
|
||||
// .Concat(OUTLINE_PROPERTIES_LIST).ToList();
|
||||
|
||||
|
||||
|
||||
//public static readonly Dictionary<string, string> THETOONSHADER_PROPERTIES_LIST = new Dictionary<string, string> { };
|
||||
|
||||
public static readonly List<string> ALL_PROPERITES = new List<string>
|
||||
// public static string[] SURFACEOPTIONSANDINPUTS_PROPERTIES_LIST =
|
||||
{
|
||||
"_LightSource",
|
||||
"_ShadingMode", "_LightFunction",
|
||||
|
||||
"_UseAlphaOnlyFromBaseMap",
|
||||
|
||||
//BiRP and URP:
|
||||
"_Cull", "_AlphaClip", "_Cutoff",
|
||||
"_BumpScale", "_BumpMap", "_EmissionColor", "_EmissionMap", "_SmoothnessTextureChannel",
|
||||
"_Metallic", "_MetallicGlossMap", "_Parallax", "_ParallaxMap", "_OcclusionStrength",
|
||||
"_OcclusionMap", "_DetailMask", "_DetailAlbedoMap", "_DetailNormalMapScale", "_DetailNormalMap",
|
||||
|
||||
|
||||
|
||||
|
||||
#if USING_URP
|
||||
//URP only:
|
||||
"_BaseMap", "_BaseColor",
|
||||
"_Surface", "_Blend",
|
||||
"_ReceiveShadows", "_SpecularHighlights", "_SpecColor", "_SpecGlossMap",
|
||||
"_Smoothness", "_SmoothnessSource", "_WorkflowMode",
|
||||
"_EnvironmentReflections", "_DetailAlbedoMapScale",
|
||||
#else
|
||||
//BiRP only:
|
||||
"_Color","_MainTex",
|
||||
"_Glossiness","_GlossMapScale",
|
||||
"_UVSec","_Mode",
|
||||
#endif
|
||||
|
||||
"_EnableToonShading", "_ShadingFunction", "_GradientTex", "_GradientMode",
|
||||
"_GradientBlending", "_GradientBlendFactor", "_NumberOfCells", "_CellTransitionSmoothness", "_SumLightsBeforePosterization", "_ShadingUseLightColors", "_EnableShadows",
|
||||
"_CoreShadowColor", "_TerminatorPosition", "_TerminatorWidth", "_TerminatorSmoothness", "_FormShadowColor", "_EnableCastShadows",
|
||||
//"_CastShadowsStrength", "_CastShadowsSmoothness",
|
||||
"_CastShadowColor",
|
||||
"_CastShadowColorMode",
|
||||
|
||||
"_ShadingAffectedByNormalMap",
|
||||
//Specular
|
||||
"_EnableSpecular", "_SpecularBlending", "_SpecularColor", "_SpecularSize", "_SpecularSmoothness","_SpecularOpacity", "_SpecularAffectedByNormalMap", "_SpecularUseLightColors",
|
||||
//Rim
|
||||
"_EnableRim", "_RimBlending", "_RimColor", "_RimSize", "_RimSmoothness", "_RimOpacity", "_RimAffectedArea", "_RimAffectedByNormalMap",
|
||||
//Styling
|
||||
"_EnableStyling", "_EnableStylingDistanceFade", "_StylingDFStartingDistance", "_StylingDFFalloff", "_StylingAdjustDistanceFadeValue", "_StylingDistanceFadeValue",
|
||||
"_EnableAntiAliasing",
|
||||
/////////////////////
|
||||
// SHADING STYLING //
|
||||
/////////////////////
|
||||
"_EnableShadingStyling", "_StylingShadingSyncWithOtherStyling",
|
||||
"_StylingColor",
|
||||
//Style
|
||||
"_ShadingStyle",
|
||||
//Partitioning
|
||||
"_SyncWithLightPartitioning", "_NumberOfCellsHatching", "_StylingTerminatorPosition", "_StylingOvermodelingFactor",
|
||||
//Blending
|
||||
"_StylingShadingBlending", "_StylingShadingIsInverted",
|
||||
//DrawSpace
|
||||
"_DrawSpace", "_UVSet", "_SSCameraDistanceScaled","_AnchorSSToObjectsOrigin", "_CoordinateSystem", "_PolarCenterMode", "_PolarCenter",
|
||||
//Density and Direction
|
||||
"_StylingShadingDensity", "_StylingShadingInitialDirection", "_StylingShadingRotationBetweenCells", "_StylingShadingHalftonesOffset",
|
||||
//Style Settings
|
||||
"_StylingShadingOpacity", "_StylingShadingOpacityFalloff", "_StylingShadingThicknessControl", "_StylingShadingThickness", "_StylingShadingThicknessFalloff",
|
||||
"_StylingShadingHardness", "_StylingShadingHalftonesRoundness", "_StylingShadingHalftonesRoundnessFalloff",
|
||||
|
||||
"_StylingShadingEnableDashes", "_StylingShadingDashesSize", "_StylingShadingDashesUseHatchingDensity", "_StylingShadingDashesDensity",
|
||||
"_StylingShadingDashesType", "_StylingShadingDashesRoundness", "_StylingShadingDashesOffset",
|
||||
"_StylingShadingDashesTransitionPosition","_StylingShadingDashesTransitionSoftness",
|
||||
|
||||
//Randomizer
|
||||
"_EnableShadingRandomizer", "_ShadingNoise1Size", "_ShadingNoise1Seed", "_ShadingNoise2Seed",
|
||||
"_NoiseIntensity", "_SpacingRandomMode", "_SpacingRandomIntensity","_OpacityRandomMode", "_OpacityRandomIntensity", "_HardnessRandomMode", "_HardnessRandomIntensity",
|
||||
"_LengthRandomMode", "_LengthRandomIntensity", "_ThicknessRandomMode", "_ThicknesshRandomIntensity",
|
||||
|
||||
//////////////////////////
|
||||
// Cast Shadows Styling //
|
||||
//////////////////////////
|
||||
"_EnableCastShadowsStyling",
|
||||
"_StylingCastShadowsColor",
|
||||
"_StylingCastShadowsSyncWithOtherStyling",
|
||||
//Style
|
||||
"_CastShadowsStyle",
|
||||
//Partitioning
|
||||
"_CastShadowsNumberOfCellsHatching", "_StylingCastShadowsSmoothness",
|
||||
//Blending
|
||||
"_StylingCastShadowsBlending", "_StylingCastShadowsIsInverted",
|
||||
//DrawSpace
|
||||
"_CastShadowsDrawSpace", "_CastShadowsUVSet", "_CastShadowsSSCameraDistanceScaled","_CastShadowsAnchorSSToObjectsOrigin", "_CastShadowsCoordinateSystem", "_CastShadowsPolarCenterMode", "_CastShadowsPolarCenter",
|
||||
//Density and Direction
|
||||
"_StylingCastShadowsDensity", "_StylingCastShadowsInitialDirection", "_StylingCastShadowsRotationBetweenCells", "_StylingCastShadowsHalftonesOffset",
|
||||
//Style Settings
|
||||
"_StylingCastShadowsOpacity", "_StylingCastShadowsOpacityFalloff", "_StylingCastShadowsThicknessControl", "_StylingCastShadowsThickness", "_StylingCastShadowsThicknessFalloff",
|
||||
"_StylingCastShadowsHardness", "_StylingCastShadowsHalftonesRoundness", "_StylingCastShadowsHalftonesRoundnessFalloff",
|
||||
|
||||
"_StylingCastShadowsEnableDashes", "_StylingCastShadowsDashesSize", "_StylingCastShadowsDashesUseHatchingDensity", "_StylingCastShadowsDashesDensity",
|
||||
"_StylingCastShadowsDashesType", "_StylingCastShadowsDashesRoundness", "_StylingCastShadowsDashesOffset",
|
||||
"_StylingCastShadowsDashesTransitionPosition","_StylingCastShadowsDashesTransitionSoftness",
|
||||
|
||||
//Randomizer
|
||||
"_EnableCastShadowsRandomizer", "_CastShadowsNoise1Size", "_CastShadowsNoise1Seed", "_CastShadowsNoise2Seed",
|
||||
"_CastShadowsNoiseIntensity", "_CastShadowsSpacingRandomMode", "_CastShadowsSpacingRandomIntensity","_CastShadowsOpacityRandomMode", "_CastShadowsOpacityRandomIntensity",
|
||||
"_CastShadowsHardnessRandomMode", "_CastShadowsHardnessRandomIntensity", "_CastShadowsLengthRandomMode", "_CastShadowsLengthRandomIntensity", "_CastShadowsThicknessRandomMode", "_CastShadowsThicknesshRandomIntensity",
|
||||
|
||||
//////////////////////
|
||||
// Specular Styling //
|
||||
//////////////////////
|
||||
"_EnableSpecularStyling", "_StylingSpecularSyncWithOtherStyling",
|
||||
//Specular Settings
|
||||
"_SyncWithSpecular", "_StylingSpecularSize", "_StylingSpecularSmoothness",
|
||||
|
||||
"_StylingSpecularColor", "_StylingSpecularUseLightColors",
|
||||
//Style
|
||||
"_SpecularStyle",
|
||||
//Blending
|
||||
"_StylingSpecularBlending", "_StylingSpecularIsInverted",
|
||||
//DrawSpace
|
||||
"_SpecularDrawSpace", "_SpecularUVSet", "_SpecularSSCameraDistanceScaled", "_SpecularAnchorSSToObjectsOrigin", "_SpecularCoordinateSystem", "_SpecularPolarCenterMode", "_SpecularPolarCenter",
|
||||
//Density and Direction
|
||||
"_StylingSpecularDensity", "_StylingSpecularRotation", "_StylingSpecularHalftonesOffset",
|
||||
//Style Settings
|
||||
"_StylingSpecularOpacity", "_StylingSpecularOpacityFalloff", "_StylingSpecularThicknessControl", "_StylingSpecularThickness", "_StylingSpecularThicknessFalloff",
|
||||
"_StylingSpecularHardness", "_StylingSpecularHalftonesRoundness", "_StylingSpecularHalftonesRoundnessFalloff",
|
||||
|
||||
"_StylingSpecularEnableDashes", "_StylingSpecularDashesSize", "_StylingSpecularDashesUseHatchingDensity", "_StylingSpecularDashesDensity",
|
||||
"_StylingSpecularDashesType", "_StylingSpecularDashesRoundness", "_StylingSpecularDashesOffset",
|
||||
"_StylingSpecularDashesTransitionPosition","_StylingSpecularDashesTransitionSoftness",
|
||||
|
||||
//Randomizer
|
||||
"_EnableSpecularRandomizer", "_SpecularNoise1Size", "_SpecularNoise1Seed", "_SpecularNoise2Seed",
|
||||
"_SpecularNoiseIntensity", "_SpecularSpacingRandomMode", "_SpecularSpacingRandomIntensity", "_SpecularOpacityRandomMode", "_SpecularOpacityRandomIntensity",
|
||||
"_SpecularHardnessRandomMode", "_SpecularHardnessRandomIntensity", "_SpecularLengthRandomMode", "_SpecularLengthRandomIntensity", "_SpecularThicknessRandomMode",
|
||||
"_SpecularThicknesshRandomIntensity",
|
||||
|
||||
|
||||
/////////////////
|
||||
// Rim Styling //
|
||||
/////////////////
|
||||
"_EnableRimStyling", "_StylingRimSyncWithOtherStyling",
|
||||
//Rim Settings
|
||||
"_SyncWithRim", "_StylingRimSize", "_StylingRimSmoothness", "_StylingRimAffectedArea",
|
||||
|
||||
"_StylingRimColor",
|
||||
//Style
|
||||
"_RimStyle",
|
||||
//Blending
|
||||
"_StylingRimBlending", "_StylingRimIsInverted",
|
||||
//DrawSpace
|
||||
"_RimDrawSpace", "_RimSSCameraDistanceScaled", "_RimAnchorSSToObjectsOrigin", "_RimCoordinateSystem", "_RimPolarCenterMode", "_RimPolarCenter",
|
||||
//Density and Direction
|
||||
"_StylingRimDensity", "_RimUVSet", "_StylingRimRotation", "_StylingRimHalftonesOffset",
|
||||
//Style Settings
|
||||
"_StylingRimThicknessControl", "_StylingRimThickness", "_StylingRimThicknessFalloff", "_StylingRimOpacity", "_StylingRimOpacityFalloff", "_StylingRimHardness",
|
||||
"_StylingRimHalftonesRoundness", "_StylingRimHalftonesRoundnessFalloff",
|
||||
|
||||
"_StylingRimEnableDashes", "_StylingRimDashesSize", "_StylingRimDashesUseHatchingDensity", "_StylingRimDashesDensity",
|
||||
"_StylingRimDashesType", "_StylingRimDashesRoundness", "_StylingRimDashesOffset",
|
||||
"_StylingRimDashesTransitionPosition","_StylingRimDashesTransitionSoftness",
|
||||
|
||||
//Randomizer
|
||||
"_EnableRimRandomizer", "_RimNoise1Size", "_RimNoise1Seed", "_RimNoise2Seed",
|
||||
"_RimNoiseIntensity", "_RimSpacingRandomMode", "_RimSpacingRandomIntensity", "_RimOpacityRandomMode", "_RimOpacityRandomIntensity", "_RimHardnessRandomMode",
|
||||
"_RimHardnessRandomIntensity", "_RimLengthRandomMode", "_RimLengthRandomIntensity", "_RimThicknessRandomMode", "_RimThicknesshRandomIntensity",
|
||||
|
||||
"_HatchingAffectedByNormalMap", "_HatchingCameraDistanceFade", "_HalftonePatternCameraDistanceFade",
|
||||
"_EnableOutline", "_OutlineColor", "_OutlineWidth", "_OutlineDepthOffset", "_OutlineConstantScreenWidth",
|
||||
//"_OutlineCameraDistanceImpact",
|
||||
};
|
||||
|
||||
|
||||
static readonly Dictionary<string, string[]> PropertyToKeywordsURP = new()
|
||||
{
|
||||
["_ShadingMode"] = new[] { "_SHADING_COLOR", "_SHADING_BLINNPHONG", "_SHADING_PBR" },
|
||||
["_BumpMap"] = new[] { "_NORMALMAP" },
|
||||
["_EmissionMap"] = new[] { "_EMISSION" },
|
||||
["_EmissionColor"] = new[] { "_EMISSION" },
|
||||
["_AlphaClip"] = new[] { "_ALPHATEST_ON" },
|
||||
["_ReceiveShadows"] = new[] { "_RECEIVE_SHADOWS_OFF" },
|
||||
["_SpecGlossMap"] = new[] { "_SPECGLOSSMAP", "_METALLICSPECGLOSSMAP" },
|
||||
["_MetallicGlossMap"] = new[] { "_METALLICSPECGLOSSMAP" },
|
||||
["_SpecColor"] = new[] { "_SPECULAR_COLOR" },
|
||||
["_SpecularHighlights"] = new[] { "_SPECGLOSSMAP", "_SPECULAR_COLOR", "_SPECULARHIGHLIGHTS_OFF" },
|
||||
["_SmoothnessSource"] = new[] { "_GLOSSINESS_FROM_BASE_ALPHA" },
|
||||
["_EnvironmentReflections"] = new[] { "_ENVIRONMENTREFLECTIONS_OFF" },
|
||||
["_WorkflowMode"] = new[] { "_SPECULAR_SETUP" },
|
||||
["_OcclusionMap"] = new[] { "_OCCLUSIONMAP" },
|
||||
["_ParallaxMap"] = new[] { "_PARALLAXMAP" },
|
||||
["_SmoothnessTextureChannel"] = new[] { "_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A" },
|
||||
["_DetailAlbedoMap"] = new[] { "_DETAIL_MULX2" },
|
||||
["_DetailNormalMap"] = new[] { "_DETAIL_MULX2" },
|
||||
["_DetailAlbedoMapScale"] = new[] { "_DETAIL_SCALED" }
|
||||
};
|
||||
|
||||
static readonly Dictionary<string, string[]> PropertyToKeywordsBiRP = new()
|
||||
{
|
||||
["_ShadingMode"] = new[] { "_SHADING_COLOR", "_SHADING_BLINNPHONG", "_SHADING_PBR" },
|
||||
["_BumpMap"] = new[] { "_NORMALMAP" },
|
||||
["_DetailNormalMap"] = new[] { "_NORMALMAP", "_DETAIL_MULX2" },
|
||||
["_DetailMask"] = new[] { "_DETAIL_MULX2" },
|
||||
["_DetailAlbedoMap"] = new[] { "_DETAIL_MULX2" },
|
||||
["_EmissionMap"] = new[] { "_EMISSION" },
|
||||
["_EmissionColor"] = new[] { "_EMISSION" },
|
||||
["_SmoothnessTextureChannel"] = new[] { "_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A" },
|
||||
["_MetallicGlossMap"] = new[] { "_METALLICGLOSSMAP" },
|
||||
["_ParallaxMap"] = new[] { "_PARALLAXMAP" }
|
||||
};
|
||||
|
||||
public static List<string> GetKeywordList(List<string> properties, Dictionary<string, string[]> propertyToKeywordsDict)
|
||||
{
|
||||
HashSet<string> keywords = new HashSet<string>();
|
||||
|
||||
foreach (var property in properties)
|
||||
{
|
||||
if (!propertyToKeywordsDict.TryGetValue(property, out var mapped)) continue;
|
||||
|
||||
foreach (var k in mapped)
|
||||
keywords.Add(k);
|
||||
}
|
||||
|
||||
return keywords.ToList();
|
||||
}
|
||||
|
||||
public static List<string> GetKeywordListURP(List<string> properties)
|
||||
{
|
||||
return GetKeywordList(properties, PropertyToKeywordsURP);
|
||||
}
|
||||
public static List<string> GetKeywordListBiRP(List<string> properties)
|
||||
{
|
||||
return GetKeywordList(properties, PropertyToKeywordsBiRP);
|
||||
}
|
||||
|
||||
public static List<string> GetKeywordList(List<string> properties)
|
||||
{
|
||||
List<string> keywords = new List<string>();
|
||||
#if USING_URP
|
||||
return ShaderUtils.GetKeywordListURP(properties);
|
||||
#else
|
||||
return ShaderUtils.GetKeywordListBiRP(properties);
|
||||
#endif
|
||||
}
|
||||
|
||||
public static readonly List<string> THETOONSHADER_KEYWORDS_LIST = new List<string>
|
||||
{
|
||||
"_SHADING_COLOR",
|
||||
"_SHADING_BLINNPHONG",
|
||||
"_SHADING_PBR",
|
||||
|
||||
#if USING_URP
|
||||
"_NORMALMAP", // _BumpMap
|
||||
"_EMISSION", // _EmissionMap, _EmissionColor
|
||||
"_ALPHATEST_ON", //_AlphaClip
|
||||
|
||||
"_RECEIVE_SHADOWS_OFF", //_ReceiveShadows
|
||||
|
||||
"_SPECGLOSSMAP", //_SpecGlossMap, _SpecularHighlights
|
||||
"_SPECULAR_COLOR", //_SpecColor, _SpecularHighlights
|
||||
|
||||
"_GLOSSINESS_FROM_BASE_ALPHA", //_SmoothnessSource
|
||||
|
||||
|
||||
|
||||
"_SPECULARHIGHLIGHTS_OFF", // _SpecularHighlights
|
||||
"_ENVIRONMENTREFLECTIONS_OFF", // _EnvironmentReflections
|
||||
"_SPECULAR_SETUP", //_WorkflowMode
|
||||
"_METALLICSPECGLOSSMAP", //_SpecGlossMap, _MetallicGlossMap
|
||||
|
||||
"_OCCLUSIONMAP", // _OcclusionMap
|
||||
"_PARALLAXMAP", //_ParallaxMap
|
||||
"_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A", //_SmoothnessTextureChannel
|
||||
|
||||
|
||||
"_DETAIL_MULX2", //_DetailAlbedoMap, _DetailNormalMap,
|
||||
"_DETAIL_SCALED", //_DetailAlbedoMapScale
|
||||
|
||||
|
||||
"_CLEARCOAT",
|
||||
"_CLEARCOATMAP",
|
||||
"_ALPHAPREMULTIPLY_ON",
|
||||
"_ALPHAMODULATE_ON",
|
||||
"_SURFACE_TYPE_TRANSPARENT",
|
||||
#else
|
||||
|
||||
"_NORMALMAP", // _BumpMap, _DetailNormalMap
|
||||
"_DETAIL_MULX2", // _DetailNormalMap, _DetailMask, _DetailAlbedoMap
|
||||
"_EMISSION", // _EmissionMap, _EmissionColor
|
||||
"_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A", // _SmoothnessTextureChannel
|
||||
"_METALLICGLOSSMAP", //_MetallicGlossMap,
|
||||
"_PARALLAXMAP", // _ParallaxMap,
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
public static readonly List<string> TOONSHADING_PROPERTIES_LIST = new List<string>
|
||||
//public static string[] TOONSHADING_PROPERTIES_LIST =
|
||||
{
|
||||
"_EnableToonShading", "_ShadingFunction", "_GradientTex", "_GradientMode", "_GradientBlending",
|
||||
"_GradientBlendFactor", "_NumberOfCells", "_CellTransitionSmoothness", "_EnableShadows", "_CoreShadowColor",
|
||||
"_TerminatorWidth", "_TerminatorSmoothness", "_FormShadowColor", "_EnableCastShadows", "_CustomizeCastShadowsColor",
|
||||
"_CastShadowsStrength", "_CastShadowsSmoothness", "_CastShadowColorMode", "_CastShadowColor", "_ShadowsAffectByNormalMap",
|
||||
"_EnableSpecular", "_SpecularBlending", "_SpecularColor", "_SpecularSize", "_SpecularSmoothness",
|
||||
"_SpecularOpacity", "_SpecularAffectedByNormalMap", "_EnableRim", "_RimBlending", "_RimColor",
|
||||
"_RimSize", "_RimSmoothness", "_RimOpacity", "_RimAffectedArea", "_RimAffectedByNormalMap"
|
||||
};
|
||||
|
||||
//public static readonly List<string> STYLING_PROPERTIES_LIST = new List<string>
|
||||
////public static string[] STYLING_PROPERTIES_LIST =
|
||||
//{
|
||||
// "_EnableStyling", "_EnableShadingStyling", "_ShadingStyle", "_StylingShadingBlending", "_DrawSpace",
|
||||
// "_SSCameraDistanceScaled", "_CoordinateSystem", "_PolarCenterMode", "_PolarCenter", "_SyncWithLightPartitioning",
|
||||
// "_NumberOfCellsHatching", "_StylingOvermodelingFactor", "_StylingColor", "_StylingShadingDensity", "_StylingShadingHalftonesOffset",
|
||||
// "_StylingShadingThicknessControl", "_StylingShadingThickness", "_StylingShadingOpacity", "_StylingShadingOpacityFalloff", "_StylingShadingThicknessFalloff",
|
||||
// "_StylingShadingHardness", "_StylingShadingInitialDirection", "_StylingShadingRotationBetweenCells", "_StylingShadingHalftonesRoundness", "_StylingShadingHalftonesRoundnessFalloff",
|
||||
// "_EnableShadingRandomizer", "_PerlinNoiseSize", "_NoiseIntensity", "_SpacingRandomMode", "_SpacingRandomIntensity",
|
||||
// "_OpacityRandomMode", "_OpacityRandomIntensity", "_HardnessRandomMode", "_HardnessRandomIntensity", "_LengthRandomMode",
|
||||
// "_LengthRandomIntensity", "_ThicknessRandomMode", "_ThicknesshRandomIntensity", "_EnableSpecularStyling", "_SpecularStyle",
|
||||
// "_StylingSpecularBlending", "_SpecularDrawSpace", "_SpecularSSCameraDistanceScaled", "_SpecularCoordinateSystem", "_SpecularPolarCenterMode",
|
||||
// "_SpecularPolarCenter", "_SyncWithSpecular", "_StylingSpecularSize", "_StylingSpecularSmoothness", "_StylingSpecularColor",
|
||||
// "_StylingSpecularDensity", "_StylingSpecularHalftonesOffset", "_StylingSpecularThicknessControl", "_StylingSpecularThickness", "_StylingSpecularThicknessFalloff",
|
||||
// "_StylingSpecularOpacity", "_StylingSpecularOpacityFalloff", "_StylingSpecularHardness", "_StylingSpecularHalftonesRoundness", "_StylingSpecularHalftonesRoundnessFalloff",
|
||||
// "_StylingSpecularRotation", "_EnableSpecularRandomizer", "_SpecularPerlinNoiseSize", "_SpecularPerlinNoiseSeed", "_SpecularWhiteNoiseSeed",
|
||||
// "_SpecularNoiseIntensity", "_SpecularSpacingRandomMode", "_SpecularSpacingRandomIntensity", "_SpecularOpacityRandomMode", "_SpecularOpacityRandomIntensity",
|
||||
// "_SpecularHardnessRandomMode", "_SpecularHardnessRandomIntensity", "_SpecularLengthRandomMode", "_SpecularLengthRandomIntensity", "_SpecularThicknessRandomMode",
|
||||
// "_SpecularThicknesshRandomIntensity", "_EnableRimStyling", "_RimStyle", "_StylingRimBlending", "_RimDrawSpace",
|
||||
// "_RimSSCameraDistanceScaled", "_RimCoordinateSystem", "_RimPolarCenterMode", "_RimPolarCenter", "_SyncWithRim",
|
||||
// "_StylingRimSize", "_StylingRimSmoothness", "_StylingRimAffectedArea", "_StylingRimColor", "_StylingRimDensity",
|
||||
// "_StylingRimHalftonesOffset", "_StylingRimThicknessControl", "_StylingRimThickness", "_StylingRimThicknessFalloff", "_StylingRimOpacity",
|
||||
// "_StylingRimOpacityFalloff", "_StylingRimHardness", "_StylingRimHalftonesRoundness", "_StylingRimHalftonesRoundnessFalloff", "_StylingRimRotation",
|
||||
// "_EnableRimRandomizer", "_RimPerlinNoiseSize", "_RimPerlinNoiseSeed", "_RimWhiteNoiseSeed", "_RimNoiseIntensity",
|
||||
// "_RimSpacingRandomMode", "_RimSpacingRandomIntensity", "_RimOpacityRandomMode", "_RimOpacityRandomIntensity", "_RimHardnessRandomMode",
|
||||
// "_RimHardnessRandomIntensity", "_RimLengthRandomMode", "_RimLengthRandomIntensity", "_RimThicknessRandomMode", "_RimThicknesshRandomIntensity",
|
||||
// "_HatchingAffectedByNormalMap", "_NoiseMap1", "_NoiseMap2", "_HatchingCameraDistanceFade", "_HalftonePatternCameraDistanceFade"
|
||||
//};
|
||||
|
||||
//public static readonly List<string> STYLING_GENERAL_PROPERTIES = new List<string>
|
||||
//{
|
||||
// "_EnableStyling", "_EnableShadingStyling", "_ShadingStyle", "_StylingShadingBlending", "_DrawSpace",
|
||||
// "_SSCameraDistanceScaled", "_CoordinateSystem", "_PolarCenterMode", "_PolarCenter", "_StylingColor", "_StylingShadingDensity", "_StylingShadingHalftonesOffset",
|
||||
// "_StylingShadingThicknessControl", "_StylingShadingThickness", "_StylingShadingOpacity", "_StylingShadingOpacityFalloff", "_StylingShadingThicknessFalloff",
|
||||
// "_StylingShadingHardness", "_StylingShadingInitialDirection", "_StylingShadingRotationBetweenCells", "_StylingShadingHalftonesRoundness", "_StylingShadingHalftonesRoundnessFalloff",
|
||||
// "_EnableSpecularStyling", "_SpecularStyle",
|
||||
// "_StylingSpecularBlending", "_SpecularDrawSpace", "_SpecularSSCameraDistanceScaled", "_SpecularCoordinateSystem", "_SpecularPolarCenterMode",
|
||||
// "_SpecularPolarCenter", "_SyncWithSpecular", "_StylingSpecularSize", "_StylingSpecularSmoothness", "_StylingSpecularColor",
|
||||
// "_StylingSpecularDensity", "_StylingSpecularHalftonesOffset", "_StylingSpecularThicknessControl", "_StylingSpecularThickness", "_StylingSpecularThicknessFalloff",
|
||||
// "_StylingSpecularOpacity", "_StylingSpecularOpacityFalloff", "_StylingSpecularHardness", "_StylingSpecularHalftonesRoundness", "_StylingSpecularHalftonesRoundnessFalloff",
|
||||
// "_StylingSpecularRotation", "_EnableSpecularRandomizer", "_SpecularPerlinNoiseSize", "_SpecularPerlinNoiseSeed", "_SpecularWhiteNoiseSeed",
|
||||
// "_SpecularNoiseIntensity", "_SpecularSpacingRandomMode", "_SpecularSpacingRandomIntensity", "_SpecularOpacityRandomMode", "_SpecularOpacityRandomIntensity",
|
||||
// "_SpecularHardnessRandomMode", "_SpecularHardnessRandomIntensity", "_SpecularLengthRandomMode", "_SpecularLengthRandomIntensity", "_SpecularThicknessRandomMode",
|
||||
// "_SpecularThicknesshRandomIntensity", "_EnableRimStyling", "_RimStyle", "_StylingRimBlending", "_RimDrawSpace",
|
||||
// "_RimSSCameraDistanceScaled", "_RimCoordinateSystem", "_RimPolarCenterMode", "_RimPolarCenter", "_SyncWithRim",
|
||||
// "_StylingRimSize", "_StylingRimSmoothness", "_StylingRimAffectedArea", "_StylingRimColor", "_StylingRimDensity",
|
||||
// "_StylingRimHalftonesOffset", "_StylingRimThicknessControl", "_StylingRimThickness", "_StylingRimThicknessFalloff", "_StylingRimOpacity",
|
||||
// "_StylingRimOpacityFalloff", "_StylingRimHardness", "_StylingRimHalftonesRoundness", "_StylingRimHalftonesRoundnessFalloff", "_StylingRimRotation",
|
||||
// "_EnableRimRandomizer", "_RimPerlinNoiseSize", "_RimPerlinNoiseSeed", "_RimWhiteNoiseSeed", "_RimNoiseIntensity",
|
||||
// "_RimSpacingRandomMode", "_RimSpacingRandomIntensity", "_RimOpacityRandomMode", "_RimOpacityRandomIntensity", "_RimHardnessRandomMode",
|
||||
// "_RimHardnessRandomIntensity", "_RimLengthRandomMode", "_RimLengthRandomIntensity", "_RimThicknessRandomMode", "_RimThicknesshRandomIntensity",
|
||||
// "_HatchingAffectedByNormalMap", "_HatchingCameraDistanceFade", "_HalftonePatternCameraDistanceFade"
|
||||
//};
|
||||
|
||||
public static readonly List<string> STYLING_SHADING_PARTITIONING_PROPERTIES = new List<string>
|
||||
{
|
||||
"_SyncWithLightPartitioning","_NumberOfCellsHatching", "_StylingOvermodelingFactor",
|
||||
};
|
||||
|
||||
public static readonly List<string> STYLING_SHADING_RANDOMIZER_PROPERTIES = new List<string>
|
||||
{
|
||||
"_EnableShadingRandomizer", "_PerlinNoiseSize", "_NoiseIntensity", "_SpacingRandomMode", "_SpacingRandomIntensity",
|
||||
"_OpacityRandomMode", "_OpacityRandomIntensity", "_HardnessRandomMode", "_HardnessRandomIntensity", "_LengthRandomMode",
|
||||
"_LengthRandomIntensity", "_ThicknessRandomMode", "_ThicknesshRandomIntensity",
|
||||
};
|
||||
|
||||
|
||||
public static readonly List<string> OUTLINE_PROPERTIES_LIST = new List<string>
|
||||
//public static string[] OUTLINE_PROPERTIES_LIST =
|
||||
{
|
||||
"_EnableOutline", "_OutlineColor", "_OutlineWidth", "_OutlineDepthOffset", "_OutlineCameraDistanceImpact"
|
||||
};
|
||||
|
||||
|
||||
public static List<string> test = new List<string> { };
|
||||
|
||||
//public static List<string> ALL_STYLING_PROPERTIES()
|
||||
//{
|
||||
// return STYLING_GENERAL_PROPERTIES.Concat(STYLING_SHADING_PARTITIONING_PROPERTIES).Concat(STYLING_SHADING_RANDOMIZER_PROPERTIES).ToList();
|
||||
//}
|
||||
|
||||
|
||||
//public static List<string> ALL_PROPERTIES()
|
||||
//{
|
||||
// return SURFACEOPTIONSANDINPUTS_PROPERTIES_LIST.Concat(TOONSHADING_PROPERTIES_LIST).Concat(ALL_STYLING_PROPERTIES()).Concat(OUTLINE_PROPERTIES_LIST).ToList();
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ead06657dddf7034cabeabf149593a4c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 269238
|
||||
packageName: The Toon Shader
|
||||
packageVersion: 1.4.2
|
||||
assetPath: Packages/com.shadercrew.the-toon-shader.core/Scripts/Runtime/Common/ShaderUtils.cs
|
||||
uploadId: 919972
|
||||
@@ -0,0 +1,19 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
public static class Strings
|
||||
{
|
||||
public static readonly string THE_TOON_SHADER_TITLE = "The Toon Shader"; // + stsVersion;
|
||||
public static readonly string SHADER_CREW_TITLE = "ShaderCrew presents"; // + stsVersion;
|
||||
|
||||
// ComponentMenu TITLES:
|
||||
public const string COMPONENTMENU_FOLDER = "The Toon Shader/"; //FOLDER
|
||||
public const string COMPONENTMENU_RPHELPER = COMPONENTMENU_FOLDER + "TTS-RP-Helper";
|
||||
public const string COMPONENTMENU_REPLACEORSYNCHRONIZE = COMPONENTMENU_FOLDER + "TTS-Replace Or Synchronize Toon Settings";
|
||||
public const string COMPONENTMENU_TOON2DLIGHTMANAGER = COMPONENTMENU_FOLDER + "TTS-Toon 2D Light Manager";
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2bde833add707bd49b42a9087e196056
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 269238
|
||||
packageName: The Toon Shader
|
||||
packageVersion: 1.4.2
|
||||
assetPath: Packages/com.shadercrew.the-toon-shader.core/Scripts/Runtime/Common/Strings.cs
|
||||
uploadId: 919972
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
|
||||
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
public static class TheToonShaderConstants
|
||||
{
|
||||
public const string THETOONSHADER_VERSION_3D = "1.4.2";
|
||||
public const string THETOONSHADER_VERSION_2D = "1.0.0";
|
||||
|
||||
|
||||
public const string THETOONSHADER_IDENTIFIER_PROPERTY = "_TheToonShaderIdentifier";
|
||||
public const string THETOONSHADER2D_IDENTIFIER_PROPERTY = "_TheToonShader2DIdentifier"; //temp
|
||||
public static readonly string THETOONSHADER_INSTANCE_PREFIX = "TTS - Instance";
|
||||
|
||||
public static readonly string TTS_SHADER_DEFAULT_KEY = "default";
|
||||
|
||||
public static readonly string TTS_URP2D_SHADER_STANDARD_KEY = "TTS_URP2D";
|
||||
|
||||
|
||||
public static readonly string TTS_SHADER_STANDARD_WITH_OUTLINE_KEY = "TTS_StandardWithOutline";
|
||||
public static readonly string TTS_SHADER_STANDARD_KEY = "TTS_Standard";
|
||||
|
||||
public static readonly string TTS_SHADER_STS_WITH_OUTLINE_KEY = "TTS_STSWithOutline";
|
||||
public static readonly string TTS_SHADER_STS_KEY = "TTS_STS";
|
||||
|
||||
public static readonly string TTS_SHADER_NAME_WITH_OUTLINE_SUFFIX = "_WithOutline";
|
||||
|
||||
public static readonly string TTS_SHADER_NAME_WITH_STS_SUFFIX = "_WithSTS";
|
||||
|
||||
public static readonly string TTS_SHADER_NAME_FOLDER = "TheToonShader";
|
||||
public static readonly string TTS_SHADER_NAME = "/TheToonShader";
|
||||
|
||||
|
||||
public static readonly string TTS_SHADER_FILENAME_2D_SHADERGRAPH = TTS_SHADER_NAME_FOLDER + "/URP2D" + "/TheToonShader_URP2D" ;
|
||||
|
||||
|
||||
/// BiRP ///
|
||||
public static readonly string TTS_SHADER_NAME_BIRP_FOLDER = TTS_SHADER_NAME_FOLDER + "/BiRP";
|
||||
public static readonly string TTS_SHADER_NAME_BIRP = TTS_SHADER_NAME_BIRP_FOLDER + "/TheToonShader";
|
||||
public static readonly string TTS_SHADER_NAME_BIRP_WITH_OUTLINE = TTS_SHADER_NAME_BIRP + TTS_SHADER_NAME_WITH_OUTLINE_SUFFIX;
|
||||
|
||||
public static readonly string TTS_SHADER_NAME_BIRP_WITH_STS = TTS_SHADER_NAME_BIRP + TTS_SHADER_NAME_WITH_STS_SUFFIX;
|
||||
public static readonly string TTS_SHADER_NAME_BIRP_WITH_OUTLINE_AND_STS = TTS_SHADER_NAME_BIRP_WITH_OUTLINE + TTS_SHADER_NAME_WITH_STS_SUFFIX;
|
||||
|
||||
/// URP ///
|
||||
public static readonly string TTS_SHADER_NAME_URP_FOLDER = TTS_SHADER_NAME_FOLDER + "/URP";
|
||||
|
||||
/// URP 2020///
|
||||
public static readonly string TTS_SHADER_NAME_URP_2020 = TTS_SHADER_NAME_URP_FOLDER + "/2020" + TTS_SHADER_NAME;
|
||||
public static readonly string TTS_SHADER_NAME_URP_2020_WITH_OUTLINE = TTS_SHADER_NAME_URP_2020 + TTS_SHADER_NAME_WITH_OUTLINE_SUFFIX;
|
||||
|
||||
public static readonly string TTS_SHADER_NAME_URP_2020_WITH_STS = TTS_SHADER_NAME_URP_2020 + TTS_SHADER_NAME_WITH_STS_SUFFIX;
|
||||
public static readonly string TTS_SHADER_NAME_URP_2020_WITH_OUTLINE_AND_STS = TTS_SHADER_NAME_URP_2020_WITH_OUTLINE + TTS_SHADER_NAME_WITH_STS_SUFFIX;
|
||||
|
||||
|
||||
/// URP 2021///
|
||||
public static readonly string TTS_SHADER_NAME_URP_2021 = TTS_SHADER_NAME_URP_FOLDER + "/2021" + TTS_SHADER_NAME;
|
||||
public static readonly string TTS_SHADER_NAME_URP_2021_WITH_OUTLINE = TTS_SHADER_NAME_URP_2021 + TTS_SHADER_NAME_WITH_OUTLINE_SUFFIX;
|
||||
|
||||
public static readonly string TTS_SHADER_NAME_URP_2021_WITH_STS = TTS_SHADER_NAME_URP_2021 + TTS_SHADER_NAME_WITH_STS_SUFFIX;
|
||||
public static readonly string TTS_SHADER_NAME_URP_2021_WITH_OUTLINE_AND_STS = TTS_SHADER_NAME_URP_2021_WITH_OUTLINE + TTS_SHADER_NAME_WITH_STS_SUFFIX;
|
||||
|
||||
|
||||
/// URP 2022///
|
||||
public static readonly string TTS_SHADER_NAME_URP_2022 = TTS_SHADER_NAME_URP_FOLDER + "/2022" + TTS_SHADER_NAME;
|
||||
public static readonly string TTS_SHADER_NAME_URP_2022_WITH_OUTLINE = TTS_SHADER_NAME_URP_2022 + TTS_SHADER_NAME_WITH_OUTLINE_SUFFIX;
|
||||
|
||||
public static readonly string TTS_SHADER_NAME_URP_2022_WITH_STS = TTS_SHADER_NAME_URP_2022 + TTS_SHADER_NAME_WITH_STS_SUFFIX;
|
||||
public static readonly string TTS_SHADER_NAME_URP_2022_WITH_OUTLINE_AND_STS = TTS_SHADER_NAME_URP_2022_WITH_OUTLINE + TTS_SHADER_NAME_WITH_STS_SUFFIX;
|
||||
|
||||
|
||||
/// URP 6///
|
||||
public static readonly string TTS_SHADER_NAME_URP_UNITY6 = TTS_SHADER_NAME_URP_FOLDER + "/Unity6" + TTS_SHADER_NAME;
|
||||
public static readonly string TTS_SHADER_NAME_URP_UNITY6_WITH_OUTLINE = TTS_SHADER_NAME_URP_UNITY6 + TTS_SHADER_NAME_WITH_OUTLINE_SUFFIX;
|
||||
|
||||
public static readonly string TTS_SHADER_NAME_URP_UNITY6_WITH_STS = TTS_SHADER_NAME_URP_UNITY6 + TTS_SHADER_NAME_WITH_STS_SUFFIX;
|
||||
public static readonly string TTS_SHADER_NAME_URP_UNITY6_WITH_OUTLINE_AND_STS = TTS_SHADER_NAME_URP_UNITY6_WITH_OUTLINE + TTS_SHADER_NAME_WITH_STS_SUFFIX;
|
||||
|
||||
|
||||
/// URP 6.3///
|
||||
public static readonly string TTS_SHADER_NAME_URP_UNITY6_3 = TTS_SHADER_NAME_URP_FOLDER + "/Unity6_3" + TTS_SHADER_NAME;
|
||||
public static readonly string TTS_SHADER_NAME_URP_UNITY6_3_WITH_OUTLINE = TTS_SHADER_NAME_URP_UNITY6_3 + TTS_SHADER_NAME_WITH_OUTLINE_SUFFIX;
|
||||
|
||||
public static readonly string TTS_SHADER_NAME_URP_UNITY6_3_WITH_STS = TTS_SHADER_NAME_URP_UNITY6_3 + TTS_SHADER_NAME_WITH_STS_SUFFIX;
|
||||
public static readonly string TTS_SHADER_NAME_URP_UNITY6_3_WITH_OUTLINE_AND_STS = TTS_SHADER_NAME_URP_UNITY6_3_WITH_OUTLINE + TTS_SHADER_NAME_WITH_STS_SUFFIX;
|
||||
|
||||
|
||||
|
||||
/// BiRP ///
|
||||
public static readonly string TTS_SHADER_FILENAME_BIRP = "/BiRP" + "/TheToonShader" + "_BiRP";
|
||||
public static readonly string TTS_SHADER_FILENAME_BIRP_WITH_OUTLINE = "/BiRP" + "/TheToonShader" + "_WithOutline" + "_BiRP";
|
||||
|
||||
public static readonly string TTS_SHADER_FILENAME_BIRP_WITH_STS = "/BiRP" + "/TheToonShader" + TTS_SHADER_NAME_WITH_STS_SUFFIX + "_BiRP";
|
||||
public static readonly string TTS_SHADER_FILENAME_BIRP_WITH_OUTLINE_AND_STS = "/BiRP" + "/TheToonShader" + "_WithOutline" + TTS_SHADER_NAME_WITH_STS_SUFFIX + "_BiRP";
|
||||
|
||||
/// URP 2020///
|
||||
public static readonly string TTS_SHADER_FILENAME_URP_2020 = "/URP" + "/2020" + "/TheToonShader" + "_URP2020";
|
||||
public static readonly string TTS_SHADER_FILENAME_URP_2020_WITH_OUTLINE = "/URP" + "/2020" + "/TheToonShader" + "_WithOutline" + "_URP2020";
|
||||
|
||||
public static readonly string TTS_SHADER_FILENAME_URP_2020_WITH_STS = "/URP" + "/2020" + "/TheToonShader" + TTS_SHADER_NAME_WITH_STS_SUFFIX + "_URP2020";
|
||||
public static readonly string TTS_SHADER_FILENAME_URP_2020_WITH_OUTLINE_AND_STS = "/URP" + "/2020" + "/TheToonShader" + "_WithOutline" + TTS_SHADER_NAME_WITH_STS_SUFFIX + "_URP2020";
|
||||
|
||||
/// URP 2021///
|
||||
public static readonly string TTS_SHADER_FILENAME_URP_2021 = "/URP" + "/2021" + "/TheToonShader" + "_URP2021";
|
||||
public static readonly string TTS_SHADER_FILENAME_URP_2021_WITH_OUTLINE = "/URP" + "/2021" + "/TheToonShader" + "_WithOutline" + "_URP2021";
|
||||
|
||||
public static readonly string TTS_SHADER_FILENAME_URP_2021_WITH_STS = "/URP" + "/2021" + "/TheToonShader" + TTS_SHADER_NAME_WITH_STS_SUFFIX + "_URP2021";
|
||||
public static readonly string TTS_SHADER_FILENAME_URP_2021_WITH_OUTLINE_AND_STS = "/URP" + "/2021" + "/TheToonShader" + "_WithOutline" + TTS_SHADER_NAME_WITH_STS_SUFFIX + "_URP2021";
|
||||
|
||||
/// URP 2022///
|
||||
public static readonly string TTS_SHADER_FILENAME_URP_2022 = "/URP" + "/2022" + "/TheToonShader" + "_URP2022";
|
||||
public static readonly string TTS_SHADER_FILENAME_URP_2022_WITH_OUTLINE = "/URP" + "/2022" + "/TheToonShader" + "_WithOutline" + "_URP2022";
|
||||
|
||||
public static readonly string TTS_SHADER_FILENAME_URP_2022_WITH_STS = "/URP" + "/2022" + "/TheToonShader" + TTS_SHADER_NAME_WITH_STS_SUFFIX + "_URP2022";
|
||||
public static readonly string TTS_SHADER_FILENAME_URP_2022_WITH_OUTLINE_AND_STS = "/URP" + "/2022" + "/TheToonShader" + "_WithOutline" + TTS_SHADER_NAME_WITH_STS_SUFFIX + "_URP2022";
|
||||
|
||||
/// URP 6///
|
||||
public static readonly string TTS_SHADER_FILENAME_URP_UNITY6 = "/URP" + "/Unity6" + "/TheToonShader" + "_URPUnity6";
|
||||
public static readonly string TTS_SHADER_FILENAME_URP_UNITY6_WITH_OUTLINE = "/URP" + "/Unity6" + "/TheToonShader" + "_WithOutline" + "_URPUnity6";
|
||||
|
||||
public static readonly string TTS_SHADER_FILENAME_URP_UNITY6_WITH_STS = "/URP" + "/Unity6" + "/TheToonShader" + TTS_SHADER_NAME_WITH_STS_SUFFIX + "_URPUnity6";
|
||||
public static readonly string TTS_SHADER_FILENAME_URP_UNITY6_WITH_OUTLINE_AND_STS = "/URP" + "/Unity6" + "/TheToonShader" + "_WithOutline" + TTS_SHADER_NAME_WITH_STS_SUFFIX + "_URPUnity6";
|
||||
|
||||
/// URP 6.3///
|
||||
public static readonly string TTS_SHADER_FILENAME_URP_UNITY6_3 = "/URP" + "/Unity6_3" + "/TheToonShader" + "_URPUnity6_3";
|
||||
public static readonly string TTS_SHADER_FILENAME_URP_UNITY6_3_WITH_OUTLINE = "/URP" + "/Unity6_3" + "/TheToonShader" + "_WithOutline" + "_URPUnity6_3";
|
||||
|
||||
public static readonly string TTS_SHADER_FILENAME_URP_UNITY6_3_WITH_STS = "/URP" + "/Unity6_3" + "/TheToonShader" + TTS_SHADER_NAME_WITH_STS_SUFFIX + "_URPUnity6_3";
|
||||
public static readonly string TTS_SHADER_FILENAME_URP_UNITY6_3_WITH_OUTLINE_AND_STS = "/URP" + "/Unity6_3" + "/TheToonShader" + "_WithOutline" + TTS_SHADER_NAME_WITH_STS_SUFFIX + "_URPUnity6_3";
|
||||
|
||||
//public static readonly string TTS_SHADER_NAME_URP = TTS_SHADER_NAME_URP_FOLDER + "/TheToonShader";
|
||||
//public static readonly string TTS_SHADER_NAME_URP_WITH_OUTLINE = TTS_SHADER_NAME_URP + TTS_SHADER_NAME_WITH_OUTLINE_SUFFIX;
|
||||
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 49409b8a1fc748246bb65a237bc345db
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 269238
|
||||
packageName: The Toon Shader
|
||||
packageVersion: 1.4.2
|
||||
assetPath: Packages/com.shadercrew.the-toon-shader.core/Scripts/Runtime/Common/TheToonShaderConstants.cs
|
||||
uploadId: 919972
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a13855122c81c764f90736643a2e06fe
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+217
@@ -0,0 +1,217 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using static ShaderCrew.TheToonShader.ShaderUtils;
|
||||
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
public class CameraChildFocus : MonoBehaviour
|
||||
{
|
||||
public Camera targetCamera;
|
||||
public float distanceFromChild = 5.0f;
|
||||
public float yOffset = 0.0f;
|
||||
|
||||
public float transitionSpeed = 2.0f;
|
||||
public GameObject currentMaterialText;
|
||||
|
||||
public GameObject originalTemple;
|
||||
private bool isInitial = true;
|
||||
|
||||
private Transform[] headerTransforms;
|
||||
private Transform[] materialTransforms;
|
||||
private string currentKey = "";
|
||||
private int currentKeyIndex = 0;
|
||||
private int currentMaterialIndex = 0;
|
||||
|
||||
private Vector3 targetPosition;
|
||||
private Quaternion targetRotation;
|
||||
|
||||
Dictionary<string, List<Transform>> headersToMaterials;
|
||||
|
||||
RenderPipelineOptions rp;
|
||||
void Start()
|
||||
{
|
||||
rp = ShaderUtils.getCurrentRenderPipeline();
|
||||
|
||||
int childCount = transform.childCount;
|
||||
headerTransforms = new Transform[childCount];
|
||||
|
||||
headersToMaterials = new Dictionary<string, List<Transform>>();
|
||||
for (int i = 0; i < childCount; i++)
|
||||
{
|
||||
Transform header = transform.GetChild(i);
|
||||
headerTransforms[i] = header;
|
||||
string nameKey = header.name;
|
||||
headersToMaterials[nameKey] = new List<Transform>();
|
||||
|
||||
int materialCount = header.childCount;
|
||||
for (int j = 0; j < materialCount; j++)
|
||||
{
|
||||
headersToMaterials[nameKey].Add(header.GetChild(j));
|
||||
|
||||
}
|
||||
}
|
||||
currentKey = headersToMaterials.Keys.First();
|
||||
|
||||
if(rp == RenderPipelineOptions.URP2D)
|
||||
{
|
||||
targetPosition = originalTemple.transform.position + -1 * originalTemple.transform.forward * distanceFromChild;
|
||||
} else
|
||||
{
|
||||
targetPosition = originalTemple.transform.position + originalTemple.transform.forward * distanceFromChild;
|
||||
}
|
||||
targetPosition.y += yOffset;
|
||||
targetRotation = Quaternion.LookRotation(originalTemple.transform.position - targetPosition + new Vector3(0, yOffset / 2, 0));
|
||||
|
||||
|
||||
//// Set initial camera target if there are children
|
||||
//if (headersToMaterials[currentKey].Count > 0 && targetCamera != null)
|
||||
//{
|
||||
// FocusOnChild(currentMaterialIndex);
|
||||
//}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
string test;
|
||||
if (!isInitial)
|
||||
{
|
||||
test = "<b><size=50>" + currentKey + "</size></b>\r\n<b>" + headersToMaterials[currentKey][currentMaterialIndex].name + "</b>";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(rp != RenderPipelineOptions.URP2D)
|
||||
{
|
||||
test = "<b><size=50>" + "Unity Lit" + "</size></b>";
|
||||
}
|
||||
else
|
||||
{
|
||||
test = "<b><size=50>" + "Unity Sprite Lit Default" + "</size></b>";
|
||||
}
|
||||
|
||||
}
|
||||
currentMaterialText.GetComponent<Text>().text = test;
|
||||
|
||||
//if (Input.GetKeyDown(KeyCode.D))
|
||||
if (SystemIndependentInput.GetKeyDown(KeyCode.D))
|
||||
{
|
||||
MoveToNextChild();
|
||||
isInitial = false;
|
||||
}
|
||||
//else if (Input.GetKeyDown(KeyCode.A))
|
||||
else if(SystemIndependentInput.GetKeyDown(KeyCode.A))
|
||||
{
|
||||
if (currentMaterialIndex != 0)
|
||||
{
|
||||
if (!isInitial)
|
||||
MoveToPreviousChild();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (rp == RenderPipelineOptions.URP2D)
|
||||
{
|
||||
targetPosition = originalTemple.transform.position + -1 * originalTemple.transform.forward * distanceFromChild;
|
||||
}
|
||||
else
|
||||
{
|
||||
targetPosition = originalTemple.transform.position + originalTemple.transform.forward * distanceFromChild;
|
||||
}
|
||||
|
||||
targetPosition.y += yOffset;
|
||||
|
||||
if (rp != RenderPipelineOptions.URP2D)
|
||||
{
|
||||
targetRotation = Quaternion.LookRotation(originalTemple.transform.position - targetPosition + new Vector3(0, yOffset / 2, 0));
|
||||
}
|
||||
isInitial = true;
|
||||
}
|
||||
|
||||
}
|
||||
//else if (Input.GetKeyDown(KeyCode.W))
|
||||
else if (SystemIndependentInput.GetKeyDown(KeyCode.W))
|
||||
{
|
||||
MoveToNextHeader();
|
||||
}
|
||||
//else if (Input.GetKeyDown(KeyCode.S))
|
||||
else if (SystemIndependentInput.GetKeyDown(KeyCode.S))
|
||||
{
|
||||
MoveToPreviousHeader();
|
||||
}
|
||||
|
||||
targetCamera.transform.position = Vector3.Lerp(targetCamera.transform.position, targetPosition, Time.deltaTime * transitionSpeed);
|
||||
|
||||
if (rp != RenderPipelineOptions.URP2D)
|
||||
{
|
||||
targetCamera.transform.rotation = Quaternion.Lerp(targetCamera.transform.rotation, targetRotation, Time.deltaTime * transitionSpeed);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void MoveToNextChild()
|
||||
{
|
||||
if (headersToMaterials[currentKey].Count == 0) return;
|
||||
if (!isInitial)
|
||||
{
|
||||
currentMaterialIndex = (currentMaterialIndex + 1) % headersToMaterials[currentKey].Count;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
currentMaterialIndex = 0;
|
||||
|
||||
}
|
||||
FocusOnChild(currentMaterialIndex);
|
||||
}
|
||||
|
||||
private void MoveToPreviousChild()
|
||||
{
|
||||
if (headersToMaterials[currentKey].Count == 0) return;
|
||||
currentMaterialIndex = (currentMaterialIndex - 1 + headersToMaterials[currentKey].Count) % headersToMaterials[currentKey].Count;
|
||||
FocusOnChild(currentMaterialIndex);
|
||||
}
|
||||
|
||||
private void MoveToNextHeader()
|
||||
{
|
||||
if (headerTransforms.Length == 0) return;
|
||||
currentKeyIndex = (currentKeyIndex + 1) % headerTransforms.Length;
|
||||
currentKey = headerTransforms[currentKeyIndex].name;
|
||||
currentMaterialIndex = 0;
|
||||
FocusOnChild(0);
|
||||
}
|
||||
private void MoveToPreviousHeader()
|
||||
{
|
||||
if (headersToMaterials[currentKey].Count == 0) return;
|
||||
currentKeyIndex = (currentKeyIndex - 1 + headerTransforms.Length) % headerTransforms.Length;
|
||||
currentKey = headerTransforms[currentKeyIndex].name;
|
||||
currentMaterialIndex = 0;
|
||||
FocusOnChild(0);
|
||||
}
|
||||
private void FocusOnChild(int index)
|
||||
{
|
||||
if (targetCamera == null || index < 0 || index >= headersToMaterials[currentKey].Count) return;
|
||||
Transform targetChild = headersToMaterials[currentKey][index];
|
||||
//Debug.Log(targetChild.name);
|
||||
|
||||
|
||||
if (rp == RenderPipelineOptions.URP2D)
|
||||
{
|
||||
targetPosition = targetChild.position + -1 * targetChild.forward * distanceFromChild;
|
||||
}
|
||||
else
|
||||
{
|
||||
targetPosition = targetChild.position + targetChild.forward * distanceFromChild;
|
||||
}
|
||||
|
||||
targetPosition.y += yOffset;
|
||||
if (rp != RenderPipelineOptions.URP2D)
|
||||
{
|
||||
targetRotation = Quaternion.LookRotation(targetChild.position - targetPosition + new Vector3(0, yOffset / 2, 0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c304ba79dc2c704d807a85f6827fda0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 269238
|
||||
packageName: The Toon Shader
|
||||
packageVersion: 1.4.2
|
||||
assetPath: Packages/com.shadercrew.the-toon-shader.core/Scripts/Runtime/Demo/CameraChildFocus.cs
|
||||
uploadId: 919972
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using static ShaderCrew.TheToonShader.ShaderUtils;
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
[ExecuteInEditMode]
|
||||
public class ChangeLightIntensityRP : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
|
||||
private Light light;
|
||||
private float originalIntensity;
|
||||
public float intensityBiRP = 1f;
|
||||
public float intensityURP = 60f;
|
||||
|
||||
|
||||
|
||||
protected RenderPipelineOptions rp = RenderPipelineOptions.NONE;
|
||||
void Start()
|
||||
{
|
||||
light = GetComponent<Light>();
|
||||
if (light != null)
|
||||
{
|
||||
if (rp == RenderPipelineOptions.NONE)
|
||||
{
|
||||
rp = getCurrentRenderPipeline();
|
||||
}
|
||||
if (rp == RenderPipelineOptions.URP)
|
||||
{
|
||||
light.intensity = intensityURP;
|
||||
}
|
||||
else
|
||||
{
|
||||
light.intensity = intensityBiRP;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 600bb0163f5f2f144a1edfa9dca81290
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 269238
|
||||
packageName: The Toon Shader
|
||||
packageVersion: 1.4.2
|
||||
assetPath: Packages/com.shadercrew.the-toon-shader.core/Scripts/Runtime/Demo/ChangeLightIntensityRP.cs
|
||||
uploadId: 919972
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
#if USING_URP
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
public class Light2DOscillator : MonoBehaviour
|
||||
{
|
||||
public float moveDistance = 3f;
|
||||
public float moveSpeed = 2f;
|
||||
|
||||
private Vector3 startPos;
|
||||
|
||||
void Start()
|
||||
{
|
||||
startPos = transform.position;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
float offset = Mathf.Sin(Time.time * moveSpeed) * moveDistance;
|
||||
transform.position = new Vector3(startPos.x + offset, startPos.y, startPos.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3060582221477124c834179a062d0bc5
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 269238
|
||||
packageName: The Toon Shader
|
||||
packageVersion: 1.4.2
|
||||
assetPath: Packages/com.shadercrew.the-toon-shader.core/Scripts/Runtime/Demo/Light2DOscillator.cs
|
||||
uploadId: 919972
|
||||
@@ -0,0 +1,63 @@
|
||||
|
||||
|
||||
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
public class LightRotation : MonoBehaviour
|
||||
{
|
||||
public float startAngle = -30f;
|
||||
public float endAngle = 30f;
|
||||
|
||||
public float rotationSpeed = 1f;
|
||||
|
||||
public int pauseDuration = 500;
|
||||
|
||||
public int rotationAxis = 1;
|
||||
|
||||
private float t = 0f;
|
||||
private bool reversing = false;
|
||||
private bool isPaused = false;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (isPaused) return;
|
||||
|
||||
t += (reversing ? -1 : 1) * rotationSpeed * Time.deltaTime;
|
||||
|
||||
if (t >= 1f)
|
||||
{
|
||||
t = 1f;
|
||||
reversing = true;
|
||||
StartCoroutine(PauseAtMaxPoint());
|
||||
}
|
||||
else if (t <= 0f)
|
||||
{
|
||||
t = 0f;
|
||||
reversing = false;
|
||||
StartCoroutine(PauseAtMaxPoint());
|
||||
}
|
||||
|
||||
float easedT = Mathf.SmoothStep(0f, 1f, t);
|
||||
float angle = Mathf.Lerp(startAngle, endAngle, easedT);
|
||||
|
||||
Vector3 rotation = transform.eulerAngles;
|
||||
if (rotationAxis == 0)
|
||||
rotation.x = angle;
|
||||
else if (rotationAxis == 1)
|
||||
rotation.y = angle;
|
||||
else if (rotationAxis == 2)
|
||||
rotation.z = angle;
|
||||
|
||||
transform.eulerAngles = rotation;
|
||||
}
|
||||
|
||||
private IEnumerator PauseAtMaxPoint()
|
||||
{
|
||||
isPaused = true;
|
||||
yield return new WaitForSeconds(pauseDuration / 1000f);
|
||||
isPaused = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7af7bbc77e05cf749813ecc2f2d47e83
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 269238
|
||||
packageName: The Toon Shader
|
||||
packageVersion: 1.4.2
|
||||
assetPath: Packages/com.shadercrew.the-toon-shader.core/Scripts/Runtime/Demo/LightRotation.cs
|
||||
uploadId: 919972
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
using UnityEngine;
|
||||
|
||||
#if ENABLE_INPUT_SYSTEM
|
||||
using UnityEngine.InputSystem;
|
||||
#endif
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
public static class SystemIndependentInput
|
||||
{
|
||||
public static bool GetKeyDown(KeyCode key)
|
||||
{
|
||||
#if ENABLE_INPUT_SYSTEM
|
||||
Keyboard kb = Keyboard.current;
|
||||
if (kb == null) return false;
|
||||
|
||||
|
||||
Key newKey;
|
||||
if (TryConvertKeyCode(key, out newKey))
|
||||
return kb[newKey].wasPressedThisFrame;
|
||||
|
||||
return false;
|
||||
#elif ENABLE_LEGACY_INPUT_MANAGER
|
||||
return Input.GetKeyDown(key);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ENABLE_INPUT_SYSTEM
|
||||
private static bool TryConvertKeyCode(KeyCode oldKey, out Key newKey)
|
||||
{
|
||||
switch (oldKey)
|
||||
{
|
||||
case KeyCode.D: newKey = Key.D; return true;
|
||||
case KeyCode.A: newKey = Key.A; return true;
|
||||
case KeyCode.W: newKey = Key.W; return true;
|
||||
case KeyCode.S: newKey = Key.S; return true;
|
||||
|
||||
case KeyCode.Space: newKey = Key.Space; return true;
|
||||
case KeyCode.Escape: newKey = Key.Escape; return true;
|
||||
case KeyCode.UpArrow: newKey = Key.UpArrow; return true;
|
||||
case KeyCode.DownArrow: newKey = Key.DownArrow; return true;
|
||||
case KeyCode.LeftArrow: newKey = Key.LeftArrow; return true;
|
||||
case KeyCode.RightArrow: newKey = Key.RightArrow; return true;
|
||||
default:
|
||||
newKey = Key.None;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 99f5465f5ff6af040b99b7ba1c623641
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 269238
|
||||
packageName: The Toon Shader
|
||||
packageVersion: 1.4.2
|
||||
assetPath: Packages/com.shadercrew.the-toon-shader.core/Scripts/Runtime/Demo/SystemIndependentInput.cs
|
||||
uploadId: 919972
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "ShaderCrew.TheToonShader.Core.Runtime",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:15fc0a57446b3144c949da3e2b9737a9",
|
||||
"GUID:516a5277b8c3b4f4c8cc86b77b1591ff",
|
||||
"GUID:75469ad4d38634e559750d17036d5f7c"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [
|
||||
{
|
||||
"name": "com.unity.render-pipelines.universal",
|
||||
"expression": "",
|
||||
"define": "USING_URP"
|
||||
},
|
||||
{
|
||||
"name": "com.unity.render-pipelines.high-definition",
|
||||
"expression": "",
|
||||
"define": "USING_HDRP"
|
||||
},
|
||||
{
|
||||
"name": "com.unity.2d.sprite",
|
||||
"expression": "",
|
||||
"define": "USING_URP2D"
|
||||
}
|
||||
],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 83e2004185752be4684414733d22e0e7
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 269238
|
||||
packageName: The Toon Shader
|
||||
packageVersion: 1.4.2
|
||||
assetPath: Packages/com.shadercrew.the-toon-shader.core/Scripts/Runtime/ShaderCrew.TheToonShader.Core.Runtime.asmdef
|
||||
uploadId: 919972
|
||||
Reference in New Issue
Block a user