2026-03-19 커스텀 셰이더를 통한 디졸브 효과

This commit is contained in:
2026-03-19 01:39:57 +09:00
parent c7ae384376
commit b6b90e6ad6
5 changed files with 1196 additions and 2 deletions

View File

@@ -0,0 +1,483 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Gold_Custom_Mat
m_Shader: {fileID: 4800000, guid: d6e83dd11f9bce64592407669f7cc8e7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _RIMLIGHTOVERLAY
- _USEOUTLINE
m_InvalidKeywords:
- N_F_EAL_ON
- N_F_O_ON
- N_F_RDC_ON
- N_F_RELGI_ON
- N_F_SS_ON
- N_F_TRANSAFFSHA
- N_F_TRANSAFFSHA_ON
- _CUSTOMLIGHTDIRECTIONFOLLOWOBJECTROTATION_OFF
- _GIFLATSHADE_OFF
- _GLOSSTEXTUREFOLLOWOBJECTROTATION_OFF
- _LIGHTAFFECTOUTLINECOLOR_OFF
- _LIGHTAFFECTRIMLIGHTCOLOR_OFF
- _LIGHTAFFECTSHADOW_OFF
- _LIGHTFALLOFFAFFECTSHADOWT_OFF
- _LIGIGNOYNORDIR_OFF
- _MCIALO_OFF
- _MIXMAINTEXTOOUTLINE_OFF
- _MVCOL_OFF
- _OUTLINEWIDTHAFFECTEDBYVIEWDISTANCE_OFF
- _PSGLOTEX_OFF
- _SELFSHADOWAFFECTEDBYLIGHTSHADOWSTRENGTH_OFF
- _SELFSHADOWSHADOWTATVIEWDIRECTION_OFF
- _SHOWNORMAL_OFF
- _SPECMODE_OFF
- _STIL_OFF
- _TEXTUREPATTERNSTYLE_OFF
- _USESECONDARYCUTOUT_OFF
- _VERTEXCOLORBLUEAFFECTOUTLINEWITDH_OFF
- _VERTEXCOLORGREENCONTROLSELFSHADOWTHRESHOLD_OFF
- _VERTEXCOLORREDCONTROLSMOOTHOBJECTNORMAL_OFF
m_LightmapFlags: 0
m_EnableInstancingVariants: 1
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DecalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FReflection:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _GlossTexture:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _LogoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MCap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MCapMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MaskGloss:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MaskReflection:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MaskSelfLit:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MaskTransparency:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 2800000, guid: f25cebb1e93a5134bafb22fdd5f6c8b1, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OutlineWidthControl:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _PTexture:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _PatternMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SecondaryCutout:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ShadowColorTexture:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ShadowT:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Texture2D:
m_Texture: {fileID: 2800000, guid: 59d1283caeec8924fb66168d2e2e5413, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- Brightness: 2
- _AAS: 0.0001
- _AddPrecomputedVelocity: 0
- _AlpToCov: 0
- _AlphaBaseCutout: 1
- _AlphaClip: 0
- _AlphaToMask: 0
- _AmbiantStrength: 1
- _BUILTIN_QueueControl: -1
- _BUILTIN_QueueOffset: 0
- _BleModDest: 0
- _BleModSour: 1
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _Brightness: 1
- _BumpScale: 1
- _CastShadows: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _ClipAdju: 0
- _Compa: 4
- _ComputeMeshIndex: 0
- _Cull: 2
- _Culling: 2
- _CustomLightDirectionFollowObjectRotation: 0
- _CustomLightDirectionIntensity: 0
- _Cutoff: 0.5
- _Cutout: 0.5
- _DecalBlend: 0
- _DecalUVSet: 1
- _DepthThreshold: 900
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DirectionalLightIntensity: 0
- _DissolveNoiseScale: 50
- _DissolvePower: 0
- _DoubleSidedOutline: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _DynamicNoisyOutline: 0
- _EdgeThickness: 0.2
- _EnvironmentReflections: 1
- _EnvironmentalLightingIntensity: 1
- _FarDistanceMaxWidth: 10
- _Fresnel: 10
- _GIFlatShade: 0
- _GIShadeThreshold: 0
- _GlossColorPower: 10
- _GlossIntensity: 1
- _GlossMapScale: 0
- _GlossSoftness: 0
- _GlossTextureFollowLight: 0
- _GlossTextureFollowObjectRotation: 0
- _GlossTextureRotate: 0
- _GlossTextureSoftness: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Glow_Edge_Width: 1
- _HighlightColorPower: 1
- _LLI_Max: 1
- _LLI_Min: 0
- _LigIgnoYNorDir: 0
- _LightAffectOutlineColor: 0
- _LightAffectRimLightColor: 0
- _LightAffectShadow: 0
- _LightFalloffAffectShadowT: 0
- _LightFalloffSoftness: 1
- _LightHeightDirectionStrength: 1
- _LightIntensity: 1
- _MCIALO: 0
- _MCapIntensity: 1
- _MVCOL: 0
- _MaiColPo: 0.8
- _MaskEdgeHigh_1: 0.01
- _MaskEdgeHigh_2: 0.01
- _MaskEdgeHigh_3: 0.01
- _MaskEdgeHigh_4: 0.01
- _MaskEdgeHigh_5: 0.01
- _MaskEdgeHigh_6: 0.01
- _MaskEdgeLow_1: 0.01
- _MaskEdgeLow_2: 0.01
- _MaskEdgeLow_3: 0.01
- _MaskEdgeLow_4: 0.01
- _MaskEdgeLow_5: 0.01
- _MaskEdgeLow_6: 0.01
- _MaxFadDistance: 2
- _Metallic: 0
- _MinFadDistance: 0
- _MixMainTexToOutline: 0
- _MultipleLightSharpness: 0
- _MultipleStrength: 1
- _N_F_ANIS: 0
- _N_F_CA: 0
- _N_F_CLD: 0
- _N_F_CO: 0
- _N_F_COEDGL: 0
- _N_F_DCS: 0
- _N_F_DDMD: 0
- _N_F_EAL: 1
- _N_F_ESSAO: 0
- _N_F_FR: 0
- _N_F_GLO: 0
- _N_F_GLOT: 0
- _N_F_HDLS: 0
- _N_F_HPSS: 0
- _N_F_LLI: 0
- _N_F_MC: 0
- _N_F_MSSOLTFO: 0
- _N_F_NFD: 0
- _N_F_NLASOBF: 0
- _N_F_NM: 0
- _N_F_O: 1
- _N_F_OFLMB: 0
- _N_F_PA: 0
- _N_F_PT: 0
- _N_F_R: 0
- _N_F_RDC: 1
- _N_F_RL: 0
- _N_F_SCO: 0
- _N_F_SCT: 0
- _N_F_SE: 0
- _N_F_SL: 0
- _N_F_SLMM: 0
- _N_F_SON: 0
- _N_F_SS: 1
- _N_F_ST: 0
- _N_F_STIAL: 0
- _N_F_STIS: 0
- _N_F_STSDFM: 0
- _N_F_TP: 0
- _NoiTexAffStraWidt: 0
- _NoisTexInten: 1
- _NoiseSize: 100
- _NoisyOutlineIntensity: 0
- _NormalMapIntensity: 1
- _OcclusionStrength: 1
- _Opacity: 1
- _Oper: 0
- _OutStenPass: 0
- _OutlineAlpha: 1
- _OutlineColor: 0
- _OutlineDistance: 2
- _OutlineExtrudeMethod: 0
- _OutlineThickness: 2
- _OutlineVertexColorWeight: 0
- _OutlineWidth: 0.5
- _OutlineWidthAffectedByViewDistance: 0
- _OutlineZPostionInCamera: 0
- _OverallShadowColorPower: 1
- _PADist: 0
- _PASize: 0.5
- _PASmooTrans: 1
- _PSGLOTEX: 0
- _PTexturePower: 1
- _Parallax: 0.005
- _PatternBlend: 1
- _PatternUVSet: 0
- _PointSpotlightIntensity: 0
- _PresAdju: 1
- _QueueControl: 0
- _QueueOffset: 0
- _RELG: 1
- _ReceiveShadows: 1
- _RecieveShadows: 0
- _ReduSha: 0.5
- _RefMetallic: 0
- _RefVal: 0
- _ReflectionIntensity: 0
- _RimLigInt: 1
- _RimLightColorPower: 10
- _RimLightInLight: 1
- _RimLightSoftness: 1
- _RimLightUnfill: 1.5
- _RimlightPower: 0.5
- _RimlightSharpness: 0.5
- _SPECIN: 1
- _SPECMODE: 0
- _STIL: 0
- _Saturation: 1
- _SelfLitHighContrast: 1
- _SelfLitIntensity: 0
- _SelfLitPower: 2
- _SelfShadowAffectedByLightShadowStrength: 0
- _SelfShadowHardness: 1
- _SelfShadowRealTimeShadowColorPower: 1
- _SelfShadowRealtimeShadowIntensity: 1
- _SelfShadowShadowTAtViewDirection: 0
- _SelfShadowThreshold: 0.93
- _ShadowColorTexturePower: 0
- _ShadowEdge: 0.042
- _ShadowHardness: 0
- _ShadowSharpness: 0.12
- _ShadowTColorPower: 1
- _ShadowTHardness: 1
- _ShadowTIntensity: 1
- _ShadowTLightThreshold: 50
- _ShadowTShadowThreshold: 0
- _ShifAnis: 0
- _Shininess: 10
- _ShowInAmbientLightShadowIntensity: 1
- _ShowInAmbientLightShadowThreshold: 0.4
- _ShowNormal: 0
- _SimTrans: 0
- _SkinMatrixIndex: 0
- _SmoothObjectNormal: 0
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _StencilPass: 2
- _StencilReadMask: 255
- _StencilWriteMask: 221
- _StraWidt: 10
- _Surface: 0
- _TEXMCOLINT: 1
- _TRANSMODE: 0
- _TexturePatternStyle: 0
- _TrailSize: 1.5
- _TransAffSha: 1
- _TransparentThreshold: 0
- _TriPlaBlend: 4
- _TriPlaTile: 1
- _UseAmbiant: 1
- _UseCustomTexture: 0
- _UseMaskMap: 0
- _UseMultipleLights: 1
- _UseNormalMap: 0
- _UseOutline: 1
- _UseRimlight: 0
- _UseRimlightOverlay: 1
- _UseSecondaryCutout: 0
- _UseTLB: 0
- _VertexColorBlueAffectOutlineWitdh: 0
- _VertexColorGreenControlSelfShadowThreshold: 0
- _VertexColorRedControlSmoothObjectNormal: 0
- _WorkflowMode: 1
- _ZTest: 4
- _ZWrite: 1
- _ZWriteControl: 0
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Color_1: {r: 1, g: 0, b: 0, a: 0}
- _Color_2: {r: 0, g: 1, b: 0, a: 0}
- _Color_3: {r: 0, g: 0, b: 1, a: 0}
- _Color_4: {r: 0.9727612, g: 1, b: 0, a: 0}
- _Color_5: {r: 0, g: 0.9845986, b: 1, a: 0}
- _Color_6: {r: 1, g: 0, b: 0.988061, a: 0}
- _Color_7: {r: 1, g: 1, b: 1, a: 0}
- _Color_8: {r: 0.50314456, g: 0.50314456, b: 0.50314456, a: 0}
- _Color_9: {r: 0, g: 0, b: 0, a: 0}
- _CustomLightDirection: {r: 0, g: 0, b: 10, a: 0}
- _DecalColor_1: {r: 1, g: 1, b: 1, a: 1}
- _DecalColor_2: {r: 0.557, g: 0.557, b: 0.557, a: 1}
- _DecalColor_3: {r: 0, g: 0, b: 0, a: 1}
- _DecalScale: {r: 1, g: 1, b: 0, a: 0}
- _EdgeColor: {r: 1.0039216, g: 1.0039216, b: 128, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FresnelColor: {r: 0, g: 0, b: 0, a: 0}
- _GlossColor: {r: 1, g: 1, b: 1, a: 1}
- _Glow_Color: {r: 1, g: 1, b: 1, a: 1}
- _HighlightColor: {r: 1, g: 1, b: 1, a: 1}
- _LogoColor_1: {r: 0, g: 0, b: 0, a: 0}
- _LogoColor_2: {r: 0, g: 0, b: 0, a: 0}
- _LogoColor_3: {r: 0, g: 0, b: 0, a: 0}
- _LogoScale: {r: 0, g: 0, b: 0, a: 0}
- _MainColor: {r: 1, g: 1, b: 1, a: 1}
- _ObjPosi: {r: 0, g: 0, b: 0, a: 0}
- _ObjectForward: {r: 0, g: 0, b: 0, a: 0}
- _ObjectRight: {r: 0, g: 0, b: 0, a: 0}
- _OutlineColor: {r: 0, g: 0, b: 0, a: 1}
- _OutlineOffset: {r: 0, g: 0, b: 0, a: 1}
- _OverallShadowColor: {r: 0, g: 0, b: 0, a: 1}
- _PTCol: {r: 0, g: 0, b: 0, a: 1}
- _PatternColor_1: {r: 1, g: 1, b: 1, a: 1}
- _PatternColor_2: {r: 0.5568628, g: 0.5568628, b: 0.5568628, a: 1}
- _PatternColor_3: {r: 0, g: 0, b: 0, a: 1}
- _PatternScale: {r: 50, g: 50, b: 0, a: 0}
- _PrevPosition: {r: 0, g: 0, b: 0, a: 0}
- _RimLightColor: {r: 1, g: 1, b: 1, a: 1}
- _RimlightColor: {r: 0, g: 0, b: 0, a: 0}
- _SSAOColor: {r: 0, g: 0, b: 0, a: 0}
- _SelfLitColor: {r: 1, g: 1, b: 1, a: 1}
- _SelfShadowRealTimeShadowColor: {r: 1, g: 1, b: 1, a: 1}
- _ShadowColor: {r: 0.75, g: 0.56624997, b: 0.56624997, a: 0}
- _ShadowEdgeColor: {r: 1, g: 0.77873063, b: 0.5943395, a: 0}
- _ShadowTColor: {r: 1, g: 1, b: 1, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
- _XYZPosition: {r: 0, g: 0, b: 0, a: 0}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2fdddac74fc6a694595c7b5a54cc3306
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,694 @@
Shader "BoZo/BMAC_Toon_Custom"
{
Properties
{
[MainTexture][NoScaleOffset]_Texture2D("Texture2D", 2D) = "white" {}
[Normal][NoScaleOffset]_NormalMap("NormalMap", 2D) = "bump" {}
[Header(Dissolve Options)]
_DissolvePower("Dissolve Power", Range(0, 1)) = 0.0
_DissolveNoiseScale("Dissolve Noise Scale", Float) = 50.0
_EdgeThickness("Edge Thickness", Range(0, 0.3)) = 0.03
[HDR] _EdgeColor("Edge Color", Color) = (5.0, 0.5, 0.5, 1.0) // HDR 강도를 높게 설정하세요
[Header(Colors Options)]
[Space(10)]
[Toggle(_USECUSTOMTEXTURE)]_UseCustomTexture("useCustomTexture", Float) = 0
_Color_1("Color_1", Color) = (1, 0, 0, 0)
_Color_2("Color_2", Color) = (0, 1, 0, 0)
_Color_3("Color_3", Color) = (0, 0, 1, 0)
_Color_4("Color_4", Color) = (0.9727613, 1, 0, 0)
_Color_5("Color_5", Color) = (0, 0.9845986, 1, 0)
_Color_6("Color_6", Color) = (1, 0, 0.988061, 0)
_Color_7("Color_7", Color) = (1, 1, 1, 0)
_Color_8("Color_8", Color) = (0.5031446, 0.5031446, 0.5031446, 0)
_Color_9("Color_9", Color) = (0, 0, 0, 0)
[Header(Outline Options)]
[Space(10)]
[Toggle(_USEOUTLINE)]_UseOutline("useOutline", Float) = 1
_OutlineColor("OutlineColor", Color) = (0, 0, 0, 0)
_OutlineDistance("OutlineDistance", Float) = 2
_OutlineVertexColorWeight("Outline VC Weight", Range(0, 1)) = 0 // 0이면 버텍스 컬러 무시, 1이면 원본 방식
_OutlineAlpha("Outline Alpha", Range(0, 1)) = 1.0
[Header(Lighting Options)]
[Space(10)]
[Toggle(_USENORMALMAP)]_UseNormalMap("UseNormalMap", Float) = 0
_LightHeightDirectionStrength("LightHeightDirectionStrength", Range(0, 1)) = 1
_Brightness("Brightness", Range(0, 2)) = 1
[Header(Rimlight Options)]
[Space(10)]
[Toggle(_USERIMLIGHT)]_UseRimlight("Use Rimlight", Float) = 0
_BaseColor("BaseColor", Color) = (1, 1, 1, 0)
_RimlightPower("Rimlight Power", Range(0, 10)) = 0.5
_RimlightSharpness("Rimlight Sharpness", Range(0, 1)) = 0.5
_RimlightColor("RimLightColor", Color) = (0, 0, 0, 0)
[Toggle(_RIMLIGHTOVERLAY)]_UseRimlightOverlay("Use Rimlight Overlay", Float) = 1
[Header(Shadow Options)]
[Space(10)]
_ShadowColor("ShadowColor", Color) = (0.8862745, 0.8862745, 0.8862745, 0)
_ShadowEdgeColor("ShadowEdgeColor", Color) = (1, 0.9058824, 0.827451, 0)
_ShadowEdge("ShadowEdge", Range(0.001, 1)) = 0.1
_ShadowSharpness("ShadowSharpness", Range(0.001, 1)) = 0.1
_RecieveShadows("RecieveShadows", Range(0, 1)) = 1
[Header(Ambiant Options)]
[Space(10)]
[ToggleUI]_UseAmbiant("UseAmbiant", Float) = 1
_AmbiantStrength("AmbiantStrength", Range(0, 3)) = 0.5
[Header(MultiLight Options)]
[ToggleUI]_UseMultipleLights("UseMultipleLights", Float) = 0
_MultipleLightSharpness("MultipleLightSharpness", Range(0, 1)) = 0
_MultipleStrength("MultipleStrength", Float) = 1
[Header(Decal Options)]
[Space(10)]
[NoScaleOffset]_DecalMap("DecalMap", 2D) = "black" {}
_DecalUVSet("DecalUVSet", Range(0, 1)) = 0
_DecalBlend("DecalBlend", Range(0, 1)) = 0
_DecalScale("DecalScale", Vector) = (1, 1, 0, 0)
_DecalColor_1("DecalColor_1", Color) = (0, 0, 0, 0)
_DecalColor_2("DecalColor_2", Color) = (0, 0, 0, 0)
_DecalColor_3("DecalColor_3", Color) = (0, 0, 0, 0)
[Header(Pattern Options)]
[Space(10)]
[NoScaleOffset]_PatternMap("PatternMap", 2D) = "black" {}
_PatternUVSet("PatternUVSet", Range(0, 1)) = 0
_PatternBlend("PatternBlend", Range(0, 1)) = 0
_PatternScale("PatternScale", Vector) = (1, 1, 0, 0)
_PatternColor_1("PatternColor_1", Color) = (0, 0, 0, 0)
_PatternColor_2("PatternColor_2", Color) = (0, 0, 0, 0)
_PatternColor_3("PatternColor_3", Color) = (0, 0, 0, 0)
[Space(10)]
[Enum(UnityEngine.Rendering.CullMode)] _Culling("Culling", int) = 2
[Enum(On, 1, Off, 0)] _ZWrite("ZWrite", int) = 1
[Enum(UnityEngine.Rendering.CompareFunction)] _ZTest("ZTest", int) = 0
[Header(Stencil Options)]
[Space(10)]
_RefVal ("ID", int ) = 221
[Enum(UnityEngine.Rendering.CompareFunction)] _Compa("Compare Function", int) = 8
[Enum(UnityEngine.Rendering.StencilOp)] _StencilPass ("Pass", Float) = 2
_StencilWriteMask ("Stencil Write Mask", Float) = 221
_StencilReadMask ("Stencil Read Mask", Float) = 255
}
SubShader
{
Tags
{
"RenderPipeline"="UniversalPipeline"
"RenderType"="TransparentCutout"
"Queue"="AlphaTest"
}
HLSLINCLUDE
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
// 일관된 노이즈 함수
float random(float2 uv) { return frac(sin(dot(uv, float2(12.9898, 78.233))) * 43758.5453123); }
float SimpleNoise(float2 uv) {
float2 i = floor(uv); float2 f = frac(uv);
f = f * f * (3.0 - 2.0 * f);
return lerp(lerp(random(i), random(i + float2(1.0, 0.0)), f.x),
lerp(random(i + float2(0.0, 1.0)), random(i + float2(1.0, 1.0)), f.x), f.y);
}
float _DissolvePower, _DissolveNoiseScale, _EdgeThickness;
float4 _EdgeColor;
ENDHLSL
Pass
{
Name "ForwardLit"
Tags
{
"LightMode" = "UniversalForward"
"RenderType"="TransparentCutout"
"Queue"="AlphaTest"
}
Cull [_Culling]
ZWrite[_ZWrite]
ZTest[_ZTest]
Blend Off
Stencil
{
Ref [_RefVal]
WriteMask [_StencilWriteMask]
ReadMask [_StencilReadMask]
Comp [_Compa]
Pass [_StencilPass]
}
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
// URP multi-compile directives
#pragma multi_compile _ _USEOUTLINE
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
#pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS
#pragma multi_compile _ _ADDITIONAL_LIGHTS
#pragma multi_compile_fragment _ _SHADOWS_SOFT
#pragma multi_compile _ _FORWARD_PLUS
#pragma multi_compile _ _USENORMALMAP
#pragma multi_compile _ _USEMASKMAP
#pragma multi_compile _ _USECUSTOMTEXTURE
#pragma multi_compile _ _USERIMLIGHT
#pragma multi_compile _ _RIMLIGHTOVERLAY
#pragma multi_compile_fog
// Additional lights support (required for Forward+)
#pragma multi_compile _ _ADDITIONAL_LIGHTS
// Include URP libraries
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
//#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Fog.hlsl"
struct Attributes
{
float4 positionOS : POSITION;
float2 uv : TEXCOORD0;
float2 uv1 : TEXCOORD1;
float3 normalOS : NORMAL;
float4 tangentOS : TANGENT;
float4 vertexColor : COLOR;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct Varyings
{
float2 uv : TEXCOORD0;
float2 uv1 : TEXCOORD5;
float4 positionCS : SV_POSITION;
float3 positionWS : TEXCOORD1;
float3 normalWS : TEXCOORD2;
float4 shadowCoord : TEXCOORD3;
float4 screenPos : TEXCOORD4;
float3x3 tangentToWorld : TEXCOORD6;
float3 viewDirWS : TEXCOORD9;
float2 fogCoord : TEXCOORD10;
float4 vertexColor : COLOR;
UNITY_VERTEX_OUTPUT_STEREO
};
sampler2D _Texture2D;
float4 _Texture2D_ST;
//BaseColor
float4 _Color_1;
float4 _Color_2;
float4 _Color_3;
float4 _Color_4;
float4 _Color_5;
float4 _Color_6;
float4 _Color_7;
float4 _Color_8;
float4 _Color_9;
//decal
sampler2D _DecalMap;
float4 _DecalMap_ST;
float _DecalUVSet;
float _DecalBlend;
float4 _DecalScale;
float4 _DecalColor_1;
float4 _DecalColor_2;
float4 _DecalColor_3;
//pattern
sampler2D _PatternMap;
float4 _PatternMap_ST;
float _PatternUVSet;
float _PatternBlend;
float4 _PatternScale;
float4 _PatternColor_1;
float4 _PatternColor_2;
float4 _PatternColor_3;
//lighting
sampler2D _NormalMap;
float _Brightness;
float3 _BaseColor;
float _LightHeightDirectionStrength;
float _ShadowSharpness;
float _ShadowEdge;
float4 _ShadowColor;
float4 _ShadowEdgeColor;
float _AmbiantStrength;
float _RecieveShadows;
float _RimlightPower;
float _RimlightSharpness;
float3 _RimlightColor;
Varyings vert (Attributes input)
{
Varyings output;
UNITY_SETUP_INSTANCE_ID(input);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
float4 positionHCS = TransformObjectToHClip(input.positionOS);
output.positionCS = positionHCS;
output.positionWS = TransformObjectToWorld(input.positionOS.xyz);
output.normalWS = TransformObjectToWorldNormal(input.normalOS);
output.uv = TRANSFORM_TEX(input.uv, _Texture2D);
output.uv1 = TRANSFORM_TEX(input.uv1, _Texture2D);
output.vertexColor = input.vertexColor;
output.screenPos = ComputeScreenPos(output.positionCS);
output.viewDirWS = normalize(GetWorldSpaceViewDir(output.positionWS));
float3 tangentWS = TransformObjectToWorldDir(input.tangentOS.xyz);
float3 bitangentWS = cross(output.normalWS, tangentWS) * input.tangentOS.w;
output.fogCoord = ComputeFogFactor(positionHCS.z);
output.tangentToWorld = float3x3(tangentWS, bitangentWS, output.normalWS);
// Compute shadow coordinates
output.shadowCoord = TransformWorldToShadowCoord(output.positionWS);
return output;
}
float4 ApplyPattern(float4 tex, float flatTexture, float mask, Varyings i)
{
float2 uv = lerp(i.uv, i.uv1, _PatternUVSet);
//float2 scaleduv = uv * _DecalScale;
float2 scaleduv = uv * _PatternScale + ((_PatternScale * -1) / 2) + 0.5;
float4 pattern = tex2D(_PatternMap, scaleduv);
float4 color1 = lerp(0, _PatternColor_1, pattern.x);
float4 color2 = lerp(0, _PatternColor_2, pattern.y);
float4 color3 = lerp(0, _PatternColor_3, pattern.z);
float4 combine = color1 + color2 + color3;
float steppedMask = step(0.01, mask);
steppedMask = steppedMask * i.vertexColor.x;
steppedMask = steppedMask * pattern.a;
steppedMask = lerp(pattern.a, steppedMask, _PatternBlend);
float4 blend = lerp(combine, flatTexture * combine, _PatternBlend);
float4 final = lerp(tex, blend, pattern.w * steppedMask);
return float4(final.rgb, tex.a + pattern.a);
}
float4 ApplyDecal(float4 tex, float flatTexture, float mask, Varyings i)
{
float2 uv = lerp(i.uv, i.uv1, _DecalUVSet);
//float2 scaleduv = uv * _DecalScale;
float2 scaleduv = uv * _DecalScale + ((_DecalScale * -1) / 2) + 0.5;
float4 decal = tex2D(_DecalMap, scaleduv);
float4 color1 = lerp(0, _DecalColor_1, decal.x);
float4 color2 = lerp(0, _DecalColor_2, decal.y);
float4 color3 = lerp(0, _DecalColor_3, decal.z);
float4 combine = color1 + color2 + color3;
float steppedMask = step(0.06, mask);
float4 blend = lerp(combine, flatTexture * combine, _DecalBlend);
float4 final = lerp(tex, blend, decal.a);
return float4(final.rgb, tex.a);
}
float4 CustomColors(float4 tex, float4 vertexColors)
{
float4 color1 = lerp(0, _Color_1, tex.x);
float4 color2 = lerp(0, _Color_2, tex.y);
float4 color3 = lerp(0, _Color_3, tex.z);
float4 color4 = lerp(0, _Color_4, tex.x);
float4 color5 = lerp(0, _Color_5, tex.y);
float4 color6 = lerp(0, _Color_6, tex.z);
float4 color7 = lerp(0, _Color_7, tex.x);
float4 color8 = lerp(0, _Color_8, tex.y);
float4 color9 = lerp(0, _Color_9, tex.z);
float4 combine1 = color1 + color2 + color3;
float4 combine2 = color4 + color5 + color6;
float4 combine3 = color7 + color8 + color9;
float4 layer1 = lerp(0, combine1, vertexColors.x);
float4 layer2 = lerp(layer1, combine2, vertexColors.y);
float4 layer3 = lerp(layer2, combine3, vertexColors.z);
return float4(layer3.rgb, tex.a);
}
half4 frag (Varyings input) : SV_Target
{
// Normalize normal
half3 normalWS = normalize(input.normalWS);
#ifdef _USENORMALMAP
float3 normalTS = UnpackNormal(tex2D(_NormalMap, input.uv)) * 1;
normalWS = normalize(mul(normalTS, input.tangentToWorld));
#endif
// Sample albedo texture
half4 map = tex2D(_Texture2D, input.uv);
half4 albedo = map;
#ifdef _USECUSTOMTEXTURE
half4 flat = map.x + map.y + map.z;
albedo = CustomColors(map, input.vertexColor);
albedo = ApplyPattern(albedo, flat, map.x, input);
albedo = ApplyDecal(albedo, flat, map.x, input);
#endif
// ---------------------------------------------------------
// 디졸브 & 이미션 계산
float noiseVal = SimpleNoise(input.uv * _DissolveNoiseScale);
// 디졸브 클리핑 (사라지는 부분 잘라내기)
clip(noiseVal - _DissolvePower);
// 타들어가는 경계선(Emission) 계산
float edgeMask = 1.0 - saturate((noiseVal - _DissolvePower) / _EdgeThickness);
// _DissolvePower가 0.001보다 작으면 0을 곱해서 에지를 강제로 지움
edgeMask *= step(0.001, _DissolvePower);
float3 dissolveEmission = pow(edgeMask, 2.0) * _EdgeColor.rgb;
// ---------------------------------------------------------
// Initialize lighting
half3 diffuse = 0;
half3 specular = 0;
half3 ambient = SampleSH(input.normalWS) * _AmbiantStrength;
ambient = ambient * albedo.rgb;
// View direction
half3 viewDirWS = normalize(GetWorldSpaceViewDir(input.positionWS));
// Main light
Light mainLight = GetMainLight(input.shadowCoord);
half3 lightDir = mainLight.direction;
half3 heightlessLightDir = half3(mainLight.direction.x,0,mainLight.direction.z);
float3 dir = lerp(heightlessLightDir, lightDir, _LightHeightDirectionStrength);
half3 lightColor = mainLight.color;
half shadowAtten = mainLight.shadowAttenuation;
// Toon Lighting
half NdotL = dot(normalWS, dir);
float shadow = smoothstep(0, _ShadowSharpness, NdotL);
float shadowEdge = smoothstep(0 - _ShadowEdge, _ShadowSharpness - _ShadowEdge, NdotL);
float3 shadowColors = lerp(_ShadowColor, _ShadowEdgeColor, shadowEdge);
float3 litColor = lerp(shadowColors, _BaseColor, shadow);
float3 recievedShadows = lerp(_ShadowColor, litColor, shadowAtten);
float3 finalLight = lerp(litColor, recievedShadows, _RecieveShadows);
finalLight = finalLight * _Brightness;
diffuse += finalLight;
#if USE_FORWARD_PLUS
InputData inputData = (InputData)0;
inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
inputData.viewDirectionWS = GetWorldSpaceNormalizeViewDir(input.positionWS);
inputData.normalWS = input.normalWS;
inputData.positionWS = input.positionWS;
#endif
float3 forwardMultiLights = 0;
uint pixelLightCount = GetAdditionalLightsCount();
LIGHT_LOOP_BEGIN(pixelLightCount)
//get light color and direction
#if !USE_FORWARD_PLUS
lightIndex = GetPerObjectLightIndex(lightIndex);
#endif
Light light = GetAdditionalPerObjectLight(lightIndex, input.positionWS);
//calculate shadows
light.shadowAttenuation = AdditionalLightRealtimeShadow(lightIndex, input.positionWS, light.direction);
float atten = light.distanceAttenuation * light.shadowAttenuation;
//calculate diffuse and specular
float NdotL = saturate(dot(input.normalWS, light.direction));
NdotL *= atten;
NdotL = NdotL;
//accumulate light
forwardMultiLights += light.color * (NdotL * albedo.rgb);
LIGHT_LOOP_END
// Combine lighting
half3 finalColor = albedo.rgb * (diffuse * mainLight.color) + ambient;
finalColor = finalColor + forwardMultiLights;
#if _USERIMLIGHT
float fresnel = pow(1.0 - saturate(dot(input.normalWS, input.viewDirWS)), _RimlightPower);
fresnel = smoothstep(0, _RimlightSharpness, fresnel);
#if _RIMLIGHTOVERLAY
finalColor = lerp(finalColor, _RimlightColor, fresnel);
#elif !_RIMLIGHTOVERLAY
finalColor += fresnel * finalColor * _RimlightColor;
#endif
#endif
finalColor = MixFog(finalColor, input.fogCoord);
clip(albedo.a - 0.5);
finalColor += dissolveEmission;
return half4(finalColor, 1);
}
ENDHLSL
}
Pass
{
Name "ShadowCaster"
Tags { "LightMode"="ShadowCaster" "RenderType"="TransparentCutout" "Queue"="Geometry" }
ZWrite On
ZTest LEqual
ColorMask 0
Cull Back
HLSLPROGRAM
#pragma vertex ShadowPassVertex
#pragma fragment ShadowPassFragment
#pragma multi_compile_instancing
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
sampler2D _Texture2D;
float4 _Texture2D_ST;
struct Attributes
{
float4 positionOS : POSITION;
float3 normalOS : NORMAL;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct Varyings
{
float4 positionCS : SV_POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};
Varyings ShadowPassVertex(Attributes input)
{
Varyings o;
UNITY_SETUP_INSTANCE_ID(input);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
float3 positionWS = TransformObjectToWorld(input.positionOS.xyz);
// Simple clip-space transform is fine for shadows here
o.positionCS = TransformWorldToHClip(positionWS);
o.uv = TRANSFORM_TEX(input.uv, _Texture2D);
return o;
}
half4 ShadowPassFragment(Varyings input) : SV_Target
{
// Use base texture alpha as cutout mask (threshold 0.5, same as Forward pass)
half alpha = tex2D(_Texture2D, input.uv).a;
clip(alpha - 0.5);
float noiseVal = SimpleNoise(input.uv * _DissolveNoiseScale);
clip(noiseVal - _DissolvePower);
return 0;
}
ENDHLSL
}
Pass
{
Name "DepthOnly"
Tags { "LightMode"="DepthOnly" }
ZWrite On
ColorMask 0
Cull [_Culling]
HLSLPROGRAM
#pragma vertex vert
#pragma fragment fragDepth
#pragma multi_compile_instancing
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
struct Attributes
{
float4 positionOS : POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct Varyings
{
float4 positionCS : SV_POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};
sampler2D _Texture2D;
Varyings vert (Attributes input)
{
Varyings o;
UNITY_SETUP_INSTANCE_ID(input);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.positionCS = TransformObjectToHClip(input.positionOS);
o.uv = input.uv;
return o;
}
half4 fragDepth (Varyings input) : SV_Target
{
half alpha = tex2D(_Texture2D, input.uv).a;
clip(alpha - 0.5);
return 0;
}
ENDHLSL
}
Pass
{
Name "Outline"
Tags {"RenderPipeline"="UniversalPipeline" "RenderType"="Transparent" "Queue"="Transparent" }
Cull Front
ZWrite[_ZWrite]
ZTest[_ZTest]
Blend SrcAlpha OneMinusSrcAlpha
Stencil
{
Ref 221
WriteMask 221
Comp Always
Pass Replace
}
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile _ _USEOUTLINE
# include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
struct Attributes
{
float4 positionOS : POSITION;
float3 normalOS : NORMAL;
float4 vertexColor : COLOR;
float2 uv: TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct Varyings
{
float4 positionHCS : SV_POSITION;
float4 vertexColor : COLOR;
float2 uv: TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};
float _OutlineDistance;
float _OutlineVertexColorWeight;
float4 _OutlineColor;
float _OutlineAlpha;
Varyings vert(Attributes IN)
{
Varyings OUT;
UNITY_SETUP_INSTANCE_ID(IN);
UNITY_TRANSFER_INSTANCE_ID(IN, OUT);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
float weight = IN.vertexColor.w;
float3 norm = normalize(IN.normalOS);
float3 pos = IN.positionOS.xyz + norm * (_OutlineDistance * 0.001) * weight;
OUT.positionHCS = TransformObjectToHClip(pos);
OUT.uv = IN.uv;
OUT.vertexColor = IN.vertexColor;
return OUT;
}
half4 frag(Varyings IN) : SV_Target
{
#ifdef _USEOUTLINE
float finalMask = 1;
finalMask = finalMask * IN.vertexColor.w;
float noiseVal = SimpleNoise(IN.uv * _DissolveNoiseScale);
clip(noiseVal - _DissolvePower);
//clip(IN.vertexColor.a - 0.5);
return float4(_OutlineColor.rgb, _OutlineAlpha * IN.vertexColor.w);
#else
discard;
//clip(1 - 0.5);
return float4(0,0,0,0);
#endif
}
ENDHLSL
}
}
//FallBack "Universal Render Pipeline/Lit"
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: d6e83dd11f9bce64592407669f7cc8e7
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant: