Updated UTSRenderPass

This commit is contained in:
Misaki
2024-11-08 18:32:46 +09:00
parent d0554a73bb
commit da32fd952d
12 changed files with 106 additions and 83 deletions

View File

@@ -0,0 +1,20 @@
//namespace Unity.Toonshader.Editor
//{
//[CustomEditor(typeof(BoxLightAdjustment))]
//public class BoxLightAdjustmentInspector : UnityEditor.Editor
//{
// private void OnEnable()
// {
// var boxLightAdjustment = target as BoxLightAdjustment;
// }
// public override VisualElement CreateInspectorGUI()
// {
// var root = new VisualElement();
// return root;
// }
//}
//}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: e2b76b74e6ec63546bdb3963e2c88d12

View File

@@ -0,0 +1,102 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using Unity.Rendering.Toon;
namespace UnityEditor.Rendering.Toon
{
[CustomEditor(typeof(DebugShadowmap))]
internal class DebugShadowmapInspector : Editor
{
public override void OnInspectorGUI()
{
const string labelDebugShadowmap = "Show Shadowmap";
const string labelDebugSelfShadow = "Show SelfShadow";
const string labelBinalization = "Binalization";
const string labelNoOutline = "No Outline";
bool isChanged = false;
var obj = target as DebugShadowmap;
// hi cut filter
EditorGUI.BeginChangeCheck();
bool showShadow = EditorGUILayout.Toggle(labelDebugShadowmap, obj.m_enableShadowmapDebugging);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(target, "Changed Shadowmap debbuging flag");
obj.m_enableShadowmapDebugging = showShadow;
isChanged = true;
}
EditorGUI.BeginDisabledGroup(!obj.m_enableShadowmapDebugging);
{
EditorGUI.indentLevel++;
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
bool binalization = EditorGUILayout.Toggle(labelBinalization, obj.m_enableBinalization);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(target, "Changed Binalization flag");
obj.m_enableBinalization = binalization;
isChanged = true;
}
EditorGUILayout.EndHorizontal();
EditorGUI.indentLevel--;
}
EditorGUI.EndDisabledGroup();
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
bool showSlefShadow = EditorGUILayout.Toggle(labelDebugSelfShadow, obj.m_enableSelfShadowDebugging);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(target, "Changed Self shadow debbuging flag");
obj.m_enableSelfShadowDebugging = showSlefShadow;
isChanged = true;
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
bool showOutline = EditorGUILayout.Toggle(labelNoOutline, obj.m_enableOutlineDebugging);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(target, "Changed Outline flag");
obj.m_enableOutlineDebugging = showOutline;
isChanged = true;
}
EditorGUILayout.EndHorizontal();
if (isChanged)
{
// at leaset 2020.3.12f1, not neccessary. but, from which version??
EditorApplication.QueuePlayerLoopUpdate();
}
}
}
}

View File

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

View File

@@ -0,0 +1,167 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using Unity.Rendering.Toon;
namespace UnityEditor.Rendering.Toon
{
[CustomEditor(typeof(ModelToonEvAdjustment))]
internal class ModelToonEvAdjustmentInspector : Editor
{
SerializedObject m_SerializedObject;
public override void OnInspectorGUI()
{
const string labelLightAdjustment = "Toon EV Adjustment";
const string labelLightAdjustmentCurve = "Curve";
const string labelLightHighCutFilter = "Light High-Cut Filter";
const string labeIgnoreVolumeExposure = "Ignore Volume Exposure";
const string labelCompensation = "Compensation";
bool isChanged = false;
var obj = target as ModelToonEvAdjustment;
// hi cut filter
EditorGUI.BeginChangeCheck();
bool egnoreExposure = EditorGUILayout.Toggle(labeIgnoreVolumeExposure, obj.m_IgnorVolumeExposure);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(target, "Changed Ignore Volume Exposure");
obj.m_IgnorVolumeExposure = egnoreExposure;
isChanged = true;
}
// hi cut filter
EditorGUI.BeginChangeCheck();
bool lightFilterr = EditorGUILayout.Toggle(labelLightHighCutFilter, obj.m_ToonLightHiCutFilter);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(target, "Changed Light Hi Cut Filter");
obj.m_ToonLightHiCutFilter = lightFilterr;
isChanged = true;
}
// Compensation
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
float compensation = EditorGUILayout.FloatField(labelCompensation, obj.m_Compensation);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(target, "Changed Compensation");
obj.m_Compensation = compensation;
isChanged = true;
}
EditorGUILayout.EndHorizontal();
// curve
EditorGUI.BeginChangeCheck();
bool exposureAdjustment = EditorGUILayout.Toggle(labelLightAdjustment, obj.m_ExposureAdjustmnt);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(target, "Changed Expsure Adjustment");
obj.m_ExposureAdjustmnt = exposureAdjustment;
isChanged = true;
}
EditorGUI.BeginDisabledGroup(!obj.m_ExposureAdjustmnt);
{
EditorGUI.indentLevel++;
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
// var ranges = new Rect(-10, -10, 20, 20);
// var curve = EditorGUILayout.CurveField(labelExposureCurave, obj.m_AnimationCurve, Color.green,ranges);
AnimationCurve curve = EditorGUILayout.CurveField(labelLightAdjustmentCurve, obj.m_AnimationCurve);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(target, "Changed Curve");
obj.m_AnimationCurve = curve;
isChanged = true;
}
EditorGUI.BeginChangeCheck();
bool buttonIsPressed = GUILayout.Button("Reset", GUILayout.Width(50));
var curve2 = obj.m_AnimationCurve;
if (buttonIsPressed)
{
curve2 = SceneToonEvAdjustment.DefaultAnimationCurve();
}
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(target, "Changed Curve");
obj.m_AnimationCurve = curve2;
isChanged = true;
}
EditorGUILayout.EndHorizontal();
var rangeMinLux = ConvertFromEV100(obj.m_Min);
var rangeMaxLux = ConvertFromEV100(obj.m_Max);
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Min EV/LUX:" + obj.m_Min + " / " + rangeMinLux.ToString());
EditorGUILayout.LabelField("Max EV/LUX:" + obj.m_Max + " / " + rangeMaxLux.ToString());
EditorGUILayout.EndHorizontal();
EditorGUI.indentLevel--;
}
EditorGUI.EndDisabledGroup();
if (isChanged)
{
// at leaset 2020.3.12f1, not neccessary. but, from which version??
EditorApplication.QueuePlayerLoopUpdate();
}
}
float ConvertFromEV100(float EV100)
{
float val = Mathf.Pow(2, EV100) * 2.5f;
return val;
}
float ConvertToEV100(float val)
{
return Mathf.Log(val * 0.4f, 2.0f);
}
[MenuItem("GameObject/Toon Shader/Attach Model Toon Ev Adjustment", false, 9999)]
static void AttachToonEvAdjustmentCurve()
{
var go = Selection.activeGameObject;
if (go == null)
go.AddComponent<ModelToonEvAdjustment>();
else
{
Debug.LogError("Please, select a GameObject you want to attach.");
}
}
}
}

View File

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