Upload project file

This commit is contained in:
Misaki
2024-08-15 17:00:11 +09:00
parent 684c51a8c0
commit e441bb7911
162 changed files with 63084 additions and 0 deletions

View File

@@ -0,0 +1,136 @@
//Unity Toon Shader/HDRP
//nobuyuki@unity3d.com
//toshiyuki@unity3d.com (Universal RP/HDRP)
using UnityEngine;
using UnityEditor;
using System;
using UnityEngine.Rendering;
namespace UnityEditor.Rendering.Toon
{
internal partial class UTS3GUI
{
enum TessellationMode
{
None,
Phong
}
internal class TessellationStyles
{
public const string header = "Tessellation Options";
public static GUIContent tessellationModeText = new GUIContent("Tessellation Mode","Tessellation Mode. None/Phong.");
public static readonly string[] tessellationModeNames = System.Enum.GetNames(typeof(
TessellationMode));
public static GUIContent tessellationText = new GUIContent("Tessellation Options", "Tessellation options");
public static GUIContent tessellationFactorText = new GUIContent("Tessellation Factor", "Controls the strength of the tessellation effect. Higher values result in more tessellation. Maximum tessellation factor is 15 on the Xbox One and PS4.");
public static GUIContent tessellationFactorMinDistanceText = new GUIContent("Start Fade Distance", "Sets the distance (in meters) at which tessellation begins to fade out.");
public static GUIContent tessellationFactorMaxDistanceText = new GUIContent("End Fade Distance", "Sets the maximum distance (in meters) to the Camera where HDRP tessellates triangle.");
public static GUIContent tessellationFactorTriangleSizeText = new GUIContent("Triangle Size", "Sets the desired screen space size of triangles (in pixels). Smaller values result in smaller triangle.");
public static GUIContent tessellationShapeFactorText = new GUIContent("Shape Factor", "Controls the strength of Phong tessellation shape (lerp factor).");
public static GUIContent tessellationBackFaceCullEpsilonText = new GUIContent("Triangle Culling Epsilon", "Controls triangle culling. A value of -1.0 disables back face culling for tessellation, higher values produce more aggressive culling and better performance.");
}
// tessellation params
MaterialProperty tessellationMode = null;
const string kTessellationMode = "_TessellationMode";
MaterialProperty tessellationFactor = null;
const string kTessellationFactor = "_TessellationFactor";
MaterialProperty tessellationFactorMinDistance = null;
const string kTessellationFactorMinDistance = "_TessellationFactorMinDistance";
MaterialProperty tessellationFactorMaxDistance = null;
const string kTessellationFactorMaxDistance = "_TessellationFactorMaxDistance";
MaterialProperty tessellationFactorTriangleSize = null;
const string kTessellationFactorTriangleSize = "_TessellationFactorTriangleSize";
MaterialProperty tessellationShapeFactor = null;
const string kTessellationShapeFactor = "_TessellationShapeFactor";
MaterialProperty tessellationBackFaceCullEpsilon = null;
const string kTessellationBackFaceCullEpsilon = "_TessellationBackFaceCullEpsilon";
MaterialProperty doubleSidedEnable = null;
const string kDoubleSidedEnable = "_DoubleSidedEnable";
public static GUIContent tessellationModeText = new GUIContent("Tessellation Mode",
"Transparent mode that fits you. ");
internal void FindTessellationPropertiesHDRP(MaterialProperty[] props)
{
tessellationMode = FindProperty(kTessellationMode, props, false);
tessellationFactor = FindProperty(kTessellationFactor, props, false);
tessellationFactorMinDistance = FindProperty(kTessellationFactorMinDistance, props, false);
tessellationFactorMaxDistance = FindProperty(kTessellationFactorMaxDistance, props, false);
tessellationFactorTriangleSize = FindProperty(kTessellationFactorTriangleSize, props, false);
tessellationShapeFactor = FindProperty(kTessellationShapeFactor, props, false);
tessellationBackFaceCullEpsilon = FindProperty(kTessellationBackFaceCullEpsilon, props, false);
doubleSidedEnable = FindProperty(kDoubleSidedEnable, props, false);
}
static void SetKeyword(Material material, string keyword, bool state)
{
if (state)
material.EnableKeyword(keyword);
else
material.DisableKeyword(keyword);
}
internal void ApplyTessellationHDRP(Material material)
{
if (material.HasProperty(kTessellationMode))
{
TessellationMode tessMode = (TessellationMode)material.GetFloat(kTessellationMode);
SetKeyword(material, "_TESSELLATION_PHONG", tessMode == TessellationMode.Phong);
}
}
void DrawDelayedFloatProperty(MaterialProperty prop, GUIContent content)
{
Rect position = EditorGUILayout.GetControlRect();
EditorGUI.BeginChangeCheck();
EditorGUI.showMixedValue = prop.hasMixedValue;
float newValue = EditorGUI.DelayedFloatField(position, content, prop.floatValue);
EditorGUI.showMixedValue = false;
if (EditorGUI.EndChangeCheck())
prop.floatValue = newValue;
}
void TessellationModePopup()
{
EditorGUI.showMixedValue = tessellationMode.hasMixedValue;
var mode = (TessellationMode)tessellationMode.floatValue;
EditorGUI.BeginChangeCheck();
mode = (TessellationMode)EditorGUILayout.Popup(TessellationStyles.tessellationModeText, (int)mode, TessellationStyles.tessellationModeNames);
if (EditorGUI.EndChangeCheck())
{
m_MaterialEditor.RegisterPropertyChangeUndo("Tessellation Mode");
tessellationMode.floatValue = (float)mode;
}
EditorGUI.showMixedValue = false;
}
void GUI_TessellationHDRP(Material material)
{
TessellationModePopup();
m_MaterialEditor.ShaderProperty(tessellationFactor, TessellationStyles.tessellationFactorText);
DrawDelayedFloatProperty(tessellationFactorMinDistance, TessellationStyles.tessellationFactorMinDistanceText);
DrawDelayedFloatProperty(tessellationFactorMaxDistance, TessellationStyles.tessellationFactorMaxDistanceText);
// clamp min distance to be below max distance
tessellationFactorMinDistance.floatValue = Math.Min(tessellationFactorMaxDistance.floatValue, tessellationFactorMinDistance.floatValue);
m_MaterialEditor.ShaderProperty(tessellationFactorTriangleSize, TessellationStyles.tessellationFactorTriangleSizeText);
if ((TessellationMode)tessellationMode.floatValue == TessellationMode.Phong)
{
m_MaterialEditor.ShaderProperty(tessellationShapeFactor, TessellationStyles.tessellationShapeFactorText);
}
if (doubleSidedEnable.floatValue == 0.0)
{
m_MaterialEditor.ShaderProperty(tessellationBackFaceCullEpsilon, TessellationStyles.tessellationBackFaceCullEpsilonText);
}
}
} // End of UTS2GUI2
}// End of namespace UnityChan

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5cea690c8e7837f4b95eaabbe718999e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,45 @@
using UnityEditor.Rendering.HighDefinition;
using UnityEngine;
namespace UnityEditor.Rendering.Toon
{
[CustomPassDrawer(typeof(HairShadowPass))]
public class HairShadowPassDrawer : CustomPassDrawer
{
SerializedProperty m_RenderQueueType;
SerializedProperty m_SortingCriteria;
SerializedProperty m_LayerMask;
protected override void Initialize(SerializedProperty customPass)
{
m_RenderQueueType = customPass.FindPropertyRelative("renderQueueType");
m_SortingCriteria = customPass.FindPropertyRelative("sortingCriteria");
m_LayerMask = customPass.FindPropertyRelative("layerMask");
}
protected override void DoPassGUI(SerializedProperty customPass, Rect rect)
{
EditorGUILayout.HelpBox("Eyebrow Passthrough feature in the Toon shader will need this part to function", MessageType.Info);
EditorGUILayout.HelpBox("Please Assign Hair/Eyebrow Renderer respectively as the 1st/2nd element of renderer array", MessageType.Info);
EditorGUI.BeginProperty(rect, new GUIContent("Queue", "Filter the render queue range you want to render."), m_RenderQueueType);
EditorGUI.PropertyField(rect, m_RenderQueueType, new GUIContent("Queue", "Filter the render queue range you want to render."));
EditorGUI.EndProperty();
rect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(rect, m_SortingCriteria, new GUIContent("Sorting Criteria", "Sorting settings used to render objects in a certain order."));
rect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(rect, m_LayerMask, new GUIContent("Layer Mask", "Chose the Callback position for this render pass object."));
rect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
//base.DoPassGUI(customPass, rect);
}
protected override float GetPassHeight(SerializedProperty customPass)
{
return (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) * 3;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8a0dff152af1b39468bd5027f57c0b27
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,41 @@
using UnityEditor;
using UnityEditor.Rendering.HighDefinition;
using UnityEngine;
namespace Unity.Toonshader.Editor
{
[CustomPassDrawerAttribute(typeof(UTSOutlinePass))]
public class UTSOutlinePassEditor : CustomPassDrawer
{
SerializedProperty m_RenderQueueType;
SerializedProperty m_SortingCriteria;
SerializedProperty m_LayerMask;
protected override void Initialize(SerializedProperty customPass)
{
m_RenderQueueType = customPass.FindPropertyRelative("renderQueueType");
m_SortingCriteria = customPass.FindPropertyRelative("sortingCriteria");
m_LayerMask = customPass.FindPropertyRelative("layerMask");
}
protected override void DoPassGUI(SerializedProperty customPass, Rect rect)
{
EditorGUI.BeginProperty(rect, new GUIContent("Queue", "Filter the render queue range you want to render."), m_RenderQueueType);
EditorGUI.PropertyField(rect, m_RenderQueueType, new GUIContent("Queue", "Filter the render queue range you want to render."));
EditorGUI.EndProperty();
rect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(rect, m_SortingCriteria, new GUIContent("Sorting Criteria", "Sorting settings used to render objects in a certain order."));
rect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(rect, m_LayerMask, new GUIContent("Layer Mask", "Chose the Callback position for this render pass object."));
rect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
protected override float GetPassHeight(SerializedProperty customPass)
{
return (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) * 3;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6ff30d943d4212043bf0a26bd9bc2eed
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: