Fix : 배경 크기 다듬기

This commit is contained in:
user 2026-03-19 02:41:44 +09:00
parent 8dde743442
commit 1381c92bbd
8 changed files with 160 additions and 26 deletions

View File

@ -26,7 +26,6 @@ Material:
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _NORMALMAP
- _RECEIVE_NILOTOON_CHAR_SHADOW
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
@ -174,11 +173,11 @@ Material:
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _NiloToonCharShadowStrength: 1
- _NiloToonCharShadowStrength: 0.5
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveNiloToonCharShadow: 1
- _ReceiveNiloToonCharShadow: 0
- _ReceiveShadows: 1
- _ScreenSpaceOutlineIntensity: 1
- _ScreenSpaceOutlineWidth: 1

View File

@ -28,7 +28,6 @@ Material:
- _METALLICSPECGLOSSMAP
- _NORMALMAP
- _PARALLAXMAP
- _RECEIVE_NILOTOON_CHAR_SHADOW
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
@ -176,11 +175,11 @@ Material:
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _NiloToonCharShadowStrength: 1
- _NiloToonCharShadowStrength: 0.5
- _OcclusionStrength: 1
- _Parallax: 0.0353
- _QueueOffset: 0
- _ReceiveNiloToonCharShadow: 1
- _ReceiveNiloToonCharShadow: 0
- _ReceiveShadows: 1
- _ScreenSpaceOutlineIntensity: 1
- _ScreenSpaceOutlineWidth: 1

View File

