Remove : 불필요 스크립트 제거
This commit is contained in:
parent
7bb4cb5c00
commit
4bf67212e1
@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ae0a68acee725e141b02318f249f7990
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@ -1,179 +0,0 @@
|
|||||||
Shader "NiloToon/Environment/Reflection Demo"
|
|
||||||
{
|
|
||||||
Properties
|
|
||||||
{
|
|
||||||
[Header(Base Properties)]
|
|
||||||
_BaseMap ("Base Map", 2D) = "white" {}
|
|
||||||
_BaseColor ("Base Color", Color) = (1, 1, 1, 1)
|
|
||||||
|
|
||||||
[Header(Surface Properties)]
|
|
||||||
_Metallic ("Metallic", Range(0, 1)) = 0.5
|
|
||||||
_Smoothness ("Smoothness", Range(0, 1)) = 0.5
|
|
||||||
|
|
||||||
[Header(Normal)]
|
|
||||||
_BumpMap ("Normal Map", 2D) = "bump" {}
|
|
||||||
_BumpScale ("Normal Scale", Float) = 1.0
|
|
||||||
|
|
||||||
[Header(Planar Reflection)]
|
|
||||||
[Toggle] _EnablePlanarReflection ("Enable Planar Reflection", Float) = 1
|
|
||||||
_ReflectionIntensity ("Reflection Intensity", Range(0, 2)) = 1.0
|
|
||||||
_ReflectionTintColor ("Reflection Tint", Color) = (1, 1, 1, 1)
|
|
||||||
_ReflectionFresnel ("Fresnel Power", Range(0.1, 5)) = 1.5
|
|
||||||
_ReflectionDistortion ("Distortion", Range(0, 0.1)) = 0.02
|
|
||||||
_ReflectionDepthFade ("Depth Fade", Range(0, 10)) = 1.0
|
|
||||||
_ReflectionBlurRadius ("Blur Radius", Range(0, 2)) = 0.5
|
|
||||||
|
|
||||||
[Header(Advanced)]
|
|
||||||
_Cutoff ("Alpha Cutoff", Range(0, 1)) = 0.5
|
|
||||||
|
|
||||||
// Unity Standard Properties
|
|
||||||
_Surface ("Surface Type", Float) = 0.0
|
|
||||||
}
|
|
||||||
|
|
||||||
SubShader
|
|
||||||
{
|
|
||||||
Tags
|
|
||||||
{
|
|
||||||
"RenderType" = "Opaque"
|
|
||||||
"RenderPipeline" = "UniversalPipeline"
|
|
||||||
"Queue" = "Geometry"
|
|
||||||
}
|
|
||||||
|
|
||||||
LOD 300
|
|
||||||
|
|
||||||
Pass
|
|
||||||
{
|
|
||||||
Name "ForwardLit"
|
|
||||||
Tags { "LightMode" = "UniversalForward" }
|
|
||||||
|
|
||||||
HLSLPROGRAM
|
|
||||||
#pragma target 3.0
|
|
||||||
|
|
||||||
// Universal Pipeline keywords
|
|
||||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
|
|
||||||
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
|
||||||
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
|
|
||||||
#pragma multi_compile_fragment _ _SHADOWS_SOFT
|
|
||||||
#pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION
|
|
||||||
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
|
|
||||||
#pragma multi_compile _ SHADOWS_SHADOWMASK
|
|
||||||
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
|
||||||
#pragma multi_compile _ LIGHTMAP_ON
|
|
||||||
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
|
|
||||||
#pragma multi_compile_fog
|
|
||||||
|
|
||||||
// Material keywords
|
|
||||||
#pragma shader_feature_local _NORMALMAP
|
|
||||||
#pragma shader_feature_local _METALLICSPECGLOSSMAP
|
|
||||||
#pragma shader_feature_local _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
|
||||||
#pragma shader_feature_local _OCCLUSIONMAP
|
|
||||||
#pragma shader_feature_local _EMISSION
|
|
||||||
#pragma shader_feature_local _ALPHATEST_ON
|
|
||||||
#pragma shader_feature_local _ALPHAPREMULTIPLY_ON
|
|
||||||
#pragma shader_feature_local _RECEIVE_SHADOWS_OFF
|
|
||||||
|
|
||||||
// Custom keywords for reflection
|
|
||||||
#pragma shader_feature_local _ENABLE_PLANAR_REFLECTION
|
|
||||||
#pragma shader_feature_local _REFLECTION_DEPTH_FADE
|
|
||||||
|
|
||||||
// Instancing
|
|
||||||
#pragma multi_compile_instancing
|
|
||||||
#pragma multi_compile _ DOTS_INSTANCING_ON
|
|
||||||
|
|
||||||
#pragma vertex LitPassVertex
|
|
||||||
#pragma fragment LitPassFragment
|
|
||||||
|
|
||||||
// Include URP Lit shaders (NiloToon extension will be applied globally)
|
|
||||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl"
|
|
||||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/LitForwardPass.hlsl"
|
|
||||||
|
|
||||||
ENDHLSL
|
|
||||||
}
|
|
||||||
|
|
||||||
// Shadow Caster Pass
|
|
||||||
Pass
|
|
||||||
{
|
|
||||||
Name "ShadowCaster"
|
|
||||||
Tags { "LightMode" = "ShadowCaster" }
|
|
||||||
|
|
||||||
ZWrite On
|
|
||||||
ZTest LEqual
|
|
||||||
ColorMask 0
|
|
||||||
Cull[_Cull]
|
|
||||||
|
|
||||||
HLSLPROGRAM
|
|
||||||
#pragma target 2.0
|
|
||||||
|
|
||||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
|
||||||
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
|
||||||
|
|
||||||
#pragma multi_compile_instancing
|
|
||||||
#pragma multi_compile _ DOTS_INSTANCING_ON
|
|
||||||
|
|
||||||
#pragma vertex ShadowPassVertex
|
|
||||||
#pragma fragment ShadowPassFragment
|
|
||||||
|
|
||||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl"
|
|
||||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/ShadowCasterPass.hlsl"
|
|
||||||
ENDHLSL
|
|
||||||
}
|
|
||||||
|
|
||||||
// Depth Only Pass
|
|
||||||
Pass
|
|
||||||
{
|
|
||||||
Name "DepthOnly"
|
|
||||||
Tags { "LightMode" = "DepthOnly" }
|
|
||||||
|
|
||||||
ZWrite On
|
|
||||||
ColorMask 0
|
|
||||||
Cull[_Cull]
|
|
||||||
|
|
||||||
HLSLPROGRAM
|
|
||||||
#pragma target 2.0
|
|
||||||
|
|
||||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
|
||||||
#pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
|
||||||
|
|
||||||
#pragma multi_compile_instancing
|
|
||||||
#pragma multi_compile _ DOTS_INSTANCING_ON
|
|
||||||
|
|
||||||
#pragma vertex DepthOnlyVertex
|
|
||||||
#pragma fragment DepthOnlyFragment
|
|
||||||
|
|
||||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl"
|
|
||||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/DepthOnlyPass.hlsl"
|
|
||||||
ENDHLSL
|
|
||||||
}
|
|
||||||
|
|
||||||
// Meta Pass (for Lightmapping)
|
|
||||||
Pass
|
|
||||||
{
|
|
||||||
Name "Meta"
|
|
||||||
Tags { "LightMode" = "Meta" }
|
|
||||||
|
|
||||||
Cull Off
|
|
||||||
|
|
||||||
HLSLPROGRAM
|
|
||||||
#pragma target 2.0
|
|
||||||
|
|
||||||
#pragma shader_feature EDITOR_VISUALIZATION
|
|
||||||
#pragma shader_feature_local_fragment _SPECULAR_SETUP
|
|
||||||
#pragma shader_feature_local_fragment _EMISSION
|
|
||||||
#pragma shader_feature_local_fragment _METALLICSPECGLOSSMAP
|
|
||||||
#pragma shader_feature_local_fragment _ALPHATEST_ON
|
|
||||||
#pragma shader_feature_local_fragment _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
|
|
||||||
#pragma shader_feature_local _ _DETAIL_MULX2 _DETAIL_SCALED
|
|
||||||
|
|
||||||
#pragma vertex UniversalVertexMeta
|
|
||||||
#pragma fragment UniversalFragmentMeta
|
|
||||||
|
|
||||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl"
|
|
||||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/LitMetaPass.hlsl"
|
|
||||||
|
|
||||||
ENDHLSL
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomEditor "UnityEditor.Rendering.Universal.ShaderGUI.LitShader"
|
|
||||||
Fallback "Hidden/Universal Render Pipeline/FallbackError"
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 6b78a61e45607f744b59e4cfdd9d4b2a
|
|
||||||
ShaderImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
defaultTextures: []
|
|
||||||
nonModifiableTextures: []
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@ -1,202 +0,0 @@
|
|||||||
using UnityEngine;
|
|
||||||
using PlanarReflections5;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// NiloToon Environment 셰이더와 PIDI Planar Reflections 5를 연동하는 브리지 스크립트
|
|
||||||
/// </summary>
|
|
||||||
[System.Serializable]
|
|
||||||
public class NiloToonReflectionSettings
|
|
||||||
{
|
|
||||||
[Header("Reflection Control")]
|
|
||||||
[Range(0f, 1f)]
|
|
||||||
public float reflectionIntensity = 1.0f;
|
|
||||||
|
|
||||||
[ColorUsage(false)]
|
|
||||||
public Color reflectionTintColor = Color.white;
|
|
||||||
|
|
||||||
[Range(0.1f, 5f)]
|
|
||||||
public float fresnelPower = 1.5f;
|
|
||||||
|
|
||||||
[Range(0f, 0.1f)]
|
|
||||||
public float distortionStrength = 0.02f;
|
|
||||||
|
|
||||||
[Range(0f, 10f)]
|
|
||||||
public float depthFade = 1.0f;
|
|
||||||
|
|
||||||
[Range(0f, 2f)]
|
|
||||||
public float blurRadius = 0.5f;
|
|
||||||
|
|
||||||
[Header("Advanced")]
|
|
||||||
public bool enableReflection = true;
|
|
||||||
public bool useDepthFade = false;
|
|
||||||
public LayerMask reflectionLayers = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
[RequireComponent(typeof(PlanarReflectionRenderer))]
|
|
||||||
public class NiloToonPlanarReflectionBridge : MonoBehaviour
|
|
||||||
{
|
|
||||||
[Header("NiloToon Integration Settings")]
|
|
||||||
public NiloToonReflectionSettings reflectionSettings = new NiloToonReflectionSettings();
|
|
||||||
|
|
||||||
[Header("Shader Keywords")]
|
|
||||||
[SerializeField] private bool enableReflectionDepthFade = false;
|
|
||||||
|
|
||||||
private PlanarReflectionRenderer planarRenderer;
|
|
||||||
private Camera[] monitoredCameras;
|
|
||||||
|
|
||||||
// 셰이더 프로퍼티 IDs (성능 최적화)
|
|
||||||
private static readonly int EnablePlanarReflectionID = Shader.PropertyToID("_EnablePlanarReflection");
|
|
||||||
private static readonly int ReflectionIntensityID = Shader.PropertyToID("_ReflectionIntensity");
|
|
||||||
private static readonly int ReflectionTintColorID = Shader.PropertyToID("_ReflectionTintColor");
|
|
||||||
private static readonly int ReflectionFresnelID = Shader.PropertyToID("_ReflectionFresnel");
|
|
||||||
private static readonly int ReflectionDistortionID = Shader.PropertyToID("_ReflectionDistortion");
|
|
||||||
private static readonly int ReflectionDepthFadeID = Shader.PropertyToID("_ReflectionDepthFade");
|
|
||||||
private static readonly int ReflectionBlurRadiusID = Shader.PropertyToID("_ReflectionBlurRadius");
|
|
||||||
|
|
||||||
private void Awake()
|
|
||||||
{
|
|
||||||
planarRenderer = GetComponent<PlanarReflectionRenderer>();
|
|
||||||
if (planarRenderer == null)
|
|
||||||
{
|
|
||||||
Debug.LogError("NiloToonPlanarReflectionBridge requires PlanarReflectionRenderer component!");
|
|
||||||
enabled = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Start()
|
|
||||||
{
|
|
||||||
// 초기 설정 적용
|
|
||||||
UpdateShaderProperties();
|
|
||||||
UpdateShaderKeywords();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Update()
|
|
||||||
{
|
|
||||||
// 실시간으로 셰이더 프로퍼티 업데이트
|
|
||||||
UpdateShaderProperties();
|
|
||||||
|
|
||||||
// 카메라 변경 감지 및 업데이트
|
|
||||||
if (monitoredCameras == null || monitoredCameras.Length != Camera.allCamerasCount)
|
|
||||||
{
|
|
||||||
UpdateCameraReferences();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateShaderProperties()
|
|
||||||
{
|
|
||||||
// Global 셰이더 프로퍼티 업데이트
|
|
||||||
Shader.SetGlobalFloat(EnablePlanarReflectionID, reflectionSettings.enableReflection ? 1.0f : 0.0f);
|
|
||||||
Shader.SetGlobalFloat(ReflectionIntensityID, reflectionSettings.reflectionIntensity);
|
|
||||||
Shader.SetGlobalVector(ReflectionTintColorID, new Vector4(
|
|
||||||
reflectionSettings.reflectionTintColor.r,
|
|
||||||
reflectionSettings.reflectionTintColor.g,
|
|
||||||
reflectionSettings.reflectionTintColor.b,
|
|
||||||
reflectionSettings.reflectionTintColor.a));
|
|
||||||
Shader.SetGlobalFloat(ReflectionFresnelID, reflectionSettings.fresnelPower);
|
|
||||||
Shader.SetGlobalFloat(ReflectionDistortionID, reflectionSettings.distortionStrength);
|
|
||||||
Shader.SetGlobalFloat(ReflectionDepthFadeID, reflectionSettings.depthFade);
|
|
||||||
Shader.SetGlobalFloat(ReflectionBlurRadiusID, reflectionSettings.blurRadius);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateShaderKeywords()
|
|
||||||
{
|
|
||||||
// 셰이더 키워드 업데이트
|
|
||||||
if (enableReflectionDepthFade && reflectionSettings.useDepthFade)
|
|
||||||
{
|
|
||||||
Shader.EnableKeyword("_REFLECTION_DEPTH_FADE");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Shader.DisableKeyword("_REFLECTION_DEPTH_FADE");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateCameraReferences()
|
|
||||||
{
|
|
||||||
monitoredCameras = new Camera[Camera.allCamerasCount];
|
|
||||||
Camera.GetAllCameras(monitoredCameras);
|
|
||||||
|
|
||||||
// Planar Reflection 설정을 카메라별로 동기화
|
|
||||||
if (planarRenderer != null && planarRenderer.Settings != null)
|
|
||||||
{
|
|
||||||
planarRenderer.Settings.reflectLayers = reflectionSettings.reflectionLayers;
|
|
||||||
planarRenderer.Settings.renderDepth = reflectionSettings.useDepthFade;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 특정 재질에 반사 설정을 적용합니다.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="material">적용할 재질</param>
|
|
||||||
public void ApplyToMaterial(Material material)
|
|
||||||
{
|
|
||||||
if (material == null) return;
|
|
||||||
|
|
||||||
material.SetFloat(EnablePlanarReflectionID, reflectionSettings.enableReflection ? 1.0f : 0.0f);
|
|
||||||
material.SetFloat(ReflectionIntensityID, reflectionSettings.reflectionIntensity);
|
|
||||||
material.SetVector(ReflectionTintColorID, new Vector4(
|
|
||||||
reflectionSettings.reflectionTintColor.r,
|
|
||||||
reflectionSettings.reflectionTintColor.g,
|
|
||||||
reflectionSettings.reflectionTintColor.b,
|
|
||||||
reflectionSettings.reflectionTintColor.a));
|
|
||||||
material.SetFloat(ReflectionFresnelID, reflectionSettings.fresnelPower);
|
|
||||||
material.SetFloat(ReflectionDistortionID, reflectionSettings.distortionStrength);
|
|
||||||
material.SetFloat(ReflectionDepthFadeID, reflectionSettings.depthFade);
|
|
||||||
material.SetFloat(ReflectionBlurRadiusID, reflectionSettings.blurRadius);
|
|
||||||
|
|
||||||
// 키워드 설정
|
|
||||||
if (enableReflectionDepthFade && reflectionSettings.useDepthFade)
|
|
||||||
{
|
|
||||||
material.EnableKeyword("_REFLECTION_DEPTH_FADE");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
material.DisableKeyword("_REFLECTION_DEPTH_FADE");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 씬의 모든 NiloToon Environment 재질에 설정을 적용합니다.
|
|
||||||
/// </summary>
|
|
||||||
public void ApplyToAllNiloToonMaterials()
|
|
||||||
{
|
|
||||||
Renderer[] renderers = FindObjectsOfType<Renderer>();
|
|
||||||
foreach (Renderer renderer in renderers)
|
|
||||||
{
|
|
||||||
foreach (Material mat in renderer.materials)
|
|
||||||
{
|
|
||||||
// NiloToon Environment 셰이더인지 확인 (이름으로 판별)
|
|
||||||
if (mat.shader.name.Contains("NiloToon") && mat.shader.name.Contains("Environment"))
|
|
||||||
{
|
|
||||||
ApplyToMaterial(mat);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnValidate()
|
|
||||||
{
|
|
||||||
// Inspector에서 값이 변경될 때 실시간 업데이트
|
|
||||||
if (Application.isPlaying)
|
|
||||||
{
|
|
||||||
UpdateShaderProperties();
|
|
||||||
UpdateShaderKeywords();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
[UnityEditor.MenuItem("Tools/NiloToon/Create Planar Reflection Bridge")]
|
|
||||||
private static void CreateBridge()
|
|
||||||
{
|
|
||||||
GameObject bridge = new GameObject("NiloToon Planar Reflection Bridge");
|
|
||||||
bridge.AddComponent<PlanarReflectionRenderer>();
|
|
||||||
bridge.AddComponent<NiloToonPlanarReflectionBridge>();
|
|
||||||
|
|
||||||
UnityEditor.Selection.activeGameObject = bridge;
|
|
||||||
UnityEditor.EditorGUIUtility.PingObject(bridge);
|
|
||||||
|
|
||||||
Debug.Log("NiloToon Planar Reflection Bridge가 생성되었습니다!");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 7e4f8a9b2c3d5e6f7a8b9c0d1e2f3a4b
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
BIN
Assets/Scripts/NiloToon_PlanarReflection_사용법.md
(Stored with Git LFS)
BIN
Assets/Scripts/NiloToon_PlanarReflection_사용법.md
(Stored with Git LFS)
Binary file not shown.
@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: a61c34d59640f5140b3974d1f4968189
|
|
||||||
TextScriptImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
Loading…
x
Reference in New Issue
Block a user