#T#PoiDecalsProperties
//ifex _DecalEnabled==0 && _DecalEnabled1==0 && _DecalEnabled2==0 && _DecalEnabled3==0
// Decal Texture
//[HideInInspector] m_start_DecalSection ("Decals Group [IDX_DecalGroup++]--{button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/color-and-normals/decals},hover:YouTube}}", Float) = 0
[HideInInspector] m_start_DecalSection ("Decals--{button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/color-and-normals/decals},hover:YouTube}}", Float) = 0
[sRGBWarning][ThryRGBAPacker(Decal 0 Mask, Decal 1 Mask, Decal 2 Mask, Decal 3 Mask, Linear, false)]_DecalMask ("RGBA Mask [Click to Expand]--{reference_properties:[_DecalMaskPan, _DecalMaskUV]}", 2D) = "white" { }
[HideInInspector][Vector2]_DecalMaskPan ("Panning", Vector) = (0, 0, 0, 0)
[HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos, 5, Local Pos, 8, Polar UV, 6, Distorted UV, 7)] _DecalMaskUV ("UV", Int) = 0
//ifex 0==0
//ex_remove_texture _Udon_VideoTex
//_Udon_VideoTex ("Video Debug Texture                                                                                                                               NL", 2D) = "" {}
//endex

[HideInInspector] s_start_DecalTPSMaskGroup ("--{condition_showS:(_TPSPenetratorEnabled==1)}", Float) = 0
[ThryToggleUI(true)] _DecalTPSDepthMaskEnabled ("<size=13><b>  TPS Depth Enabled</b></size>", Float) = 0
_Decal0TPSMaskStrength ("Mask r Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
_Decal1TPSMaskStrength ("Mask g Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
_Decal2TPSMaskStrength ("Mask b Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
_Decal3TPSMaskStrength ("Mask a Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
[HideInInspector] s_end_DecalTPSMaskGroup ("", Float) = 0
//ifex _DecalEnabled==0
// Decal 0
[HideInInspector] m_start_Decal0 ("Decal [IDX_Decal++]--{reference_property:_DecalEnabled}", Float) = 0
[HideInInspector][ThryToggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
[HideInInspector] s_start_decal_position ("Positioning--{persistent_expand:true,default_expand:true}", Float) = 1
[ThryDecalPositioning(_DecalTexture, _DecalTextureUV, _DecalPosition, _DecalRotation, _DecalScale, _DecalSideOffset)]
[Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
_DecalRotation ("Rotation", Range(0, 360)) = 0
_DecalRotationSpeed ("Rotation Speed", Float) = 0
[VectorLabel(X, Y)]_DecalScale ("Scale", Vector) = (1, 1, 1, 0)
[VectorLabel(L, R, D, U)]_DecalSideOffset ("Side Offset", Vector) = (0, 0, 0, 0)
[ThryWideEnum(Off, 0, Flip, 1, Left Only, 2, Right Only, 3, Flip Right Only, 4)] _DecalMirroredUVMode ("Mirrored UV Mode", Int) = 0
[ThryWideEnum(Off, 0, Symmetry, 1, Flipped, 2)] _DecalSymmetryMode ("Symmetry Mode", Int) = 0
[ToggleUI]_DecalTiled ("Tiled", Float) = 0
[HideInInspector] s_end_decal_position ("Positioning", Float) = 0

_DecalColor ("Color--{reference_property:_DecalColorThemeIndex}", Color) = (1, 1, 1, 1)
[HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _DecalColorThemeIndex ("", Int) = 0
[sRGBWarning(true)]_DecalTexture ("Decal--{reference_properties:[_DecalTexturePan, _DecalTextureUV, _Decal0MaskChannel]}", 2D) = "white" { }
[HideInInspector][Vector2]_DecalTexturePan ("Panning", Vector) = (0, 0, 0, 0)
[HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos, 5, Local Pos, 8, Polar UV, 6, Distorted UV, 7)] _DecalTextureUV ("UV", Int) = 0
[HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)] _Decal0MaskChannel ("Mask Channel", Int) = 0

_DecalEmissionStrength ("Emission Strength", Range(0, 20)) = 0
[ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Lighten, 5, Screen, 6, Subtract, 7, Add, 8, Overlay, 9, Mixed, 20)]_DecalBlendType ("Color Blend Mode", Range(0, 1)) = 0
[ThryWideEnum(Off, 0, Replace, 1, Multiply, 2, Add, 3, Subtract, 4, Min, 5, Max, 6)]_DecalOverrideAlpha ("Alpha Blend Mode--{reference_property:_Decal0OverrideAlphaMode}", Float) = 0
[HideInInspector][Enum(Everywhere, 0, Decal Bounds, 1)] _Decal0OverrideAlphaMode ("Mode", Int) = 0
_DecalBlendAlpha ("Alpha", Range(0, 1)) = 1
_Decal0Depth ("Depth", Range(-0.5, 2)) = 0

[HideInInspector] s_start_Decal0HueShift ("Hue Shift--{reference_property:_DecalHueShiftEnabled, persistent_expand:true, default_expand:false}", Float) = 0
[HideInInspector][ThryToggleUI(true)]_DecalHueShiftEnabled ("Hue Shift", Float) = 0
[ThryWideEnum(OKLab, 0, HSV, 1)] _DecalHueShiftColorSpace ("Color Space", Int) = 0
[ThryWideEnum(Hue Select, 0, Hue Shift, 1)] _DecalHueShiftSelectOrShift ("Select or Shift", Int) = 1
_DecalHueShiftSpeed ("Shift Speed", Float) = 0
_DecalHueShift ("Hue Shift", Range(0, 1)) = 0
_Decal0HueAngleStrength ("Hue Angle Power", Float) = 0
[HideInInspector] s_end_Decal0HueShift ("Hue Shift", Float) = 0

[HideInInspector] s_start_Decal0Video ("Video Texture--{reference_property:_Decal0VideoEnabled, persistent_expand:true, default_expand:false}", Float) = 0
[HideInInspector][ToggleUI] _Decal0VideoEnabled ("Video Texture", Float) = 0
[ThryWideEnum(Shrink2Fit, 0, Grow2Fit, 1, Off, 2)] _Decal0VideoAspectFix ("Aspect Ratio", Int) = 0
[ToggleUI] _Decal0VideoFitToScale ("Fit To Scale--{condition_showS:(_Decal0VideoAspectFix==0||_Decal0VideoAspectFix==1)}", Float) = 1
[ToggleUI] _Decal0UseDecalAlpha ("Use Decal Alpha", Float) = 0
[ToggleUI] _Decal0OnlyVideo ("Only Show Video", Float) = 0
_Decal0VideoEmissionStrength ("Emission", Range(0, 20)) = 0
[HideInInspector] s_end_Decal0Video ("Video Texture", Float) = 0

[HideInInspector] s_start_Decal0ChannelSeparation ("Chromatic Aberration--{reference_property:_Decal0ChannelSeparationEnable, persistent_expand:true, default_expand:false}", Int) = 0
[HideInInspector][DoNotAnimate][ThryToggle(true)]_Decal0ChannelSeparationEnable ("Chromatic Aberration", Float) = 0
_Decal0ChannelSeparation ("Intensity", Float) = 0
_Decal0ChannelSeparationAngleStrength ("Surface Angle Intensity", Float) = 0
_Decal0ChannelSeparationHue ("Hue", Range(-1, 1)) = 0
_Decal0ChannelSeparationVertical ("Direction", Range(-3.142, 3.142)) = 0
[ToggleUI]_Decal0ChannelSeparationPremultiply ("Premultiply Alpha--{tooltip:''Fixes Chromatic Aberration issues on some decal textures''}", Float) = 0
[HideInInspector] s_end_Decal0ChannelSeparation ("", Int) = 0

[HideInInspector] s_start_Decal0GlobalMasking ("Masking--{persistent_expand:false, default_expand:false}", Float) = 0
[ThryWideEnum(Off, 0, Front Only, 1, Back Only, 2)] _Decal0FaceMask ("Face Mask", Int) = 0
[ThryWideEnum(Off, 0, 1R, 1, 1G, 2, 1B, 3, 1A, 4, 2R, 5, 2G, 6, 2B, 7, 2A, 8, 3R, 9, 3G, 10, 3B, 11, 3A, 12, 4R, 13, 4G, 14, 4B, 15, 4A, 16)] _Decal0GlobalMask (" Apply From Global Mask--{reference_property:_Decal0GlobalMaskBlendType}", Int) = 0
[HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)]_Decal0GlobalMaskBlendType ("Blending", Range(0, 1)) = 2
[ThryWideEnum(Off, 0, 1R, 1, 1G, 2, 1B, 3, 1A, 4, 2R, 5, 2G, 6, 2B, 7, 2A, 8, 3R, 9, 3G, 10, 3B, 11, 3A, 12, 4R, 13, 4G, 14, 4B, 15, 4A, 16)] _Decal0ApplyGlobalMaskIndex (" Apply to Global Mask--{reference_property:_Decal0ApplyGlobalMaskBlendType}", Int) = 0
[HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _Decal0ApplyGlobalMaskBlendType ("Blending", Int) = 0
[HideInInspector] s_end_Decal0GlobalMasking ("Masking", Float) = 0
// Decal 0 Audio Link
[HideInInspector] m_start_Decal0AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal0ScaleBand ("Scale Band", Int) = 0
[VectorLabel(Xmin, Ymin, Xmax, Ymax)]_AudioLinkDecal0Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal0SideBand ("Side Band", Int) = 0
[VectorLabel(L, R, D, U)]_AudioLinkDecal0SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
[VectorLabel(L, R, D, U)]_AudioLinkDecal0SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal0RotationBand ("Rotation Band", Int) = 0
[VectorLabel(Min, Max)]_AudioLinkDecal0Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal0AlphaBand ("Alpha Band", Int) = 0
[VectorLabel(Min, Max)]_AudioLinkDecal0Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal0EmissionBand ("Emission Band", Int) = 0
[VectorLabel(Min, Max)]_AudioLinkDecal0Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
[ToggleUI]_AudioLinkDecalCC0 ("CC Strip", Float) = 0
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _DecalRotationCTALBand0 ("Chrono Rotation Band", Int) = 0
[ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType0 ("Chrono Motion Type", Int) = 0
_DecalRotationCTALSpeed0 ("Chrono Rotation Speed", Float) = 0
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal0ChannelSeparationBand ("Chromatic Aberration Band--{condition_showS:(_Decal0ChannelSeparationEnable==1)}", Int) = 0
[VectorLabel(Min, Max)]_AudioLinkDecal0ChannelSeparation ("Chromatic Aberration--{condition_showS:(_Decal0ChannelSeparationEnable==1)}", Vector) = (0, 0, 0, 0)
[HideInInspector] m_end_Decal0AudioLink ("Audio Link", Float) = 0
[HideInInspector] m_end_Decal0 ("Decal 0", Float) = 0
//endex
//ifex _DecalEnabled1==0
// Decal 1
[HideInInspector] m_start_Decal1 ("Decal [IDX_Decal++]--{reference_property:_DecalEnabled1}", Float) = 0
[HideInInspector][ThryToggle(GEOM_TYPE_BRANCH_DETAIL)]_DecalEnabled1 ("Enable", Float) = 0
[HideInInspector] s_start_decal1_position ("Positioning--{persistent_expand:true,default_expand:true}", Float) = 1
[ThryDecalPositioning(_DecalTexture1, _DecalTexture1UV, _DecalPosition1, _DecalRotation1, _DecalScale1, _DecalSideOffset1)]
[Vector2]_DecalPosition1 ("Position", Vector) = (.5, .5, 0, 0)
_DecalRotation1 ("Rotation", Range(0, 360)) = 0
_DecalRotationSpeed1 ("Rotation Speed", Float) = 0
[VectorLabel(X, Y)]_DecalScale1 ("Scale", Vector) = (1, 1, 1, 0)
[VectorLabel(L, R, D, U)]_DecalSideOffset1 ("Side Offset", Vector) = (0, 0, 0, 0)
[ThryWideEnum(Off, 0, Flip, 1, Left Only, 2, Right Only, 3, Flip Right Only, 4)] _DecalMirroredUVMode1 ("Mirrored UV Mode", Int) = 0
[ThryWideEnum(Off, 0, Symmetry, 1, Flipped, 2)] _DecalSymmetryMode1 ("Symmetry Mode", Int) = 0
[ToggleUI]_DecalTiled1 ("Tiled", Float) = 0
[HideInInspector] s_end_decal1_position ("Positioning", Float) = 0

_DecalColor1 ("Color--{reference_property:_DecalColor1ThemeIndex}", Color) = (1, 1, 1, 1)
[HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _DecalColor1ThemeIndex ("", Int) = 0
[sRGBWarning(true)]_DecalTexture1 ("Decal--{reference_properties:[_DecalTexture1Pan, _DecalTexture1UV, _Decal1MaskChannel]}", 2D) = "white" { }
[HideInInspector][Vector2]_DecalTexture1Pan ("Panning", Vector) = (0, 0, 0, 0)
[HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos, 5, Local Pos, 8, Polar UV, 6, Distorted UV, 7)] _DecalTexture1UV ("UV", Int) = 0
[HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)] _Decal1MaskChannel ("Mask Channel", Int) = 1

_DecalEmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
[ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Lighten, 5, Screen, 6, Subtract, 7, Add, 8, Overlay, 9, Mixed, 20)]_DecalBlendType1 ("Color Blend Mode", Range(0, 1)) = 0
[ThryWideEnum(Off, 0, Replace, 1, Multiply, 2, Add, 3, Subtract, 4, Min, 5, Max, 6)]_DecalOverrideAlpha1 ("Alpha Blend Mode--{reference_property:_Decal1OverrideAlphaMode}", Float) = 0
[HideInInspector][Enum(Everywhere, 0, Decal Bounds, 1)] _Decal1OverrideAlphaMode ("Mode", Int) = 0
_DecalBlendAlpha1 ("Alpha", Range(0, 1)) = 1
_Decal1Depth ("Depth", Range(-0.5, 2)) = 0

[HideInInspector] s_start_Decal1HueShift ("Hue Shift--{reference_property:_DecalHueShiftEnabled1, persistent_expand:true, default_expand:false}", Float) = 0
[HideInInspector][ThryToggleUI(true)]_DecalHueShiftEnabled1 ("Hue Shift", Float) = 0
[ThryWideEnum(OKLab, 0, HSV, 1)] _DecalHueShiftColorSpace1 ("Color Space", Int) = 0
[ThryWideEnum(Hue Select, 0, Hue Shift, 1)] _DecalHueShiftSelectOrShift1 ("Select or Shift", Int) = 1
_DecalHueShiftSpeed1 ("Shift Speed", Float) = 0
_DecalHueShift1 ("Hue Shift", Range(0, 1)) = 0
_Decal1HueAngleStrength ("Hue Angle Power", Float) = 0
[HideInInspector] s_end_Decal1HueShift ("Hue Shift", Float) = 0

[HideInInspector] s_start_Decal1Video ("Video Texture--{reference_property:_Decal1VideoEnabled, persistent_expand:true, default_expand:false}", Float) = 0
[HideInInspector][ToggleUI] _Decal1VideoEnabled ("Video Texture", Float) = 0
[ThryWideEnum(Shrink2Fit, 0, Grow2Fit, 1, Off, 2)] _Decal1VideoAspectFix ("Aspect Ratio", Int) = 0
[ToggleUI] _Decal1VideoFitToScale ("Fit To Scale--{condition_showS:(_Decal1VideoAspectFix==0||_Decal1VideoAspectFix==1)}", Float) = 1
[ToggleUI] _Decal1UseDecalAlpha ("Use Decal Alpha", Float) = 0
[ToggleUI] _Decal1OnlyVideo ("Only Show Video", Float) = 0
_Decal1VideoEmissionStrength ("Emission", Range(0, 20)) = 0
[HideInInspector] s_end_Decal1Video ("Video Texture", Float) = 0

[HideInInspector] s_start_Decal1ChannelSeparation ("Chromatic Aberration--{reference_property:_Decal1ChannelSeparationEnable, persistent_expand:true, default_expand:false}", Int) = 0
[HideInInspector][DoNotAnimate][ThryToggle(true)]_Decal1ChannelSeparationEnable ("Chromatic Aberration", Float) = 0
_Decal1ChannelSeparation ("Intensity", Float) = 0
_Decal1ChannelSeparationAngleStrength ("Surface Angle Intensity", Float) = 0
_Decal1ChannelSeparationHue ("Hue", Range(-1, 1)) = 0
_Decal1ChannelSeparationVertical ("Direction", Range(-3.142, 3.142)) = 0
[ToggleUI]_Decal1ChannelSeparationPremultiply ("Premultiply Alpha--{tooltip:''Fixes Chromatic Aberration issues on some decal textures''}", Float) = 0
[HideInInspector] s_end_Decal1ChannelSeparation ("", Int) = 0

[HideInInspector] s_start_Decal1GlobalMasking ("Masking--{persistent_expand:false, default_expand:false}", Float) = 0
[ThryWideEnum(Off, 0, Front Only, 1, Back Only, 2)] _Decal1FaceMask ("Face Mask", Int) = 0
[ThryWideEnum(Off, 0, 1R, 1, 1G, 2, 1B, 3, 1A, 4, 2R, 5, 2G, 6, 2B, 7, 2A, 8, 3R, 9, 3G, 10, 3B, 11, 3A, 12, 4R, 13, 4G, 14, 4B, 15, 4A, 16)] _Decal1GlobalMask ("Apply From Global Mask--{reference_property:_Decal1GlobalMaskBlendType}", Int) = 0
[HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)]_Decal1GlobalMaskBlendType ("Blending", Range(0, 1)) = 2
[ThryWideEnum(Off, 0, 1R, 1, 1G, 2, 1B, 3, 1A, 4, 2R, 5, 2G, 6, 2B, 7, 2A, 8, 3R, 9, 3G, 10, 3B, 11, 3A, 12, 4R, 13, 4G, 14, 4B, 15, 4A, 16)] _Decal1ApplyGlobalMaskIndex ("Apply to Global Mask--{reference_property:_Decal1ApplyGlobalMaskBlendType}", Int) = 0
[HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _Decal1ApplyGlobalMaskBlendType ("Blending", Int) = 0
[HideInInspector] s_end_Decal1GlobalMasking ("Masking", Float) = 0
// Decal 1 Audio Link
[HideInInspector] m_start_Decal1AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal1ScaleBand ("Scale Band", Int) = 0
[VectorLabel(Xmin, Ymin, Xmax, Ymax)]_AudioLinkDecal1Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal1SideBand ("Side Band", Int) = 0
[VectorLabel(L, R, D, U)]_AudioLinkDecal1SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
[VectorLabel(L, R, D, U)]_AudioLinkDecal1SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal1RotationBand ("Rotation Band", Int) = 0
[VectorLabel(Min, Max)]_AudioLinkDecal1Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal1AlphaBand ("Alpha Band", Int) = 0
[VectorLabel(Min, Max)]_AudioLinkDecal1Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal1EmissionBand ("Emission Band", Int) = 0
[VectorLabel(Min, Max)]_AudioLinkDecal1Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
[ToggleUI]_AudioLinkDecalCC1 ("CC Strip", Float) = 0
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _DecalRotationCTALBand1 ("Chrono Rotation Band", Int) = 0
[ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType1 ("Chrono Motion Type", Int) = 0
_DecalRotationCTALSpeed1 ("Chrono Rotation Speed", Float) = 0
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal1ChannelSeparationBand ("Chromatic Aberration Band--{condition_showS:(_Decal1ChannelSeparationEnable==1)}", Int) = 0
[VectorLabel(Min, Max)]_AudioLinkDecal1ChannelSeparation ("Chromatic Aberration--{condition_showS:(_Decal1ChannelSeparationEnable==1)}", Vector) = (0, 0, 0, 0)
[HideInInspector] m_end_Decal1AudioLink ("Audio Link", Float) = 0
[HideInInspector] m_end_Decal1 ("Decal 0", Float) = 0
//endex
//ifex _DecalEnabled2==0
// Decal 2
[HideInInspector] m_start_Decal2 ("Decal [IDX_Decal++]--{reference_property:_DecalEnabled2}", Float) = 0
[HideInInspector][ThryToggle(GEOM_TYPE_FROND)]_DecalEnabled2 ("Enable", Float) = 0
[HideInInspector] s_start_decal2_position ("Positioning--{persistent_expand:true,default_expand:true}", Float) = 1
[ThryDecalPositioning(_DecalTexture2, _DecalTexture2UV, _DecalPosition2, _DecalRotation2, _DecalScale2, _DecalSideOffset2)]
[Vector2]_DecalPosition2 ("Position", Vector) = (.5, .5, 0, 0)
_DecalRotation2 ("Rotation", Range(0, 360)) = 0
_DecalRotationSpeed2 ("Rotation Speed", Float) = 0
[VectorLabel(X, Y)]_DecalScale2 ("Scale", Vector) = (1, 1, 1, 0)
[VectorLabel(L, R, D, U)]_DecalSideOffset2 ("Side Offset", Vector) = (0, 0, 0, 0)
[ThryWideEnum(Off, 0, Flip, 1, Left Only, 2, Right Only, 3, Flip Right Only, 4)] _DecalMirroredUVMode2 ("Mirrored UV Mode", Int) = 0
[ThryWideEnum(Off, 0, Symmetry, 1, Flipped, 2)] _DecalSymmetryMode2 ("Symmetry Mode", Int) = 0
[ToggleUI]_DecalTiled2 ("Tiled", Float) = 0
[HideInInspector] s_end_decal2_position ("Positioning", Float) = 0

_DecalColor2 ("Color--{reference_property:_DecalColor2ThemeIndex}", Color) = (1, 1, 1, 1)
[HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _DecalColor2ThemeIndex ("", Int) = 0
[sRGBWarning(true)]_DecalTexture2 ("Decal--{reference_properties:[_DecalTexture2Pan, _DecalTexture2UV, _Decal2MaskChannel]}", 2D) = "white" { }
[HideInInspector][Vector2]_DecalTexture2Pan ("Panning", Vector) = (0, 0, 0, 0)
[HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos, 5, Local Pos, 8, Polar UV, 6, Distorted UV, 7)] _DecalTexture2UV ("UV", Int) = 0
[HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)] _Decal2MaskChannel ("Mask Channel", Int) = 2

_DecalEmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
[ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Lighten, 5, Screen, 6, Subtract, 7, Add, 8, Overlay, 9, Mixed, 20)]_DecalBlendType2 ("Color Blend Mode", Range(0, 1)) = 0
[ThryWideEnum(Off, 0, Replace, 1, Multiply, 2, Add, 3, Subtract, 4, Min, 5, Max, 6)]_DecalOverrideAlpha2 ("Alpha Blend Mode--{reference_property:_Decal2OverrideAlphaMode}", Float) = 0
[HideInInspector][Enum(Everywhere, 0, Decal Bounds, 1)] _Decal2OverrideAlphaMode ("Mode", Int) = 0
_DecalBlendAlpha2 ("Alpha", Range(0, 1)) = 1
_Decal2Depth ("Depth", Range(-0.5, 2)) = 0

[HideInInspector] s_start_Decal2HueShift ("Hue Shift--{reference_property:_DecalHueShiftEnabled2, persistent_expand:true, default_expand:false}", Float) = 0
[HideInInspector][ThryToggleUI(true)]_DecalHueShiftEnabled2 ("Hue Shift", Float) = 0
[ThryWideEnum(OKLab, 0, HSV, 1)] _DecalHueShiftColorSpace2 ("Color Space", Int) = 0
[ThryWideEnum(Hue Select, 0, Hue Shift, 1)] _DecalHueShiftSelectOrShift2 ("Select or Shift", Int) = 1
_DecalHueShiftSpeed2 ("Shift Speed", Float) = 0
_DecalHueShift2 ("Hue Shift", Range(0, 1)) = 0
_Decal2HueAngleStrength ("Hue Angle Power", Float) = 0
[HideInInspector] s_end_Decal2HueShift ("Hue Shift", Float) = 0

[HideInInspector] s_start_Decal2Video ("Video Texture--{reference_property:_Decal2VideoEnabled, persistent_expand:true, default_expand:false}", Float) = 0
[HideInInspector][ToggleUI] _Decal2VideoEnabled ("Video Texture", Float) = 0
[ThryWideEnum(Shrink2Fit, 0, Grow2Fit, 1, Off, 2)] _Decal2VideoAspectFix ("Aspect Ratio", Int) = 0
[ToggleUI] _Decal2VideoFitToScale ("Fit To Scale--{condition_showS:(_Decal2VideoAspectFix==0||_Decal2VideoAspectFix==1)}", Float) = 1
[ToggleUI] _Decal2UseDecalAlpha ("Use Decal Alpha", Float) = 0
[ToggleUI] _Decal2OnlyVideo ("Only Show Video", Float) = 0
_Decal2VideoEmissionStrength ("Emission", Range(0, 20)) = 0
[HideInInspector] s_end_Decal2Video ("Video Texture", Float) = 0

[HideInInspector] s_start_Decal2ChannelSeparation ("Chromatic Aberration--{reference_property:_Decal2ChannelSeparationEnable, persistent_expand:true, default_expand:false}", Int) = 0
[HideInInspector][DoNotAnimate][ThryToggle(true)]_Decal2ChannelSeparationEnable ("Chromatic Aberration", Float) = 0
_Decal2ChannelSeparation ("Intensity", Float) = 0
_Decal2ChannelSeparationAngleStrength ("Surface Angle Intensity", Float) = 0
_Decal2ChannelSeparationHue ("Hue", Range(-1, 1)) = 0
_Decal2ChannelSeparationVertical ("Direction", Range(-3.142, 3.142)) = 0
[ToggleUI]_Decal2ChannelSeparationPremultiply ("Premultiply Alpha--{tooltip:''Fixes Chromatic Aberration issues on some decal textures''}", Float) = 0
[HideInInspector] s_end_Decal2ChannelSeparation ("", Int) = 0

[HideInInspector] s_start_Decal2GlobalMasking ("Masking--{persistent_expand:false, default_expand:false}", Float) = 0
[ThryWideEnum(Off, 0, Front Only, 1, Back Only, 2)] _Decal2FaceMask ("Face Mask", Int) = 0
[ThryWideEnum(Off, 0, 1R, 1, 1G, 2, 1B, 3, 1A, 4, 2R, 5, 2G, 6, 2B, 7, 2A, 8, 3R, 9, 3G, 10, 3B, 11, 3A, 12, 4R, 13, 4G, 14, 4B, 15, 4A, 16)] _Decal2GlobalMask ("Apply From Global Mask--{reference_property:_Decal2GlobalMaskBlendType}", Int) = 0
[HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)]_Decal2GlobalMaskBlendType ("Blending", Range(0, 1)) = 2
[ThryWideEnum(Off, 0, 1R, 1, 1G, 2, 1B, 3, 1A, 4, 2R, 5, 2G, 6, 2B, 7, 2A, 8, 3R, 9, 3G, 10, 3B, 11, 3A, 12, 4R, 13, 4G, 14, 4B, 15, 4A, 16)] _Decal2ApplyGlobalMaskIndex ("Apply to Global Mask--{reference_property:_Decal2ApplyGlobalMaskBlendType}", Int) = 0
[HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _Decal2ApplyGlobalMaskBlendType ("Blending", Int) = 0
[HideInInspector] s_end_Decal2GlobalMasking ("Masking", Float) = 0
// Decal 2 Audio Link
[HideInInspector] m_start_Decal2AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal2ScaleBand ("Scale Band", Int) = 0
[VectorLabel(Xmin, Ymin, Xmax, Ymax)]_AudioLinkDecal2Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal2SideBand ("Side Band", Int) = 0
[VectorLabel(L, R, U, D)]_AudioLinkDecal2SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
[VectorLabel(L, R, U, D)]_AudioLinkDecal2SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal2RotationBand ("Rotation Band", Int) = 0
[VectorLabel(Min, Max)]_AudioLinkDecal2Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal2AlphaBand ("Alpha Band", Int) = 0
[VectorLabel(Min, Max)]_AudioLinkDecal2Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal2EmissionBand ("Emission Band", Int) = 0
[VectorLabel(Min, Max)]_AudioLinkDecal2Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
[ToggleUI]_AudioLinkDecalCC2 ("CC Strip", Float) = 0
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _DecalRotationCTALBand2 ("Chrono Rotation Band", Int) = 0
[ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType2 ("Chrono Motion Type", Int) = 0
_DecalRotationCTALSpeed2 ("Chrono Rotation Speed", Float) = 0
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal2ChannelSeparationBand ("Chromatic Aberration Band--{condition_showS:(_Decal2ChannelSeparationEnable==1)}", Int) = 0
[VectorLabel(Min, Max)]_AudioLinkDecal2ChannelSeparation ("Chromatic Aberration--{condition_showS:(_Decal2ChannelSeparationEnable==1)}", Vector) = (0, 0, 0, 0)
[HideInInspector] m_end_Decal2AudioLink ("Audio Link", Float) = 0
[HideInInspector] m_end_Decal2 ("Decal 0", Float) = 0
//endex
//ifex _DecalEnabled3==0
// Decal 3
[HideInInspector] m_start_Decal3 ("Decal [IDX_Decal++]--{reference_property:_DecalEnabled3}", Float) = 0
[HideInInspector][ThryToggle(DEPTH_OF_FIELD_COC_VIEW)]_DecalEnabled3 ("Enable", Float) = 0
[HideInInspector] s_start_decal3_position ("Positioning--{persistent_expand:true,default_expand:true}", Float) = 1
[ThryDecalPositioning(_DecalTexture3, _DecalTexture3UV, _DecalPosition3, _DecalRotation3, _DecalScale3, _DecalSideOffset3)]
[Vector3]_DecalPosition3 ("Position", Vector) = (.5, .5, 0, 0)
_DecalRotation3 ("Rotation", Range(0, 360)) = 0
_DecalRotationSpeed3 ("Rotation Speed", Float) = 0
[VectorLabel(X, Y)]_DecalScale3 ("Scale", Vector) = (1, 1, 1, 0)
[VectorLabel(L, R, D, U)]_DecalSideOffset3 ("Side Offset", Vector) = (0, 0, 0, 0)
[ThryWideEnum(Off, 0, Flip, 1, Left Only, 2, Right Only, 3, Flip Right Only, 4)] _DecalMirroredUVMode3 ("Mirrored UV Mode", Int) = 0
[ThryWideEnum(Off, 0, Symmetry, 1, Flipped, 2)] _DecalSymmetryMode3 ("Symmetry Mode", Int) = 0
[ToggleUI]_DecalTiled3 ("Tiled", Float) = 0
[HideInInspector] s_end_decal3_position ("Positioning", Float) = 0

_DecalColor3 ("Color--{reference_property:_DecalColor3ThemeIndex}", Color) = (1, 1, 1, 1)
[HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _DecalColor3ThemeIndex ("", Int) = 0
[sRGBWarning(true)]_DecalTexture3 ("Decal--{reference_properties:[_DecalTexture3Pan, _DecalTexture3UV, _Decal3MaskChannel, _DecalOverrideAlpha3]}", 2D) = "white" { }
[HideInInspector][Vector2]_DecalTexture3Pan ("Panning", Vector) = (0, 0, 0, 0)
[HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos, 5, Local Pos, 8, Polar UV, 6, Distorted UV, 7)] _DecalTexture3UV ("UV", Int) = 0
[HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)] _Decal3MaskChannel ("Mask Channel", Int) = 3

_DecalEmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
[ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Lighten, 5, Screen, 6, Subtract, 7, Add, 8, Overlay, 9, Mixed, 20)]_DecalBlendType3 ("Color Blend Mode", Range(0, 1)) = 0
[ThryWideEnum(Off, 0, Replace, 1, Multiply, 2, Add, 3, Subtract, 4, Min, 5, Max, 6)]_DecalOverrideAlpha3 ("Alpha Blend Mode--{reference_property:_Decal3OverrideAlphaMode}", Float) = 0
[HideInInspector][Enum(Everywhere, 0, Decal Bounds, 1)] _Decal3OverrideAlphaMode ("Mode", Int) = 0
_DecalBlendAlpha3 ("Alpha", Range(0, 1)) = 1
_Decal3Depth ("Depth", Range(-0.5, 2)) = 0

[HideInInspector] s_start_Decal3HueShift ("Hue Shift--{reference_property:_DecalHueShiftEnabled3, persistent_expand:true, default_expand:false}", Float) = 0
[HideInInspector][ThryToggleUI(true)]_DecalHueShiftEnabled3 ("Hue Shift", Float) = 0
[ThryWideEnum(OKLab, 0, HSV, 1)] _DecalHueShiftColorSpace3 ("Color Space", Int) = 0
[ThryWideEnum(Hue Select, 0, Hue Shift, 1)] _DecalHueShiftSelectOrShift3 ("Select or Shift", Int) = 1
_DecalHueShiftSpeed3 ("Shift Speed", Float) = 0
_DecalHueShift3 ("Hue Shift", Range(0, 1)) = 0
_Decal3HueAngleStrength ("Hue Angle Power", Float) = 0
[HideInInspector] s_end_Decal3HueShift ("Hue Shift", Float) = 0

[HideInInspector] s_start_Decal3Video ("Video Texture--{reference_property:_Decal3VideoEnabled, persistent_expand:true, default_expand:false}", Float) = 0
[HideInInspector][ToggleUI] _Decal3VideoEnabled ("Video Texture", Float) = 0
[ThryWideEnum(Shrink2Fit, 0, Grow2Fit, 1, Off, 2)] _Decal3VideoAspectFix ("Aspect Ratio", Int) = 0
[ToggleUI] _Decal3VideoFitToScale ("Fit To Scale--{condition_showS:(_Decal3VideoAspectFix==0||_Decal3VideoAspectFix==1)}", Float) = 1
[ToggleUI] _Decal3UseDecalAlpha ("Use Decal Alpha", Float) = 0
[ToggleUI] _Decal3OnlyVideo ("Only Show Video", Float) = 0
_Decal3VideoEmissionStrength ("Emission", Range(0, 20)) = 0
[HideInInspector] s_end_Decal3Video ("Video Texture", Float) = 0

[HideInInspector] s_start_Decal3ChannelSeparation ("Chromatic Aberration--{reference_property:_Decal3ChannelSeparationEnable, persistent_expand:true, default_expand:false}", Int) = 0
[HideInInspector][DoNotAnimate][ThryToggle(true)]_Decal3ChannelSeparationEnable ("Chromatic Aberration", Float) = 0
_Decal3ChannelSeparation ("Intensity", Float) = 0
_Decal3ChannelSeparationAngleStrength ("Surface Angle Intensity", Float) = 0
_Decal3ChannelSeparationHue ("Hue", Range(-1, 1)) = 0
_Decal3ChannelSeparationVertical ("Direction", Range(-3.142, 3.142)) = 0
[ToggleUI]_Decal3ChannelSeparationPremultiply ("Premultiply Alpha--{tooltip:''Fixes Chromatic Aberration issues on some decal textures''}", Float) = 0
[HideInInspector] s_end_Decal3ChannelSeparation ("", Int) = 0

[HideInInspector] s_start_Decal3GlobalMasking ("Masking--{persistent_expand:false, default_expand:false}", Float) = 0
[ThryWideEnum(Off, 0, Front Only, 1, Back Only, 2)] _Decal3FaceMask ("Face Mask", Int) = 0
[ThryWideEnum(Off, 0, 1R, 1, 1G, 2, 1B, 3, 1A, 4, 2R, 5, 2G, 6, 2B, 7, 2A, 8, 3R, 9, 3G, 10, 3B, 11, 3A, 12, 4R, 13, 4G, 14, 4B, 15, 4A, 16)] _Decal3GlobalMask ("Apply From Global Mask--{reference_property:_Decal3GlobalMaskBlendType}", Int) = 0
[HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)]_Decal3GlobalMaskBlendType ("Blending", Range(0, 1)) = 2
[ThryWideEnum(Off, 0, 1R, 1, 1G, 2, 1B, 3, 1A, 4, 2R, 5, 2G, 6, 2B, 7, 2A, 8, 3R, 9, 3G, 10, 3B, 11, 3A, 12, 4R, 13, 4G, 14, 4B, 15, 4A, 16)] _Decal3ApplyGlobalMaskIndex ("Apply to Global Mask--{reference_property:_Decal3ApplyGlobalMaskBlendType}", Int) = 0
[HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _Decal3ApplyGlobalMaskBlendType ("Blending", Int) = 0
[HideInInspector] s_end_Decal3GlobalMasking ("Masking", Float) = 0
// Decal 3 Audio Link
[HideInInspector] m_start_Decal3AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal3ScaleBand ("Scale Band", Int) = 0
[VectorLabel(Xmin, Ymin, Xmax, Ymax)]_AudioLinkDecal3Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal3SideBand ("Side Band", Int) = 0
[VectorLabel(L, R, U, D)]_AudioLinkDecal3SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
[VectorLabel(L, R, U, D)]_AudioLinkDecal3SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal3RotationBand ("Rotation Band", Int) = 0
[VectorLabel(Min, Max)]_AudioLinkDecal3Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal3AlphaBand ("Alpha Band", Int) = 0
[VectorLabel(Min, Max)]_AudioLinkDecal3Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal3EmissionBand ("Emission Band", Int) = 0
[VectorLabel(Min, Max)]_AudioLinkDecal3Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
[ToggleUI]_AudioLinkDecalCC3 ("CC Strip", Float) = 0
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _DecalRotationCTALBand3 ("Chrono Rotation Band", Int) = 0
[ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType3 ("Chrono Motion Type", Int) = 0
_DecalRotationCTALSpeed3 ("Chrono Rotation Speed", Float) = 0
[Space(7)]
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDecal3ChannelSeparationBand ("Chromatic Aberration Band--{condition_showS:(_Decal3ChannelSeparationEnable==1)}", Int) = 0
[VectorLabel(Min, Max)]_AudioLinkDecal3ChannelSeparation ("Chromatic Aberration--{condition_showS:(_Decal3ChannelSeparationEnable==1)}", Vector) = (0, 0, 0, 0)
[HideInInspector] m_end_Decal3AudioLink ("Audio Link", Float) = 0
[HideInInspector] m_end_Decal3 ("Decal 0", Float) = 0
//endex
[HideInInspector] m_end_DecalSection ("Decal", Float) = 0
//endex
#T#PoiDecalsKeywords
//ifex _DecalEnabled==0
#pragma shader_feature GEOM_TYPE_BRANCH
//endex
//ifex _DecalEnabled1==0
#pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
//endex
//ifex _DecalEnabled2==0
#pragma shader_feature GEOM_TYPE_FROND
//endex
//ifex _DecalEnabled3==0
#pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
//endex

#T#PoiDecalsVariables
//ifex _DecalEnabled==0 && _DecalEnabled1==0 && _DecalEnabled2==0 && _DecalEnabled3==0

#if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
	Texture2D _DecalMask;
	float4 _DecalMask_ST;
	float2 _DecalMaskPan;
	float _DecalMaskUV;
#endif
float _DecalTPSDepthMaskEnabled;
float _Decal0TPSMaskStrength;
float _Decal1TPSMaskStrength;
float _Decal2TPSMaskStrength;
float _Decal3TPSMaskStrength;

sampler2D _Udon_VideoTex;
float4 _Udon_VideoTex_TexelSize;

#ifdef POI_AUDIOLINK
	//ifex _DecalEnabled==0
	#ifdef GEOM_TYPE_BRANCH
		// Audio Link
		half _AudioLinkDecal0ScaleBand;
		float4 _AudioLinkDecal0Scale;
		half _AudioLinkDecal0RotationBand;
		float2 _AudioLinkDecal0Rotation;
		half _AudioLinkDecal0AlphaBand;
		float2 _AudioLinkDecal0Alpha;
		half _AudioLinkDecal0EmissionBand;
		float2 _AudioLinkDecal0Emission;
		float _DecalRotationCTALBand0;
		float _DecalRotationCTALSpeed0;
		float _DecalRotationCTALType0;
		float _AudioLinkDecalCC0;
		float _AudioLinkDecal0SideBand;
		float4 _AudioLinkDecal0SideMin;
		float4 _AudioLinkDecal0SideMax;
		float2 _AudioLinkDecal0ChannelSeparation;
		float _AudioLinkDecal0ChannelSeparationBand;
	#endif //GEOM_TYPE_BRANCH
	//endex
	//ifex _DecalEnabled1==0
	#ifdef GEOM_TYPE_BRANCH_DETAIL
		half _AudioLinkDecal1ScaleBand;
		float4 _AudioLinkDecal1Scale;
		half _AudioLinkDecal1RotationBand;
		float2 _AudioLinkDecal1Rotation;
		half _AudioLinkDecal1AlphaBand;
		float2 _AudioLinkDecal1Alpha;
		half _AudioLinkDecal1EmissionBand;
		float2 _AudioLinkDecal1Emission;
		float _DecalRotationCTALBand1;
		float _DecalRotationCTALSpeed1;
		float _DecalRotationCTALType1;
		float _AudioLinkDecalCC1;
		float _AudioLinkDecal1SideBand;
		float4 _AudioLinkDecal1SideMin;
		float4 _AudioLinkDecal1SideMax;
		float2 _AudioLinkDecal1ChannelSeparation;
		float _AudioLinkDecal1ChannelSeparationBand;
	#endif //GEOM_TYPE_BRANCH_DETAIL
	//endex
	//ifex _DecalEnabled2==0
	#ifdef GEOM_TYPE_FROND
		half _AudioLinkDecal2ScaleBand;
		float4 _AudioLinkDecal2Scale;
		half _AudioLinkDecal2RotationBand;
		float2 _AudioLinkDecal2Rotation;
		half _AudioLinkDecal2AlphaBand;
		float2 _AudioLinkDecal2Alpha;
		half _AudioLinkDecal2EmissionBand;
		float2 _AudioLinkDecal2Emission;
		float _DecalRotationCTALBand2;
		float _DecalRotationCTALSpeed2;
		float _DecalRotationCTALType2;
		float _AudioLinkDecalCC2;
		float _AudioLinkDecal2SideBand;
		float4 _AudioLinkDecal2SideMin;
		float4 _AudioLinkDecal2SideMax;
		float2 _AudioLinkDecal2ChannelSeparation;
		float _AudioLinkDecal2ChannelSeparationBand;
	#endif //GEOM_TYPE_FROND
	//endex
	//ifex _DecalEnabled3==0
	#ifdef DEPTH_OF_FIELD_COC_VIEW
		half _AudioLinkDecal3ScaleBand;
		float4 _AudioLinkDecal3Scale;
		half _AudioLinkDecal3RotationBand;
		float2 _AudioLinkDecal3Rotation;
		half _AudioLinkDecal3AlphaBand;
		float2 _AudioLinkDecal3Alpha;
		half _AudioLinkDecal3EmissionBand;
		float2 _AudioLinkDecal3Emission;
		float _DecalRotationCTALBand3;
		float _DecalRotationCTALSpeed3;
		float _DecalRotationCTALType3;
		float _AudioLinkDecalCC3;
		float _AudioLinkDecal3SideBand;
		float4 _AudioLinkDecal3SideMin;
		float4 _AudioLinkDecal3SideMax;
		float2 _AudioLinkDecal3ChannelSeparation;
		float _AudioLinkDecal3ChannelSeparationBand;
	#endif //DEPTH_OF_FIELD_COC_VIEW
	//endex
#endif
//endex
//ifex _DecalEnabled==0
#ifdef GEOM_TYPE_BRANCH
	float _Decal0VideoFitToScale;
	float _Decal0VideoAspectFix;
	float _Decal0VideoEmissionStrength;
	float _Decal0VideoEnabled;
	float _Decal0UseDecalAlpha;
	float _Decal0OnlyVideo;
	sampler2D _DecalTexture;
	float _Decal0FaceMask;
	float _Decal0MaskChannel;
	float _Decal0GlobalMask;
	float _Decal0GlobalMaskBlendType;
	float _Decal0ApplyGlobalMaskIndex;
	float _Decal0ApplyGlobalMaskBlendType;
	float4 _DecalTexture_ST;
	float2 _DecalTexturePan;
	float _DecalTextureUV;
	float4 _DecalColor;
	float _DecalColorThemeIndex;
	float _DecalTiled;
	float _DecalMirroredUVMode;
	float _DecalSymmetryMode;
	float _DecalBlendType;
	half _DecalRotation;
	half3 _DecalScale;
	float4 _DecalSideOffset;
	half2 _DecalPosition;
	half _DecalRotationSpeed;
	float _DecalEmissionStrength;
	float _DecalBlendAlpha;
	float _DecalOverrideAlpha;
	float _DecalHueShiftColorSpace;
	float _DecalHueShiftSelectOrShift;
	float _DecalHueShiftEnabled;
	float _DecalHueShift;
	float _DecalHueShiftSpeed;
	float _Decal0Depth;
	float _Decal0HueAngleStrength;
	float _Decal0ChannelSeparationEnable;
	float _Decal0ChannelSeparation;
	float _Decal0ChannelSeparationPremultiply;
	float _Decal0ChannelSeparationHue;
	float _Decal0ChannelSeparationVertical;
	float _Decal0ChannelSeparationAngleStrength;
	float _Decal0OverrideAlphaMode;
#endif
//endex

//ifex _DecalEnabled1==0
#ifdef GEOM_TYPE_BRANCH_DETAIL
	float _Decal1VideoAspectFix;
	float _Decal1VideoFitToScale;
	float _Decal1VideoEmissionStrength;
	float _Decal1VideoEnabled;
	float _Decal1UseDecalAlpha;
	float _Decal1OnlyVideo;
	float _Decal1TextureToUse;
	sampler2D _DecalTexture1;
	float _Decal1FaceMask;
	float _Decal1MaskChannel;
	float _Decal1GlobalMask;
	float _Decal1GlobalMaskBlendType;
	float _Decal1ApplyGlobalMaskIndex;
	float _Decal1ApplyGlobalMaskBlendType;
	float4 _DecalTexture1_ST;
	float2 _DecalTexture1Pan;
	float _DecalTexture1UV;
	float4 _DecalColor1;
	float _DecalColor1ThemeIndex;
	fixed _DecalTiled1;
	float _DecalBlendType1;
	half _DecalRotation1;
	half3 _DecalScale1;
	float4 _DecalSideOffset1;
	half2 _DecalPosition1;
	half _DecalRotationSpeed1;
	float _DecalEmissionStrength1;
	float _DecalBlendAlpha1;
	float _DecalOverrideAlpha1;
	float _DecalHueShiftColorSpace1;
	float _DecalHueShiftSelectOrShift1;
	float _DecalHueShiftEnabled1;
	float _DecalHueShift1;
	float _DecalHueShiftSpeed1;
	float _Decal1Depth;
	float _Decal1HueAngleStrength;
	float _Decal1ChannelSeparationEnable;
	float _Decal1ChannelSeparation;
	float _Decal1ChannelSeparationPremultiply;
	float _Decal1ChannelSeparationHue;
	float _Decal1ChannelSeparationVertical;
	float _Decal1ChannelSeparationAngleStrength;
	float _Decal1OverrideAlphaMode;
	float _DecalMirroredUVMode1;
	float _DecalSymmetryMode1;
#endif
//endex

//ifex _DecalEnabled2==0
#ifdef GEOM_TYPE_FROND
	float _Decal2VideoAspectFix;
	float _Decal2VideoFitToScale;
	float _Decal2VideoEmissionStrength;
	float _Decal2VideoEnabled;
	float _Decal2UseDecalAlpha;
	float _Decal2OnlyVideo;
	float _Decal2TextureToUse;
	sampler2D _DecalTexture2;
	float _Decal2FaceMask;
	float _Decal2MaskChannel;
	float _Decal2GlobalMask;
	float _Decal2GlobalMaskBlendType;
	float _Decal2ApplyGlobalMaskIndex;
	float _Decal2ApplyGlobalMaskBlendType;
	float4 _DecalTexture2_ST;
	float2 _DecalTexture2Pan;
	float _DecalTexture2UV;
	float4 _DecalColor2;
	float _DecalColor2ThemeIndex;
	fixed _DecalTiled2;
	float _DecalBlendType2;
	half _DecalRotation2;
	half3 _DecalScale2;
	float4 _DecalSideOffset2;
	half2 _DecalPosition2;
	half _DecalRotationSpeed2;
	float _DecalEmissionStrength2;
	float _DecalBlendAlpha2;
	float _DecalOverrideAlpha2;
	float _DecalHueShiftColorSpace2;
	float _DecalHueShiftSelectOrShift2;
	float _DecalHueShiftEnabled2;
	float _DecalHueShift2;
	float _DecalHueShiftSpeed2;
	float _Decal2Depth;
	float _Decal2HueAngleStrength;
	float _Decal2ChannelSeparationEnable;
	float _Decal2ChannelSeparation;
	float _Decal2ChannelSeparationPremultiply;
	float _Decal2ChannelSeparationHue;
	float _Decal2ChannelSeparationVertical;
	float _Decal2ChannelSeparationAngleStrength;
	float _Decal2OverrideAlphaMode;
	float _DecalMirroredUVMode2;
	float _DecalSymmetryMode2;
#endif
//endex

//ifex _DecalEnabled3==0
#ifdef DEPTH_OF_FIELD_COC_VIEW
	float _Decal3VideoAspectFix;
	float _Decal3VideoFitToScale;
	float _Decal3VideoEmissionStrength;
	float _Decal3VideoEnabled;
	float _Decal3UseDecalAlpha;
	float _Decal3OnlyVideo;
	float _Decal3TextureToUse;
	sampler2D _DecalTexture3;
	float _Decal3FaceMask;
	float _Decal3MaskChannel;
	float _Decal3GlobalMask;
	float _Decal3GlobalMaskBlendType;
	float _Decal3ApplyGlobalMaskIndex;
	float _Decal3ApplyGlobalMaskBlendType;
	float4 _DecalTexture3_ST;
	float2 _DecalTexture3Pan;
	float _DecalTexture3UV;
	float4 _DecalColor3;
	float _DecalColor3ThemeIndex;
	fixed _DecalTiled3;
	float _DecalBlendType3;
	half _DecalRotation3;
	half3 _DecalScale3;
	float4 _DecalSideOffset3;
	half2 _DecalPosition3;
	half _DecalRotationSpeed3;
	float _DecalEmissionStrength3;
	float _DecalBlendAlpha3;
	float _DecalOverrideAlpha3;
	float _DecalHueShiftColorSpace3;
	float _DecalHueShiftSelectOrShift3;
	float _DecalHueShiftEnabled3;
	float _DecalHueShift3;
	float _DecalHueShiftSpeed3;
	float _Decal3Depth;
	float _Decal3HueAngleStrength;
	float _Decal3ChannelSeparationEnable;
	float _Decal3ChannelSeparation;
	float _Decal3ChannelSeparationPremultiply;
	float _Decal3ChannelSeparationHue;
	float _Decal3ChannelSeparationVertical;
	float _Decal3ChannelSeparationAngleStrength;
	float _Decal3OverrideAlphaMode;
	float _DecalMirroredUVMode3;
	float _DecalSymmetryMode3;
#endif
//endex

#T#PoiDecalsFunctions
#if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
	float2 decalUV(float uvNumber, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in float symmetryMode, in float mirroredUVMode, in PoiMesh poiMesh, in PoiCam poiCam)
	{
		scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
		float2 centerOffset = float2((scaleOffset.x + scaleOffset.y) / 2, (scaleOffset.z + scaleOffset.w) / 2);
		float2 uv = poiMesh.uv[uvNumber];

		// Copy
		if (symmetryMode == 1) uv.x = abs(uv.x - 0.5) + 0.5;
		// Flip
		if (symmetryMode == 2 && uv.x < 0.5) uv.x = uv.x + 0.5;
		if ((mirroredUVMode == 1 || mirroredUVMode == 4) && poiMesh.isRightHand) uv.x = 1.0 - uv.x;
		// Hide
		if (mirroredUVMode == 2 && poiMesh.isRightHand) uv.x = -1.0;
		if ((mirroredUVMode == 3 || mirroredUVMode == 4) && !poiMesh.isRightHand) uv.x = -1.0;

		uv += calcParallax(depth + 1, poiCam);
		float2 decalCenter = position + centerOffset;
		float theta = radians(rotation + _Time.z * rotationSpeed);
		float cs = cos(theta);
		float sn = sin(theta);
		uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
		uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
		return uv;
	}
	inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed, float colorSpace, float selectOrShift)
	{
		//UNITY_BRANCH
		if (enabled)
		{
			color = hueShift(color, shift + _Time.x * shiftSpeed, colorSpace, selectOrShift);
		}
		return color;
	}

	inline float applyTilingClipping(float enabled, float2 uv)
	{
		float ret = 1;
		//UNITY_BRANCH
		if (!enabled)
		{
			if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
			{
				ret = 0;
			}
		}
		return ret;
	}

	struct PoiDecal
	{
		float m_DecalFaceMask;
		float m_DecalMaskChannel;
		float m_DecalGlobalMask;
		float m_DecalGlobalMaskBlendType;
		float m_DecalApplyGlobalMaskIndex;
		float m_DecalApplyGlobalMaskBlendType;
		float4 m_DecalTexture_ST;
		float2 m_DecalTexturePan;
		float m_DecalTextureUV;
		float4 m_DecalColor;
		float m_DecalColorThemeIndex;
		fixed m_DecalTiled;
		float m_DecalBlendType;
		half m_DecalRotation;
		half3 m_DecalScale;
		float4 m_DecalSideOffset;
		half2 m_DecalPosition;
		half m_DecalRotationSpeed;
		float m_DecalEmissionStrength;
		float m_DecalBlendAlpha;
		float m_DecalAlphaBlendMode;
		float m_DecalHueShiftColorSpace;
		float m_DecalHueShiftSelectOrShift;
		float m_DecalHueShiftEnabled;
		float m_DecalHueShift;
		float m_DecalHueShiftSpeed;
		float m_DecalDepth;
		float m_DecalHueAngleStrength;
		float m_DecalChannelSeparationEnable;
		float m_DecalChannelSeparation;
		float m_DecalChannelSeparationPremultiply;
		float m_DecalChannelSeparationHue;
		float m_DecalChannelSeparationVertical;
		float m_DecalChannelSeparationAngleStrength;
		float m_DecalOverrideAlphaMode;
		float m_DecalOverrideAlpha;
		float m_DecalSymmetryMode;
		float m_DecalMirroredUVMode;

		#if defined(POI_AUDIOLINK)
			half m_AudioLinkDecalScaleBand;
			float4 m_AudioLinkDecalScale;
			half m_AudioLinkDecalRotationBand;
			float2 m_AudioLinkDecalRotation;
			half m_AudioLinkDecalAlphaBand;
			float2 m_AudioLinkDecalAlpha;
			half m_AudioLinkDecalEmissionBand;
			float2 m_AudioLinkDecalEmission;
			float m_DecalRotationCTALBand;
			float m_DecalRotationCTALSpeed;
			float m_DecalRotationCTALType;
			float m_AudioLinkDecalColorChord;
			float m_AudioLinkDecalSideBand;
			float4 m_AudioLinkDecalSideMin;
			float4 m_AudioLinkDecalSideMax;
			float2 m_AudioLinkDecalChannelSeparation;
			float m_AudioLinkDecalChannelSeparationBand;
		#endif

		float4 decalColor;
		float2 decalScale;
		float decalRotation;
		float2 uv;
		float4 dduv;
		float4 sideMod;
		float decalChannelOffset;
		float4 decalMask;
		
		void Init(in float4 DecalMask)
		{
			decalMask = DecalMask;
			decalScale = m_DecalScale.xy;// * m_DecalScale.z;

		}

		void InitAudiolink(in PoiMods poiMods)
		{
			#ifdef POI_AUDIOLINK
				if (poiMods.audioLinkAvailable)
				{
					decalScale += lerp(m_AudioLinkDecalScale.xy, m_AudioLinkDecalScale.zw, poiMods.audioLink[m_AudioLinkDecalScaleBand]);
					sideMod += lerp(m_AudioLinkDecalSideMin, m_AudioLinkDecalSideMax, poiMods.audioLink[m_AudioLinkDecalSideBand]);
					decalRotation += lerp(m_AudioLinkDecalRotation.x, m_AudioLinkDecalRotation.y, poiMods.audioLink[m_AudioLinkDecalRotationBand]);
					decalRotation += AudioLinkGetChronoTime(m_DecalRotationCTALType, m_DecalRotationCTALBand) * m_DecalRotationCTALSpeed * 360;
					decalChannelOffset += lerp(m_AudioLinkDecalChannelSeparation[0], m_AudioLinkDecalChannelSeparation[1], poiMods.audioLink[m_AudioLinkDecalChannelSeparationBand]);
				}
			#endif
		}

		void SampleDecalNoTexture(in PoiMods poiMods, in PoiLight poiLight, in PoiMesh poiMesh, in PoiCam poiCam)
		{
			uv = decalUV(m_DecalTextureUV, m_DecalPosition, m_DecalRotation + decalRotation, m_DecalRotationSpeed, decalScale, m_DecalSideOffset +sideMod, m_DecalDepth, m_DecalSymmetryMode, m_DecalMirroredUVMode, poiMesh, poiCam);
			decalColor = float4(poiThemeColor(poiMods, m_DecalColor.rgb, m_DecalColorThemeIndex), m_DecalColor.a);
			decalColor.rgb = decalHueShift(m_DecalHueShiftEnabled, decalColor.rgb, m_DecalHueShift + poiLight.nDotV * m_DecalHueAngleStrength, m_DecalHueShiftSpeed, m_DecalHueShiftColorSpace, m_DecalHueShiftSelectOrShift);
			decalColor.a *= decalMask[m_DecalMaskChannel] * applyTilingClipping(m_DecalTiled, uv);
		}

		void SampleDecal(sampler2D decalTexture, in PoiMods poiMods, in PoiLight poiLight, in PoiMesh poiMesh, in PoiCam poiCam, float2 scaleMultiplier = float2(1, 1))
		{
			uv = decalUV(m_DecalTextureUV, m_DecalPosition, m_DecalRotation + decalRotation, m_DecalRotationSpeed, decalScale * scaleMultiplier, m_DecalSideOffset +sideMod, m_DecalDepth, m_DecalSymmetryMode, m_DecalMirroredUVMode, poiMesh, poiCam);
			// Adjust derivatives for _ST of decal texture
			float4 dduv = any(fwidth(uv) > .5) ? 0.001 : float4(ddx(uv) * m_DecalTexture_ST.x, ddy(uv) * m_DecalTexture_ST.y);
			decalColor = tex2D(decalTexture, poiUV(uv, m_DecalTexture_ST) + m_DecalTexturePan * _Time.x, dduv.xy, dduv.zw) * float4(poiThemeColor(poiMods, m_DecalColor.rgb, m_DecalColorThemeIndex), m_DecalColor.a);
			decalColor.rgb = decalHueShift(m_DecalHueShiftEnabled, decalColor.rgb, m_DecalHueShift + poiLight.nDotV * m_DecalHueAngleStrength, m_DecalHueShiftSpeed, m_DecalHueShiftColorSpace, m_DecalHueShiftSelectOrShift);
			decalColor.a *= decalMask[m_DecalMaskChannel] * applyTilingClipping(m_DecalTiled, uv);
		}

		void SampleDecalNoAlpha(sampler2D decalTexture, in PoiMods poiMods, in PoiLight poiLight, in PoiMesh poiMesh, in PoiCam poiCam, float2 scaleMultiplier = float2(1, 1))
		{
			uv = decalUV(m_DecalTextureUV, m_DecalPosition, m_DecalRotation + decalRotation, m_DecalRotationSpeed, decalScale * scaleMultiplier, m_DecalSideOffset +sideMod, m_DecalDepth, m_DecalSymmetryMode, m_DecalMirroredUVMode, poiMesh, poiCam);
			// Adjust derivatives for _ST of decal texture
			float4 dduv = any(fwidth(uv) > .5) ? 0.001 : float4(ddx(uv) * m_DecalTexture_ST.x, ddy(uv) * m_DecalTexture_ST.y);
			decalColor.rgb = tex2D(decalTexture, poiUV(uv, m_DecalTexture_ST) + m_DecalTexturePan * _Time.x, dduv.xy, dduv.zw) * float4(poiThemeColor(poiMods, m_DecalColor.rgb, m_DecalColorThemeIndex), m_DecalColor.a).rgb;
			decalColor.rgb = decalHueShift(m_DecalHueShiftEnabled, decalColor.rgb, m_DecalHueShift + poiLight.nDotV * m_DecalHueAngleStrength, m_DecalHueShiftSpeed, m_DecalHueShiftColorSpace, m_DecalHueShiftSelectOrShift);
			decalColor.a *= decalMask[m_DecalMaskChannel] * applyTilingClipping(m_DecalTiled, uv);
		}

		void SampleDecalAlphaOnly(sampler2D decalTexture, in PoiMods poiMods, in PoiLight poiLight, in PoiMesh poiMesh, in PoiCam poiCam, float2 scaleMultiplier = float2(1, 1))
		{
			uv = decalUV(m_DecalTextureUV, m_DecalPosition, m_DecalRotation + decalRotation, m_DecalRotationSpeed, decalScale * scaleMultiplier, m_DecalSideOffset +sideMod, m_DecalDepth, m_DecalSymmetryMode, m_DecalMirroredUVMode, poiMesh, poiCam);
			// Adjust derivatives for _ST of decal texture
			float4 dduv = any(fwidth(uv) > .5) ? 0.001 : float4(ddx(uv) * m_DecalTexture_ST.x, ddy(uv) * m_DecalTexture_ST.y);
			decalColor = tex2D(decalTexture, poiUV(uv, m_DecalTexture_ST) + m_DecalTexturePan * _Time.x, dduv.xy, dduv.zw) * float4(poiThemeColor(poiMods, m_DecalColor.rgb, m_DecalColorThemeIndex), m_DecalColor.a);
			decalColor.a *= decalMask[m_DecalMaskChannel] * applyTilingClipping(m_DecalTiled, uv);
		}

		void SampleDecalChannelSeparation(sampler2D decalTexture, in PoiMods poiMods, in PoiLight poiLight, in PoiMesh poiMesh, in PoiCam poiCam)
		{
			decalColor = float4(0, 0, 0, 1);
			decalChannelOffset += m_DecalChannelSeparation + m_DecalChannelSeparationAngleStrength * (m_DecalChannelSeparationAngleStrength > 0 ? (1 - poiLight.nDotV) : poiLight.nDotV);
			float2 positionOffset = decalChannelOffset * 0.01 * (decalScale.x + decalScale.y) * float2(cos(m_DecalChannelSeparationVertical), sin(m_DecalChannelSeparationVertical));
			float2 uvSample0 = decalUV(m_DecalTextureUV, m_DecalPosition + positionOffset, m_DecalRotation + decalRotation, m_DecalRotationSpeed, decalScale, m_DecalSideOffset +sideMod, m_DecalDepth, m_DecalSymmetryMode, m_DecalMirroredUVMode, poiMesh, poiCam);
			float2 uvSample1 = decalUV(m_DecalTextureUV, m_DecalPosition - positionOffset, m_DecalRotation + decalRotation, m_DecalRotationSpeed, decalScale, m_DecalSideOffset +sideMod, m_DecalDepth, m_DecalSymmetryMode, m_DecalMirroredUVMode, poiMesh, poiCam);

			float4 dduvSample0 = any(fwidth(uvSample0) > .5) ? 0.001 : float4(ddx(uvSample0) * m_DecalTexture_ST.x, ddy(uvSample0) * m_DecalTexture_ST.y);
			float4 dduvSample1 = any(fwidth(uvSample1) > .5) ? 0.001 : float4(ddx(uvSample1) * m_DecalTexture_ST.x, ddy(uvSample1) * m_DecalTexture_ST.y);

			float4 sample0 = tex2D(decalTexture, poiUV(uvSample0, m_DecalTexture_ST) + m_DecalTexturePan * _Time.x, dduvSample0.xy, dduvSample0.zw) * float4(poiThemeColor(poiMods, m_DecalColor.rgb, m_DecalColorThemeIndex), m_DecalColor.a);
			float4 sample1 = tex2D(decalTexture, poiUV(uvSample1, m_DecalTexture_ST) + m_DecalTexturePan * _Time.x, dduvSample1.xy, dduvSample1.zw) * float4(poiThemeColor(poiMods, m_DecalColor.rgb, m_DecalColorThemeIndex), m_DecalColor.a);

			sample0.rgb = decalHueShift(m_DecalHueShiftEnabled, sample0.rgb, m_DecalHueShift + poiLight.nDotV * m_DecalHueAngleStrength, m_DecalHueShiftSpeed, m_DecalHueShiftColorSpace, m_DecalHueShiftSelectOrShift);
			sample1.rgb = decalHueShift(m_DecalHueShiftEnabled, sample1.rgb, m_DecalHueShift + poiLight.nDotV * m_DecalHueAngleStrength, m_DecalHueShiftSpeed, m_DecalHueShiftColorSpace, m_DecalHueShiftSelectOrShift);

			float3 channelSeparationColor = HUEtoRGB(frac(m_DecalChannelSeparationHue));

			if (m_DecalChannelSeparationPremultiply)
			{
				decalColor.rgb = lerp(sample0 * sample0.a, sample1 * sample1.a, channelSeparationColor);
			}
			else
			{
				decalColor.rgb = lerp(sample0, sample1, channelSeparationColor);
			}
			decalColor.a = 0.5 * (sample0.a + sample1.a);
			decalColor.a *= decalMask[m_DecalMaskChannel] * max(applyTilingClipping(m_DecalTiled, uvSample0), applyTilingClipping(m_DecalTiled, uvSample1));
		}

		void Apply(inout float alphaOverride, inout float decalAlpha, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, inout PoiMods poiMods, in PoiLight poiLight)
		{
			if (m_DecalGlobalMask > 0)
			{
				decalColor.a = maskBlend(decalColor.a, poiMods.globalMask[m_DecalGlobalMask - 1], m_DecalGlobalMaskBlendType);
			}

			// Hide
			if (m_DecalMirroredUVMode == 2 && poiMesh.isRightHand) decalColor.a = 0;
			if ((m_DecalMirroredUVMode == 3 || m_DecalMirroredUVMode == 4) && !poiMesh.isRightHand) decalColor.a = 0;

			float audioLinkDecalAlpha = 0;
			float audioLinkDecalEmission = 0;
			#ifdef POI_AUDIOLINK
				audioLinkDecalEmission = lerp(m_AudioLinkDecalEmission.x, m_AudioLinkDecalEmission.y, poiMods.audioLink[m_AudioLinkDecalEmissionBand]) * poiMods.audioLinkAvailable;

				if (m_AudioLinkDecalColorChord)
				{
					if (poiMods.audioLinkAvailable)
					{
						decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
					}
					else
					{
						decalAlpha = 0;
					}
				}
				audioLinkDecalAlpha = lerp(m_AudioLinkDecalAlpha.x, m_AudioLinkDecalAlpha.y, poiMods.audioLink[m_AudioLinkDecalAlphaBand]) * poiMods.audioLinkAvailable;
			#endif



			if (m_DecalFaceMask > 0)
			{
				if (m_DecalFaceMask == 1 && !poiMesh.isFrontFace)
				{
					decalColor.a *= 0;
				}
				else if (m_DecalFaceMask == 2 && poiMesh.isFrontFace)
				{
					decalColor.a *= 0;
				}
			}

			float decalAlphaMixed = decalColor.a * saturate(m_DecalBlendAlpha + audioLinkDecalAlpha);

			if (m_DecalOverrideAlpha)
			{
				float finalAlpha = decalAlphaMixed;
				if (m_DecalOverrideAlphaMode != 0 && !m_DecalTiled)
				{
					if (uv.x > 0 && uv.x < 1 && uv.y > 0 && uv.y < 1)
					{
						//decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[m_DecalMaskChannel]);
						//poiFragData.alpha = saturate(poiFragData.alpha + lerp(1, min(decalAlpha, decalColor.a), decalMask[m_DecalMaskChannel]));
						if (m_DecalOverrideAlpha == 1) poiFragData.alpha = finalAlpha;
						if (m_DecalOverrideAlpha == 2) poiFragData.alpha = saturate(poiFragData.alpha * finalAlpha);
						if (m_DecalOverrideAlpha == 3) poiFragData.alpha = saturate(poiFragData.alpha + finalAlpha);
						if (m_DecalOverrideAlpha == 4) poiFragData.alpha = saturate(poiFragData.alpha - finalAlpha);
						if (m_DecalOverrideAlpha == 5) poiFragData.alpha = min(poiFragData.alpha, finalAlpha);
						if (m_DecalOverrideAlpha == 6) poiFragData.alpha = max(poiFragData.alpha, finalAlpha);
					}
				}
				else
				{
					if (m_DecalOverrideAlpha == 1) poiFragData.alpha = finalAlpha;
					if (m_DecalOverrideAlpha == 2) poiFragData.alpha = saturate(poiFragData.alpha * finalAlpha);
					if (m_DecalOverrideAlpha == 3) poiFragData.alpha = saturate(poiFragData.alpha + finalAlpha);
					if (m_DecalOverrideAlpha == 4) poiFragData.alpha = saturate(poiFragData.alpha - finalAlpha);
					if (m_DecalOverrideAlpha == 5) poiFragData.alpha = min(poiFragData.alpha, finalAlpha);
					if (m_DecalOverrideAlpha == 6) poiFragData.alpha = max(poiFragData.alpha, finalAlpha);
				}
			}

			if (m_DecalApplyGlobalMaskIndex > 0)
			{
				applyToGlobalMask(poiMods, m_DecalApplyGlobalMaskIndex - 1, m_DecalApplyGlobalMaskBlendType, decalAlphaMixed);
			}

			poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, m_DecalBlendType), decalAlphaMixed);
			poiFragData.emission += decalColor.rgb * decalColor.a * max(m_DecalEmissionStrength + audioLinkDecalEmission, 0);
		}
		float2 GetVideoAspectRatio(float2 videoDimensions, float CorrectionType, float fitToScale)
		{
			float2 AspectRatioMultiplier = float2(1, 1);
			if (fitToScale)
			{
				float2 decalScale = m_DecalScale.xy + float2(m_DecalSideOffset.x + m_DecalSideOffset.y, m_DecalSideOffset.z + m_DecalSideOffset.w);
				if (decalScale.x > decalScale.y)
				{
					videoDimensions.xy *= float2((decalScale.y / decalScale.x), 1);
				}
				else
				{
					videoDimensions.xy *= float2(1, (decalScale.x / decalScale.y));
				}
			}

			if (CorrectionType != 2)
			{
				if (CorrectionType == 0)
				{
					if (videoDimensions.x > videoDimensions.y)
					{
						AspectRatioMultiplier = float2(1, videoDimensions.y / videoDimensions.x);
					}
					else
					{
						AspectRatioMultiplier = float2(videoDimensions.x / videoDimensions.y, 1);
					}
				}
				else if (CorrectionType == 1)
				{
					if (videoDimensions.x > videoDimensions.y)
					{
						AspectRatioMultiplier = float2(1 / (videoDimensions.y / videoDimensions.x), 1);
					}
					else
					{
						AspectRatioMultiplier = float2(1, 1 / (videoDimensions.x / videoDimensions.y));
					}
				}
			}
			return AspectRatioMultiplier;
		}
	};


	void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, inout PoiMods poiMods, in PoiLight poiLight)
	{
		// check if _Udon_VideoTex is greater than 16 pixels in width
		float udonVideoTexAvailable = 0;
		float2 udonVideoAspectRatio = 1;
		if (_Udon_VideoTex_TexelSize.z > 16)
		{
			udonVideoTexAvailable = 1;
		}

		float decalAlpha = 1;
		float alphaOverride = 0;
		#if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
			float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
		#else
			float4 decalMask = 1;
		#endif

		#ifdef TPS_Penetrator
			if (_DecalTPSDepthMaskEnabled)
			{
				decalMask.r = lerp(0, decalMask.r * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal0TPSMaskStrength);
				decalMask.g = lerp(0, decalMask.g * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal1TPSMaskStrength);
				decalMask.b = lerp(0, decalMask.b * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal2TPSMaskStrength);
				decalMask.a = lerp(0, decalMask.a * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal3TPSMaskStrength);
			}
		#endif

		float4 decalColor = 1;
		float2 uv = 0;
		// yaes

		//ifex _DecalEnabled==0
		#ifdef GEOM_TYPE_BRANCH
			PoiDecal Decal0;
			PoiInitStruct(PoiDecal, Decal0)
			Decal0.m_DecalFaceMask = _Decal0FaceMask;
			Decal0.m_DecalMaskChannel = _Decal0MaskChannel;
			Decal0.m_DecalGlobalMask = _Decal0GlobalMask;
			Decal0.m_DecalGlobalMaskBlendType = _Decal0GlobalMaskBlendType;
			Decal0.m_DecalApplyGlobalMaskIndex = _Decal0ApplyGlobalMaskIndex;
			Decal0.m_DecalApplyGlobalMaskBlendType = _Decal0ApplyGlobalMaskBlendType;
			Decal0.m_DecalTexture_ST = _DecalTexture_ST;
			Decal0.m_DecalTexturePan = _DecalTexturePan;
			Decal0.m_DecalTextureUV = _DecalTextureUV;
			Decal0.m_DecalColor = _DecalColor;
			Decal0.m_DecalColorThemeIndex = _DecalColorThemeIndex;
			Decal0.m_DecalTiled = _DecalTiled;
			Decal0.m_DecalBlendType = _DecalBlendType;
			Decal0.m_DecalRotation = _DecalRotation;
			Decal0.m_DecalScale = _DecalScale;
			Decal0.m_DecalSideOffset = _DecalSideOffset;
			Decal0.m_DecalPosition = _DecalPosition;
			Decal0.m_DecalRotationSpeed = _DecalRotationSpeed;
			Decal0.m_DecalEmissionStrength = _DecalEmissionStrength;
			Decal0.m_DecalBlendAlpha = _DecalBlendAlpha;
			Decal0.m_DecalOverrideAlpha = _DecalOverrideAlpha;
			Decal0.m_DecalHueShiftEnabled = _DecalHueShiftEnabled;
			Decal0.m_DecalHueShiftColorSpace = _DecalHueShiftColorSpace;
			Decal0.m_DecalHueShiftSelectOrShift = _DecalHueShiftSelectOrShift;
			Decal0.m_DecalHueShift = _DecalHueShift;
			Decal0.m_DecalHueShiftSpeed = _DecalHueShiftSpeed;
			Decal0.m_DecalDepth = _Decal0Depth;
			Decal0.m_DecalHueAngleStrength = _Decal0HueAngleStrength;
			Decal0.m_DecalChannelSeparationEnable = _Decal0ChannelSeparationEnable;
			Decal0.m_DecalChannelSeparation = _Decal0ChannelSeparation;
			Decal0.m_DecalChannelSeparationPremultiply = _Decal0ChannelSeparationPremultiply;
			Decal0.m_DecalChannelSeparationHue = _Decal0ChannelSeparationHue;
			Decal0.m_DecalChannelSeparationVertical = _Decal0ChannelSeparationVertical;
			Decal0.m_DecalChannelSeparationAngleStrength = _Decal0ChannelSeparationAngleStrength;
			Decal0.m_DecalOverrideAlphaMode = _Decal0OverrideAlphaMode;
			Decal0.m_DecalMirroredUVMode = _DecalMirroredUVMode;
			Decal0.m_DecalSymmetryMode = _DecalSymmetryMode;

			Decal0.Init(decalMask);

			#if defined(POI_AUDIOLINK)
				Decal0.m_AudioLinkDecalScaleBand = _AudioLinkDecal0ScaleBand;
				Decal0.m_AudioLinkDecalScale = _AudioLinkDecal0Scale;
				Decal0.m_AudioLinkDecalRotationBand = _AudioLinkDecal0RotationBand;
				Decal0.m_AudioLinkDecalRotation = _AudioLinkDecal0Rotation;
				Decal0.m_AudioLinkDecalAlphaBand = _AudioLinkDecal0AlphaBand;
				Decal0.m_AudioLinkDecalAlpha = _AudioLinkDecal0Alpha;
				Decal0.m_AudioLinkDecalEmissionBand = _AudioLinkDecal0EmissionBand;
				Decal0.m_AudioLinkDecalEmission = _AudioLinkDecal0Emission;
				Decal0.m_DecalRotationCTALBand = _DecalRotationCTALBand0;
				Decal0.m_DecalRotationCTALSpeed = _DecalRotationCTALSpeed0;
				Decal0.m_DecalRotationCTALType = _DecalRotationCTALType0;
				Decal0.m_AudioLinkDecalColorChord = _AudioLinkDecalCC0;
				Decal0.m_AudioLinkDecalSideBand = _AudioLinkDecal0SideBand;
				Decal0.m_AudioLinkDecalSideMin = _AudioLinkDecal0SideMin;
				Decal0.m_AudioLinkDecalSideMax = _AudioLinkDecal0SideMax;
				Decal0.m_AudioLinkDecalChannelSeparation = _AudioLinkDecal0ChannelSeparation;
				Decal0.m_AudioLinkDecalChannelSeparationBand = _AudioLinkDecal0ChannelSeparationBand;

				Decal0.InitAudiolink(poiMods);
			#endif
			
			
			
			if (!_Decal0VideoEnabled)
			{

				#if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
					//ifex _Decal0ChannelSeparationEnable==0
					if (_Decal0ChannelSeparationEnable)
					{
						Decal0.SampleDecalChannelSeparation(_DecalTexture, poiMods, poiLight, poiMesh, poiCam);
					}
					//endex
					//ifex _Decal0ChannelSeparationEnable==1
					if (!_Decal0ChannelSeparationEnable)
					{
						Decal0.SampleDecal(_DecalTexture, poiMods, poiLight, poiMesh, poiCam);
					}
					//endex
				#else
					Decal0.SampleDecalNoTexture(poiMods, poiLight, poiMesh, poiCam);
				#endif
				Decal0.Apply(alphaOverride, decalAlpha, poiFragData, poiMesh, poiCam, poiMods, poiLight);
			}
			else
			{
				udonVideoAspectRatio = Decal0.GetVideoAspectRatio(_Udon_VideoTex_TexelSize.zw, _Decal0VideoAspectFix, _Decal0VideoFitToScale);
				
				if (_Decal0OnlyVideo)
				{
					if (udonVideoTexAvailable)
					{
						Decal0.m_DecalEmissionStrength += _Decal0VideoEmissionStrength;
						if (_Decal0UseDecalAlpha)
						{
							Decal0.SampleDecal(_DecalTexture, poiMods, poiLight, poiMesh, poiCam);
							Decal0.SampleDecalNoAlpha(_Udon_VideoTex, poiMods, poiLight, poiMesh, poiCam, udonVideoAspectRatio);
						}
						else
						{
							Decal0.SampleDecal(_Udon_VideoTex, poiMods, poiLight, poiMesh, poiCam, udonVideoAspectRatio);
						}
						Decal0.Apply(alphaOverride, decalAlpha, poiFragData, poiMesh, poiCam, poiMods, poiLight);
					}
				}
				else
				{
					Decal0.SampleDecal(_DecalTexture, poiMods, poiLight, poiMesh, poiCam);
					if (udonVideoTexAvailable)
					{
						Decal0.m_DecalEmissionStrength += _Decal0VideoEmissionStrength;
						if (_Decal0UseDecalAlpha)
						{
							Decal0.SampleDecalNoAlpha(_Udon_VideoTex, poiMods, poiLight, poiMesh, poiCam, udonVideoAspectRatio);
						}
						else
						{
							Decal0.SampleDecal(_Udon_VideoTex, poiMods, poiLight, poiMesh, poiCam, udonVideoAspectRatio);
						}
					}
					Decal0.Apply(alphaOverride, decalAlpha, poiFragData, poiMesh, poiCam, poiMods, poiLight);
				}
			}
		#endif
		//endex

		//ifex _DecalEnabled1==0
		#ifdef GEOM_TYPE_BRANCH_DETAIL
			PoiDecal Decal1;
			PoiInitStruct(PoiDecal, Decal1)
			Decal1.m_DecalFaceMask = _Decal1FaceMask;
			Decal1.m_DecalMaskChannel = _Decal1MaskChannel;
			Decal1.m_DecalGlobalMask = _Decal1GlobalMask;
			Decal1.m_DecalGlobalMaskBlendType = _Decal1GlobalMaskBlendType;
			Decal1.m_DecalApplyGlobalMaskIndex = _Decal1ApplyGlobalMaskIndex;
			Decal1.m_DecalApplyGlobalMaskBlendType = _Decal1ApplyGlobalMaskBlendType;
			Decal1.m_DecalTexture_ST = _DecalTexture1_ST;
			Decal1.m_DecalTexturePan = _DecalTexture1Pan;
			Decal1.m_DecalTextureUV = _DecalTexture1UV;
			Decal1.m_DecalColor = _DecalColor1;
			Decal1.m_DecalColorThemeIndex = _DecalColor1ThemeIndex;
			Decal1.m_DecalTiled = _DecalTiled1;
			Decal1.m_DecalBlendType = _DecalBlendType1;
			Decal1.m_DecalRotation = _DecalRotation1;
			Decal1.m_DecalScale = _DecalScale1;
			Decal1.m_DecalSideOffset = _DecalSideOffset1;
			Decal1.m_DecalPosition = _DecalPosition1;
			Decal1.m_DecalRotationSpeed = _DecalRotationSpeed1;
			Decal1.m_DecalEmissionStrength = _DecalEmissionStrength1;
			Decal1.m_DecalBlendAlpha = _DecalBlendAlpha1;
			Decal1.m_DecalOverrideAlpha = _DecalOverrideAlpha1;
			Decal1.m_DecalHueShiftEnabled = _DecalHueShiftEnabled1;
			Decal1.m_DecalHueShiftColorSpace = _DecalHueShiftColorSpace1;
			Decal1.m_DecalHueShiftSelectOrShift = _DecalHueShiftSelectOrShift1;
			Decal1.m_DecalHueShift = _DecalHueShift1;
			Decal1.m_DecalHueShiftSpeed = _DecalHueShiftSpeed1;
			Decal1.m_DecalDepth = _Decal1Depth;
			Decal1.m_DecalHueAngleStrength = _Decal1HueAngleStrength;
			Decal1.m_DecalChannelSeparationEnable = _Decal1ChannelSeparationEnable;
			Decal1.m_DecalChannelSeparation = _Decal1ChannelSeparation;
			Decal1.m_DecalChannelSeparationPremultiply = _Decal1ChannelSeparationPremultiply;
			Decal1.m_DecalChannelSeparationHue = _Decal1ChannelSeparationHue;
			Decal1.m_DecalChannelSeparationVertical = _Decal1ChannelSeparationVertical;
			Decal1.m_DecalChannelSeparationAngleStrength = _Decal1ChannelSeparationAngleStrength;
			Decal1.m_DecalOverrideAlphaMode = _Decal1OverrideAlphaMode;
			Decal1.m_DecalMirroredUVMode = _DecalMirroredUVMode1;
			Decal1.m_DecalSymmetryMode = _DecalSymmetryMode1;

			Decal1.Init(decalMask);

			#if defined(POI_AUDIOLINK)
				Decal1.m_AudioLinkDecalScaleBand = _AudioLinkDecal1ScaleBand;
				Decal1.m_AudioLinkDecalScale = _AudioLinkDecal1Scale;
				Decal1.m_AudioLinkDecalRotationBand = _AudioLinkDecal1RotationBand;
				Decal1.m_AudioLinkDecalRotation = _AudioLinkDecal1Rotation;
				Decal1.m_AudioLinkDecalAlphaBand = _AudioLinkDecal1AlphaBand;
				Decal1.m_AudioLinkDecalAlpha = _AudioLinkDecal1Alpha;
				Decal1.m_AudioLinkDecalEmissionBand = _AudioLinkDecal1EmissionBand;
				Decal1.m_AudioLinkDecalEmission = _AudioLinkDecal1Emission;
				Decal1.m_DecalRotationCTALBand = _DecalRotationCTALBand1;
				Decal1.m_DecalRotationCTALSpeed = _DecalRotationCTALSpeed1;
				Decal1.m_DecalRotationCTALType = _DecalRotationCTALType1;
				Decal1.m_AudioLinkDecalColorChord = _AudioLinkDecalCC1;
				Decal1.m_AudioLinkDecalSideBand = _AudioLinkDecal1SideBand;
				Decal1.m_AudioLinkDecalSideMin = _AudioLinkDecal1SideMin;
				Decal1.m_AudioLinkDecalSideMax = _AudioLinkDecal1SideMax;
				Decal1.m_AudioLinkDecalChannelSeparation = _AudioLinkDecal1ChannelSeparation;
				Decal1.m_AudioLinkDecalChannelSeparationBand = _AudioLinkDecal1ChannelSeparationBand;

				Decal1.InitAudiolink(poiMods);
			#endif
			
			if (!_Decal1VideoEnabled)
			{
				#if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
					//ifex _Decal1ChannelSeparationEnable==0
					if (_Decal1ChannelSeparationEnable)
					{
						Decal1.SampleDecalChannelSeparation(_DecalTexture1, poiMods, poiLight, poiMesh, poiCam);
					}
					//endex
					//ifex _Decal1ChannelSeparationEnable==1
					if (!_Decal1ChannelSeparationEnable)
					{
						Decal1.SampleDecal(_DecalTexture1, poiMods, poiLight, poiMesh, poiCam);
					}
					//endex
				#else
					Decal1.SampleDecalNoTexture(poiMods, poiLight, poiMesh, poiCam);
				#endif
				Decal1.Apply(alphaOverride, decalAlpha, poiFragData, poiMesh, poiCam, poiMods, poiLight);
			}
			else
			{
				udonVideoAspectRatio = Decal1.GetVideoAspectRatio(_Udon_VideoTex_TexelSize.zw, _Decal1VideoAspectFix, _Decal1VideoFitToScale);
				if (_Decal1OnlyVideo)
				{
					if (udonVideoTexAvailable)
					{
						Decal1.m_DecalEmissionStrength += _Decal1VideoEmissionStrength;
						if (_Decal1UseDecalAlpha)
						{
							Decal1.SampleDecal(_DecalTexture1, poiMods, poiLight, poiMesh, poiCam);
							Decal1.SampleDecalNoAlpha(_Udon_VideoTex, poiMods, poiLight, poiMesh, poiCam, udonVideoAspectRatio);
						}
						else
						{
							Decal1.SampleDecal(_Udon_VideoTex, poiMods, poiLight, poiMesh, poiCam, udonVideoAspectRatio);
						}
						Decal1.Apply(alphaOverride, decalAlpha, poiFragData, poiMesh, poiCam, poiMods, poiLight);
					}
				}
				else
				{
					Decal1.SampleDecal(_DecalTexture1, poiMods, poiLight, poiMesh, poiCam);
					if (udonVideoTexAvailable)
					{
						Decal1.m_DecalEmissionStrength += _Decal1VideoEmissionStrength;
						if (_Decal1UseDecalAlpha)
						{
							Decal1.SampleDecalNoAlpha(_Udon_VideoTex, poiMods, poiLight, poiMesh, poiCam, udonVideoAspectRatio);
						}
						else
						{
							Decal1.SampleDecal(_Udon_VideoTex, poiMods, poiLight, poiMesh, poiCam, udonVideoAspectRatio);
						}
					}
					Decal1.Apply(alphaOverride, decalAlpha, poiFragData, poiMesh, poiCam, poiMods, poiLight);
				}
			}
		#endif
		//endex

		//ifex _DecalEnabled2==0
		#ifdef GEOM_TYPE_FROND
			PoiDecal Decal2;
			PoiInitStruct(PoiDecal, Decal2)
			Decal2.m_DecalFaceMask = _Decal2FaceMask;
			Decal2.m_DecalMaskChannel = _Decal2MaskChannel;
			Decal2.m_DecalGlobalMask = _Decal2GlobalMask;
			Decal2.m_DecalGlobalMaskBlendType = _Decal2GlobalMaskBlendType;
			Decal2.m_DecalApplyGlobalMaskIndex = _Decal2ApplyGlobalMaskIndex;
			Decal2.m_DecalApplyGlobalMaskBlendType = _Decal2ApplyGlobalMaskBlendType;
			Decal2.m_DecalTexture_ST = _DecalTexture2_ST;
			Decal2.m_DecalTexturePan = _DecalTexture2Pan;
			Decal2.m_DecalTextureUV = _DecalTexture2UV;
			Decal2.m_DecalColor = _DecalColor2;
			Decal2.m_DecalColorThemeIndex = _DecalColor2ThemeIndex;
			Decal2.m_DecalTiled = _DecalTiled2;
			Decal2.m_DecalBlendType = _DecalBlendType2;
			Decal2.m_DecalRotation = _DecalRotation2;
			Decal2.m_DecalScale = _DecalScale2;
			Decal2.m_DecalSideOffset = _DecalSideOffset2;
			Decal2.m_DecalPosition = _DecalPosition2;
			Decal2.m_DecalRotationSpeed = _DecalRotationSpeed2;
			Decal2.m_DecalEmissionStrength = _DecalEmissionStrength2;
			Decal2.m_DecalBlendAlpha = _DecalBlendAlpha2;
			Decal2.m_DecalOverrideAlpha = _DecalOverrideAlpha2;
			Decal2.m_DecalHueShiftColorSpace = _DecalHueShiftColorSpace2;
			Decal2.m_DecalHueShiftSelectOrShift = _DecalHueShiftSelectOrShift2;
			Decal2.m_DecalHueShiftEnabled = _DecalHueShiftEnabled2;
			Decal2.m_DecalHueShift = _DecalHueShift2;
			Decal2.m_DecalHueShiftSpeed = _DecalHueShiftSpeed2;
			Decal2.m_DecalDepth = _Decal2Depth;
			Decal2.m_DecalHueAngleStrength = _Decal2HueAngleStrength;
			Decal2.m_DecalChannelSeparationEnable = _Decal2ChannelSeparationEnable;
			Decal2.m_DecalChannelSeparation = _Decal2ChannelSeparation;
			Decal2.m_DecalChannelSeparationPremultiply = _Decal2ChannelSeparationPremultiply;
			Decal2.m_DecalChannelSeparationHue = _Decal2ChannelSeparationHue;
			Decal2.m_DecalChannelSeparationVertical = _Decal2ChannelSeparationVertical;
			Decal2.m_DecalChannelSeparationAngleStrength = _Decal2ChannelSeparationAngleStrength;
			Decal2.m_DecalOverrideAlphaMode = _Decal2OverrideAlphaMode;
			Decal2.m_DecalMirroredUVMode = _DecalMirroredUVMode2;
			Decal2.m_DecalSymmetryMode = _DecalSymmetryMode2;

			Decal2.Init(decalMask);

			#if defined(POI_AUDIOLINK)
				Decal2.m_AudioLinkDecalScaleBand = _AudioLinkDecal2ScaleBand;
				Decal2.m_AudioLinkDecalScale = _AudioLinkDecal2Scale;
				Decal2.m_AudioLinkDecalRotationBand = _AudioLinkDecal2RotationBand;
				Decal2.m_AudioLinkDecalRotation = _AudioLinkDecal2Rotation;
				Decal2.m_AudioLinkDecalAlphaBand = _AudioLinkDecal2AlphaBand;
				Decal2.m_AudioLinkDecalAlpha = _AudioLinkDecal2Alpha;
				Decal2.m_AudioLinkDecalEmissionBand = _AudioLinkDecal2EmissionBand;
				Decal2.m_AudioLinkDecalEmission = _AudioLinkDecal2Emission;
				Decal2.m_DecalRotationCTALBand = _DecalRotationCTALBand2;
				Decal2.m_DecalRotationCTALSpeed = _DecalRotationCTALSpeed2;
				Decal2.m_DecalRotationCTALType = _DecalRotationCTALType2;
				Decal2.m_AudioLinkDecalColorChord = _AudioLinkDecalCC2;
				Decal2.m_AudioLinkDecalSideBand = _AudioLinkDecal2SideBand;
				Decal2.m_AudioLinkDecalSideMin = _AudioLinkDecal2SideMin;
				Decal2.m_AudioLinkDecalSideMax = _AudioLinkDecal2SideMax;
				Decal2.m_AudioLinkDecalChannelSeparation = _AudioLinkDecal2ChannelSeparation;
				Decal2.m_AudioLinkDecalChannelSeparationBand = _AudioLinkDecal2ChannelSeparationBand;

				Decal2.InitAudiolink(poiMods);
			#endif
			if (!_Decal2VideoEnabled)
			{
				#if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
					//ifex _Decal2ChannelSeparationEnable==0
					if (_Decal2ChannelSeparationEnable)
					{
						Decal2.SampleDecalChannelSeparation(_DecalTexture2, poiMods, poiLight, poiMesh, poiCam);
					}
					//endex
					//ifex _Decal2ChannelSeparationEnable==1
					if (!_Decal2ChannelSeparationEnable)
					{
						Decal2.SampleDecal(_DecalTexture2, poiMods, poiLight, poiMesh, poiCam);
					}
					//endex
				#else
					Decal2.SampleDecalNoTexture(poiMods, poiLight, poiMesh, poiCam);
				#endif
				Decal2.Apply(alphaOverride, decalAlpha, poiFragData, poiMesh, poiCam, poiMods, poiLight);
			}
			else
			{
				udonVideoAspectRatio = Decal2.GetVideoAspectRatio(_Udon_VideoTex_TexelSize.zw, _Decal2VideoAspectFix, _Decal2VideoFitToScale);
				if (_Decal2OnlyVideo)
				{
					if (udonVideoTexAvailable)
					{
						Decal2.m_DecalEmissionStrength += _Decal2VideoEmissionStrength;
						if (_Decal2UseDecalAlpha)
						{
							Decal2.SampleDecal(_DecalTexture2, poiMods, poiLight, poiMesh, poiCam);
							Decal2.SampleDecalNoAlpha(_Udon_VideoTex, poiMods, poiLight, poiMesh, poiCam, udonVideoAspectRatio);
						}
						else
						{
							Decal2.SampleDecal(_Udon_VideoTex, poiMods, poiLight, poiMesh, poiCam, udonVideoAspectRatio);
						}
						Decal2.Apply(alphaOverride, decalAlpha, poiFragData, poiMesh, poiCam, poiMods, poiLight);
					}
				}
				else
				{
					Decal2.SampleDecal(_DecalTexture2, poiMods, poiLight, poiMesh, poiCam);
					if (udonVideoTexAvailable)
					{
						Decal2.m_DecalEmissionStrength += _Decal2VideoEmissionStrength;
						if (_Decal2UseDecalAlpha)
						{
							Decal2.SampleDecalNoAlpha(_Udon_VideoTex, poiMods, poiLight, poiMesh, poiCam, udonVideoAspectRatio);
						}
						else
						{
							Decal2.SampleDecal(_Udon_VideoTex, poiMods, poiLight, poiMesh, poiCam, udonVideoAspectRatio);
						}
					}
					Decal2.Apply(alphaOverride, decalAlpha, poiFragData, poiMesh, poiCam, poiMods, poiLight);
				}
			}
		#endif
		//endex

		//ifex _DecalEnabled3==0
		#ifdef DEPTH_OF_FIELD_COC_VIEW
			PoiDecal Decal3;
			PoiInitStruct(PoiDecal, Decal3)
			Decal3.m_DecalFaceMask = _Decal3FaceMask;
			Decal3.m_DecalMaskChannel = _Decal3MaskChannel;
			Decal3.m_DecalGlobalMask = _Decal3GlobalMask;
			Decal3.m_DecalGlobalMaskBlendType = _Decal3GlobalMaskBlendType;
			Decal3.m_DecalApplyGlobalMaskIndex = _Decal3ApplyGlobalMaskIndex;
			Decal3.m_DecalApplyGlobalMaskBlendType = _Decal3ApplyGlobalMaskBlendType;
			Decal3.m_DecalTexture_ST = _DecalTexture3_ST;
			Decal3.m_DecalTexturePan = _DecalTexture3Pan;
			Decal3.m_DecalTextureUV = _DecalTexture3UV;
			Decal3.m_DecalColor = _DecalColor3;
			Decal3.m_DecalColorThemeIndex = _DecalColor3ThemeIndex;
			Decal3.m_DecalTiled = _DecalTiled3;
			Decal3.m_DecalBlendType = _DecalBlendType3;
			Decal3.m_DecalRotation = _DecalRotation3;
			Decal3.m_DecalScale = _DecalScale3;
			Decal3.m_DecalSideOffset = _DecalSideOffset3;
			Decal3.m_DecalPosition = _DecalPosition3;
			Decal3.m_DecalRotationSpeed = _DecalRotationSpeed3;
			Decal3.m_DecalEmissionStrength = _DecalEmissionStrength3;
			Decal3.m_DecalBlendAlpha = _DecalBlendAlpha3;
			Decal3.m_DecalOverrideAlpha = _DecalOverrideAlpha3;
			Decal3.m_DecalHueShiftColorSpace = _DecalHueShiftColorSpace3;
			Decal3.m_DecalHueShiftSelectOrShift = _DecalHueShiftSelectOrShift3;
			Decal3.m_DecalHueShiftEnabled = _DecalHueShiftEnabled3;
			Decal3.m_DecalHueShift = _DecalHueShift3;
			Decal3.m_DecalHueShiftSpeed = _DecalHueShiftSpeed3;
			Decal3.m_DecalDepth = _Decal3Depth;
			Decal3.m_DecalHueAngleStrength = _Decal3HueAngleStrength;
			Decal3.m_DecalChannelSeparationEnable = _Decal3ChannelSeparationEnable;
			Decal3.m_DecalChannelSeparation = _Decal3ChannelSeparation;
			Decal3.m_DecalChannelSeparationPremultiply = _Decal3ChannelSeparationPremultiply;
			Decal3.m_DecalChannelSeparationHue = _Decal3ChannelSeparationHue;
			Decal3.m_DecalChannelSeparationVertical = _Decal3ChannelSeparationVertical;
			Decal3.m_DecalChannelSeparationAngleStrength = _Decal3ChannelSeparationAngleStrength;
			Decal3.m_DecalOverrideAlphaMode = _Decal3OverrideAlphaMode;
			Decal3.m_DecalMirroredUVMode = _DecalMirroredUVMode3;
			Decal3.m_DecalSymmetryMode = _DecalSymmetryMode3;

			Decal3.Init(decalMask);

			#if defined(POI_AUDIOLINK)
				Decal3.m_AudioLinkDecalScaleBand = _AudioLinkDecal3ScaleBand;
				Decal3.m_AudioLinkDecalScale = _AudioLinkDecal3Scale;
				Decal3.m_AudioLinkDecalRotationBand = _AudioLinkDecal3RotationBand;
				Decal3.m_AudioLinkDecalRotation = _AudioLinkDecal3Rotation;
				Decal3.m_AudioLinkDecalAlphaBand = _AudioLinkDecal3AlphaBand;
				Decal3.m_AudioLinkDecalAlpha = _AudioLinkDecal3Alpha;
				Decal3.m_AudioLinkDecalEmissionBand = _AudioLinkDecal3EmissionBand;
				Decal3.m_AudioLinkDecalEmission = _AudioLinkDecal3Emission;
				Decal3.m_DecalRotationCTALBand = _DecalRotationCTALBand3;
				Decal3.m_DecalRotationCTALSpeed = _DecalRotationCTALSpeed3;
				Decal3.m_DecalRotationCTALType = _DecalRotationCTALType3;
				Decal3.m_AudioLinkDecalColorChord = _AudioLinkDecalCC3;
				Decal3.m_AudioLinkDecalSideBand = _AudioLinkDecal3SideBand;
				Decal3.m_AudioLinkDecalSideMin = _AudioLinkDecal3SideMin;
				Decal3.m_AudioLinkDecalSideMax = _AudioLinkDecal3SideMax;
				Decal3.m_AudioLinkDecalChannelSeparation = _AudioLinkDecal3ChannelSeparation;
				Decal3.m_AudioLinkDecalChannelSeparationBand = _AudioLinkDecal3ChannelSeparationBand;

				Decal3.InitAudiolink(poiMods);
			#endif
			if (!_Decal3VideoEnabled)
			{
				#if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
					//ifex _Decal3ChannelSeparationEnable==0
					if (_Decal3ChannelSeparationEnable)
					{
						Decal3.SampleDecalChannelSeparation(_DecalTexture3, poiMods, poiLight, poiMesh, poiCam);
					}
					//endex
					//ifex _Decal3ChannelSeparationEnable==1
					if (!_Decal3ChannelSeparationEnable)
					{
						Decal3.SampleDecal(_DecalTexture3, poiMods, poiLight, poiMesh, poiCam);
					}
					//endex
				#else
					Decal3.SampleDecalNoTexture(poiMods, poiLight, poiMesh, poiCam);
				#endif
				Decal3.Apply(alphaOverride, decalAlpha, poiFragData, poiMesh, poiCam, poiMods, poiLight);
			}
			else
			{
				udonVideoAspectRatio = Decal3.GetVideoAspectRatio(_Udon_VideoTex_TexelSize.zw, _Decal3VideoAspectFix, _Decal3VideoFitToScale);
				if (_Decal3OnlyVideo)
				{
					if (udonVideoTexAvailable)
					{
						Decal3.m_DecalEmissionStrength += _Decal3VideoEmissionStrength;
						if (_Decal3UseDecalAlpha)
						{
							Decal3.SampleDecal(_DecalTexture3, poiMods, poiLight, poiMesh, poiCam);
							Decal3.SampleDecalNoAlpha(_Udon_VideoTex, poiMods, poiLight, poiMesh, poiCam, udonVideoAspectRatio);
						}
						else
						{
							Decal3.SampleDecal(_Udon_VideoTex, poiMods, poiLight, poiMesh, poiCam, udonVideoAspectRatio);
						}
						Decal3.Apply(alphaOverride, decalAlpha, poiFragData, poiMesh, poiCam, poiMods, poiLight);
					}
				}
				else
				{
					Decal3.SampleDecal(_DecalTexture3, poiMods, poiLight, poiMesh, poiCam);
					if (udonVideoTexAvailable)
					{
						Decal3.m_DecalEmissionStrength += _Decal3VideoEmissionStrength;
						if (_Decal3UseDecalAlpha)
						{
							Decal3.SampleDecalNoAlpha(_Udon_VideoTex, poiMods, poiLight, poiMesh, poiCam, udonVideoAspectRatio);
						}
						else
						{
							Decal3.SampleDecal(_Udon_VideoTex, poiMods, poiLight, poiMesh, poiCam, udonVideoAspectRatio);
						}
					}
					Decal3.Apply(alphaOverride, decalAlpha, poiFragData, poiMesh, poiCam, poiMods, poiLight);
				}
			}
		#endif
		//endex
		//if (alphaOverride)
		//{
		
		//poiFragData.baseColor = decalAlpha;
		//poiFragData.alpha *= decalAlpha;

		//}
		//poiFragData.baseColor = saturate(poiFragData.baseColor);

	}
#endif

#T#PoiDecalsFunctionCalls
#if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
	applyDecals(poiFragData, poiMesh, poiCam, poiMods, poiLight);
#endif