@ -24,8 +24,7 @@ Material:
m_Shader: {fileID: 4800000, guid: 50e19b7c9fbe3324e978246ad9789e96, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _RECEIVE_NILOTOON_CHAR_SHADOW
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
@ -173,11 +172,11 @@ Material:
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0.53
- _NiloToonCharShadowStrength: 1
- _NiloToonCharShadowStrength: 0.5
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveNiloToonCharShadow: 1
- _ReceiveNiloToonCharShadow: 0
- _ReceiveShadows: 1
- _ScreenSpaceOutlineIntensity: 1
- _ScreenSpaceOutlineWidth: 1

View File

@ -24,8 +24,7 @@ Material:
m_Shader: {fileID: 4800000, guid: 50e19b7c9fbe3324e978246ad9789e96, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _RECEIVE_NILOTOON_CHAR_SHADOW
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
@ -173,11 +172,11 @@ Material:
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _NiloToonCharShadowStrength: 1
- _NiloToonCharShadowStrength: 0.5
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveNiloToonCharShadow: 1
- _ReceiveNiloToonCharShadow: 0
- _ReceiveShadows: 1
- _ScreenSpaceOutlineIntensity: 1
- _ScreenSpaceOutlineWidth: 1

View File

@ -174,7 +174,7 @@ Material:
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0.244
- _NiloToonCharShadowStrength: 1
- _NiloToonCharShadowStrength: 0.5
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0

View File

@ -9,6 +9,8 @@ namespace Streamingle.Background.Editor
[CustomEditor(typeof(SkyboxTimeController))]
public class SkyboxTimeControllerEditor : UnityEditor.Editor
{
private const string FoldoutKeyPrefix = "SkyboxTimeController_Foldout_";
public override VisualElement CreateInspectorGUI()
{
var root = new VisualElement();
@ -68,8 +70,11 @@ namespace Streamingle.Background.Editor
root.Add(WrapSection(CreateStageFoldout("Stage 2 Settings", "stage2")));
root.Add(WrapSection(CreateStageFoldout("Stage 3 Settings", "stage3")));
// ── NiloToon Light Override ──
root.Add(WrapSection(CreateNiloToonSection()));
// ── Custom Material Properties ──
var matPropFoldout = CreateFoldout("Custom Material Properties", true);
var matPropFoldout = CreateFoldout("Custom Material Properties", false);
matPropFoldout.Add(CreatePropField("materialPropertyOverrides"));
root.Add(WrapSection(matPropFoldout));
@ -85,7 +90,6 @@ namespace Streamingle.Background.Editor
return root;
}
// section wrapper: 배경 스타일만 담당
private VisualElement WrapSection(VisualElement content)
{
var section = new VisualElement();
@ -94,22 +98,103 @@ namespace Streamingle.Background.Editor
return section;
}
// foldout 생성: 여기에 직접 콘텐츠를 Add
private Foldout CreateFoldout(string title, bool defaultOpen)
{
var foldout = new Foldout { text = title, value = defaultOpen };
string key = FoldoutKeyPrefix + title;
bool savedState = SessionState.GetBool(key, defaultOpen);
var foldout = new Foldout { text = title, value = savedState };
foldout.AddToClassList("section-foldout");
foldout.RegisterValueChangedCallback(evt =>
{
if (evt.target == foldout)
SessionState.SetBool(key, evt.newValue);
});
return foldout;
}
private Foldout CreateStageFoldout(string title, string propName)
{
var foldout = CreateFoldout(title, false);
foldout.Add(CreatePropField($"{propName}.lightColor"));
foldout.Add(CreatePropField($"{propName}.lightIntensity"));
foldout.Add(CreatePropField($"{propName}.lightRotation"));
foldout.Add(CreatePropField($"{propName}.skyboxExposure"));
foldout.Add(CreatePropField($"{propName}.skyboxTint"));
// Directional Light 헤더
var lightHeader = new Label("Directional Light");
lightHeader.style.unityFontStyleAndWeight = FontStyle.Bold;
lightHeader.style.marginTop = 4;
foldout.Add(lightHeader);
foldout.Add(CreatePropField($"{propName}.lightColor", "Light Color"));
foldout.Add(CreatePropField($"{propName}.lightIntensity", "Light Intensity"));
foldout.Add(CreatePropField($"{propName}.lightRotation", "Light Rotation"));
// Skybox 헤더
var skyHeader = new Label("Skybox");
skyHeader.style.unityFontStyleAndWeight = FontStyle.Bold;
skyHeader.style.marginTop = 8;
foldout.Add(skyHeader);
foldout.Add(CreatePropField($"{propName}.skyboxExposure", "Skybox Exposure"));
foldout.Add(CreatePropField($"{propName}.skyboxTint", "Skybox Tint"));
return foldout;
}
private VisualElement CreateNiloToonSection()
{
var foldout = CreateFoldout("NiloToon Light Override", false);
foldout.Add(CreatePropField("niloToonLightOverrider", "Overrider"));
// ── Color ──
var colorToggle = CreatePropField("niloToonSeparateColor", "Separate Color");
foldout.Add(colorToggle);
var colorContainer = new VisualElement();
colorContainer.Add(CreatePropField("niloToonColorStage1", "Color Stage 1"));
colorContainer.Add(CreatePropField("niloToonColorStage2", "Color Stage 2"));
colorContainer.Add(CreatePropField("niloToonColorStage3", "Color Stage 3"));
foldout.Add(colorContainer);
// ── Intensity ──
var intensityToggle = CreatePropField("niloToonSeparateIntensity", "Separate Intensity");
foldout.Add(intensityToggle);
var intensityContainer = new VisualElement();
intensityContainer.Add(CreatePropField("niloToonIntensityStage1", "Intensity Stage 1"));
intensityContainer.Add(CreatePropField("niloToonIntensityStage2", "Intensity Stage 2"));
intensityContainer.Add(CreatePropField("niloToonIntensityStage3", "Intensity Stage 3"));
foldout.Add(intensityContainer);
// Visibility: separate 꺼져 있으면 숨김
void UpdateColorVisibility()
{
var prop = serializedObject.FindProperty("niloToonSeparateColor");
colorContainer.style.display = prop.boolValue ? DisplayStyle.Flex : DisplayStyle.None;
}
void UpdateIntensityVisibility()
{
var prop = serializedObject.FindProperty("niloToonSeparateIntensity");
intensityContainer.style.display = prop.boolValue ? DisplayStyle.Flex : DisplayStyle.None;
}
colorToggle.RegisterValueChangeCallback(_ => UpdateColorVisibility());
intensityToggle.RegisterValueChangeCallback(_ => UpdateIntensityVisibility());
// 초기 visibility
foldout.schedule.Execute(() =>
{
UpdateColorVisibility();
UpdateIntensityVisibility();
});
// info label
var info = new Label("Off일 때 디렉셔널 라이트 값을 그대로 사용합니다.");
info.style.color = new Color(0.5f, 0.5f, 0.5f);
info.style.fontSize = 10;
info.style.marginTop = 4;
foldout.Add(info);
return foldout;
}
@ -118,6 +203,11 @@ namespace Streamingle.Background.Editor
return new PropertyField(serializedObject.FindProperty(path));
}
private PropertyField CreatePropField(string path, string label)
{
return new PropertyField(serializedObject.FindProperty(path), label);
}
private Button CreateQuickButton(string label, float value, Slider slider, SkyboxTimeController controller)
{
var btn = new Button(() =>

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using NiloToon.NiloToonURP;
using UnityEngine;
namespace Streamingle.Background
@ -65,6 +66,22 @@ namespace Streamingle.Background
[Tooltip("머티리얼의 임의 프로퍼티를 3단계로 보간 제어")]
public List<MaterialPropertyOverride> materialPropertyOverrides = new List<MaterialPropertyOverride>();
// ───────────────────────── NiloToon Light Override ─────────────────────────
[Tooltip("NiloToon 캐릭터 메인 라이트 오버라이더 (디렉셔널 라이트와 동기화)")]
public NiloToonCharacterMainLightOverrider niloToonLightOverrider;
[Tooltip("NiloToon 라이트 컬러를 별도로 지정할지 여부 (false면 디렉셔널 라이트와 동일)")]
public bool niloToonSeparateColor = false;
public Color niloToonColorStage1 = Color.white;
public Color niloToonColorStage2 = Color.white;
public Color niloToonColorStage3 = Color.white;
[Tooltip("NiloToon 라이트 Intensity를 별도로 지정할지 여부 (false면 디렉셔널 라이트와 동일)")]
public bool niloToonSeparateIntensity = false;
public float niloToonIntensityStage1 = 1f;
public float niloToonIntensityStage2 = 1f;
public float niloToonIntensityStage3 = 1f;
// ───────────────────────── Ambient ─────────────────────────
[Tooltip("Ambient 컬러도 함께 보간")]
public bool controlAmbient = true;
@ -172,6 +189,37 @@ namespace Streamingle.Background
directionalLight.transform.rotation = Quaternion.Euler(current.lightRotation);
}
// ── NiloToon Light Override ──
if (niloToonLightOverrider != null)
{
// Direction: 디렉셔널 라이트와 동일한 rotation 적용
niloToonLightOverrider.transform.rotation = Quaternion.Euler(current.lightRotation);
// Color
if (niloToonSeparateColor)
{
niloToonLightOverrider.color = t < 0.5f
? Color.Lerp(niloToonColorStage1, niloToonColorStage2, t * 2f)
: Color.Lerp(niloToonColorStage2, niloToonColorStage3, (t - 0.5f) * 2f);
}
else
{
niloToonLightOverrider.color = current.lightColor;
}
// Intensity
if (niloToonSeparateIntensity)
{
niloToonLightOverrider.intensity = t < 0.5f
? Mathf.Lerp(niloToonIntensityStage1, niloToonIntensityStage2, t * 2f)
: Mathf.Lerp(niloToonIntensityStage2, niloToonIntensityStage3, (t - 0.5f) * 2f);
}
else
{
niloToonLightOverrider.intensity = current.lightIntensity;
}
}
// ── Ambient ──
if (controlAmbient)
{