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: 6e5e40827d4fa4f43a04f53d916019e8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Binary file not shown.
+14
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ddd9fd26ef3c5284da3b70d75ffaa315
|
||||
DefaultImporter:
|
||||
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/Documentation/TheToonShader-1.0-Documentation.pdf
|
||||
uploadId: 919972
|
||||
@@ -0,0 +1,4 @@
|
||||
There are several ways of how to install the TTS samples:
|
||||
|
||||
Unity:
|
||||
Go to Unity -> Window -> Package Manager -> Select the The Toon Shader package. There under "Samples" you should be able to install the examples :)
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c4ab73ec551266f428994d9974034cc3
|
||||
TextScriptImporter:
|
||||
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/README for Samples.md
|
||||
uploadId: 919972
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 00cf082e569845c429dd37be347e5778
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da8c730e6b282b148bb0594553c1047d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e699416d0943b3b4583dd66e5cda09b6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,396 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
public static class EditorUtils
|
||||
{
|
||||
public static void usualStart(string name)
|
||||
{
|
||||
LogoOnlyStart(name);
|
||||
|
||||
Rect rect = EditorGUILayout.BeginVertical();
|
||||
GUI.Box(rect, GUIContent.none);
|
||||
|
||||
}
|
||||
|
||||
public static void LogoOnlyStart(string name)
|
||||
{
|
||||
Rect screenRect = GUILayoutUtility.GetRect(1, 1);
|
||||
|
||||
Rect vertRect = EditorGUILayout.BeginVertical();
|
||||
|
||||
Color backgroundColor = new Color(0.4f, 0.4f, 0.4f);
|
||||
EditorGUI.DrawRect(new Rect(screenRect.x - 20, screenRect.y - 5, screenRect.width + 25, vertRect.height + 9), backgroundColor);
|
||||
|
||||
Sprite test = Resources.Load<Sprite>("logo-the-toon-shader-small");
|
||||
|
||||
GUIStyle headStyle = new GUIStyle();
|
||||
headStyle.normal.textColor = Color.white;
|
||||
headStyle.fontSize = 13;
|
||||
headStyle.alignment = TextAnchor.MiddleCenter;
|
||||
headStyle.fontStyle = FontStyle.Italic;
|
||||
|
||||
|
||||
//GUILayout.Label(Strings.THE_TOON_SHADER_TITLE, headStyle);
|
||||
//GUILayout.Label(Strings.SHADER_CREW_TITLE, headStyle);
|
||||
headStyle.fontStyle = FontStyle.Bold;
|
||||
headStyle.fontSize = 14;
|
||||
GUILayout.Label(name, headStyle);
|
||||
|
||||
if (test != null)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
//GUILayout.Label(test.texture, GUILayout.Width(250), GUILayout.Height(150));
|
||||
GUILayout.Label(test.texture, GUILayout.Width(300), GUILayout.Height(200));
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
//EditorGUILayout.Space(30);
|
||||
|
||||
}
|
||||
|
||||
public static bool LogoOnlyStartWithDescription(string name, string description, bool showDescription)
|
||||
{
|
||||
LogoOnlyStart(name);
|
||||
|
||||
if (description != null && description != "")
|
||||
{
|
||||
Rect rectt = EditorGUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
GUI.Box(rectt, GUIContent.none);
|
||||
string title = " Description:";
|
||||
|
||||
GUIStyle style = EditorStyles.foldout;
|
||||
FontStyle previousStyle = style.fontStyle;
|
||||
style.fontStyle = FontStyle.Bold;
|
||||
|
||||
showDescription = EditorGUILayout.Foldout(showDescription, title, style); //, EditorStyles.boldLabel);
|
||||
style.fontStyle = previousStyle;
|
||||
|
||||
|
||||
//showDescription = EditorGUILayout.Foldout(showDescription, title);
|
||||
if (showDescription)
|
||||
{
|
||||
GUIStyle textStyle = EditorStyles.label;
|
||||
textStyle.wordWrap = true;
|
||||
textStyle.richText = true;
|
||||
textStyle.fontStyle = FontStyle.Normal;
|
||||
GUILayout.Space(10);
|
||||
GUILayout.Label(description, textStyle);
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
EditorUtils.makeHorizontalSeparation();
|
||||
return showDescription;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static bool usualStartWithDescription(string name, string description, bool showDescription)
|
||||
{
|
||||
usualStart(name);
|
||||
if (description != null && description != "")
|
||||
{
|
||||
string title = " Description:";
|
||||
|
||||
GUIStyle style = EditorStyles.foldout;
|
||||
FontStyle previousStyle = style.fontStyle;
|
||||
style.fontStyle = FontStyle.Bold;
|
||||
|
||||
showDescription = EditorGUILayout.Foldout(showDescription, title, style); //, EditorStyles.boldLabel);
|
||||
style.fontStyle = previousStyle;
|
||||
|
||||
|
||||
//showDescription = EditorGUILayout.Foldout(showDescription, title);
|
||||
if (showDescription)
|
||||
{
|
||||
GUIStyle textStyle = EditorStyles.label;
|
||||
textStyle.wordWrap = true;
|
||||
textStyle.richText = true;
|
||||
textStyle.fontStyle = FontStyle.Normal;
|
||||
GUILayout.Space(10);
|
||||
GUILayout.Label(description, textStyle);
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
return showDescription;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void usualEnd()
|
||||
{
|
||||
EditorGUILayout.EndVertical();
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
public static void LogoOnlyEnd()
|
||||
{
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
|
||||
public static void Header(string title, GUIStyle style)
|
||||
{
|
||||
|
||||
Rect rectt = EditorGUILayout.BeginVertical();
|
||||
//rectt.y = rectt.y - 2f;
|
||||
//rectt.width = rectt.width + 6;
|
||||
//rectt.x = rectt.x - 3;
|
||||
rectt.width = rectt.width + 20;
|
||||
rectt.x = 0;
|
||||
//EditorUtils.DrawUILineFullWidth(Color.black, thickness: 1, padding: -3);
|
||||
|
||||
Color lightBlue = new Color(1.5f, 1.6f, 1.7f, 2);
|
||||
EditorUtils.DrawUILineBottom(rectt, new Color(0.25f, 0.25f, 0.25f, 1f));
|
||||
|
||||
|
||||
|
||||
var c = GUI.color;
|
||||
if (EditorGUIUtility.isProSkin)
|
||||
{
|
||||
GUI.color = new Color(0.5f, 1.5f, 2.5f, 1f);
|
||||
GUI.color = new Color(1.5f, 1.6f, 1.7f, 2);
|
||||
GUI.color = Color.black;
|
||||
GUI.color = new Color(0.5f, 1.5f, 2.5f, 1.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.color = new Color(0.5f, 0.7f, 0.9f, 1f);
|
||||
}
|
||||
|
||||
|
||||
Color myStyleColor = new Color(0.8f, 0.95f, 1f, 1f);// *0.9f;
|
||||
myStyleColor = Color.white;
|
||||
style.fontStyle = FontStyle.BoldAndItalic;
|
||||
style.fontSize = 14;
|
||||
|
||||
style.normal.textColor = myStyleColor;
|
||||
style.onNormal.textColor = myStyleColor;
|
||||
style.hover.textColor = myStyleColor;
|
||||
style.onHover.textColor = myStyleColor;
|
||||
style.focused.textColor = myStyleColor;
|
||||
style.onFocused.textColor = myStyleColor;
|
||||
style.active.textColor = myStyleColor;
|
||||
style.onActive.textColor = myStyleColor;
|
||||
|
||||
GUI.Box(rectt, GUIContent.none);
|
||||
GUI.color = c;
|
||||
GUILayout.Space(5);
|
||||
GUILayout.Label(title, style);
|
||||
GUILayout.Space(5);
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
//Color color = Color.black;
|
||||
//Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(1));
|
||||
//r.y = r.y - 4f;
|
||||
//r.width = r.width + 6;
|
||||
//r.x = r.x - 3;
|
||||
//EditorGUI.DrawRect(r, color);
|
||||
|
||||
lightBlue = new Color(1.1f, 1.2f, 1.7f, 0.5f);
|
||||
EditorUtils.DrawUILineBottom(rectt, lightBlue, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void DrawUILine(int thickness = 1, int padding = 10)
|
||||
{
|
||||
Color color = Color.black;
|
||||
Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness));
|
||||
r.height = thickness;
|
||||
r.y += padding / 2;
|
||||
EditorGUI.DrawRect(r, color);
|
||||
}
|
||||
|
||||
public static void DrawUILineFull(int thickness = 1, int padding = 10)
|
||||
{
|
||||
Color color = Color.black;
|
||||
Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness));
|
||||
r.width = Screen.width;
|
||||
r.x = 0;
|
||||
r.height = thickness;
|
||||
r.y += padding / 2;
|
||||
EditorGUI.DrawRect(r, color);
|
||||
}
|
||||
public static void DrawUILineFull(Color color, int thickness = 1, int padding = 10)
|
||||
{
|
||||
Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness));
|
||||
r.width = Screen.width;
|
||||
r.x = 0;
|
||||
r.height = thickness;
|
||||
r.y += padding / 2;
|
||||
EditorGUI.DrawRect(r, color);
|
||||
}
|
||||
public static void DrawUILineGray(int thickness = 2, int padding = 10)
|
||||
{
|
||||
Color color = new Color(0.2f, 0.2f, 0.2f, 1);
|
||||
Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness));
|
||||
r.height = thickness;
|
||||
r.y += padding / 2;
|
||||
EditorGUI.DrawRect(r, color);
|
||||
}
|
||||
|
||||
public static void DrawUILineLightBlue(int thickness = 1, int padding = 0)
|
||||
{
|
||||
Color color = new Color(0.5f, 0.6f, 0.7f, 1);
|
||||
Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness));
|
||||
r.height = thickness;
|
||||
r.y += padding / 2;
|
||||
EditorGUI.DrawRect(r, color);
|
||||
}
|
||||
|
||||
public static void DrawUILineFullWidth(Color color, int thickness = 2, int padding = -1)
|
||||
{
|
||||
|
||||
Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness));
|
||||
r.x = 0;
|
||||
r.width += 30;
|
||||
r.height = thickness;
|
||||
r.y += padding / 2;
|
||||
EditorGUI.DrawRect(r, color);
|
||||
}
|
||||
public static void DrawUILine(Color color, int thickness = 2, int padding = -1)
|
||||
{
|
||||
|
||||
Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness));
|
||||
r.height = thickness;
|
||||
r.y += padding / 2;
|
||||
EditorGUI.DrawRect(r, color);
|
||||
}
|
||||
|
||||
public static void DrawUILineBottom(Rect rect, Color color, int thickness = 2, int padding = -1)
|
||||
{
|
||||
|
||||
Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness));
|
||||
r.height = thickness;
|
||||
r.y += padding / 2;
|
||||
r.x = rect.x;
|
||||
r.width = rect.width;
|
||||
EditorGUI.DrawRect(r, color);
|
||||
}
|
||||
|
||||
public static void DrawUILine(Rect rect, Color color, int thickness = 2, int padding = -1)
|
||||
{
|
||||
|
||||
Rect r = rect;
|
||||
r.height = thickness;
|
||||
r.y += padding / 2;
|
||||
EditorGUI.DrawRect(r, color);
|
||||
}
|
||||
|
||||
public static void DrawSubMenuSeparation()
|
||||
{
|
||||
//EditorGUILayout.Space();
|
||||
EditorUtils.DrawUILineSubMenu(1, -1, 10);
|
||||
EditorUtils.DrawUILineSubMenu(Color.gray, 1, 2, 10);
|
||||
}
|
||||
|
||||
public static void DrawSubMenuSeparation2()
|
||||
{
|
||||
//EditorGUILayout.Space();
|
||||
//Color color = new Color(0.28f, 0.28f, 0.28f, 1);
|
||||
//EditorUtils.DrawUILineSubMenu(color, 1, -2, 10);
|
||||
EditorUtils.DrawUILineSubMenu(4, -1, 0);
|
||||
EditorUtils.DrawUILineSubMenu(Color.gray, 1, 2, 0);
|
||||
}
|
||||
|
||||
public static void DrawUILineSubMenu(int thickness = 2, int padding = 1)
|
||||
{
|
||||
Color color = new Color(0.28f, 0.28f, 0.28f, 1);
|
||||
|
||||
|
||||
|
||||
DrawUILineSubMenu(color, thickness, padding);
|
||||
}
|
||||
|
||||
public static void DrawUILineSubMenu(int thickness = 2, int padding = 1, float margin = 20)
|
||||
{
|
||||
Color color = new Color(0.28f, 0.28f, 0.28f, 1);
|
||||
|
||||
|
||||
|
||||
DrawUILineSubMenu(color, thickness, padding, margin);
|
||||
}
|
||||
|
||||
public static void DrawUILineSubMenu(Color color, int thickness = 2, int padding = 1)
|
||||
{
|
||||
Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness));
|
||||
r.height = thickness;
|
||||
//r.y += padding / 2;
|
||||
float marginLeft = 20;
|
||||
r.width = r.width - marginLeft;
|
||||
r.x += marginLeft;
|
||||
|
||||
EditorGUI.DrawRect(r, color);
|
||||
}
|
||||
|
||||
public static void DrawUILineSubMenu(Color color, int thickness = 2, int padding = 1, float margin = 20)
|
||||
{
|
||||
Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness));
|
||||
r.height = thickness;
|
||||
//r.y += padding / 2;
|
||||
float marginLeft = margin;
|
||||
r.width = r.width - marginLeft;
|
||||
r.x += marginLeft;
|
||||
|
||||
EditorGUI.DrawRect(r, color);
|
||||
}
|
||||
public static void DrawUILineCenter(Color color, int thickness = 2, int padding = 1)
|
||||
{
|
||||
Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness));
|
||||
r.height = thickness;
|
||||
//r.y += padding / 2;
|
||||
float marginLeft = 20;
|
||||
r.width = r.width - marginLeft * 2;
|
||||
r.x += marginLeft;
|
||||
|
||||
EditorGUI.DrawRect(r, color);
|
||||
}
|
||||
|
||||
|
||||
public static void makeHorizontalSeparation(Color color)
|
||||
{
|
||||
GUIStyle horizontalLine;
|
||||
horizontalLine = new GUIStyle();
|
||||
horizontalLine.normal.background = EditorGUIUtility.whiteTexture;
|
||||
horizontalLine.margin = new RectOffset(0, 0, 4, 4);
|
||||
horizontalLine.fixedHeight = 10;
|
||||
|
||||
var c = GUI.color;
|
||||
GUI.color = color;
|
||||
GUILayout.Box(GUIContent.none, horizontalLine);
|
||||
GUI.color = c;
|
||||
}
|
||||
|
||||
public static void makeHorizontalSeparation()
|
||||
{
|
||||
makeHorizontalSeparation(new Color(0.4f, 0.4f, 0.4f));
|
||||
}
|
||||
|
||||
public static void DrawBox(Rect position, Color color)
|
||||
{
|
||||
Color oldColor = GUI.color;
|
||||
GUI.color = color;
|
||||
GUI.Box(position, GUIContent.none);
|
||||
GUI.color = oldColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2751e2e41ac5ec2468893425195204b0
|
||||
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/Editor/Common/EditorUtils.cs
|
||||
uploadId: 919972
|
||||
@@ -0,0 +1,12 @@
|
||||
using UnityEngine;
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
public class GradientSO : ScriptableObject
|
||||
{
|
||||
[SerializeField]
|
||||
public Gradient gradient;
|
||||
|
||||
[SerializeField]
|
||||
public bool isBakedToTexture = false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: abb55f1f10b566340bf309a09598fc57
|
||||
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/Editor/Common/GradientSO.cs
|
||||
uploadId: 919972
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
|
||||
// Source: https://discussions.unity.com/t/how-to-get-shader-source-code-from-script/839046/5
|
||||
public static class ShaderGraphToShaderExporterUtil
|
||||
{
|
||||
private static object GetGraphData(string shaderAssetPath)
|
||||
{
|
||||
var importer = AssetImporter.GetAtPath(shaderAssetPath);
|
||||
|
||||
var textGraph = File.ReadAllText(importer.assetPath, Encoding.UTF8);
|
||||
var graphObjectType = Type.GetType("UnityEditor.Graphing.GraphObject, Unity.ShaderGraph.Editor")!;
|
||||
|
||||
// var graphObject = CreateInstance<GraphObject>();
|
||||
var graphObject = ScriptableObject.CreateInstance(graphObjectType);
|
||||
|
||||
graphObject.hideFlags = HideFlags.HideAndDontSave;
|
||||
bool isSubGraph;
|
||||
var extension = Path.GetExtension(importer.assetPath).Replace(".", "");
|
||||
switch (extension)
|
||||
{
|
||||
case "shadergraph":
|
||||
isSubGraph = false;
|
||||
break;
|
||||
case "ShaderGraph":
|
||||
isSubGraph = false;
|
||||
break;
|
||||
case "shadersubgraph":
|
||||
isSubGraph = true;
|
||||
break;
|
||||
default:
|
||||
throw new Exception($"Invalid file extension {extension}");
|
||||
}
|
||||
var assetGuid = AssetDatabase.AssetPathToGUID(importer.assetPath);
|
||||
|
||||
// graphObject.graph = new GraphData { assetGuid = assetGuid, isSubGraph = isSubGraph, messageManager = null };
|
||||
var graphObject_graphProperty = graphObjectType.GetProperty("graph")!;
|
||||
var graphDataType = Type.GetType("UnityEditor.ShaderGraph.GraphData, Unity.ShaderGraph.Editor")!;
|
||||
var graphDataInstance = Activator.CreateInstance(graphDataType);
|
||||
graphDataType.GetProperty("assetGuid")!.SetValue(graphDataInstance, assetGuid);
|
||||
graphDataType.GetProperty("isSubGraph")!.SetValue(graphDataInstance, isSubGraph);
|
||||
graphDataType.GetProperty("messageManager")!.SetValue(graphDataInstance, null);
|
||||
graphObject_graphProperty.SetValue(graphObject, graphDataInstance);
|
||||
|
||||
// MultiJson.Deserialize(graphObject.graph, textGraph);
|
||||
// = MultiJson.Deserialize<JsonObject>(graphObject.graph, textGraph, null, false);
|
||||
var multiJsonType = Type.GetType("UnityEditor.ShaderGraph.Serialization.MultiJson, Unity.ShaderGraph.Editor")!;
|
||||
var deserializeMethod = multiJsonType.GetMethod("Deserialize")!;
|
||||
var descrializeGenericMethod = deserializeMethod.MakeGenericMethod(graphDataType);
|
||||
descrializeGenericMethod.Invoke(null, new object[] { graphDataInstance, textGraph, null, false });
|
||||
|
||||
// graphObject.graph.OnEnable();
|
||||
graphDataType.GetMethod("OnEnable")!.Invoke(graphDataInstance, null);
|
||||
|
||||
// graphObject.graph.ValidateGraph();
|
||||
graphDataType.GetMethod("ValidateGraph")!.Invoke(graphDataInstance, null);
|
||||
|
||||
// return graphData.graph
|
||||
return graphDataInstance;
|
||||
}
|
||||
|
||||
public static string GenerateShaderCode(string shaderAssetPath, string shaderName = null)
|
||||
{
|
||||
Type generatorType =
|
||||
Type.GetType("UnityEditor.ShaderGraph.Generator, Unity.ShaderGraph.Editor")!;
|
||||
Type modeType =
|
||||
Type.GetType("UnityEditor.ShaderGraph.GenerationMode, Unity.ShaderGraph.Editor")!;
|
||||
|
||||
shaderName ??= Path.GetFileNameWithoutExtension(shaderAssetPath);
|
||||
|
||||
object graphData = GetGraphData(shaderAssetPath);
|
||||
|
||||
// new Generator(graphData, null, GenerationMode.ForReals, assetName, target:null, assetCollection:null, humanReadable: true);
|
||||
object forReals = ((FieldInfo)modeType.GetMember("ForReals")[0]).GetValue(null);
|
||||
object generator = Activator.CreateInstance(
|
||||
generatorType,
|
||||
new object[] { graphData, null, forReals, shaderName, null, null, true }
|
||||
);
|
||||
object shaderCode = generatorType
|
||||
.GetProperty("generatedShader", BindingFlags.Public | BindingFlags.Instance)!
|
||||
.GetValue(generator);
|
||||
|
||||
return (string)shaderCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5cda48d5367852448bb16514360fc9f
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 269238
|
||||
packageName: The Toon Shader
|
||||
packageVersion: 1.4.2
|
||||
assetPath: Packages/com.shadercrew.the-toon-shader.core/Scripts/Editor/Common/ShaderGraphToShaderExporterUtil.cs
|
||||
uploadId: 919972
|
||||
+386
@@ -0,0 +1,386 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using static ShaderCrew.TheToonShader.ShaderUtils;
|
||||
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
public class TheToonShaderGenerator
|
||||
{
|
||||
|
||||
public TheToonShaderGenerator() { }
|
||||
|
||||
//public bool _USE_OPTIMIZATION_DEFINES;
|
||||
public bool _ENABLE_TOON_SHADING;
|
||||
|
||||
public int _LIGHT_SOURCE = -1;
|
||||
|
||||
public int _SHADING_FUNCTION;
|
||||
public bool _SHADING_TERMINATORPOSITION;
|
||||
public bool _ENABLE_SHADOWS;
|
||||
public bool _ENABLE_CAST_SHADOWS;
|
||||
|
||||
public bool _ENABLE_SPECULAR;
|
||||
public int _SPECULAR_BLENDING = -1;
|
||||
|
||||
public bool _ENABLE_RIM;
|
||||
public int _RIM_BLENDING = -1;
|
||||
|
||||
public bool _SUM_LIGHTS_BEFORE_POSTERIZATION;
|
||||
public bool _SHADING_USE_LIGHT_COLORS;
|
||||
public bool _SPECULAR_USE_LIGHT_COLORS;
|
||||
public bool _STYLING_SPECULAR_USE_LIGHT_COLORS;
|
||||
|
||||
|
||||
public bool _ENABLE_STYLING;
|
||||
|
||||
public int _STYLING_CASTSHADOWS_SYNC_WITH_OTHER_STYLING = -1;
|
||||
|
||||
public bool _ENABLE_STYLING_DISTANCEFADE;
|
||||
|
||||
public bool _ENABLE_SHADING_STYLING;
|
||||
public bool _SHADING_STYLING_TERMINATORPOSITION;
|
||||
public int _SHADING_STYLING_BLENDING = -1;
|
||||
public int _SHADING_STYLING_DRAWSPACE = -1;
|
||||
public int _SHADING_STYLING_UVSET = -1;
|
||||
public int _SHADING_STYLING_COORDINATESYSTEM = -1;
|
||||
public int _SHADING_STYLE = -1;
|
||||
public int _SHADING_STYLING_NUMBER_OF_CELLS_HATCHING = -1;
|
||||
public bool _SHADING_STYLING_RANDOMIZER;
|
||||
public bool _SHADING_STYLING_RANDOMIZER_PERLIN;
|
||||
public bool _SHADING_STYLING_RANDOMIZER_PERLIN_FLOORED;
|
||||
public bool _SHADING_STYLING_RANDOMIZER_WHITE;
|
||||
public bool _SHADING_STYLING_RANDOMIZER_WHITE_FLOORED;
|
||||
|
||||
public bool _SHADING_STYLING_ENABLE_DASHES;
|
||||
public int _SHADING_STYLING_DASHES_TYPE = -1;
|
||||
|
||||
|
||||
public bool _ENABLE_CASTSHADOWS_STYLING;
|
||||
public int _CASTSHADOWS_STYLING_BLENDING = -1;
|
||||
public int _CASTSHADOWS_STYLING_DRAWSPACE = -1;
|
||||
public int _CASTSHADOWS_STYLING_UVSET = -1;
|
||||
public int _CASTSHADOWS_STYLING_COORDINATESYSTEM = -1;
|
||||
public int _CASTSHADOWS_STYLE = -1;
|
||||
public int _CASTSHADOWS_STYLING_NUMBER_OF_CELLS_HATCHING = -1;
|
||||
public bool _CASTSHADOWS_STYLING_RANDOMIZER;
|
||||
public bool _CASTSHADOWS_STYLING_RANDOMIZER_PERLIN;
|
||||
public bool _CASTSHADOWS_STYLING_RANDOMIZER_PERLIN_FLOORED;
|
||||
public bool _CASTSHADOWS_STYLING_RANDOMIZER_WHITE;
|
||||
public bool _CASTSHADOWS_STYLING_RANDOMIZER_WHITE_FLOORED;
|
||||
|
||||
public bool _CASTSHADOWS_STYLING_ENABLE_DASHES;
|
||||
public int _CASTSHADOWS_STYLING_DASHES_TYPE = -1;
|
||||
|
||||
|
||||
public bool _ENABLE_SPECULAR_STYLING;
|
||||
public int _SPECULAR_STYLING_BLENDING = -1;
|
||||
public int _SPECULAR_STYLING_DRAWSPACE = -1;
|
||||
public int _SPECULAR_STYLING_UVSET = -1;
|
||||
public int _SPECULAR_STYLING_COORDINATESYSTEM = -1;
|
||||
public int _SPECULAR_STYLE = -1;
|
||||
public bool _SPECULAR_STYLING_RANDOMIZER;
|
||||
public bool _SPECULAR_STYLING_RANDOMIZER_PERLIN;
|
||||
public bool _SPECULAR_STYLING_RANDOMIZER_PERLIN_FLOORED;
|
||||
public bool _SPECULAR_STYLING_RANDOMIZER_WHITE;
|
||||
public bool _SPECULAR_STYLING_RANDOMIZER_WHITE_FLOORED;
|
||||
|
||||
public bool _SPECULAR_STYLING_ENABLE_DASHES;
|
||||
public int _SPECULAR_STYLING_DASHES_TYPE = -1;
|
||||
|
||||
public bool _ENABLE_RIM_STYLING;
|
||||
public int _RIM_STYLING_BLENDING = -1;
|
||||
public int _RIM_STYLING_DRAWSPACE = -1;
|
||||
public int _RIM_STYLING_UVSET = -1;
|
||||
public int _RIM_STYLING_COORDINATESYSTEM = -1;
|
||||
public int _RIM_STYLE = -1;
|
||||
public bool _RIM_STYLING_RANDOMIZER;
|
||||
public bool _RIM_STYLING_RANDOMIZER_PERLIN;
|
||||
public bool _RIM_STYLING_RANDOMIZER_PERLIN_FLOORED;
|
||||
public bool _RIM_STYLING_RANDOMIZER_WHITE;
|
||||
public bool _RIM_STYLING_RANDOMIZER_WHITE_FLOORED;
|
||||
|
||||
public bool _RIM_STYLING_ENABLE_DASHES;
|
||||
public int _RIM_STYLING_DASHES_TYPE = -1;
|
||||
|
||||
|
||||
#if USING_URP2D
|
||||
public int _MAX_LIGHT_COUNT = -1;
|
||||
public int _CELL_METHOD = -1;
|
||||
public bool _ENABLE_MAINTEX_POSTERIZATION;
|
||||
|
||||
public bool _EMISSION;
|
||||
public bool _NORMALMAP;
|
||||
|
||||
public bool _USE_MAINTEX;
|
||||
public bool _CONVERT_NORMAL_TO_ALBEDO;
|
||||
|
||||
public bool _USE_CORE_SHADOW_COLOR;
|
||||
public bool _ENABLE_LIGHT_PARTITIONING;
|
||||
public int _ROUND_METHOD = -1;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
public bool _ENABLE_OUTLINE;
|
||||
|
||||
|
||||
public static bool CheckIfShaderIsAlreadyOptimized(Material material)
|
||||
{
|
||||
if (material != null && material.shader != null)
|
||||
{
|
||||
string dataPathWithoutAssets = Application.dataPath;
|
||||
if (dataPathWithoutAssets.EndsWith("/Assets"))
|
||||
{
|
||||
dataPathWithoutAssets = dataPathWithoutAssets.Substring(0, dataPathWithoutAssets.LastIndexOf("/Assets"));
|
||||
}
|
||||
string realPath = null;
|
||||
|
||||
string shaderAssetPath = UnityEditor.AssetDatabase.GetAssetPath(material.shader);
|
||||
string fileName = Path.GetFileName(shaderAssetPath);
|
||||
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(shaderAssetPath);
|
||||
string extension = Path.GetExtension(shaderAssetPath);
|
||||
|
||||
if (fileName != null && !fileName.Equals("") && extension != null && extension.Equals(".shader"))
|
||||
{
|
||||
realPath = dataPathWithoutAssets + "/" + shaderAssetPath;
|
||||
}
|
||||
|
||||
//if (material.shader.name == "Dev/TheToonShaderDev")
|
||||
//{
|
||||
// realPath = dataPathWithoutAssets + "/Packages/com.shadercrew.the-toon-shader.core/Scripts/Shaders/Native/URP/TheToonShader_URP2020.shader";
|
||||
//}
|
||||
//else // remove in final
|
||||
//{
|
||||
// Debug.Log("Remove me in final");
|
||||
// return false;
|
||||
//}
|
||||
|
||||
|
||||
//Debug.Log(realPath);
|
||||
|
||||
string fileContent = File.ReadAllText(realPath);
|
||||
//Debug.Log(fileContent);
|
||||
|
||||
//string pattern = @"\b#define\s+_USE_OPTIMIZATION_DEFINES\s+1\b";
|
||||
string pattern = @"#\bdefine\s+_USE_OPTIMIZATION_DEFINES\s+1\b";
|
||||
Regex regex = new Regex(pattern);
|
||||
|
||||
bool lineFound = regex.IsMatch(fileContent);
|
||||
|
||||
|
||||
return lineFound;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static bool CheckIfShaderIsAlreadyOptimizedPropertyBased(Material material)
|
||||
{
|
||||
if (material != null && material.shader != null)
|
||||
{
|
||||
return material.HasProperty("_IsOptimized");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public Shader GenerateOptimizedShaderFile(Material material) // return generated shader
|
||||
{
|
||||
if(material != null && material.shader != null)
|
||||
{
|
||||
|
||||
RenderPipelineOptions rp = getCurrentRenderPipeline();
|
||||
|
||||
|
||||
string shaderAssetPath = UnityEditor.AssetDatabase.GetAssetPath(material.shader);
|
||||
string fileName = Path.GetFileName(shaderAssetPath);
|
||||
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(shaderAssetPath);
|
||||
string extension = Path.GetExtension(shaderAssetPath);
|
||||
|
||||
|
||||
string dataPathWithoutAssets = Application.dataPath;
|
||||
if (dataPathWithoutAssets.EndsWith("/Assets"))
|
||||
{
|
||||
dataPathWithoutAssets = dataPathWithoutAssets.Substring(0, dataPathWithoutAssets.LastIndexOf("/Assets"));
|
||||
}
|
||||
|
||||
string realPath = null;
|
||||
|
||||
|
||||
if (fileName != null && !fileName.Equals("") && extension != null && (extension.Equals(".shader") || extension.Equals(".shadergraph")))
|
||||
{
|
||||
realPath = dataPathWithoutAssets + "/" + shaderAssetPath;
|
||||
}
|
||||
|
||||
|
||||
////cause debug:
|
||||
|
||||
////realPath = dataPathWithoutAssets + "/Packages/com.shadercrew.the-toon-shader.core/Scripts/Shaders/Native/URP/TheToonShader_URP2020.shader";
|
||||
//if(material.shader.name == "Dev/TheToonShaderDev")
|
||||
//{
|
||||
// realPath = dataPathWithoutAssets + "/Packages/com.shadercrew.the-toon-shader.core/Scripts/Shaders/Native/URP/TheToonShader_URP2020.shader";
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
if (realPath != null && !realPath.Equals(""))
|
||||
{
|
||||
string content = null;
|
||||
|
||||
if (rp == RenderPipelineOptions.URP2D)
|
||||
{
|
||||
content = ShaderGraphToShaderExporterUtil.GenerateShaderCode(shaderAssetPath, fileNameWithoutExtension);
|
||||
}
|
||||
else
|
||||
{
|
||||
content = File.ReadAllText(realPath);
|
||||
}
|
||||
string optimizedShaderName = "";
|
||||
|
||||
//string patternShaderName = @"Shader\s*""([^""]+)""";
|
||||
//string patternShaderName = @"(\r\n|\r|\n)\s*Shader\s*""([^""]+)""";
|
||||
//Regex regex = new Regex(patternShaderName);
|
||||
Regex regex = new Regex(@"^\s*Shader\s*""([^""]+)""", RegexOptions.Multiline);
|
||||
|
||||
Match matchShaderName = regex.Match(content);
|
||||
if (matchShaderName.Success)
|
||||
{
|
||||
string shaderName = matchShaderName.Groups[1].Value;
|
||||
string modifiedShaderName = shaderName + "_" + material.name + "_Optimized";
|
||||
|
||||
optimizedShaderName = modifiedShaderName;
|
||||
//Debug.Log("optimizedShaderName: " + optimizedShaderName);
|
||||
List<string> parts = optimizedShaderName.Split('/').ToList();
|
||||
parts.Insert(1, "Optimized");
|
||||
optimizedShaderName = string.Join("/", parts);
|
||||
|
||||
content = regex.Replace(content, matchShaderName.Value.Replace(shaderName, optimizedShaderName));
|
||||
|
||||
}
|
||||
|
||||
string patternProperties = @"Properties\s*\{\s*";
|
||||
Match matchProperties = Regex.Match(content, patternProperties);
|
||||
|
||||
if (matchProperties.Success)
|
||||
{
|
||||
int insertPosition = matchProperties.Index + matchProperties.Length;
|
||||
|
||||
content = content.Insert(insertPosition, "[HideInInspector] _IsOptimized(\"_IsOptimized\", Float) = 1.0" + "\n");
|
||||
}
|
||||
|
||||
string pattern = @"SubShader\s*\{\s*";
|
||||
|
||||
Match match = Regex.Match(content, pattern);
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
int insertPosition = match.Index + match.Length;
|
||||
|
||||
StringBuilder defineDefinitions = new StringBuilder(2000);
|
||||
|
||||
if (rp == RenderPipelineOptions.BiRP)
|
||||
{
|
||||
defineDefinitions.AppendLine("\tCGINCLUDE");
|
||||
}
|
||||
else
|
||||
{
|
||||
defineDefinitions.AppendLine("\tHLSLINCLUDE");
|
||||
}
|
||||
|
||||
defineDefinitions.AppendLine("\t\t#define _USE_OPTIMIZATION_DEFINES 1");
|
||||
|
||||
Type type = this.GetType();
|
||||
FieldInfo[] properties = type.GetFields();
|
||||
|
||||
foreach (FieldInfo property in properties)
|
||||
{
|
||||
//if(!property.Name.Equals("_ENABLE_OUTLINE"))
|
||||
//{
|
||||
|
||||
if (property.GetValue(this).GetType() == typeof(bool))
|
||||
{
|
||||
//Debug.Log("name: " + property.Name + " - " + (bool)property.GetValue(this));
|
||||
if ((bool)property.GetValue(this) == true)
|
||||
{
|
||||
defineDefinitions.AppendLine("\t\t#define " + property.Name + " 1");
|
||||
}
|
||||
}
|
||||
else if (property.GetValue(this).GetType() == typeof(int))
|
||||
{
|
||||
if ((int)property.GetValue(this) != -1)
|
||||
{
|
||||
defineDefinitions.AppendLine("\t\t#define " + property.Name + " " + (int)property.GetValue(this));
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (rp == RenderPipelineOptions.BiRP)
|
||||
{
|
||||
defineDefinitions.AppendLine("\tENDCG");
|
||||
}
|
||||
else
|
||||
{
|
||||
defineDefinitions.AppendLine("\tENDHLSL");
|
||||
}
|
||||
|
||||
string modifiedContent = content.Insert(insertPosition, "\n" + defineDefinitions.ToString() + "\n");
|
||||
|
||||
|
||||
//if (_ENABLE_OUTLINE == false)
|
||||
//{
|
||||
// string outlinePassPattern = @"Pass\s*\{\s*Name\s*""Outline""[\s\S]*?ENDCG[\s\S]*?\}";
|
||||
// modifiedContent = Regex.Replace(modifiedContent, outlinePassPattern, "", RegexOptions.Singleline);
|
||||
//}
|
||||
|
||||
|
||||
|
||||
//string filePathModfied = Application.dataPath + "/ToonShaderBuilder/ShaderCreatorTest/ShaderCreatorPlain_URP2020Optimized.shader";
|
||||
|
||||
string filePathModfied;
|
||||
|
||||
if (rp == RenderPipelineOptions.URP2D && material.HasProperty(TheToonShaderConstants.THETOONSHADER2D_IDENTIFIER_PROPERTY))
|
||||
{
|
||||
filePathModfied = dataPathWithoutAssets + "/Packages/com.shadercrew.the-toon-shader.2d/Scripts/Resources/OptimizedShaders/";
|
||||
}
|
||||
else
|
||||
{
|
||||
filePathModfied = dataPathWithoutAssets + "/Packages/com.shadercrew.the-toon-shader.3d/Scripts/Resources/OptimizedShaders/";
|
||||
}
|
||||
|
||||
if (!Directory.Exists(filePathModfied))
|
||||
{
|
||||
Directory.CreateDirectory(filePathModfied);
|
||||
}
|
||||
|
||||
filePathModfied += fileNameWithoutExtension + "_" + material.name + "_Optimized";
|
||||
filePathModfied += ".shader";
|
||||
|
||||
File.WriteAllText(filePathModfied, modifiedContent);
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
Shader optimizedShader = Shader.Find(optimizedShaderName);
|
||||
//Debug.Log(optimizedShaderName);
|
||||
return optimizedShader;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b4ccf604a3bf34b4982530526b1d037a
|
||||
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/Editor/Common/TheToonShaderGenerator.cs
|
||||
uploadId: 919972
|
||||
+1312
File diff suppressed because it is too large
Load Diff
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf2c77cd8430cac489c071ca03240422
|
||||
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/Editor/Common/ToonEditorUtils.cs
|
||||
uploadId: 919972
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c477a66f7a67ad4c82a60786cea2a4c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Packages/com.shadercrew.the-toon-shader.core/Scripts/Editor/Resources/logo-the-toon-shader-small.png
LFS
BIN
Binary file not shown.
+134
@@ -0,0 +1,134 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74b696f19defb14429d09ca2ccaed00e
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 512
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 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/Editor/Resources/logo-the-toon-shader-small.png
|
||||
uploadId: 919972
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"name": "ShaderCrew.TheToonShader.Core.Editor",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:78bd2ddd6e276394a9615c203e574844",
|
||||
"GUID:3eae0364be2026648bf74846acb8a731",
|
||||
"GUID:be0903cd8e1546f498710afdc59db5eb",
|
||||
"GUID:457756d89b35d2941b3e7b37b4ece6f1",
|
||||
"GUID:df380645f10b7bc4b97d4f5eb6303d95",
|
||||
"GUID:c579267770062bf448e75eb160330b7f",
|
||||
"GUID:83e2004185752be4684414733d22e0e7",
|
||||
"GUID:6a37219044b169f4fa7e60a15e3e8279",
|
||||
"GUID:7072132f216016e47a05cb60e25c2c9b",
|
||||
"GUID:516a5277b8c3b4f4c8cc86b77b1591ff",
|
||||
"GUID:1e1df38bdb063c04fb8d144480b35d37"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"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.shadercrew.seethroughshader.core",
|
||||
"expression": "",
|
||||
"define": "USING_SEE_THROUGH_SHADER"
|
||||
},
|
||||
{
|
||||
"name": "com.unity.2d.sprite",
|
||||
"expression": "",
|
||||
"define": "USING_URP2D"
|
||||
},
|
||||
{
|
||||
"name": "com.shadercrew.the-toon-shader.2d",
|
||||
"expression": "",
|
||||
"define": "USING_TOON2D"
|
||||
}
|
||||
],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 771e886dc8ff2624f9fb1e98ab52afc2
|
||||
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/Editor/ShaderCrew.TheToonShader.Core.Editor.asmdef
|
||||
uploadId: 919972
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6319f07d59873194cb4548a0d67da792
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+389
@@ -0,0 +1,389 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using static ShaderCrew.TheToonShader.TheToonShaderGUIEditor;
|
||||
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
public class BiRPLightingGUI
|
||||
{
|
||||
public MaterialEditor m_MaterialEditor;
|
||||
|
||||
public Color textColor;
|
||||
Color originalColor;
|
||||
|
||||
public enum BlendMode
|
||||
{
|
||||
Opaque,
|
||||
Cutout,
|
||||
//Transparent
|
||||
}
|
||||
public enum AlphaModes
|
||||
{
|
||||
Opaque,
|
||||
Blend,
|
||||
Add,
|
||||
PreMultiply
|
||||
}
|
||||
|
||||
public enum SmoothnessMapChannel
|
||||
{
|
||||
SpecularMetallicAlpha,
|
||||
AlbedoAlpha,
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Standard
|
||||
public MaterialProperty blendMode = null;
|
||||
public MaterialProperty cullMode = null;
|
||||
|
||||
public MaterialProperty albedoMap = null;
|
||||
public MaterialProperty albedoColor = null;
|
||||
public MaterialProperty alphaCutoff = null;
|
||||
public MaterialProperty metallic = null;
|
||||
public MaterialProperty metallicMap = null;
|
||||
|
||||
public MaterialProperty smoothness = null;
|
||||
public MaterialProperty smoothnessScale = null;
|
||||
public MaterialProperty smoothnessMapChannel = null;
|
||||
|
||||
public MaterialProperty bumpScale = null;
|
||||
public MaterialProperty bumpMap = null;
|
||||
|
||||
public MaterialProperty emissionMap = null;
|
||||
public MaterialProperty emissionColor = null;
|
||||
|
||||
public MaterialProperty occlusionMap = null;
|
||||
public MaterialProperty occlusionStrength = null;
|
||||
|
||||
public MaterialProperty heigtMapScale = null;
|
||||
public MaterialProperty heightMap = null;
|
||||
|
||||
public MaterialProperty detailMask = null;
|
||||
public MaterialProperty detailAlbedoMap = null;
|
||||
public MaterialProperty detailNormalMap = null;
|
||||
public MaterialProperty detailNormalMapScale = null;
|
||||
|
||||
|
||||
public MaterialProperty uvSetSecondary = null;
|
||||
|
||||
|
||||
|
||||
private static class StandardLitStyles
|
||||
{
|
||||
// Standard
|
||||
public static GUIContent albedoText = EditorGUIUtility.TrTextContent("Albedo", "Albedo (RGB) and Transparency (A)");
|
||||
public static GUIContent alphaCutoffText = EditorGUIUtility.TrTextContent("Alpha Cutoff", "Threshold for alpha cutoff");
|
||||
public static GUIContent metallicMapText = EditorGUIUtility.TrTextContent("Metallic", "Metallic (R) and Smoothness (A)");
|
||||
|
||||
public static GUIContent smoothnessText = EditorGUIUtility.TrTextContent("Smoothness", "Smoothness value");
|
||||
public static GUIContent smoothnessScaleText = EditorGUIUtility.TrTextContent("Smoothness", "Smoothness scale factor");
|
||||
public static GUIContent smoothnessMapChannelText = EditorGUIUtility.TrTextContent("Source", "Smoothness texture and channel");
|
||||
|
||||
public static GUIContent normalMapText = EditorGUIUtility.TrTextContent("Normal Map", "Normal Map");
|
||||
|
||||
public static GUIContent heightMapText = EditorGUIUtility.TrTextContent("Height Map", "Height Map (G)");
|
||||
|
||||
public static GUIContent emissionText = EditorGUIUtility.TrTextContent("Emission", "Emission (RGB)");
|
||||
public static GUIContent occlusionMapText = EditorGUIUtility.TrTextContent("Occlusion", "Occlusion (G)");
|
||||
|
||||
public static GUIContent detailMaskText = EditorGUIUtility.TrTextContent("Detail Mask", "Mask for Secondary Maps (A)");
|
||||
public static GUIContent detailAlbedoText = EditorGUIUtility.TrTextContent("Detail Albedo x2", "Albedo (RGB) multiplied by 2");
|
||||
public static GUIContent detailNormalMapText = EditorGUIUtility.TrTextContent("Normal Map", "Normal Map");
|
||||
public static GUIContent uvSetLabel = EditorGUIUtility.TrTextContent("UV Set");
|
||||
|
||||
|
||||
public static string secondaryMapsText = "Secondary Maps";
|
||||
public static string advancedText = "Advanced Options";
|
||||
public static string renderingMode = "Rendering Mode";
|
||||
|
||||
public static readonly string[] blendNames = System.Enum.GetNames(typeof(BlendMode));
|
||||
|
||||
}
|
||||
|
||||
public void DoSetup(MaterialEditor materialEditor)
|
||||
{
|
||||
m_MaterialEditor = materialEditor;
|
||||
MaterialChanged(materialEditor.target as Material);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void DrawUILine(int thickness = 1, int padding = 10)
|
||||
{
|
||||
Color color = Color.black;
|
||||
Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness));
|
||||
r.height = thickness;
|
||||
r.y += padding / 2;
|
||||
EditorGUI.DrawRect(r, color);
|
||||
}
|
||||
|
||||
public void BiRPShaderPropertiesGUI(Material material, GeneralShadingMode shadingMode, LightFunction lightFunction)
|
||||
{
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
{
|
||||
BlendModePopup();
|
||||
m_MaterialEditor.ShaderProperty(cullMode, "Cull Mode");
|
||||
|
||||
DoAlbedoArea(material);
|
||||
if(shadingMode == GeneralShadingMode.LightBased)
|
||||
{
|
||||
DoSpecularMetallicArea(material);
|
||||
}
|
||||
|
||||
DoNormalArea();
|
||||
|
||||
if (shadingMode == GeneralShadingMode.LightBased)
|
||||
{
|
||||
DoHeightMapArea();
|
||||
DoOcclusionArea();
|
||||
DoDetailMaskArea();
|
||||
}
|
||||
DoEmissionArea();
|
||||
|
||||
bool shouldEmissionBeEnabled = (material.globalIlluminationFlags & MaterialGlobalIlluminationFlags.EmissiveIsBlack) == 0;
|
||||
|
||||
bool showTextureScaleOffset = (albedoMap.textureValue != null ||
|
||||
bumpMap.textureValue != null ||
|
||||
(emissionMap.textureValue != null && shouldEmissionBeEnabled));
|
||||
|
||||
if (shadingMode == GeneralShadingMode.LightBased)
|
||||
{
|
||||
showTextureScaleOffset = showTextureScaleOffset || occlusionMap.textureValue != null ||
|
||||
heightMap.textureValue != null ||
|
||||
metallicMap.textureValue != null ||
|
||||
detailMask.textureValue != null; }
|
||||
|
||||
if (showTextureScaleOffset)
|
||||
{
|
||||
EditorGUI.indentLevel += 2;
|
||||
m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
|
||||
EditorGUI.indentLevel -= 2;
|
||||
}
|
||||
if (shadingMode == GeneralShadingMode.LightBased)
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
DoSecondaryArea();
|
||||
}
|
||||
}
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
//MaterialChanged(material);
|
||||
foreach (var obj in blendMode.targets)
|
||||
MaterialChanged((Material)obj);
|
||||
}
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void OnlyBlendModeAndCullModeGUI()
|
||||
{
|
||||
BlendModePopup();
|
||||
m_MaterialEditor.ShaderProperty(cullMode, "Cull Mode");
|
||||
}
|
||||
|
||||
public void OnlyCullModeGUI()
|
||||
{
|
||||
m_MaterialEditor.ShaderProperty(cullMode, "Cull Mode");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BlendModePopup()
|
||||
{
|
||||
EditorGUI.showMixedValue = blendMode.hasMixedValue;
|
||||
var mode = (BlendMode)blendMode.floatValue;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
mode = (BlendMode)EditorGUILayout.Popup(StandardLitStyles.renderingMode, (int)mode, StandardLitStyles.blendNames);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_MaterialEditor.RegisterPropertyChangeUndo("Rendering Mode");
|
||||
blendMode.floatValue = (float)mode;
|
||||
}
|
||||
|
||||
EditorGUI.showMixedValue = false;
|
||||
}
|
||||
|
||||
|
||||
static void MaterialChanged(Material material)
|
||||
{
|
||||
SetMaterialKeywords(material);
|
||||
}
|
||||
|
||||
static void SetMaterialKeywords(Material material)
|
||||
{
|
||||
SetKeyword(material, "_NORMALMAP", material.GetTexture("_BumpMap") || material.GetTexture("_DetailNormalMap"));
|
||||
SetKeyword(material, "_METALLICGLOSSMAP", material.GetTexture("_MetallicGlossMap"));
|
||||
SetKeyword(material, "_PARALLAXMAP", material.GetTexture("_ParallaxMap"));
|
||||
SetKeyword(material, "_DETAIL_MULX2", material.GetTexture("_DetailAlbedoMap") || material.GetTexture("_DetailNormalMap"));
|
||||
|
||||
MaterialEditor.FixupEmissiveFlag(material);
|
||||
bool shouldEmissionBeEnabled = (material.globalIlluminationFlags & MaterialGlobalIlluminationFlags.EmissiveIsBlack) == 0;
|
||||
SetKeyword(material, "_EMISSION", shouldEmissionBeEnabled);
|
||||
if (material.HasProperty("_SmoothnessTextureChannel"))
|
||||
{
|
||||
SetKeyword(material, "_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A", GetSmoothnessMapChannel(material) == SmoothnessMapChannel.AlbedoAlpha);
|
||||
}
|
||||
|
||||
}
|
||||
static void SetKeyword(Material m, string keyword, bool state)
|
||||
{
|
||||
if (state)
|
||||
m.EnableKeyword(keyword);
|
||||
else
|
||||
m.DisableKeyword(keyword);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void DoAlbedoArea(Material material)
|
||||
{
|
||||
float oriLabelWidth = EditorGUIUtility.labelWidth;
|
||||
EditorGUIUtility.labelWidth = EditorGUIUtility.currentViewWidth - 94;
|
||||
m_MaterialEditor.TexturePropertySingleLine(StandardLitStyles.albedoText, albedoMap, albedoColor);
|
||||
EditorGUIUtility.labelWidth = oriLabelWidth;
|
||||
|
||||
if (((BlendMode)material.GetFloat("_Mode") == BlendMode.Cutout))
|
||||
{
|
||||
m_MaterialEditor.ShaderProperty(alphaCutoff, StandardLitStyles.alphaCutoffText.text, MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DoDetailMaskArea()
|
||||
{
|
||||
m_MaterialEditor.TexturePropertySingleLine(StandardLitStyles.detailMaskText, detailMask);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DoSecondaryArea()
|
||||
{
|
||||
GUILayout.Label(StandardLitStyles.secondaryMapsText, EditorStyles.boldLabel);
|
||||
m_MaterialEditor.TexturePropertySingleLine(StandardLitStyles.detailAlbedoText, detailAlbedoMap);
|
||||
m_MaterialEditor.TexturePropertySingleLine(StandardLitStyles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
|
||||
m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
|
||||
m_MaterialEditor.ShaderProperty(uvSetSecondary, StandardLitStyles.uvSetLabel.text);
|
||||
|
||||
}
|
||||
|
||||
void DoNormalArea()
|
||||
{
|
||||
m_MaterialEditor.TexturePropertySingleLine(StandardLitStyles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);
|
||||
}
|
||||
|
||||
void DoHeightMapArea()
|
||||
{
|
||||
m_MaterialEditor.TexturePropertySingleLine(StandardLitStyles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
|
||||
}
|
||||
void DoSpecularMetallicArea(Material material)
|
||||
{
|
||||
bool hasGlossMap = metallicMap.textureValue != null;
|
||||
m_MaterialEditor.TexturePropertySingleLine(StandardLitStyles.metallicMapText, metallicMap, hasGlossMap ? null : metallic);
|
||||
|
||||
bool showSmoothnessScale = hasGlossMap;
|
||||
if (smoothnessMapChannel != null)
|
||||
{
|
||||
int smoothnessChannel = (int)smoothnessMapChannel.floatValue;
|
||||
if (smoothnessChannel == (int)SmoothnessMapChannel.AlbedoAlpha)
|
||||
showSmoothnessScale = true;
|
||||
}
|
||||
|
||||
int indentation = 2;
|
||||
m_MaterialEditor.ShaderProperty(showSmoothnessScale ? smoothnessScale : smoothness, showSmoothnessScale ? StandardLitStyles.smoothnessScaleText : StandardLitStyles.smoothnessText, indentation);
|
||||
|
||||
++indentation;
|
||||
if (smoothnessMapChannel != null)
|
||||
m_MaterialEditor.ShaderProperty(smoothnessMapChannel, StandardLitStyles.smoothnessMapChannelText, indentation);
|
||||
}
|
||||
|
||||
|
||||
void DoOcclusionArea()
|
||||
{
|
||||
m_MaterialEditor.TexturePropertySingleLine(StandardLitStyles.occlusionMapText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
|
||||
}
|
||||
|
||||
|
||||
void DoEmissionArea()
|
||||
{
|
||||
if (m_MaterialEditor.EmissionEnabledProperty())
|
||||
{
|
||||
bool hadEmissionTexture = emissionMap.textureValue != null;
|
||||
|
||||
m_MaterialEditor.TexturePropertyWithHDRColor(StandardLitStyles.emissionText, emissionMap, emissionColor, false);
|
||||
|
||||
float brightness = emissionColor.colorValue.maxColorComponent;
|
||||
if (emissionMap.textureValue != null && !hadEmissionTexture && brightness <= 0f)
|
||||
{
|
||||
emissionColor.colorValue = Color.white;
|
||||
}
|
||||
|
||||
m_MaterialEditor.LightmapEmissionFlagsProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static SmoothnessMapChannel GetSmoothnessMapChannel(Material material)
|
||||
{
|
||||
int ch = (int)material.GetFloat("_SmoothnessTextureChannel");
|
||||
if (ch == (int)SmoothnessMapChannel.AlbedoAlpha)
|
||||
return SmoothnessMapChannel.AlbedoAlpha;
|
||||
else
|
||||
return SmoothnessMapChannel.SpecularMetallicAlpha;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static void SetupMaterialWithBlendMode(Material material, BlendMode blendMode)
|
||||
{
|
||||
//switch (blendMode)
|
||||
//{
|
||||
// case BlendMode.Opaque:
|
||||
// material.SetFloat("_AlphaMode", (float)AlphaModes.Opaque);
|
||||
// material.SetOverrideTag("RenderType", "");
|
||||
// material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
|
||||
// material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
|
||||
// material.SetInt("_ZWrite", 1);
|
||||
// //material.DisableKeyword("_ALPHATEST_ON");
|
||||
// //material.renderQueue = -1;
|
||||
// //material.SetColor("_Color", Color.green);
|
||||
// break;
|
||||
// case BlendMode.Cutout:
|
||||
// material.SetFloat("_AlphaMode", (float)AlphaModes.Opaque);
|
||||
// //material.SetInt("_ZWrite", 1);
|
||||
// //material.EnableKeyword("_ALPHATEST_ON");
|
||||
// //material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.AlphaTest;
|
||||
// break;
|
||||
// case BlendMode.Transparent:
|
||||
// material.SetOverrideTag("RenderType", "Transparent");
|
||||
// material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent;
|
||||
// //material.SetColor("_Color", Color.blue);
|
||||
// material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
|
||||
// material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
|
||||
// material.SetInt("_ZWrite", 0);
|
||||
// //material.SetFloat("_AlphaMode", (float)AlphaModes.Blend);
|
||||
// break;
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 366dd6a816be8c040862fa3ea7bddc58
|
||||
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/Editor/ShaderGUI/BiRPLightingGUI.cs
|
||||
uploadId: 919972
|
||||
+7810
File diff suppressed because it is too large
Load Diff
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 33247f247717cf14684dd2a4377df685
|
||||
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/Editor/ShaderGUI/TheToonShaderGUIEditor.cs
|
||||
uploadId: 919972
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef2bd3b8659ddf74a8dd8083161ff076
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 123d9432966facc47b882fba28ad7595
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+628
@@ -0,0 +1,628 @@
|
||||
//SEE: https://github.com/Unity-Technologies/Graphics/blob/v10.10.1/com.unity.render-pipelines.universal/Editor/ShaderGUI/BaseShaderGUI.cs
|
||||
|
||||
#if !UNITY_2021_1_OR_NEWER
|
||||
#if USING_URP
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEditor.Rendering.Universal;
|
||||
using UnityEditor;
|
||||
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
public abstract class BaseShaderGUI : ShaderGUI
|
||||
{
|
||||
#region EnumsAndClasses
|
||||
|
||||
public enum SurfaceType
|
||||
{
|
||||
Opaque,
|
||||
Transparent
|
||||
}
|
||||
|
||||
public enum BlendMode
|
||||
{
|
||||
Alpha, // Old school alpha-blending mode, fresnel does not affect amount of transparency
|
||||
Premultiply, // Physically plausible transparency mode, implemented as alpha pre-multiply
|
||||
Additive,
|
||||
Multiply
|
||||
}
|
||||
|
||||
public enum SmoothnessSource
|
||||
{
|
||||
BaseAlpha,
|
||||
SpecularAlpha
|
||||
}
|
||||
|
||||
public enum RenderFace
|
||||
{
|
||||
Front = 2,
|
||||
Back = 1,
|
||||
Both = 0
|
||||
}
|
||||
|
||||
protected class Styles
|
||||
{
|
||||
// Catergories
|
||||
public static readonly GUIContent SurfaceOptions =
|
||||
new GUIContent("Surface Options", "Controls how Universal RP renders the Material on a screen.");
|
||||
|
||||
public static readonly GUIContent SurfaceInputs = new GUIContent("Surface Inputs",
|
||||
"These settings describe the look and feel of the surface itself.");
|
||||
|
||||
public static readonly GUIContent AdvancedLabel = new GUIContent("Advanced",
|
||||
"These settings affect behind-the-scenes rendering and underlying calculations.");
|
||||
|
||||
public static readonly GUIContent surfaceType = new GUIContent("Surface Type",
|
||||
"Select a surface type for your texture. Choose between Opaque or Transparent.");
|
||||
|
||||
public static readonly GUIContent blendingMode = new GUIContent("Blending Mode",
|
||||
"Controls how the color of the Transparent surface blends with the Material color in the background.");
|
||||
|
||||
public static readonly GUIContent cullingText = new GUIContent("Render Face",
|
||||
"Specifies which faces to cull from your geometry. Front culls front faces. Back culls backfaces. None means that both sides are rendered.");
|
||||
|
||||
public static readonly GUIContent alphaClipText = new GUIContent("Alpha Clipping",
|
||||
"Makes your Material act like a Cutout shader. Use this to create a transparent effect with hard edges between opaque and transparent areas.");
|
||||
|
||||
public static readonly GUIContent alphaClipThresholdText = new GUIContent("Threshold",
|
||||
"Sets where the Alpha Clipping starts. The higher the value is, the brighter the effect is when clipping starts.");
|
||||
|
||||
public static readonly GUIContent receiveShadowText = new GUIContent("Receive Shadows",
|
||||
"When enabled, other GameObjects can cast shadows onto this GameObject.");
|
||||
|
||||
public static readonly GUIContent baseMap = new GUIContent("Base Map",
|
||||
"Specifies the base Material and/or Color of the surface. If you’ve selected Transparent or Alpha Clipping under Surface Options, your Material uses the Texture’s alpha channel or color.");
|
||||
|
||||
public static readonly GUIContent emissionMap = new GUIContent("Emission Map",
|
||||
"Sets a Texture map to use for emission. You can also select a color with the color picker. Colors are multiplied over the Texture.");
|
||||
|
||||
public static readonly GUIContent normalMapText =
|
||||
new GUIContent("Normal Map", "Assigns a tangent-space normal map.");
|
||||
|
||||
public static readonly GUIContent bumpScaleNotSupported =
|
||||
new GUIContent("Bump scale is not supported on mobile platforms");
|
||||
|
||||
public static readonly GUIContent fixNormalNow = new GUIContent("Fix now",
|
||||
"Converts the assigned texture to be a normal map format.");
|
||||
|
||||
public static readonly GUIContent queueSlider = new GUIContent("Priority",
|
||||
"Determines the chronological rendering order for a Material. High values are rendered first.");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Variables
|
||||
|
||||
protected MaterialEditor materialEditor { get; set; }
|
||||
|
||||
protected MaterialProperty surfaceTypeProp { get; set; }
|
||||
|
||||
protected MaterialProperty blendModeProp { get; set; }
|
||||
|
||||
protected MaterialProperty cullingProp { get; set; }
|
||||
|
||||
protected MaterialProperty alphaClipProp { get; set; }
|
||||
|
||||
protected MaterialProperty alphaCutoffProp { get; set; }
|
||||
|
||||
protected MaterialProperty receiveShadowsProp { get; set; }
|
||||
|
||||
// Common Surface Input properties
|
||||
|
||||
protected MaterialProperty baseMapProp { get; set; }
|
||||
|
||||
protected MaterialProperty baseColorProp { get; set; }
|
||||
|
||||
protected MaterialProperty emissionMapProp { get; set; }
|
||||
|
||||
protected MaterialProperty emissionColorProp { get; set; }
|
||||
|
||||
protected MaterialProperty queueOffsetProp { get; set; }
|
||||
|
||||
public bool m_FirstTimeApply = true;
|
||||
|
||||
private const string k_KeyPrefix = "UniversalRP:Material:UI_State:";
|
||||
|
||||
private string m_HeaderStateKey = null;
|
||||
|
||||
protected string headerStateKey { get { return m_HeaderStateKey; } }
|
||||
|
||||
// Header foldout states
|
||||
|
||||
SavedBool m_SurfaceOptionsFoldout;
|
||||
|
||||
SavedBool m_SurfaceInputsFoldout;
|
||||
|
||||
SavedBool m_AdvancedFoldout;
|
||||
|
||||
#endregion
|
||||
|
||||
private const int queueOffsetRange = 50;
|
||||
////////////////////////////////////
|
||||
// General Functions //
|
||||
////////////////////////////////////
|
||||
#region GeneralFunctions
|
||||
|
||||
public abstract void MaterialChanged(Material material);
|
||||
|
||||
public virtual void FindProperties(MaterialProperty[] properties)
|
||||
{
|
||||
surfaceTypeProp = FindProperty("_Surface", properties);
|
||||
blendModeProp = FindProperty("_Blend", properties);
|
||||
cullingProp = FindProperty("_Cull", properties);
|
||||
alphaClipProp = FindProperty("_AlphaClip", properties);
|
||||
alphaCutoffProp = FindProperty("_Cutoff", properties);
|
||||
receiveShadowsProp = FindProperty("_ReceiveShadows", properties, false);
|
||||
baseMapProp = FindProperty("_BaseMap", properties, false);
|
||||
baseColorProp = FindProperty("_BaseColor", properties, false);
|
||||
emissionMapProp = FindProperty("_EmissionMap", properties, false);
|
||||
emissionColorProp = FindProperty("_EmissionColor", properties, false);
|
||||
queueOffsetProp = FindProperty("_QueueOffset", properties, false);
|
||||
}
|
||||
|
||||
public override void OnGUI(MaterialEditor materialEditorIn, MaterialProperty[] properties)
|
||||
{
|
||||
if (materialEditorIn == null)
|
||||
throw new ArgumentNullException("materialEditorIn");
|
||||
|
||||
FindProperties(properties); // MaterialProperties can be animated so we do not cache them but fetch them every event to ensure animated values are updated correctly
|
||||
materialEditor = materialEditorIn;
|
||||
Material material = materialEditor.target as Material;
|
||||
|
||||
// Make sure that needed setup (ie keywords/renderqueue) are set up if we're switching some existing
|
||||
// material to a universal shader.
|
||||
if (m_FirstTimeApply)
|
||||
{
|
||||
OnOpenGUI(material, materialEditorIn);
|
||||
m_FirstTimeApply = false;
|
||||
}
|
||||
|
||||
ShaderPropertiesGUI(material);
|
||||
}
|
||||
|
||||
public virtual void OnOpenGUI(Material material, MaterialEditor materialEditor)
|
||||
{
|
||||
// Foldout states
|
||||
m_HeaderStateKey = k_KeyPrefix + material.shader.name; // Create key string for editor prefs
|
||||
m_SurfaceOptionsFoldout = new SavedBool($"{m_HeaderStateKey}.SurfaceOptionsFoldout", true);
|
||||
m_SurfaceInputsFoldout = new SavedBool($"{m_HeaderStateKey}.SurfaceInputsFoldout", true);
|
||||
m_AdvancedFoldout = new SavedBool($"{m_HeaderStateKey}.AdvancedFoldout", false);
|
||||
|
||||
foreach (var obj in materialEditor.targets)
|
||||
MaterialChanged((Material)obj);
|
||||
}
|
||||
|
||||
public void ShaderPropertiesGUI(Material material)
|
||||
{
|
||||
if (material == null)
|
||||
throw new ArgumentNullException("material");
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
m_SurfaceOptionsFoldout.value = EditorGUILayout.BeginFoldoutHeaderGroup(m_SurfaceOptionsFoldout.value, Styles.SurfaceOptions);
|
||||
if (m_SurfaceOptionsFoldout.value)
|
||||
{
|
||||
DrawSurfaceOptions(material);
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
|
||||
m_SurfaceInputsFoldout.value = EditorGUILayout.BeginFoldoutHeaderGroup(m_SurfaceInputsFoldout.value, Styles.SurfaceInputs);
|
||||
if (m_SurfaceInputsFoldout.value)
|
||||
{
|
||||
DrawSurfaceInputs(material);
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
|
||||
DrawAdditionalFoldouts(material);
|
||||
|
||||
m_AdvancedFoldout.value = EditorGUILayout.BeginFoldoutHeaderGroup(m_AdvancedFoldout.value, Styles.AdvancedLabel);
|
||||
if (m_AdvancedFoldout.value)
|
||||
{
|
||||
DrawAdvancedOptions(material);
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
foreach (var obj in materialEditor.targets)
|
||||
MaterialChanged((Material)obj);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
////////////////////////////////////
|
||||
// Drawing Functions //
|
||||
////////////////////////////////////
|
||||
#region DrawingFunctions
|
||||
|
||||
public virtual void DrawSurfaceOptions(Material material)
|
||||
{
|
||||
DoPopup(Styles.surfaceType, surfaceTypeProp, Enum.GetNames(typeof(SurfaceType)));
|
||||
if ((SurfaceType)material.GetFloat("_Surface") == SurfaceType.Transparent)
|
||||
DoPopup(Styles.blendingMode, blendModeProp, Enum.GetNames(typeof(BlendMode)));
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUI.showMixedValue = cullingProp.hasMixedValue;
|
||||
var culling = (RenderFace)cullingProp.floatValue;
|
||||
culling = (RenderFace)EditorGUILayout.EnumPopup(Styles.cullingText, culling);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
materialEditor.RegisterPropertyChangeUndo(Styles.cullingText.text);
|
||||
cullingProp.floatValue = (float)culling;
|
||||
material.doubleSidedGI = (RenderFace)cullingProp.floatValue != RenderFace.Front;
|
||||
}
|
||||
|
||||
EditorGUI.showMixedValue = false;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUI.showMixedValue = alphaClipProp.hasMixedValue;
|
||||
var alphaClipEnabled = EditorGUILayout.Toggle(Styles.alphaClipText, alphaClipProp.floatValue == 1);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
alphaClipProp.floatValue = alphaClipEnabled ? 1 : 0;
|
||||
EditorGUI.showMixedValue = false;
|
||||
|
||||
if (alphaClipProp.floatValue == 1)
|
||||
materialEditor.ShaderProperty(alphaCutoffProp, Styles.alphaClipThresholdText, 1);
|
||||
|
||||
if (receiveShadowsProp != null)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUI.showMixedValue = receiveShadowsProp.hasMixedValue;
|
||||
var receiveShadows =
|
||||
EditorGUILayout.Toggle(Styles.receiveShadowText, receiveShadowsProp.floatValue == 1.0f);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
receiveShadowsProp.floatValue = receiveShadows ? 1.0f : 0.0f;
|
||||
EditorGUI.showMixedValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void DrawSurfaceInputs(Material material)
|
||||
{
|
||||
DrawBaseProperties(material);
|
||||
}
|
||||
|
||||
public virtual void DrawAdvancedOptions(Material material)
|
||||
{
|
||||
materialEditor.EnableInstancingField();
|
||||
DrawQueueOffsetField();
|
||||
}
|
||||
|
||||
protected void DrawQueueOffsetField()
|
||||
{
|
||||
if (queueOffsetProp != null)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUI.showMixedValue = queueOffsetProp.hasMixedValue;
|
||||
var queue = EditorGUILayout.IntSlider(Styles.queueSlider, (int)queueOffsetProp.floatValue, -queueOffsetRange, queueOffsetRange);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
queueOffsetProp.floatValue = queue;
|
||||
EditorGUI.showMixedValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void DrawAdditionalFoldouts(Material material) { }
|
||||
|
||||
public virtual void DrawBaseProperties(Material material)
|
||||
{
|
||||
if (baseMapProp != null && baseColorProp != null) // Draw the baseMap, most shader will have at least a baseMap
|
||||
{
|
||||
materialEditor.TexturePropertySingleLine(Styles.baseMap, baseMapProp, baseColorProp);
|
||||
// TODO Temporary fix for lightmapping, to be replaced with attribute tag.
|
||||
if (material.HasProperty("_MainTex"))
|
||||
{
|
||||
material.SetTexture("_MainTex", baseMapProp.textureValue);
|
||||
var baseMapTiling = baseMapProp.textureScaleAndOffset;
|
||||
material.SetTextureScale("_MainTex", new Vector2(baseMapTiling.x, baseMapTiling.y));
|
||||
material.SetTextureOffset("_MainTex", new Vector2(baseMapTiling.z, baseMapTiling.w));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void DrawEmissionProperties(Material material, bool keyword)
|
||||
{
|
||||
var emissive = true;
|
||||
var hadEmissionTexture = emissionMapProp.textureValue != null;
|
||||
|
||||
if (!keyword)
|
||||
{
|
||||
materialEditor.TexturePropertyWithHDRColor(Styles.emissionMap, emissionMapProp, emissionColorProp,
|
||||
false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Emission for GI?
|
||||
emissive = materialEditor.EmissionEnabledProperty();
|
||||
|
||||
EditorGUI.BeginDisabledGroup(!emissive);
|
||||
{
|
||||
// Texture and HDR color controls
|
||||
materialEditor.TexturePropertyWithHDRColor(Styles.emissionMap, emissionMapProp,
|
||||
emissionColorProp,
|
||||
false);
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// If texture was assigned and color was black set color to white
|
||||
var brightness = emissionColorProp.colorValue.maxColorComponent;
|
||||
if (emissionMapProp.textureValue != null && !hadEmissionTexture && brightness <= 0f)
|
||||
emissionColorProp.colorValue = Color.white;
|
||||
|
||||
// UniversalRP does not support RealtimeEmissive. We set it to bake emissive and handle the emissive is black right.
|
||||
if (emissive)
|
||||
{
|
||||
var oldFlags = material.globalIlluminationFlags;
|
||||
var newFlags = MaterialGlobalIlluminationFlags.BakedEmissive;
|
||||
|
||||
if (brightness <= 0f)
|
||||
newFlags |= MaterialGlobalIlluminationFlags.EmissiveIsBlack;
|
||||
|
||||
if (newFlags != oldFlags)
|
||||
material.globalIlluminationFlags = newFlags;
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawNormalArea(MaterialEditor materialEditor, MaterialProperty bumpMap, MaterialProperty bumpMapScale = null)
|
||||
{
|
||||
if (bumpMapScale != null)
|
||||
{
|
||||
materialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap,
|
||||
bumpMap.textureValue != null ? bumpMapScale : null);
|
||||
if (bumpMapScale.floatValue != 1 &&
|
||||
UnityEditorInternal.InternalEditorUtility.IsMobilePlatform(
|
||||
EditorUserBuildSettings.activeBuildTarget))
|
||||
if (materialEditor.HelpBoxWithButton(Styles.bumpScaleNotSupported, Styles.fixNormalNow))
|
||||
bumpMapScale.floatValue = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
materialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void DrawTileOffset(MaterialEditor materialEditor, MaterialProperty textureProp)
|
||||
{
|
||||
materialEditor.TextureScaleOffsetProperty(textureProp);
|
||||
}
|
||||
|
||||
#endregion
|
||||
////////////////////////////////////
|
||||
// Material Data Functions //
|
||||
////////////////////////////////////
|
||||
#region MaterialDataFunctions
|
||||
|
||||
public static void SetMaterialKeywords(Material material, Action<Material> shadingModelFunc = null, Action<Material> shaderFunc = null)
|
||||
{
|
||||
// Clear all keywords for fresh start
|
||||
material.shaderKeywords = null;
|
||||
|
||||
// Setup blending - consistent across all Universal RP shaders
|
||||
SetupMaterialBlendMode(material);
|
||||
|
||||
// Receive Shadows
|
||||
if (material.HasProperty("_ReceiveShadows"))
|
||||
CoreUtils.SetKeyword(material, "_RECEIVE_SHADOWS_OFF", material.GetFloat("_ReceiveShadows") == 0.0f);
|
||||
|
||||
// Emission
|
||||
if (material.HasProperty("_EmissionColor"))
|
||||
MaterialEditor.FixupEmissiveFlag(material);
|
||||
bool shouldEmissionBeEnabled =
|
||||
(material.globalIlluminationFlags & MaterialGlobalIlluminationFlags.EmissiveIsBlack) == 0;
|
||||
if (material.HasProperty("_EmissionEnabled") && !shouldEmissionBeEnabled)
|
||||
shouldEmissionBeEnabled = material.GetFloat("_EmissionEnabled") >= 0.5f;
|
||||
CoreUtils.SetKeyword(material, "_EMISSION", shouldEmissionBeEnabled);
|
||||
|
||||
// Normal Map
|
||||
if (material.HasProperty("_BumpMap"))
|
||||
CoreUtils.SetKeyword(material, "_NORMALMAP", material.GetTexture("_BumpMap"));
|
||||
|
||||
// Shader specific keyword functions
|
||||
shadingModelFunc?.Invoke(material);
|
||||
shaderFunc?.Invoke(material);
|
||||
}
|
||||
|
||||
public static void SetupMaterialBlendMode(Material material)
|
||||
{
|
||||
if (material == null)
|
||||
throw new ArgumentNullException("material");
|
||||
|
||||
bool alphaClip = false;
|
||||
if (material.HasProperty("_AlphaClip"))
|
||||
alphaClip = material.GetFloat("_AlphaClip") >= 0.5;
|
||||
|
||||
if (alphaClip)
|
||||
{
|
||||
material.EnableKeyword("_ALPHATEST_ON");
|
||||
}
|
||||
else
|
||||
{
|
||||
material.DisableKeyword("_ALPHATEST_ON");
|
||||
}
|
||||
|
||||
if (material.HasProperty("_Surface"))
|
||||
{
|
||||
SurfaceType surfaceType = (SurfaceType)material.GetFloat("_Surface");
|
||||
if (surfaceType == SurfaceType.Opaque)
|
||||
{
|
||||
if (alphaClip)
|
||||
{
|
||||
material.renderQueue = (int)RenderQueue.AlphaTest;
|
||||
material.SetOverrideTag("RenderType", "TransparentCutout");
|
||||
}
|
||||
else
|
||||
{
|
||||
material.renderQueue = (int)RenderQueue.Geometry;
|
||||
material.SetOverrideTag("RenderType", "Opaque");
|
||||
}
|
||||
|
||||
material.renderQueue += material.HasProperty("_QueueOffset") ? (int)material.GetFloat("_QueueOffset") : 0;
|
||||
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
|
||||
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
|
||||
material.SetInt("_ZWrite", 1);
|
||||
material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
|
||||
material.SetShaderPassEnabled("ShadowCaster", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
BlendMode blendMode = (BlendMode)material.GetFloat("_Blend");
|
||||
|
||||
// Specific Transparent Mode Settings
|
||||
switch (blendMode)
|
||||
{
|
||||
case BlendMode.Alpha:
|
||||
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
|
||||
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
|
||||
material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
|
||||
break;
|
||||
case BlendMode.Premultiply:
|
||||
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
|
||||
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
|
||||
material.EnableKeyword("_ALPHAPREMULTIPLY_ON");
|
||||
break;
|
||||
case BlendMode.Additive:
|
||||
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
|
||||
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.One);
|
||||
material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
|
||||
break;
|
||||
case BlendMode.Multiply:
|
||||
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.DstColor);
|
||||
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
|
||||
material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
|
||||
material.EnableKeyword("_ALPHAMODULATE_ON");
|
||||
break;
|
||||
}
|
||||
|
||||
// General Transparent Material Settings
|
||||
material.SetOverrideTag("RenderType", "Transparent");
|
||||
material.SetInt("_ZWrite", 0);
|
||||
material.renderQueue = (int)RenderQueue.Transparent;
|
||||
material.renderQueue += material.HasProperty("_QueueOffset") ? (int)material.GetFloat("_QueueOffset") : 0;
|
||||
material.SetShaderPassEnabled("ShadowCaster", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
////////////////////////////////////
|
||||
// Helper Functions //
|
||||
////////////////////////////////////
|
||||
#region HelperFunctions
|
||||
|
||||
public static void TwoFloatSingleLine(GUIContent title, MaterialProperty prop1, GUIContent prop1Label,
|
||||
MaterialProperty prop2, GUIContent prop2Label, MaterialEditor materialEditor, float labelWidth = 30f)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUI.showMixedValue = prop1.hasMixedValue || prop2.hasMixedValue;
|
||||
Rect rect = EditorGUILayout.GetControlRect();
|
||||
EditorGUI.PrefixLabel(rect, title);
|
||||
var indent = EditorGUI.indentLevel;
|
||||
var preLabelWidth = EditorGUIUtility.labelWidth;
|
||||
EditorGUI.indentLevel = 0;
|
||||
EditorGUIUtility.labelWidth = labelWidth;
|
||||
Rect propRect1 = new Rect(rect.x + preLabelWidth, rect.y,
|
||||
(rect.width - preLabelWidth) * 0.5f, EditorGUIUtility.singleLineHeight);
|
||||
var prop1val = EditorGUI.FloatField(propRect1, prop1Label, prop1.floatValue);
|
||||
|
||||
Rect propRect2 = new Rect(propRect1.x + propRect1.width, rect.y,
|
||||
propRect1.width, EditorGUIUtility.singleLineHeight);
|
||||
var prop2val = EditorGUI.FloatField(propRect2, prop2Label, prop2.floatValue);
|
||||
|
||||
EditorGUI.indentLevel = indent;
|
||||
EditorGUIUtility.labelWidth = preLabelWidth;
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
materialEditor.RegisterPropertyChangeUndo(title.text);
|
||||
prop1.floatValue = prop1val;
|
||||
prop2.floatValue = prop2val;
|
||||
}
|
||||
|
||||
EditorGUI.showMixedValue = false;
|
||||
}
|
||||
|
||||
public void DoPopup(GUIContent label, MaterialProperty property, string[] options)
|
||||
{
|
||||
DoPopup(label, property, options, materialEditor);
|
||||
}
|
||||
|
||||
public static void DoPopup(GUIContent label, MaterialProperty property, string[] options, MaterialEditor materialEditor)
|
||||
{
|
||||
if (property == null)
|
||||
throw new ArgumentNullException("property");
|
||||
|
||||
EditorGUI.showMixedValue = property.hasMixedValue;
|
||||
|
||||
var mode = property.floatValue;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
mode = EditorGUILayout.Popup(label, (int)mode, options);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
materialEditor.RegisterPropertyChangeUndo(label.text);
|
||||
property.floatValue = mode;
|
||||
}
|
||||
|
||||
EditorGUI.showMixedValue = false;
|
||||
}
|
||||
|
||||
// Helper to show texture and color properties
|
||||
public static Rect TextureColorProps(MaterialEditor materialEditor, GUIContent label, MaterialProperty textureProp, MaterialProperty colorProp, bool hdr = false)
|
||||
{
|
||||
Rect rect = EditorGUILayout.GetControlRect();
|
||||
EditorGUI.showMixedValue = textureProp.hasMixedValue;
|
||||
materialEditor.TexturePropertyMiniThumbnail(rect, textureProp, label.text, label.tooltip);
|
||||
EditorGUI.showMixedValue = false;
|
||||
|
||||
if (colorProp != null)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUI.showMixedValue = colorProp.hasMixedValue;
|
||||
int indentLevel = EditorGUI.indentLevel;
|
||||
EditorGUI.indentLevel = 0;
|
||||
Rect rectAfterLabel = new Rect(rect.x + EditorGUIUtility.labelWidth, rect.y,
|
||||
EditorGUIUtility.fieldWidth, EditorGUIUtility.singleLineHeight);
|
||||
var col = EditorGUI.ColorField(rectAfterLabel, GUIContent.none, colorProp.colorValue, true,
|
||||
false, hdr);
|
||||
EditorGUI.indentLevel = indentLevel;
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
materialEditor.RegisterPropertyChangeUndo(colorProp.displayName);
|
||||
colorProp.colorValue = col;
|
||||
}
|
||||
EditorGUI.showMixedValue = false;
|
||||
}
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
// Copied from shaderGUI as it is a protected function in an abstract class, unavailable to others
|
||||
|
||||
public new static MaterialProperty FindProperty(string propertyName, MaterialProperty[] properties)
|
||||
{
|
||||
return FindProperty(propertyName, properties, true);
|
||||
}
|
||||
|
||||
// Copied from shaderGUI as it is a protected function in an abstract class, unavailable to others
|
||||
|
||||
public new static MaterialProperty FindProperty(string propertyName, MaterialProperty[] properties, bool propertyIsMandatory)
|
||||
{
|
||||
for (int index = 0; index < properties.Length; ++index)
|
||||
{
|
||||
if (properties[index] != null && properties[index].name == propertyName)
|
||||
return properties[index];
|
||||
}
|
||||
if (propertyIsMandatory)
|
||||
throw new ArgumentException("Could not find MaterialProperty: '" + propertyName + "', Num properties: " + (object)properties.Length);
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d9c32b84c5466d4e8831430c414ee0a
|
||||
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/Editor/ShaderGUI/URP/2019-2020/BaseShaderGUI.cs
|
||||
uploadId: 919972
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
//SEE: https://github.com/Unity-Technologies/Graphics/blob/v10.10.1/com.unity.render-pipelines.universal/Editor/ShaderGUI/Shaders/LitShader.cs
|
||||
|
||||
#if !UNITY_2021_1_OR_NEWER
|
||||
#if USING_URP
|
||||
|
||||
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Rendering.Universal.ShaderGUI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
public class LitShader : BaseShaderGUI
|
||||
{
|
||||
private LitGUI.LitProperties litProperties;
|
||||
private LitDetailGUI.LitProperties litDetailProperties;
|
||||
private SavedBool m_DetailInputsFoldout;
|
||||
|
||||
public override void OnOpenGUI(Material material, MaterialEditor materialEditor)
|
||||
{
|
||||
base.OnOpenGUI(material, materialEditor);
|
||||
m_DetailInputsFoldout = new SavedBool($"{headerStateKey}.DetailInputsFoldout", true);
|
||||
}
|
||||
|
||||
public override void DrawAdditionalFoldouts(Material material)
|
||||
{
|
||||
m_DetailInputsFoldout.value = EditorGUILayout.BeginFoldoutHeaderGroup(m_DetailInputsFoldout.value, LitDetailGUI.Styles.detailInputs);
|
||||
if (m_DetailInputsFoldout.value)
|
||||
{
|
||||
LitDetailGUI.DoDetailArea(litDetailProperties, materialEditor);
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
}
|
||||
|
||||
// collect properties from the material properties
|
||||
public override void FindProperties(MaterialProperty[] properties)
|
||||
{
|
||||
base.FindProperties(properties);
|
||||
litProperties = new LitGUI.LitProperties(properties);
|
||||
litDetailProperties = new LitDetailGUI.LitProperties(properties);
|
||||
}
|
||||
|
||||
// material changed check
|
||||
public override void MaterialChanged(Material material)
|
||||
{
|
||||
if (material == null)
|
||||
throw new ArgumentNullException("material");
|
||||
|
||||
SetMaterialKeywords(material, LitGUI.SetMaterialKeywords, LitDetailGUI.SetMaterialKeywords);
|
||||
}
|
||||
|
||||
// material main surface options
|
||||
public override void DrawSurfaceOptions(Material material)
|
||||
{
|
||||
if (material == null)
|
||||
throw new ArgumentNullException("material");
|
||||
|
||||
// Use default labelWidth
|
||||
EditorGUIUtility.labelWidth = 0f;
|
||||
|
||||
// Detect any changes to the material
|
||||
EditorGUI.BeginChangeCheck();
|
||||
if (litProperties.workflowMode != null)
|
||||
{
|
||||
DoPopup(LitGUI.Styles.workflowModeText, litProperties.workflowMode, Enum.GetNames(typeof(LitGUI.WorkflowMode)));
|
||||
}
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
foreach (var obj in blendModeProp.targets)
|
||||
MaterialChanged((Material)obj);
|
||||
}
|
||||
base.DrawSurfaceOptions(material);
|
||||
}
|
||||
|
||||
// material main surface inputs
|
||||
public override void DrawSurfaceInputs(Material material)
|
||||
{
|
||||
base.DrawSurfaceInputs(material);
|
||||
LitGUI.Inputs(litProperties, materialEditor, material);
|
||||
DrawEmissionProperties(material, true);
|
||||
DrawTileOffset(materialEditor, baseMapProp);
|
||||
}
|
||||
|
||||
// material main advanced options
|
||||
public override void DrawAdvancedOptions(Material material)
|
||||
{
|
||||
if (litProperties.reflections != null && litProperties.highlights != null)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
materialEditor.ShaderProperty(litProperties.highlights, LitGUI.Styles.highlightsText);
|
||||
materialEditor.ShaderProperty(litProperties.reflections, LitGUI.Styles.reflectionsText);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
MaterialChanged(material);
|
||||
}
|
||||
}
|
||||
|
||||
base.DrawAdvancedOptions(material);
|
||||
}
|
||||
|
||||
public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader)
|
||||
{
|
||||
if (material == null)
|
||||
throw new ArgumentNullException("material");
|
||||
|
||||
// _Emission property is lost after assigning Standard shader to the material
|
||||
// thus transfer it before assigning the new shader
|
||||
if (material.HasProperty("_Emission"))
|
||||
{
|
||||
material.SetColor("_EmissionColor", material.GetColor("_Emission"));
|
||||
}
|
||||
|
||||
base.AssignNewShaderToMaterial(material, oldShader, newShader);
|
||||
|
||||
if (oldShader == null || !oldShader.name.Contains("Legacy Shaders/"))
|
||||
{
|
||||
SetupMaterialBlendMode(material);
|
||||
return;
|
||||
}
|
||||
|
||||
SurfaceType surfaceType = SurfaceType.Opaque;
|
||||
BlendMode blendMode = BlendMode.Alpha;
|
||||
if (oldShader.name.Contains("/Transparent/Cutout/"))
|
||||
{
|
||||
surfaceType = SurfaceType.Opaque;
|
||||
material.SetFloat("_AlphaClip", 1);
|
||||
}
|
||||
else if (oldShader.name.Contains("/Transparent/"))
|
||||
{
|
||||
// NOTE: legacy shaders did not provide physically based transparency
|
||||
// therefore Fade mode
|
||||
surfaceType = SurfaceType.Transparent;
|
||||
blendMode = BlendMode.Alpha;
|
||||
}
|
||||
material.SetFloat("_Surface", (float)surfaceType);
|
||||
material.SetFloat("_Blend", (float)blendMode);
|
||||
|
||||
if (oldShader.name.Equals("Standard (Specular setup)"))
|
||||
{
|
||||
material.SetFloat("_WorkflowMode", (float)LitGUI.WorkflowMode.Specular);
|
||||
Texture texture = material.GetTexture("_SpecGlossMap");
|
||||
if (texture != null)
|
||||
material.SetTexture("_MetallicSpecGlossMap", texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
material.SetFloat("_WorkflowMode", (float)LitGUI.WorkflowMode.Metallic);
|
||||
Texture texture = material.GetTexture("_MetallicGlossMap");
|
||||
if (texture != null)
|
||||
material.SetTexture("_MetallicSpecGlossMap", texture);
|
||||
}
|
||||
|
||||
MaterialChanged(material);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c18bb56219273c842a5ce95b7e8493ee
|
||||
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/Editor/ShaderGUI/URP/2019-2020/LitShader.cs
|
||||
uploadId: 919972
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
//SEE: https://github.com/Unity-Technologies/Graphics/blob/v10.10.1/com.unity.render-pipelines.universal/Editor/SavedParameter.cs
|
||||
|
||||
//#if !UNITY_2021_1_OR_NEWER
|
||||
//#if USING_URP
|
||||
|
||||
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine.Assertions;
|
||||
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
public class SavedParameter<T>
|
||||
where T : IEquatable<T>
|
||||
{
|
||||
public delegate void SetParameter(string key, T value);
|
||||
public delegate T GetParameter(string key, T defaultValue);
|
||||
|
||||
readonly string m_Key;
|
||||
bool m_Loaded;
|
||||
T m_Value;
|
||||
|
||||
readonly SetParameter m_Setter;
|
||||
readonly GetParameter m_Getter;
|
||||
|
||||
public SavedParameter(string key, T value, GetParameter getter, SetParameter setter)
|
||||
{
|
||||
Assert.IsNotNull(setter);
|
||||
Assert.IsNotNull(getter);
|
||||
|
||||
m_Key = key;
|
||||
m_Loaded = false;
|
||||
m_Value = value;
|
||||
m_Setter = setter;
|
||||
m_Getter = getter;
|
||||
}
|
||||
|
||||
void Load()
|
||||
{
|
||||
if (m_Loaded)
|
||||
return;
|
||||
|
||||
m_Loaded = true;
|
||||
m_Value = m_Getter(m_Key, m_Value);
|
||||
}
|
||||
|
||||
public T value
|
||||
{
|
||||
get
|
||||
{
|
||||
Load();
|
||||
return m_Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
Load();
|
||||
|
||||
if (m_Value.Equals(value))
|
||||
return;
|
||||
|
||||
m_Value = value;
|
||||
m_Setter(m_Key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Pre-specialized class for easier use and compatibility with existing code
|
||||
public sealed class SavedBool : SavedParameter<bool>
|
||||
{
|
||||
public SavedBool(string key, bool value)
|
||||
: base(key, value, EditorPrefs.GetBool, EditorPrefs.SetBool) { }
|
||||
}
|
||||
|
||||
public sealed class SavedInt : SavedParameter<int>
|
||||
{
|
||||
public SavedInt(string key, int value)
|
||||
: base(key, value, EditorPrefs.GetInt, EditorPrefs.SetInt) { }
|
||||
}
|
||||
|
||||
public sealed class SavedFloat : SavedParameter<float>
|
||||
{
|
||||
public SavedFloat(string key, float value)
|
||||
: base(key, value, EditorPrefs.GetFloat, EditorPrefs.SetFloat) { }
|
||||
}
|
||||
|
||||
public sealed class SavedString : SavedParameter<string>
|
||||
{
|
||||
public SavedString(string key, string value)
|
||||
: base(key, value, EditorPrefs.GetString, EditorPrefs.SetString) { }
|
||||
}
|
||||
}
|
||||
|
||||
//#endif
|
||||
//#endif
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a1e3c272858e934d8a774f5d100020f
|
||||
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/Editor/ShaderGUI/URP/2019-2020/SavedParameter.cs
|
||||
uploadId: 919972
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 06c569b799330c24ea9d07dcbb486bf0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
//SEE: https://github.com/Unity-Technologies/Graphics/blob/569f8878feb8f4340d6de66efa151d0fc1b79c77/Packages/com.unity.render-pipelines.universal/Editor/ShaderGUI/Shaders/LitShader.cs
|
||||
|
||||
#if USING_URP
|
||||
#if UNITY_2021_1_OR_NEWER
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Rendering;
|
||||
using UnityEditor.Rendering.Universal.ShaderGUI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
public class LitShader : BaseShaderGUI
|
||||
{
|
||||
static readonly string[] workflowModeNames = Enum.GetNames(typeof(LitGUI.WorkflowMode));
|
||||
|
||||
private LitGUI.LitProperties litProperties;
|
||||
private LitDetailGUI.LitProperties litDetailProperties;
|
||||
|
||||
public override void FillAdditionalFoldouts(MaterialHeaderScopeList materialScopesList)
|
||||
{
|
||||
materialScopesList.RegisterHeaderScope(LitDetailGUI.Styles.detailInputs, Expandable.Details, _ => LitDetailGUI.DoDetailArea(litDetailProperties, materialEditor));
|
||||
}
|
||||
|
||||
// collect properties from the material properties
|
||||
public override void FindProperties(MaterialProperty[] properties)
|
||||
{
|
||||
base.FindProperties(properties);
|
||||
litProperties = new LitGUI.LitProperties(properties);
|
||||
litDetailProperties = new LitDetailGUI.LitProperties(properties);
|
||||
}
|
||||
|
||||
// material changed check
|
||||
public override void ValidateMaterial(Material material)
|
||||
{
|
||||
SetMaterialKeywords(material, LitGUI.SetMaterialKeywords, LitDetailGUI.SetMaterialKeywords);
|
||||
}
|
||||
|
||||
// material main surface options
|
||||
public override void DrawSurfaceOptions(Material material)
|
||||
{
|
||||
// Use default labelWidth
|
||||
EditorGUIUtility.labelWidth = 0f;
|
||||
|
||||
if (litProperties.workflowMode != null)
|
||||
DoPopup(LitGUI.Styles.workflowModeText, litProperties.workflowMode, workflowModeNames);
|
||||
|
||||
base.DrawSurfaceOptions(material);
|
||||
}
|
||||
|
||||
// material main surface inputs
|
||||
public override void DrawSurfaceInputs(Material material)
|
||||
{
|
||||
base.DrawSurfaceInputs(material);
|
||||
LitGUI.Inputs(litProperties, materialEditor, material);
|
||||
DrawEmissionProperties(material, true);
|
||||
DrawTileOffset(materialEditor, baseMapProp);
|
||||
}
|
||||
|
||||
// material main advanced options
|
||||
public override void DrawAdvancedOptions(Material material)
|
||||
{
|
||||
if (litProperties.reflections != null && litProperties.highlights != null)
|
||||
{
|
||||
materialEditor.ShaderProperty(litProperties.highlights, LitGUI.Styles.highlightsText);
|
||||
materialEditor.ShaderProperty(litProperties.reflections, LitGUI.Styles.reflectionsText);
|
||||
}
|
||||
|
||||
base.DrawAdvancedOptions(material);
|
||||
}
|
||||
|
||||
public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader)
|
||||
{
|
||||
if (material == null)
|
||||
throw new ArgumentNullException("material");
|
||||
|
||||
// _Emission property is lost after assigning Standard shader to the material
|
||||
// thus transfer it before assigning the new shader
|
||||
if (material.HasProperty("_Emission"))
|
||||
{
|
||||
material.SetColor("_EmissionColor", material.GetColor("_Emission"));
|
||||
}
|
||||
|
||||
base.AssignNewShaderToMaterial(material, oldShader, newShader);
|
||||
|
||||
if (oldShader == null || !oldShader.name.Contains("Legacy Shaders/"))
|
||||
{
|
||||
SetupMaterialBlendMode(material);
|
||||
return;
|
||||
}
|
||||
|
||||
SurfaceType surfaceType = SurfaceType.Opaque;
|
||||
BlendMode blendMode = BlendMode.Alpha;
|
||||
if (oldShader.name.Contains("/Transparent/Cutout/"))
|
||||
{
|
||||
surfaceType = SurfaceType.Opaque;
|
||||
material.SetFloat("_AlphaClip", 1);
|
||||
}
|
||||
else if (oldShader.name.Contains("/Transparent/"))
|
||||
{
|
||||
// NOTE: legacy shaders did not provide physically based transparency
|
||||
// therefore Fade mode
|
||||
surfaceType = SurfaceType.Transparent;
|
||||
blendMode = BlendMode.Alpha;
|
||||
}
|
||||
material.SetFloat("_Blend", (float)blendMode);
|
||||
|
||||
material.SetFloat("_Surface", (float)surfaceType);
|
||||
if (surfaceType == SurfaceType.Opaque)
|
||||
{
|
||||
material.DisableKeyword("_SURFACE_TYPE_TRANSPARENT");
|
||||
}
|
||||
else
|
||||
{
|
||||
material.EnableKeyword("_SURFACE_TYPE_TRANSPARENT");
|
||||
}
|
||||
|
||||
if (oldShader.name.Equals("Standard (Specular setup)"))
|
||||
{
|
||||
material.SetFloat("_WorkflowMode", (float)LitGUI.WorkflowMode.Specular);
|
||||
Texture texture = material.GetTexture("_SpecGlossMap");
|
||||
if (texture != null)
|
||||
material.SetTexture("_MetallicSpecGlossMap", texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
material.SetFloat("_WorkflowMode", (float)LitGUI.WorkflowMode.Metallic);
|
||||
Texture texture = material.GetTexture("_MetallicGlossMap");
|
||||
if (texture != null)
|
||||
material.SetTexture("_MetallicSpecGlossMap", texture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e318227579cea0469bbb060b48f848e
|
||||
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/Editor/ShaderGUI/URP/2021/LitShader.cs
|
||||
uploadId: 919972
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
//SEE: https://github.com/Unity-Technologies/Graphics/blob/632f80e011f18ea537ee6e2f0be3ff4f4dea6a11/Packages/com.unity.render-pipelines.universal/Editor/ShaderGUI/ShadingModels/LitDetailGUI.cs
|
||||
|
||||
#if USING_URP
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Experimental.Rendering;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
public class LitDetailGUI
|
||||
{
|
||||
|
||||
public static class Styles
|
||||
{
|
||||
public static readonly GUIContent detailInputs = EditorGUIUtility.TrTextContent("Detail Inputs",
|
||||
"These settings define the surface details by tiling and overlaying additional maps on the surface.");
|
||||
|
||||
public static readonly GUIContent detailMaskText = EditorGUIUtility.TrTextContent("Mask",
|
||||
"Select a mask for the Detail map. The mask uses the alpha channel of the selected texture. The Tiling and Offset settings have no effect on the mask.");
|
||||
|
||||
public static readonly GUIContent detailAlbedoMapText = EditorGUIUtility.TrTextContent("Base Map",
|
||||
"Select the surface detail texture.The alpha of your texture determines surface hue and intensity.");
|
||||
|
||||
public static readonly GUIContent detailNormalMapText = EditorGUIUtility.TrTextContent("Normal Map",
|
||||
"Designates a Normal Map to create the illusion of bumps and dents in the details of this Material's surface.");
|
||||
|
||||
public static readonly GUIContent detailAlbedoMapScaleInfo = EditorGUIUtility.TrTextContent("Setting the scaling factor to a value other than 1 results in a less performant shader variant.");
|
||||
public static readonly GUIContent detailAlbedoMapFormatError = EditorGUIUtility.TrTextContent("This texture is not in linear space.");
|
||||
}
|
||||
|
||||
public struct LitProperties
|
||||
{
|
||||
public MaterialProperty detailMask;
|
||||
public MaterialProperty detailAlbedoMapScale;
|
||||
public MaterialProperty detailAlbedoMap;
|
||||
public MaterialProperty detailNormalMapScale;
|
||||
public MaterialProperty detailNormalMap;
|
||||
|
||||
public LitProperties(MaterialProperty[] properties)
|
||||
{
|
||||
detailMask = BaseShaderGUI.FindProperty("_DetailMask", properties, false);
|
||||
detailAlbedoMapScale = BaseShaderGUI.FindProperty("_DetailAlbedoMapScale", properties, false);
|
||||
detailAlbedoMap = BaseShaderGUI.FindProperty("_DetailAlbedoMap", properties, false);
|
||||
detailNormalMapScale = BaseShaderGUI.FindProperty("_DetailNormalMapScale", properties, false);
|
||||
detailNormalMap = BaseShaderGUI.FindProperty("_DetailNormalMap", properties, false);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DoDetailArea(LitProperties properties, MaterialEditor materialEditor)
|
||||
{
|
||||
materialEditor.TexturePropertySingleLine(Styles.detailMaskText, properties.detailMask);
|
||||
materialEditor.TexturePropertySingleLine(Styles.detailAlbedoMapText, properties.detailAlbedoMap,
|
||||
properties.detailAlbedoMap.textureValue != null ? properties.detailAlbedoMapScale : null);
|
||||
if (properties.detailAlbedoMapScale.floatValue != 1.0f)
|
||||
{
|
||||
EditorGUILayout.HelpBox(Styles.detailAlbedoMapScaleInfo.text, MessageType.Info, true);
|
||||
}
|
||||
var detailAlbedoTexture = properties.detailAlbedoMap.textureValue as Texture2D;
|
||||
if (detailAlbedoTexture != null && GraphicsFormatUtility.IsSRGBFormat(detailAlbedoTexture.graphicsFormat))
|
||||
{
|
||||
EditorGUILayout.HelpBox(Styles.detailAlbedoMapFormatError.text, MessageType.Warning, true);
|
||||
}
|
||||
materialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, properties.detailNormalMap,
|
||||
properties.detailNormalMap.textureValue != null ? properties.detailNormalMapScale : null);
|
||||
materialEditor.TextureScaleOffsetProperty(properties.detailAlbedoMap);
|
||||
}
|
||||
|
||||
public static void SetMaterialKeywords(Material material)
|
||||
{
|
||||
if (material.HasProperty("_DetailAlbedoMap") && material.HasProperty("_DetailNormalMap") && material.HasProperty("_DetailAlbedoMapScale"))
|
||||
{
|
||||
bool isScaled = material.GetFloat("_DetailAlbedoMapScale") != 1.0f;
|
||||
bool hasDetailMap = material.GetTexture("_DetailAlbedoMap") || material.GetTexture("_DetailNormalMap");
|
||||
CoreUtils.SetKeyword(material, "_DETAIL_MULX2", !isScaled && hasDetailMap);
|
||||
CoreUtils.SetKeyword(material, "_DETAIL_SCALED", isScaled && hasDetailMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eb3a74fd4c1042841a9468e1b00d0bbf
|
||||
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/Editor/ShaderGUI/URP/LitDetailGUI.cs
|
||||
uploadId: 919972
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
//SEE: https://github.com/Unity-Technologies/Graphics/blob/6fdc7996098aa184495c0a3c0da10135bfe18340/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/UniversalProperties.cs
|
||||
|
||||
|
||||
#if USING_URP
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ShaderCrew.TheToonShader
|
||||
{
|
||||
public class UniversalProperties
|
||||
{
|
||||
public static class Property
|
||||
{
|
||||
public static readonly string SpecularWorkflowMode = "_WorkflowMode";
|
||||
public static readonly string SurfaceType = "_Surface";
|
||||
public static readonly string BlendMode = "_Blend";
|
||||
public static readonly string AlphaClip = "_AlphaClip";
|
||||
public static readonly string AlphaToMask = "_AlphaToMask";
|
||||
public static readonly string SrcBlend = "_SrcBlend";
|
||||
public static readonly string DstBlend = "_DstBlend";
|
||||
public static readonly string SrcBlendAlpha = "_SrcBlendAlpha";
|
||||
public static readonly string DstBlendAlpha = "_DstBlendAlpha";
|
||||
public static readonly string BlendModePreserveSpecular = "_BlendModePreserveSpecular";
|
||||
public static readonly string ZWrite = "_ZWrite";
|
||||
public static readonly string CullMode = "_Cull";
|
||||
public static readonly string CastShadows = "_CastShadows";
|
||||
public static readonly string ReceiveShadows = "_ReceiveShadows";
|
||||
public static readonly string QueueOffset = "_QueueOffset";
|
||||
|
||||
// for ShaderGraph shaders only
|
||||
public static readonly string ZTest = "_ZTest";
|
||||
public static readonly string ZWriteControl = "_ZWriteControl";
|
||||
public static readonly string QueueControl = "_QueueControl";
|
||||
|
||||
// Global Illumination requires some properties to be named specifically:
|
||||
public static readonly string EmissionMap = "_EmissionMap";
|
||||
public static readonly string EmissionColor = "_EmissionColor";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1526c7c016946e949b453370ac31ab34
|
||||
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/Editor/ShaderGUI/URP/UniversalProperties.cs
|
||||
uploadId: 919972
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 325a8af6f1ad1fa4aa8b499e5cb67666
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+348
@@ -0,0 +1,348 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!200 &20000000
|
||||
ShaderVariantCollection:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: NewShaderVariants
|
||||
m_Shaders:
|
||||
- first: {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
|
||||
second:
|
||||
variants:
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS _DEPTH_NO_MSAA _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
_SHADOWS_SOFT
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS LIGHTPROBE_SH UNITY_HDR_ON _DEPTH_NO_MSAA
|
||||
_MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _SHADOWS_SOFT
|
||||
passType: 0
|
||||
- first: {fileID: 66, guid: 0000000000000000f000000000000000, type: 0}
|
||||
second:
|
||||
variants:
|
||||
- keywords:
|
||||
passType: 0
|
||||
- first: {fileID: 106, guid: 0000000000000000f000000000000000, type: 0}
|
||||
second:
|
||||
variants:
|
||||
- keywords: _DEPTH_NO_MSAA _SUNDISK_SIMPLE
|
||||
passType: 0
|
||||
- keywords: UNITY_HDR_ON _DEPTH_NO_MSAA _SUNDISK_SIMPLE
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS _DEPTH_NO_MSAA _SUNDISK_SIMPLE
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS UNITY_HDR_ON _DEPTH_NO_MSAA _SUNDISK_SIMPLE
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS _DEPTH_NO_MSAA _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
_SHADOWS_SOFT _SUNDISK_SIMPLE
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS UNITY_HDR_ON _DEPTH_NO_MSAA _MAIN_LIGHT_SHADOWS
|
||||
_MAIN_LIGHT_SHADOWS_CASCADE _SHADOWS_SOFT _SUNDISK_SIMPLE
|
||||
passType: 0
|
||||
- first: {fileID: 9000, guid: 0000000000000000f000000000000000, type: 0}
|
||||
second:
|
||||
variants:
|
||||
- keywords:
|
||||
passType: 0
|
||||
- first: {fileID: 9001, guid: 0000000000000000f000000000000000, type: 0}
|
||||
second:
|
||||
variants:
|
||||
- keywords:
|
||||
passType: 0
|
||||
- first: {fileID: 9002, guid: 0000000000000000f000000000000000, type: 0}
|
||||
second:
|
||||
variants:
|
||||
- keywords:
|
||||
passType: 0
|
||||
- first: {fileID: 9003, guid: 0000000000000000f000000000000000, type: 0}
|
||||
second:
|
||||
variants:
|
||||
- keywords:
|
||||
passType: 0
|
||||
- first: {fileID: 9004, guid: 0000000000000000f000000000000000, type: 0}
|
||||
second:
|
||||
variants:
|
||||
- keywords:
|
||||
passType: 0
|
||||
- first: {fileID: 9007, guid: 0000000000000000f000000000000000, type: 0}
|
||||
second:
|
||||
variants:
|
||||
- keywords:
|
||||
passType: 0
|
||||
- first: {fileID: 9101, guid: 0000000000000000f000000000000000, type: 0}
|
||||
second:
|
||||
variants:
|
||||
- keywords:
|
||||
passType: 0
|
||||
- first: {fileID: 9103, guid: 0000000000000000f000000000000000, type: 0}
|
||||
second:
|
||||
variants:
|
||||
- keywords: _DEPTH_NO_MSAA
|
||||
passType: 0
|
||||
- keywords: UNITY_HDR_ON _DEPTH_NO_MSAA
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS _DEPTH_NO_MSAA
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS UNITY_HDR_ON _DEPTH_NO_MSAA
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS _DEPTH_NO_MSAA _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
_SHADOWS_SOFT
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS UNITY_HDR_ON _DEPTH_NO_MSAA _MAIN_LIGHT_SHADOWS
|
||||
_MAIN_LIGHT_SHADOWS_CASCADE _SHADOWS_SOFT
|
||||
passType: 0
|
||||
- first: {fileID: 4800000, guid: c17132b1f77d20942aa75f8429c0f8bc, type: 3}
|
||||
second:
|
||||
variants:
|
||||
- keywords: _DEPTH_NO_MSAA
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS _DEPTH_NO_MSAA
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS _DEPTH_NO_MSAA _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
_SHADOWS_SOFT
|
||||
passType: 0
|
||||
- first: {fileID: 4800000, guid: d6dae50ee9e1bfa4db75f19f99355220, type: 3}
|
||||
second:
|
||||
variants:
|
||||
- keywords: UNITY_HDR_ON _DEPTH_NO_MSAA
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS UNITY_HDR_ON _DEPTH_NO_MSAA
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS UNITY_HDR_ON _DEPTH_NO_MSAA _MAIN_LIGHT_SHADOWS
|
||||
_MAIN_LIGHT_SHADOWS_CASCADE _SHADOWS_SOFT
|
||||
passType: 0
|
||||
- first: {fileID: 4800000, guid: 65df88701913c224d95fc554db28381a, type: 3}
|
||||
second:
|
||||
variants:
|
||||
- keywords: UNITY_HDR_ON _DEPTH_NO_MSAA
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS UNITY_HDR_ON _DEPTH_NO_MSAA
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS UNITY_HDR_ON _DEPTH_NO_MSAA _MAIN_LIGHT_SHADOWS
|
||||
_MAIN_LIGHT_SHADOWS_CASCADE _SHADOWS_SOFT
|
||||
passType: 0
|
||||
- first: {fileID: 4800000, guid: e7857e9d0c934dc4f83f270f8447b006, type: 3}
|
||||
second:
|
||||
variants:
|
||||
- keywords: UNITY_HDR_ON _DEPTH_NO_MSAA
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS UNITY_HDR_ON _DEPTH_NO_MSAA
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS UNITY_HDR_ON _DEPTH_NO_MSAA _MAIN_LIGHT_SHADOWS
|
||||
_MAIN_LIGHT_SHADOWS_CASCADE _SHADOWS_SOFT
|
||||
passType: 0
|
||||
- first: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
|
||||
second:
|
||||
variants:
|
||||
- keywords:
|
||||
passType: 8
|
||||
- keywords: _METALLICSPECGLOSSMAP _NORMALMAP
|
||||
passType: 8
|
||||
- keywords: _METALLICSPECGLOSSMAP _NORMALMAP _OCCLUSIONMAP
|
||||
passType: 8
|
||||
- keywords: _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _NORMALMAP
|
||||
passType: 13
|
||||
- keywords: _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _METALLICSPECGLOSSMAP
|
||||
_NORMALMAP _SHADOWS_SOFT
|
||||
passType: 13
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS _DEPTH_NO_MSAA _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
_METALLICSPECGLOSSMAP _NORMALMAP _SHADOWS_SOFT
|
||||
passType: 13
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS UNITY_HDR_ON _DEPTH_NO_MSAA _MAIN_LIGHT_SHADOWS
|
||||
_MAIN_LIGHT_SHADOWS_CASCADE _METALLICSPECGLOSSMAP _NORMALMAP _SHADOWS_SOFT
|
||||
passType: 13
|
||||
- keywords: _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _METALLICSPECGLOSSMAP
|
||||
_NORMALMAP _OCCLUSIONMAP _SHADOWS_SOFT
|
||||
passType: 13
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS _DEPTH_NO_MSAA _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
_METALLICSPECGLOSSMAP _NORMALMAP _OCCLUSIONMAP _SHADOWS_SOFT
|
||||
passType: 13
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS UNITY_HDR_ON _DEPTH_NO_MSAA _MAIN_LIGHT_SHADOWS
|
||||
_MAIN_LIGHT_SHADOWS_CASCADE _METALLICSPECGLOSSMAP _NORMALMAP _OCCLUSIONMAP
|
||||
_SHADOWS_SOFT
|
||||
passType: 13
|
||||
- first: {fileID: -6465566751694194690, guid: 365dcb759a594984cbab6ca7b7cf1392, type: 3}
|
||||
second:
|
||||
variants:
|
||||
- keywords:
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS LIGHTPROBE_SH _DEPTH_NO_MSAA _MAIN_LIGHT_SHADOWS
|
||||
_MAIN_LIGHT_SHADOWS_CASCADE _SHADING_COLOR _SHADOWS_SOFT
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS LIGHTPROBE_SH UNITY_HDR_ON _DEPTH_NO_MSAA
|
||||
_MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _SHADING_COLOR _SHADOWS_SOFT
|
||||
passType: 0
|
||||
- keywords:
|
||||
passType: 8
|
||||
- keywords: _NORMALMAP
|
||||
passType: 8
|
||||
- keywords: _SHADING_COLOR
|
||||
passType: 8
|
||||
- keywords: _SHADING_BLINNPHONG
|
||||
passType: 8
|
||||
- keywords: _METALLICSPECGLOSSMAP _NORMALMAP _SHADING_COLOR
|
||||
passType: 8
|
||||
- keywords: _METALLICSPECGLOSSMAP _NORMALMAP _OCCLUSIONMAP _SHADING_COLOR
|
||||
passType: 8
|
||||
- keywords: _METALLICSPECGLOSSMAP _NORMALMAP _SHADING_BLINNPHONG
|
||||
passType: 8
|
||||
- keywords: _METALLICSPECGLOSSMAP _NORMALMAP _OCCLUSIONMAP _SHADING_BLINNPHONG
|
||||
passType: 8
|
||||
- keywords: _ENABLECASTSHADOWS_ON _ENABLEOUTLINE_ON _ENABLESHADINGRANDOMIZER_ON
|
||||
_ENABLESHADINGSTYLING_ON _ENABLESHADOWS_ON _ENABLESPECULARRANDOMIZER_ON
|
||||
_ENABLESPECULARSTYLING_ON _ENABLESTYLING_ON _ENABLETOONSHADING_ON _METALLICSPECGLOSSMAP
|
||||
_NORMALMAP _OCCLUSIONMAP _RIMAFFECTEDBYNORMALMAP_ON _SHADING_BLINNPHONG
|
||||
_SHADOWSAFFECTBYNORMALMAP_ON _SPECULARAFFECTEDBYNORMALMAP_ON _SPECULARSSCAMERADISTANCESCALED_ON
|
||||
_SSCAMERADISTANCESCALED_ON
|
||||
passType: 8
|
||||
- keywords:
|
||||
passType: 13
|
||||
- keywords: _ADDITIONAL_LIGHTS_VERTEX _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
_SHADOWS_SOFT
|
||||
passType: 13
|
||||
- keywords: _NORMALMAP
|
||||
passType: 13
|
||||
- keywords: _ADDITIONAL_LIGHTS_VERTEX _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
_NORMALMAP _SHADOWS_SOFT
|
||||
passType: 13
|
||||
- keywords: _SHADING_COLOR
|
||||
passType: 13
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS LIGHTPROBE_SH _DEPTH_NO_MSAA _MAIN_LIGHT_SHADOWS
|
||||
_MAIN_LIGHT_SHADOWS_CASCADE _SHADING_COLOR _SHADOWS_SOFT
|
||||
passType: 13
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS UNITY_HDR_ON _DEPTH_NO_MSAA _MAIN_LIGHT_SHADOWS
|
||||
_MAIN_LIGHT_SHADOWS_CASCADE _SHADING_COLOR _SHADOWS_SOFT
|
||||
passType: 13
|
||||
- keywords: _ADDITIONAL_LIGHTS_VERTEX _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
_SHADING_COLOR _SHADOWS_SOFT
|
||||
passType: 13
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS LIGHTPROBE_SH _ANIMATIONENABLED_ON _CROSSSECTIONUVSCALEDBYDISTANCE_ON
|
||||
_DEPTH_NO_MSAA _ENABLECASTSHADOWS_ON _ENABLEOUTLINE_ON _ENABLESHADINGRANDOMIZER_ON
|
||||
_ENABLESHADINGSTYLING_ON _ENABLESHADOWS_ON _ENABLESPECULARRANDOMIZER_ON
|
||||
_ENABLESPECULARSTYLING_ON _ENABLESTYLING_ON _ENABLETOONSHADING_ON _MAIN_LIGHT_SHADOWS
|
||||
_MAIN_LIGHT_SHADOWS_CASCADE _PLAYERINDEPENDENT _RIMAFFECTEDBYNORMALMAP_ON
|
||||
_SHADING_COLOR _SHADOWSAFFECTBYNORMALMAP_ON _SHADOWS_SOFT _SPECULARAFFECTEDBYNORMALMAP_ON
|
||||
_SPECULARSSCAMERADISTANCESCALED_ON _SSCAMERADISTANCESCALED_ON _TEXTUREDEMISSIONEDGE_ON
|
||||
passType: 13
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS UNITY_HDR_ON _ANIMATIONENABLED_ON _CROSSSECTIONUVSCALEDBYDISTANCE_ON
|
||||
_DEPTH_NO_MSAA _ENABLECASTSHADOWS_ON _ENABLEOUTLINE_ON _ENABLESHADINGRANDOMIZER_ON
|
||||
_ENABLESHADINGSTYLING_ON _ENABLESHADOWS_ON _ENABLESPECULARRANDOMIZER_ON
|
||||
_ENABLESPECULARSTYLING_ON _ENABLESTYLING_ON _ENABLETOONSHADING_ON _MAIN_LIGHT_SHADOWS
|
||||
_MAIN_LIGHT_SHADOWS_CASCADE _PLAYERINDEPENDENT _RIMAFFECTEDBYNORMALMAP_ON
|
||||
_SHADING_COLOR _SHADOWSAFFECTBYNORMALMAP_ON _SHADOWS_SOFT _SPECULARAFFECTEDBYNORMALMAP_ON
|
||||
_SPECULARSSCAMERADISTANCESCALED_ON _SSCAMERADISTANCESCALED_ON _TEXTUREDEMISSIONEDGE_ON
|
||||
passType: 13
|
||||
- keywords: _SHADING_BLINNPHONG
|
||||
passType: 13
|
||||
- keywords: _ADDITIONAL_LIGHTS_VERTEX _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
_SHADING_BLINNPHONG _SHADOWS_SOFT
|
||||
passType: 13
|
||||
- keywords: _ADDITIONAL_LIGHTS_VERTEX _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
_METALLICSPECGLOSSMAP _NORMALMAP _SHADING_COLOR _SHADOWS_SOFT
|
||||
passType: 13
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS LIGHTPROBE_SH _DEPTH_NO_MSAA _ENABLECASTSHADOWS_ON
|
||||
_ENABLESHADOWS_ON _ENABLETOONSHADING_ON _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
_METALLICSPECGLOSSMAP _NORMALMAP _RIMAFFECTEDBYNORMALMAP_ON _SHADING_COLOR
|
||||
_SHADOWSAFFECTBYNORMALMAP_ON _SHADOWS_SOFT _SPECULARAFFECTEDBYNORMALMAP_ON
|
||||
_SYNCWITHRIM_ON _SYNCWITHSPECULAR_ON
|
||||
passType: 13
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS UNITY_HDR_ON _DEPTH_NO_MSAA _ENABLECASTSHADOWS_ON
|
||||
_ENABLESHADOWS_ON _ENABLETOONSHADING_ON _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
_METALLICSPECGLOSSMAP _NORMALMAP _RIMAFFECTEDBYNORMALMAP_ON _SHADING_COLOR
|
||||
_SHADOWSAFFECTBYNORMALMAP_ON _SHADOWS_SOFT _SPECULARAFFECTEDBYNORMALMAP_ON
|
||||
_SYNCWITHRIM_ON _SYNCWITHSPECULAR_ON
|
||||
passType: 13
|
||||
- keywords: _METALLICSPECGLOSSMAP _NORMALMAP _OCCLUSIONMAP _SHADING_COLOR
|
||||
passType: 13
|
||||
- keywords: _ADDITIONAL_LIGHTS_VERTEX _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
_METALLICSPECGLOSSMAP _NORMALMAP _OCCLUSIONMAP _SHADING_COLOR _SHADOWS_SOFT
|
||||
passType: 13
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS LIGHTPROBE_SH _DEPTH_NO_MSAA _ENABLECASTSHADOWS_ON
|
||||
_ENABLEOUTLINE_ON _ENABLESHADINGRANDOMIZER_ON _ENABLESHADINGSTYLING_ON
|
||||
_ENABLESHADOWS_ON _ENABLESPECULARRANDOMIZER_ON _ENABLESPECULARSTYLING_ON
|
||||
_ENABLESTYLING_ON _ENABLETOONSHADING_ON _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
_METALLICSPECGLOSSMAP _NORMALMAP _OCCLUSIONMAP _RIMAFFECTEDBYNORMALMAP_ON
|
||||
_SHADING_COLOR _SHADOWSAFFECTBYNORMALMAP_ON _SHADOWS_SOFT _SPECULARAFFECTEDBYNORMALMAP_ON
|
||||
_SPECULARSSCAMERADISTANCESCALED_ON _SSCAMERADISTANCESCALED_ON
|
||||
passType: 13
|
||||
- keywords: _METALLICSPECGLOSSMAP _NORMALMAP _SHADING_BLINNPHONG
|
||||
passType: 13
|
||||
- keywords: _ADDITIONAL_LIGHTS_VERTEX _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
_METALLICSPECGLOSSMAP _NORMALMAP _SHADING_BLINNPHONG _SHADOWS_SOFT
|
||||
passType: 13
|
||||
- keywords: _METALLICSPECGLOSSMAP _NORMALMAP _OCCLUSIONMAP _SHADING_BLINNPHONG
|
||||
passType: 13
|
||||
- keywords: _ADDITIONAL_LIGHTS_VERTEX _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
_METALLICSPECGLOSSMAP _NORMALMAP _OCCLUSIONMAP _SHADING_BLINNPHONG _SHADOWS_SOFT
|
||||
passType: 13
|
||||
- first: {fileID: -6465566751694194690, guid: 6b93549c49d7f9b47a19adc523d349b9, type: 3}
|
||||
second:
|
||||
variants:
|
||||
- keywords:
|
||||
passType: 8
|
||||
- keywords: _ANIMATIONENABLED_ON _CROSSSECTIONUVSCALEDBYDISTANCE_ON _ENABLECASTSHADOWS_ON
|
||||
_ENABLEOUTLINE_ON _ENABLESHADINGRANDOMIZER_ON _ENABLESHADINGSTYLING_ON
|
||||
_ENABLESHADOWS_ON _ENABLESPECULARRANDOMIZER_ON _ENABLESPECULARSTYLING_ON
|
||||
_ENABLESTYLING_ON _ENABLETOONSHADING_ON _PLAYERINDEPENDENT _RIMAFFECTEDBYNORMALMAP_ON
|
||||
_SHADING_COLOR _SHADOWSAFFECTBYNORMALMAP_ON _SPECULARAFFECTEDBYNORMALMAP_ON
|
||||
_SPECULARSSCAMERADISTANCESCALED_ON _SSCAMERADISTANCESCALED_ON _TEXTUREDEMISSIONEDGE_ON
|
||||
passType: 8
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS _ANIMATIONENABLED_ON _CROSSSECTIONUVSCALEDBYDISTANCE_ON
|
||||
_DEPTH_NO_MSAA _ENABLECASTSHADOWS_ON _ENABLEOUTLINE_ON _ENABLESHADINGRANDOMIZER_ON
|
||||
_ENABLESHADINGSTYLING_ON _ENABLESHADOWS_ON _ENABLESPECULARRANDOMIZER_ON
|
||||
_ENABLESPECULARSTYLING_ON _ENABLESTYLING_ON _ENABLETOONSHADING_ON _PLAYERINDEPENDENT
|
||||
_RIMAFFECTEDBYNORMALMAP_ON _SHADING_COLOR _SHADOWSAFFECTBYNORMALMAP_ON
|
||||
_SPECULARAFFECTEDBYNORMALMAP_ON _SPECULARSSCAMERADISTANCESCALED_ON _SSCAMERADISTANCESCALED_ON
|
||||
_TEXTUREDEMISSIONEDGE_ON
|
||||
passType: 8
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS UNITY_HDR_ON _ANIMATIONENABLED_ON _CROSSSECTIONUVSCALEDBYDISTANCE_ON
|
||||
_DEPTH_NO_MSAA _ENABLECASTSHADOWS_ON _ENABLEOUTLINE_ON _ENABLESHADINGRANDOMIZER_ON
|
||||
_ENABLESHADINGSTYLING_ON _ENABLESHADOWS_ON _ENABLESPECULARRANDOMIZER_ON
|
||||
_ENABLESPECULARSTYLING_ON _ENABLESTYLING_ON _ENABLETOONSHADING_ON _PLAYERINDEPENDENT
|
||||
_RIMAFFECTEDBYNORMALMAP_ON _SHADING_COLOR _SHADOWSAFFECTBYNORMALMAP_ON
|
||||
_SPECULARAFFECTEDBYNORMALMAP_ON _SPECULARSSCAMERADISTANCESCALED_ON _SSCAMERADISTANCESCALED_ON
|
||||
_TEXTUREDEMISSIONEDGE_ON
|
||||
passType: 8
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS _ANIMATIONENABLED_ON _CROSSSECTIONUVSCALEDBYDISTANCE_ON
|
||||
_DEPTH_NO_MSAA _ENABLECASTSHADOWS_ON _ENABLEOUTLINE_ON _ENABLESHADINGRANDOMIZER_ON
|
||||
_ENABLESHADINGSTYLING_ON _ENABLESHADOWS_ON _ENABLESPECULARRANDOMIZER_ON
|
||||
_ENABLESPECULARSTYLING_ON _ENABLESTYLING_ON _ENABLETOONSHADING_ON _MAIN_LIGHT_SHADOWS
|
||||
_MAIN_LIGHT_SHADOWS_CASCADE _PLAYERINDEPENDENT _RIMAFFECTEDBYNORMALMAP_ON
|
||||
_SHADING_COLOR _SHADOWSAFFECTBYNORMALMAP_ON _SHADOWS_SOFT _SPECULARAFFECTEDBYNORMALMAP_ON
|
||||
_SPECULARSSCAMERADISTANCESCALED_ON _SSCAMERADISTANCESCALED_ON _TEXTUREDEMISSIONEDGE_ON
|
||||
passType: 13
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS UNITY_HDR_ON _ANIMATIONENABLED_ON _CROSSSECTIONUVSCALEDBYDISTANCE_ON
|
||||
_DEPTH_NO_MSAA _ENABLECASTSHADOWS_ON _ENABLEOUTLINE_ON _ENABLESHADINGRANDOMIZER_ON
|
||||
_ENABLESHADINGSTYLING_ON _ENABLESHADOWS_ON _ENABLESPECULARRANDOMIZER_ON
|
||||
_ENABLESPECULARSTYLING_ON _ENABLESTYLING_ON _ENABLETOONSHADING_ON _MAIN_LIGHT_SHADOWS
|
||||
_MAIN_LIGHT_SHADOWS_CASCADE _PLAYERINDEPENDENT _RIMAFFECTEDBYNORMALMAP_ON
|
||||
_SHADING_COLOR _SHADOWSAFFECTBYNORMALMAP_ON _SHADOWS_SOFT _SPECULARAFFECTEDBYNORMALMAP_ON
|
||||
_SPECULARSSCAMERADISTANCESCALED_ON _SSCAMERADISTANCESCALED_ON _TEXTUREDEMISSIONEDGE_ON
|
||||
passType: 13
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS LIGHTPROBE_SH UNITY_HDR_ON _ANIMATIONENABLED_ON
|
||||
_CROSSSECTIONUVSCALEDBYDISTANCE_ON _DEPTH_NO_MSAA _ENABLECASTSHADOWS_ON
|
||||
_ENABLEOUTLINE_ON _ENABLESHADINGRANDOMIZER_ON _ENABLESHADINGSTYLING_ON
|
||||
_ENABLESHADOWS_ON _ENABLESPECULARRANDOMIZER_ON _ENABLESPECULARSTYLING_ON
|
||||
_ENABLESTYLING_ON _ENABLETOONSHADING_ON _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
_PLAYERINDEPENDENT _RIMAFFECTEDBYNORMALMAP_ON _SHADING_COLOR _SHADOWSAFFECTBYNORMALMAP_ON
|
||||
_SHADOWS_SOFT _SPECULARAFFECTEDBYNORMALMAP_ON _SPECULARSSCAMERADISTANCESCALED_ON
|
||||
_SSCAMERADISTANCESCALED_ON _TEXTUREDEMISSIONEDGE_ON
|
||||
passType: 13
|
||||
- first: {fileID: 4800000, guid: 96316acf0f537ae449a9a641fa00eefe, type: 3}
|
||||
second:
|
||||
variants:
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS _DEPTH_NO_MSAA _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
_SHADOWS_SOFT
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS LIGHTPROBE_SH UNITY_HDR_ON _DEPTH_NO_MSAA
|
||||
_MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _SHADOWS_SOFT
|
||||
passType: 0
|
||||
- first: {fileID: 4800000, guid: bc65170c051b0724287a7f1636d87573, type: 3}
|
||||
second:
|
||||
variants:
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS _DEPTH_NO_MSAA _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
_SHADOWS_SOFT
|
||||
passType: 0
|
||||
- keywords: BILLBOARD_FACE_CAMERA_POS LIGHTPROBE_SH UNITY_HDR_ON _DEPTH_NO_MSAA
|
||||
_MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _SHADOWS_SOFT
|
||||
passType: 0
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2cf99bf7a6d88e6449fb523c0b44037d
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 20000000
|
||||
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/Resources/NewShaderVariants.shadervariants
|
||||
uploadId: 919972
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1453a2fb0d957404aab4d3503e45eeb2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Binary file not shown.
+134
@@ -0,0 +1,134 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f40d12a41bafa6749a1465879341fff5
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 1
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 0
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 128
|
||||
resizeAlgorithm: 1
|
||||
textureFormat: 9
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 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/Resources/NoiseTextures/BlueNoise128.png
|
||||
uploadId: 919972
|
||||
BIN
Binary file not shown.
+152
@@ -0,0 +1,152 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f717b2b756c2b0343b642280db9e2443
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 2
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: 63
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: 63
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Windows Store Apps
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 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/Resources/NoiseTextures/NoiseTileable.png
|
||||
uploadId: 919972
|
||||
BIN
Binary file not shown.
+152
@@ -0,0 +1,152 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0528154608ff38a4c845b6622c088ea0
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 1
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 2
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 1024
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 1024
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 1024
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Windows Store Apps
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 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/Resources/NoiseTextures/PerlinNoise.png
|
||||
uploadId: 919972
|
||||
LFS
BIN
Binary file not shown.
+152
@@ -0,0 +1,152 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9f5d2c6a1050b0842948946ad4c25070
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 1
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 1024
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 1024
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 1024
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Windows Store Apps
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 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/Resources/NoiseTextures/PerlinNoise_High.png
|
||||
uploadId: 919972
|
||||
LFS
BIN
Binary file not shown.
+152
@@ -0,0 +1,152 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab57a42276fd5184e9ea841815bcd8fd
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 1
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 2
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 256
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 256
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 256
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Windows Store Apps
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 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/Resources/NoiseTextures/PerlinNoise_Low.png
|
||||
uploadId: 919972
|
||||
LFS
BIN
Binary file not shown.
+152
@@ -0,0 +1,152 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e34337d7a9805974d849d9bfa0ef1c7d
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 1
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 2
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 512
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 512
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 512
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Windows Store Apps
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 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/Resources/NoiseTextures/PerlinNoise_Medium.png
|
||||
uploadId: 919972
|
||||
BIN
Binary file not shown.
+152
@@ -0,0 +1,152 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2fa8b3cfbd2562945929d13578e91239
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 1
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 2
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 128
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 128
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 128
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Windows Store Apps
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 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/Resources/NoiseTextures/PerlinNoise_UltraLow.png
|
||||
uploadId: 919972
|
||||
BIN
Binary file not shown.
+152
@@ -0,0 +1,152 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd996f64cdc4d4b449f2d981a34fcf09
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 1
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 0
|
||||
aniso: 2
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 128
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 128
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 128
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Windows Store Apps
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 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/Resources/NoiseTextures/WhiteNoise.png
|
||||
uploadId: 919972
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6a5a12edabde3374d9b84c06e1ea6d13
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23f42da80a73b7d4b9b8bedbd6185bca
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5db137202e9b34e498e85d95c01537ea
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
#ifndef THETOONSHADER_LIGHTING_FUNCTION
|
||||
#define THETOONSHADER_LIGHTING_FUNCTION
|
||||
|
||||
|
||||
struct ToonShadingData
|
||||
{
|
||||
half enableToonShading;
|
||||
float3 normalWS;
|
||||
float3 normalWSNoMap;
|
||||
float cellTransitionSmoothness;
|
||||
half numberOfCells;
|
||||
float specularEdgeSmoothness;
|
||||
half shadingAffectByNormalMap;
|
||||
half specularAffectedByNormalMap;
|
||||
|
||||
};
|
||||
float Posterize(float llllllllllllll0, ToonShadingData toonShadingData)
|
||||
{
|
||||
if (toonShadingData.enableToonShading == 1)
|
||||
{
|
||||
float ll0 = (1.0 / toonShadingData.numberOfCells) * toonShadingData.cellTransitionSmoothness;
|
||||
half lll0 = ceil(llllllllllllll0 * toonShadingData.numberOfCells);
|
||||
half llll0 = lll0 / toonShadingData.numberOfCells;
|
||||
half lllll0 = max(0, lll0 - 1) / toonShadingData.numberOfCells;
|
||||
half llllll0 = max(llll0 * smoothstep(lllll0, lllll0 + ll0, llllllllllllll0), lllll0);
|
||||
return lerp(llllll0, llllllllllllll0, toonShadingData.cellTransitionSmoothness);
|
||||
}
|
||||
else
|
||||
{
|
||||
return llllllllllllll0;
|
||||
}
|
||||
}
|
||||
float3 Posterize(float3 llllllllllllll0, ToonShadingData toonShadingData)
|
||||
{
|
||||
if (toonShadingData.enableToonShading == 1)
|
||||
{
|
||||
half ll0 = (1.0 / toonShadingData.numberOfCells) * toonShadingData.cellTransitionSmoothness;
|
||||
half3 lll0 = ceil(llllllllllllll0 * toonShadingData.numberOfCells);
|
||||
half3 llll0 = lll0 / toonShadingData.numberOfCells;
|
||||
half3 lllll0 = max(0, lll0 - 1.0) / toonShadingData.numberOfCells;
|
||||
half3 llllll0 = max(llll0 * smoothstep(lllll0, lllll0 + ll0, llllllllllllll0), lllll0);
|
||||
return lerp(llllll0, llllllllllllll0, toonShadingData.cellTransitionSmoothness);
|
||||
}
|
||||
else
|
||||
{
|
||||
return llllllllllllll0;
|
||||
}
|
||||
}
|
||||
float3 PosterizeMulti(
|
||||
float3 llllllllllllll0, ToonShadingData toonShadingData, float lllllllllllllll0
|
||||
)
|
||||
{
|
||||
if (toonShadingData.enableToonShading == 1)
|
||||
{
|
||||
half ll0 = (1.0 / toonShadingData.numberOfCells) * toonShadingData.cellTransitionSmoothness;
|
||||
half3 lllllllllllllllll0 = llllllllllllll0 * toonShadingData.numberOfCells;
|
||||
half3 lll0 = 0;
|
||||
if (lllllllllllllll0 == 0)
|
||||
{
|
||||
lll0 = ceil(lllllllllllllllll0);
|
||||
}
|
||||
else
|
||||
{
|
||||
lll0 = floor(lllllllllllllllll0);
|
||||
}
|
||||
half3 llll0 = lll0 / toonShadingData.numberOfCells;
|
||||
half3 lllll0 = max(0, lll0 - 1.0) / toonShadingData.numberOfCells;
|
||||
half3 llllll0 = max(llll0 * smoothstep(lllll0, lllll0 + ll0, llllllllllllll0), lllll0);
|
||||
return lerp(llllll0, llllllllllllll0, toonShadingData.cellTransitionSmoothness);
|
||||
}
|
||||
else
|
||||
{
|
||||
return llllllllllllll0;
|
||||
}
|
||||
}
|
||||
float CalculateCellShadingPartitioning(half3 direction, ToonShadingData toonShadingData)
|
||||
{
|
||||
if (toonShadingData.enableToonShading == 1)
|
||||
{
|
||||
half3 lllllllllllllllllllllll0;
|
||||
if (toonShadingData.shadingAffectByNormalMap == 0)
|
||||
{
|
||||
lllllllllllllllllllllll0 = toonShadingData.normalWSNoMap;
|
||||
}
|
||||
else
|
||||
{
|
||||
lllllllllllllllllllllll0 = toonShadingData.normalWS;
|
||||
}
|
||||
float llllllllllllllllllllllll0 = saturate(dot(lllllllllllllllllllllll0, direction));
|
||||
return Posterize(llllllllllllllllllllllll0, toonShadingData);
|
||||
}
|
||||
else
|
||||
{
|
||||
return saturate(dot(toonShadingData.normalWS, direction));
|
||||
}
|
||||
}
|
||||
half3 PosterizeShifted(half3 llllllllllllll0, ToonShadingData toonShadingData)
|
||||
{
|
||||
if (toonShadingData.enableToonShading == 1)
|
||||
{
|
||||
half3 llllllllllllllllllllllllll0 = llllllllllllll0;
|
||||
float ll0 = (1.0 / toonShadingData.numberOfCells) * toonShadingData.cellTransitionSmoothness;
|
||||
float llllllllllllllllllllllllllll0 = (1 / (toonShadingData.numberOfCells + 1)) + ll0 * ((0.25 / toonShadingData.numberOfCells) - (1 / (toonShadingData.numberOfCells + 1)));
|
||||
float lllllllllllllllllllllllllllll0 = 1 + (1 / toonShadingData.numberOfCells);
|
||||
llllllllllllll0 = (llllllllllllll0 - llllllllllllllllllllllllllll0) * lllllllllllllllllllllllllllll0;
|
||||
half3 llll0 = ceil(llllllllllllll0 * toonShadingData.numberOfCells) / toonShadingData.numberOfCells;
|
||||
half3 lllll0 = max(0, ceil(llllllllllllll0 * toonShadingData.numberOfCells) - 1) / toonShadingData.numberOfCells;
|
||||
llllllllllllll0 = max(llll0 * smoothstep(lllll0, lllll0 + ll0, llllllllllllll0), lllll0);
|
||||
llllllllllllll0 = lerp(llllllllllllll0, llllllllllllllllllllllllll0, toonShadingData.cellTransitionSmoothness);
|
||||
}
|
||||
return llllllllllllll0;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a28f842ad01a9a64cbad78e9c7b35ca7
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 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/Shaders/xxSharedTTSDependecies/TheToonShaderLightingFunctions.hlsl
|
||||
uploadId: 919972
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "com.shadercrew.the-toon-shader.core",
|
||||
"displayName": "The Toon Shader-Core",
|
||||
"version": "1.4.2",
|
||||
"author": {
|
||||
"name": "ShaderCrew",
|
||||
"url": "https://www.shadercrew.com/",
|
||||
"email": "support@shadercrew.com"
|
||||
},
|
||||
"unity": "2020.1",
|
||||
"keywords": [
|
||||
"Toon Shader",
|
||||
"toon",
|
||||
"cartoon",
|
||||
"Shader"
|
||||
],
|
||||
"type": "tool",
|
||||
"hideInEditor": false,
|
||||
"description": "Core functionality and shared utilities for all 2D and 3D The Toon Shader.\nIncludes base scripts, common resources, and foundational systems used by both 2D and 3D Toon Shader packages.\n\nNote: This package is a dependency for The Toon Shader-2D and The Toon Shader-3D. It is not intended for direct use in projects."
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dd333689899a8144bb558ed191e61229
|
||||
PackageManifestImporter:
|
||||
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/package.json
|
||||
uploadId: 919972
|
||||
Reference in New Issue
Block a user