#T#PoiMatcapProperties
// First Matcap
//ifex _MatcapEnable==0
[HideInInspector] m_start_matcap ("Matcap [IDX_Maptcap++]--{reference_property:_MatcapEnable,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/matcap},hover:Documentation}}", Float) = 0
[HideInInspector][ThryToggle(POI_MATCAP0)]_MatcapEnable ("Enable Matcap}", Float) = 0
[ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2, Gradient, 3)] _MatcapUVMode ("UV Mode", Int) = 1
_MatcapColor ("Color--{reference_property:_MatcapColorThemeIndex}", 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)] _MatcapColorThemeIndex ("", Int) = 0
[sRGBWarning(true)][Gradient]_Matcap ("Matcap--{reference_properties:[_MatcapUVToBlend, _MatCapBlendUV1, _MatcapPan, _MatcapBorder, _MatcapRotation]}", 2D) = "white" { }
[HideInInspector][Vector2]_MatcapPan ("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)] _MatcapUVToBlend ("UV To Blend", Int) = 1
[HideInInspector][VectorToSliders(Blend UV X, 0.0, 1.0, Blend UV Y, 0.0, 1.0)]_MatCapBlendUV1 ("UV Blend", Vector) = (0, 0, 0, 0)
[HideInInspector]_MatcapBorder ("Border", Range(0, 5)) = 0.5
[HideInInspector]_MatcapRotation ("Rotation", Range(-1, 1)) = 0
_MatcapIntensity ("Intensity", Range(0, 5)) = 1
_MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
_MatcapBaseColorMix ("Base Color Mix", Range(0, 1)) = 0
_MatcapNormal ("Normal Strength", Range(0, 1)) = 1

[HideInInspector] s_start_Matcap0Masking ("Masking--{persistent_expand:true,default_expand:true}", Float) = 1
[sRGBWarning][ThryRGBAPacker(R Mask, G Nothing, B Nothing, A Smoothness, linear, false)]_MatcapMask ("Mask--{reference_properties:[_MatcapMaskPan, _MatcapMaskUV, _MatcapMaskChannel, _MatcapMaskInvert]}", 2D) = "white" { }
[HideInInspector][Vector2]_MatcapMaskPan ("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)] _MatcapMaskUV ("UV", Int) = 0
[HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)]_MatcapMaskChannel ("Channel", Float) = 0
[HideInInspector][ToggleUI]_MatcapMaskInvert ("Invert", Float) = 0
_MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 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)] _MatcapMaskGlobalMask (" Global Mask--{reference_property:_MatcapMaskGlobalMaskBlendType}", Int) = 0
[HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)]_MatcapMaskGlobalMaskBlendType ("Blending", Range(0, 1)) = 2
[HideInInspector] s_end_Matcap0Masking ("Masking", Float) = 0

[HideInInspector] s_start_Matcap0Blending ("Blending--{persistent_expand:true,default_expand:true}", Float) = 1
_MatcapReplace ("Replace", Range(0, 1)) = 1
_MatcapMultiply ("Multiply", Range(0, 1)) = 0
_MatcapAdd ("Add", Range(0, 1)) = 0
_MatcapMixed ("Mixed", Range(0, 1)) = 0
_MatcapScreen ("Screen", Range(0, 1)) = 0
_MatcapAddToLight ("Unlit Add", Range(0, 1)) = 0
[HideInInspector] s_end_Matcap0Blending ("Blending", Float) = 0

[HideInInspector] s_start_MatcapNormal ("Custom Normal Map--{reference_property:_Matcap0CustomNormal,persistent_expand:true}", Float) = 0
[HideInInspector][ThryToggle(POI_MATCAP0_CUSTOM_NORMAL, true)] _Matcap0CustomNormal ("Custom Normal", Float) = 0
[Normal]_Matcap0NormalMap ("Normal Map--{reference_properties:[_Matcap0NormalMapPan, _Matcap0NormalMapUV, _Matcap0NormalMapScale]}", 2D) = "bump" { }
[HideInInspector][Vector2]_Matcap0NormalMapPan ("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)] _Matcap0NormalMapUV ("UV", Int) = 0
[HideInInspector]_Matcap0NormalMapScale ("Intensity", Range(0, 10)) = 1
[HideInInspector] s_end_MatcapNormal ("", Float) = 0

[HideInInspector] s_start_MatcapHueShift ("Hue Shift--{reference_property:_MatcapHueShiftEnabled,persistent_expand:true}", Float) = 0
[HideInInspector][ThryToggleUI(true)] _MatcapHueShiftEnabled ("Hue Shift", Float) = 0
[ThryWideEnum(OKLab, 0, HSV, 1)] _MatcapHueShiftColorSpace ("Color Space", Int) = 0
[ThryWideEnum(Hue Select, 0, Hue Shift, 1)] _MatcapHueSelectOrShift ("Select or Shift", Int) = 1
_MatcapHueShiftSpeed ("Shift Speed", Float) = 0
_MatcapHueShift ("Hue Shift", Range(0, 1)) = 0
[HideInInspector] s_end_MatcapHueShift ("", Float) = 0

[HideInInspector] s_start_MatcapSmoothness ("Blur / Smoothness--{reference_property:_MatcapSmoothnessEnabled,persistent_expand:true}", Float) = 0
[HideInInspector][ThryToggleUI(true)] _MatcapSmoothnessEnabled ("Blur", Float) = 0
_MatcapSmoothness ("Smoothness", Range(0, 1)) = 1
[ToggleUI]_MatcapMaskSmoothnessApply ("Apply Mask for Smoothness", Float) = 0
[Enum(R, 0, G, 1, B, 2, A, 3)]_MatcapMaskSmoothnessChannel ("Mask Channel for Smoothness", Int) = 3
[HideInInspector] s_end_MatcapSmoothness ("", Float) = 0

[HideInInspector] s_start_matcapApplyToAlpha ("Alpha Options--{persistent_expand:true,default_expand:false}", Float) = 0
_MatcapAlphaOverride ("Override Alpha", Range(0, 1)) = 0
[ToggleUI] _MatcapApplyToAlphaEnabled ("Intensity To Alpha", Float) = 0
[ThryWideEnum(Greyscale, 0, Max, 1)] _MatcapApplyToAlphaSourceBlend ("Source Blend--{condition_showS:(_MatcapApplyToAlphaEnabled==1)}", Int) = 0
[ThryWideEnum(Add, 0, Multiply, 1)] _MatcapApplyToAlphaBlendType ("Blend Type--{condition_showS:(_MatcapApplyToAlphaEnabled==1)}", Int) = 0
_MatcapApplyToAlphaBlending ("Blending--{condition_showS:(_MatcapApplyToAlphaEnabled==1)}", Range(0, 1)) = 1.0
[HideInInspector] s_end_matcapApplyToAlpha ("", Float) = 0

[HideInInspector] s_start_MatcapTPSMaskGroup ("Matcap TPS Mask--{reference_property:_MatcapTPSDepthEnabled,persistent_expand:true,default_expand:false, condition_showS:(_TPSPenetratorEnabled==1)}", Float) = 0
[HideInInspector][ThryToggleUI(true)] _MatcapTPSDepthEnabled ("TPS Depth Mask Enabled", Float) = 0
_MatcapTPSMaskStrength ("TPS Mask Strength", Range(0, 1)) = 1
[HideInInspector] s_end_MatcapTPSMaskGroup ("", Float) = 0

[HideInInspector] s_start_Matcap0AudioLink ("Audio Link ♫--{reference_property:_Matcap0ALEnabled,persistent_expand:true,default_expand:false, condition_showS:(_EnableAudioLink==1)}", Float) = 0
[HideInInspector][ToggleUI] _Matcap0ALEnabled ("Enable Audio Link", Float) = 0
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _Matcap0ALAlphaAddBand ("Alpha Band", Int) = 0
[VectorLabel(Min, Max)]_Matcap0ALAlphaAdd ("Alpha Mod", Vector) = (0, 0, 0, 0)
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _Matcap0ALEmissionAddBand ("Emission Band", Int) = 0
[VectorLabel(Min, Max)]_Matcap0ALEmissionAdd ("Emission Mod", Vector) = (0, 0, 0, 0)
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _Matcap0ALIntensityAddBand ("Intensity Band", Int) = 0
[VectorLabel(Min, Max)]_Matcap0ALIntensityAdd ("Intensity Mod", Vector) = (0, 0, 0, 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)]_Matcap0ALChronoPanType ("Chrono Pan Type--{condition_showS:(_MatcapUVMode==3)}", Int) = 0
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _Matcap0ALChronoPanBand ("Chrono Pan Band--{condition_showS:(_MatcapUVMode==3)}", Int) = 0
_Matcap0ALChronoPanSpeed ("Chrono Pan Speed--{condition_showS:(_MatcapUVMode==3)}", Float) = 0
[HideInInspector] s_end_Matcap0AudioLink ("Audio Link", Float) = 0
[HideInInspector] m_end_matcap ("Matcap", Float) = 0
//endex

// Second Matcap
//ifex _Matcap2Enable==0
[HideInInspector] m_start_Matcap2 ("Matcap [IDX_Maptcap++]--{reference_property:_Matcap2Enable,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/matcap},hover:Documentation}}", Float) = 0
[HideInInspector][ThryToggle(COLOR_GRADING_HDR_3D)]_Matcap2Enable ("Enable Matcap 2", Float) = 0
[ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2, Gradient, 3)] _Matcap2UVMode ("UV Mode", Int) = 1
_Matcap2Color ("Color--{reference_property:_Matcap2ColorThemeIndex}", 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)] _Matcap2ColorThemeIndex ("", Int) = 0
[sRGBWarning(true)][Gradient]_Matcap2 ("Matcap--{reference_properties:[_Matcap2UVToBlend,_MatCap2ndBlendUV1, _Matcap2Pan,_Matcap2Border,_Matcap2Rotation]}", 2D) = "white" { }
[HideInInspector][Vector2]_Matcap2Pan ("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)] _Matcap2UVToBlend ("UV To Blend", Int) = 1
[HideInInspector][VectorToSliders(Blend UV X, 0.0, 1.0, Blend UV Y, 0.0, 1.0)]_MatCap2ndBlendUV1 ("UV Blend", Vector) = (0, 0, 0, 0)
[HideInInspector]_Matcap2Border ("Border", Range(0, 5)) = 0.5
[HideInInspector]_Matcap2Rotation ("Rotation", Range(-1, 1)) = 0
_Matcap2Intensity ("Intensity", Range(0, 5)) = 1
_Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
_Matcap2BaseColorMix ("Base Color Mix", Range(0, 1)) = 0
_Matcap2Normal ("Normal Strength", Range(0, 1)) = 1

[HideInInspector] s_start_Matcap1Masking ("Masking--{persistent_expand:true,default_expand:true}", Float) = 1
[sRGBWarning][ThryRGBAPacker(R Mask, G Nothing, B Nothing, A Smoothness, linear, false)]_Matcap2Mask ("Mask--{reference_properties:[_Matcap2MaskPan, _Matcap2MaskUV, _Matcap2MaskChannel, _Matcap2MaskInvert]}", 2D) = "white" { }
[HideInInspector][Vector2]_Matcap2MaskPan ("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)] _Matcap2MaskUV ("UV", Int) = 0
[HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)]_Matcap2MaskChannel ("Channel", Float) = 0
[HideInInspector][ToggleUI]_Matcap2MaskInvert ("Invert", Float) = 0
_Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 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)] _Matcap2MaskGlobalMask ("Global Mask--{reference_property:_Matcap2MaskGlobalMaskBlendType}", Int) = 0
[HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)]_Matcap2MaskGlobalMaskBlendType ("Blending", Range(0, 1)) = 2
[HideInInspector] s_end_Matcap1Masking ("Masking", Float) = 0

[HideInInspector] s_start_Matcap1Blending ("Blending--{persistent_expand:true,default_expand:true}", Float) = 1
_Matcap2Replace ("Replace", Range(0, 1)) = 0
_Matcap2Multiply ("Multiply", Range(0, 1)) = 0
_Matcap2Add ("Add", Range(0, 1)) = 0
_Matcap2Mixed ("Mixed", Range(0, 1)) = 0
_Matcap2Screen ("Screen", Range(0, 1)) = 0
_Matcap2AddToLight ("Unlit Add", Range(0, 1)) = 0
[HideInInspector] s_end_Matcap1Blending ("Blending", Float) = 0

[HideInInspector] s_start_Matcap1Normal ("Custom Normal Map--{reference_property:_Matcap1CustomNormal,persistent_expand:true}", Float) = 0
[HideInInspector][ThryToggle(POI_MATCAP1_CUSTOM_NORMAL, true)] _Matcap1CustomNormal ("Custom Normal", Float) = 0
[Normal]_Matcap1NormalMap ("Normal Map--{reference_properties:[_Matcap1NormalMapPan, _Matcap1NormalMapUV, _Matcap1NormalMapScale]}", 2D) = "bump" { }
[HideInInspector][Vector2]_Matcap1NormalMapPan ("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)] _Matcap1NormalMapUV ("UV", Int) = 0
[HideInInspector]_Matcap1NormalMapScale ("Intensity", Range(0, 10)) = 1
[HideInInspector] s_end_Matcap1Normal ("", Float) = 0

[HideInInspector] s_start_Matcap1HueShift ("Hue Shift--{reference_property:_Matcap2HueShiftEnabled,persistent_expand:true}", Float) = 0
[HideInInspector][ToggleUI] _Matcap2HueShiftEnabled ("Hue Shift", Float) = 0
[ThryWideEnum(OKLab, 0, HSV, 1)] _Matcap2HueShiftColorSpace ("Color Space", Int) = 0
[ThryWideEnum(Hue Select, 0, Hue Shift, 1)] _Matcap2HueSelectOrShift ("Select or Shift", Int) = 1
_Matcap2HueShiftSpeed ("Shift Speed", Float) = 0
_Matcap2HueShift ("Hue Shift", Range(0, 1)) = 0
[HideInInspector] s_end_Matcap1HueShift ("", Float) = 0

[HideInInspector] s_start_Matcap1Smoothness ("Blur / Smoothness--{reference_property:_Matcap2SmoothnessEnabled,persistent_expand:true}", Float) = 0
[HideInInspector][ToggleUI] _Matcap2SmoothnessEnabled ("Blur / Smoothness", Float) = 0
_Matcap2Smoothness ("Smoothness", Range(0, 1)) = 1
[ToggleUI]_Matcap2MaskSmoothnessApply ("Apply Mask for Smoothness", Float) = 0
[Enum(R, 0, G, 1, B, 2, A, 3)]_Matcap2MaskSmoothnessChannel ("Mask Channel for Smoothness", Int) = 3
[HideInInspector] s_end_Matcap1Smoothness ("", Float) = 0

[HideInInspector] s_start_matcap1ApplyToAlpha ("Alpha Options--{persistent_expand:true,default_expand:false}", Float) = 0
_Matcap2AlphaOverride ("Override Alpha", Range(0, 1)) = 0
[ToggleUI] _Matcap2ApplyToAlphaEnabled ("Intensity To Alpha", Float) = 0
[ThryWideEnum(Greyscale, 0, Max, 1)] _Matcap2ApplyToAlphaSourceBlend ("Source Blend--{condition_showS:(_Matcap2ApplyToAlphaEnabled==1)}", Int) = 0
[ThryWideEnum(Add, 0, Multiply, 1)] _Matcap2ApplyToAlphaBlendType ("Blend Type--{condition_showS:(_Matcap2ApplyToAlphaEnabled==1)}", Int) = 0
_Matcap2ApplyToAlphaBlending ("Blending--{condition_showS:(_Matcap2ApplyToAlphaEnabled==1)}", Range(0, 1)) = 1.0
[HideInInspector] s_end_matcap1ApplyToAlpha ("", Float) = 0

[HideInInspector] s_start_Matcap2TPSMaskGroup ("Matcap TPS Mask--{reference_property:_Matcap2TPSDepthEnabled,persistent_expand:true,default_expand:false, condition_showS:(_TPSPenetratorEnabled==1)}", Float) = 0
[HideInInspector][ThryToggleUI(true)] _Matcap2TPSDepthEnabled ("TPS Depth Mask Enabled", Float) = 0
_Matcap2TPSMaskStrength ("TPS Mask Strength", Range(0, 1)) = 1
[HideInInspector] s_end_Matcap2TPSMaskGroup ("", Float) = 0

[HideInInspector] s_start_Matcap1AudioLink ("Audio Link ♫--{reference_property:_Matcap1ALEnabled,persistent_expand:true,default_expand:false, condition_showS:(_EnableAudioLink==1)}", Float) = 0
[HideInInspector][ToggleUI] _Matcap1ALEnabled ("Enable Audio Link", Float) = 0
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _Matcap1ALAlphaAddBand ("Alpha Band", Int) = 0
[VectorLabel(Min, Max)]_Matcap1ALAlphaAdd ("Alpha Mod", Vector) = (0, 0, 0, 0)
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _Matcap1ALEmissionAddBand ("Emission Band", Int) = 0
[VectorLabel(Min, Max)]_Matcap1ALEmissionAdd ("Emission Mod", Vector) = (0, 0, 0, 0)
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _Matcap1ALIntensityAddBand ("Intensity Band", Int) = 0
[VectorLabel(Min, Max)]_Matcap1ALIntensityAdd ("Intensity Mod", Vector) = (0, 0, 0, 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)]_Matcap1ALChronoPanType ("Chrono Pan Type--{condition_showS:(_Matcap2UVMode==3)}", Int) = 0
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _Matcap1ALChronoPanBand ("Chrono Pan Band--{condition_showS:(_Matcap2UVMode==3)}", Int) = 0
_Matcap1ALChronoPanSpeed ("Chrono Pan Speed--{condition_showS:(_Matcap2UVMode==3)}", Float) = 0
[HideInInspector] s_end_Matcap1AudioLink ("Audio Link", Float) = 0
[HideInInspector] m_end_Matcap2 ("Matcap 1", Float) = 0
//endex

// Third Matcap
//ifex _Matcap3Enable==0
[HideInInspector] m_start_Matcap3 ("Matcap [IDX_Maptcap++]--{reference_property:_Matcap3Enable,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/matcap},hover:Documentation}}", Float) = 0
[HideInInspector][ThryToggle(POI_MATCAP2)]_Matcap3Enable ("Enable Matcap 2", Float) = 0
[ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2, Gradient, 3)] _Matcap3UVMode ("UV Mode", Int) = 1
_Matcap3Color ("Color--{reference_property:_Matcap3ColorThemeIndex}", 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)] _Matcap3ColorThemeIndex ("", Int) = 0
[sRGBWarning(true)][Gradient]_Matcap3 ("Matcap--{reference_properties:[_Matcap3UVToBlend,_MatCap3rdBlendUV1,_Matcap3Pan,_Matcap3Border,_Matcap3Rotation]}", 2D) = "white" { }
[HideInInspector][Vector2]_Matcap3Pan ("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)] _Matcap3UVToBlend ("UV To Blend", Int) = 1
[HideInInspector][VectorToSliders(Blend UV X, 0.0, 1.0, Blend UV Y, 0.0, 1.0)]_MatCap3rdBlendUV1 ("UV Blend", Vector) = (0, 0, 0, 0)
[HideInInspector]_Matcap3Border ("Border", Range(0, 5)) = 0.5
[HideInInspector]_Matcap3Rotation ("Rotation", Range(-1, 1)) = 0
_Matcap3Intensity ("Intensity", Range(0, 5)) = 1
_Matcap3EmissionStrength ("Emission Strength", Range(0, 20)) = 0
_Matcap3BaseColorMix ("Base Color Mix", Range(0, 1)) = 0
_Matcap3Normal ("Normal Strength", Range(0, 1)) = 1

[HideInInspector] s_start_Matcap2Masking ("Masking--{persistent_expand:true,default_expand:true}", Float) = 1
[sRGBWarning][ThryRGBAPacker(R Mask, G Nothing, B Nothing, A Smoothness, linear, false)]_Matcap3Mask ("Mask--{reference_properties:[_Matcap3MaskPan, _Matcap3MaskUV, _Matcap3MaskChannel, _Matcap3MaskInvert]}", 2D) = "white" { }
[HideInInspector][Vector2]_Matcap3MaskPan ("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)] _Matcap3MaskUV ("UV", Int) = 0
[HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)]_Matcap3MaskChannel ("Channel", Float) = 0
[HideInInspector][ToggleUI]_Matcap3MaskInvert ("Invert", Float) = 0
_Matcap3LightMask ("Hide in Shadow", Range(0, 1)) = 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)] _Matcap3MaskGlobalMask ("Global Mask--{reference_property:_Matcap3MaskGlobalMaskBlendType}", Int) = 0
[HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)]_Matcap3MaskGlobalMaskBlendType ("Blending", Range(0, 1)) = 2
[HideInInspector] s_end_Matcap2Masking ("Masking", Float) = 0

[HideInInspector] s_start_Matcap2Blending ("Blending--{persistent_expand:true,default_expand:true}", Float) = 1
_Matcap3Replace ("Replace", Range(0, 1)) = 0
_Matcap3Multiply ("Multiply", Range(0, 1)) = 0
_Matcap3Add ("Add", Range(0, 1)) = 0
_Matcap3Mixed ("Mixed", Range(0, 1)) = 0
_Matcap3Screen ("Screen", Range(0, 1)) = 0
_Matcap3AddToLight ("Unlit Add", Range(0, 1)) = 0
[HideInInspector] s_end_Matcap2Blending ("Blending", Float) = 0

[HideInInspector] s_start_Matcap2Normal ("Custom Normal Map--{reference_property:_Matcap2CustomNormal,persistent_expand:true}", Float) = 0
[HideInInspector][ThryToggle(POI_MATCAP2_CUSTOM_NORMAL, true)] _Matcap2CustomNormal ("Custom Normal", Float) = 0
[Normal]_Matcap2NormalMap ("Normal Map--{reference_properties:[_Matcap2NormalMapPan, _Matcap2NormalMapUV, _Matcap2NormalMapScale]}", 2D) = "bump" { }
[HideInInspector][Vector2]_Matcap2NormalMapPan ("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)] _Matcap2NormalMapUV ("UV", Int) = 0
[HideInInspector]_Matcap2NormalMapScale ("Intensity", Range(0, 10)) = 1
[HideInInspector] s_end_Matcap2Normal ("", Float) = 0

[HideInInspector] s_start_Matcap2HueShift ("Hue Shift--{reference_property:_Matcap3HueShiftEnabled,persistent_expand:true}", Float) = 0
[HideInInspector][ToggleUI] _Matcap3HueShiftEnabled ("Hue Shift", Float) = 0
[ThryWideEnum(OKLab, 0, HSV, 1)] _Matcap3HueShiftColorSpace ("Color Space", Int) = 0
[ThryWideEnum(Hue Select, 0, Hue Shift, 1)] _Matcap3HueSelectOrShift ("Select or Shift", Int) = 1
_Matcap3HueShiftSpeed ("Shift Speed", Float) = 0
_Matcap3HueShift ("Hue Shift", Range(0, 1)) = 0
[HideInInspector] s_end_Matcap2HueShift ("", Float) = 0

[HideInInspector] s_start_Matcap2Smoothness ("Blur / Smoothness--{reference_property:_Matcap3SmoothnessEnabled,persistent_expand:true}", Float) = 0
[HideInInspector][ToggleUI] _Matcap3SmoothnessEnabled ("Blur / Smoothness", Float) = 0
_Matcap3Smoothness ("Smoothness", Range(0, 1)) = 1
[ToggleUI]_Matcap3MaskSmoothnessApply ("Apply Mask for Smoothness", Float) = 0
[Enum(R, 0, G, 1, B, 2, A, 3)]_Matcap3MaskSmoothnessChannel ("Mask Channel for Smoothness", Int) = 3
[HideInInspector] s_end_Matcap2Smoothness ("", Float) = 0

[HideInInspector] s_start_matcap2ApplyToAlpha ("Alpha Options--{persistent_expand:true,default_expand:false}", Float) = 0
_Matcap3AlphaOverride ("Override Alpha", Range(0, 1)) = 0
[ToggleUI] _Matcap3ApplyToAlphaEnabled ("Intensity To Alpha", Float) = 0
[ThryWideEnum(Greyscale, 0, Max, 1)] _Matcap3ApplyToAlphaSourceBlend ("Source Blend--{condition_showS:(_Matcap3ApplyToAlphaEnabled==1)}", Int) = 0
[ThryWideEnum(Add, 0, Multiply, 1)] _Matcap3ApplyToAlphaBlendType ("Blend Type--{condition_showS:(_Matcap3ApplyToAlphaEnabled==1)}", Int) = 0
_Matcap3ApplyToAlphaBlending ("Blending--{condition_showS:(_Matcap3ApplyToAlphaEnabled==1)}", Range(0, 1)) = 1.0
[HideInInspector] s_end_matcap2ApplyToAlpha ("", Float) = 0

[HideInInspector] s_start_Matcap3TPSMaskGroup ("Matcap TPS Mask--{reference_property:_Matcap3TPSDepthEnabled,persistent_expand:true,default_expand:false, condition_showS:(_TPSPenetratorEnabled==1)}", Float) = 0
[HideInInspector][ThryToggleUI(true)] _Matcap3TPSDepthEnabled ("TPS Depth Mask Enabled", Float) = 0
_Matcap3TPSMaskStrength ("TPS Mask Strength", Range(0, 1)) = 1
[HideInInspector] s_end_Matcap3TPSMaskGroup ("", Float) = 0

[HideInInspector] s_start_Matcap2AudioLink ("Audio Link ♫--{reference_property:_Matcap2ALEnabled,persistent_expand:true,default_expand:false, condition_showS:(_EnableAudioLink==1)}", Float) = 0
[HideInInspector][ToggleUI] _Matcap2ALEnabled ("Enable Audio Link", Float) = 0
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _Matcap2ALAlphaAddBand ("Alpha Band", Int) = 0
[VectorLabel(Min, Max)]_Matcap2ALAlphaAdd ("Alpha Mod", Vector) = (0, 0, 0, 0)
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _Matcap2ALEmissionAddBand ("Emission Band", Int) = 0
[VectorLabel(Min, Max)]_Matcap2ALEmissionAdd ("Emission Mod", Vector) = (0, 0, 0, 0)
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _Matcap2ALIntensityAddBand ("Intensity Band", Int) = 0
[VectorLabel(Min, Max)]_Matcap2ALIntensityAdd ("Intensity Mod", Vector) = (0, 0, 0, 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)]_Matcap2ALChronoPanType ("Chrono Pan Type--{condition_showS:(_Matcap3UVMode==3)}", Int) = 0
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _Matcap2ALChronoPanBand ("Chrono Pan Band--{condition_showS:(_Matcap3UVMode==3)}", Int) = 0
_Matcap2ALChronoPanSpeed ("Chrono Pan Speed--{condition_showS:(_Matcap3UVMode==3)}", Float) = 0
[HideInInspector] s_end_Matcap2AudioLink ("Audio Link", Float) = 0
[HideInInspector] m_end_Matcap3 ("Matcap 3", Float) = 0
//endex

// Fourth Matcap
//ifex _Matcap4Enable==0
[HideInInspector] m_start_Matcap4 ("Matcap [IDX_Maptcap++]--{reference_property:_Matcap4Enable,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/matcap},hover:Documentation}}", Float) = 0
[HideInInspector][ThryToggle(POI_MATCAP3)]_Matcap4Enable ("Enable Matcap 3", Float) = 0
[ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2, Gradient, 3)] _Matcap4UVMode ("UV Mode", Int) = 1
_Matcap4Color ("Color--{reference_property:_Matcap4ColorThemeIndex}", 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)] _Matcap4ColorThemeIndex ("", Int) = 0
[sRGBWarning(true)][Gradient]_Matcap4 ("Matcap--{reference_properties:[_Matcap4UVToBlend,_MatCap4thBlendUV1,_Matcap4Pan,_Matcap4Border,_Matcap4Rotation]}", 2D) = "white" { }
[HideInInspector][Vector2]_Matcap4Pan ("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)] _Matcap4UVToBlend ("UV To Blend", Int) = 1
[HideInInspector][VectorToSliders(Blend UV X, 0.0, 1.0, Blend UV Y, 0.0, 1.0)]_MatCap4thBlendUV1 ("UV Blend", Vector) = (0, 0, 0, 0)
[HideInInspector]_Matcap4Border ("Border", Range(0, 5)) = 0.5
[HideInInspector]_Matcap4Rotation ("Rotation", Range(-1, 1)) = 0
_Matcap4Intensity ("Intensity", Range(0, 5)) = 1
_Matcap4EmissionStrength ("Emission Strength", Range(0, 20)) = 0
_Matcap4BaseColorMix ("Base Color Mix", Range(0, 1)) = 0
_Matcap4Normal ("Normal Strength", Range(0, 1)) = 1

[HideInInspector] s_start_Matcap3Masking ("Masking--{persistent_expand:true,default_expand:true}", Float) = 1
[sRGBWarning][ThryRGBAPacker(R Mask, G Nothing, B Nothing, A Smoothness, linear, false)]_Matcap4Mask ("Mask--{reference_properties:[_Matcap4MaskPan, _Matcap4MaskUV, _Matcap4MaskChannel, _Matcap4MaskInvert]}", 2D) = "white" { }
[HideInInspector][Vector2]_Matcap4MaskPan ("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)] _Matcap4MaskUV ("UV", Int) = 0
[HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)]_Matcap4MaskChannel ("Channel", Float) = 0
[HideInInspector][ToggleUI]_Matcap4MaskInvert ("Invert", Float) = 0
_Matcap4LightMask ("Hide in Shadow", Range(0, 1)) = 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)] _Matcap4MaskGlobalMask ("Global Mask--{reference_property:_Matcap4MaskGlobalMaskBlendType}", Int) = 0
[HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)]_Matcap4MaskGlobalMaskBlendType ("Blending", Range(0, 1)) = 2
[HideInInspector] s_end_Matcap3Masking ("Masking", Float) = 0

[HideInInspector] s_start_Matcap3Blending ("Blending--{persistent_expand:true,default_expand:true}", Float) = 1
_Matcap4Replace ("Replace", Range(0, 1)) = 0
_Matcap4Multiply ("Multiply", Range(0, 1)) = 0
_Matcap4Add ("Add", Range(0, 1)) = 0
_Matcap4Mixed ("Mixed", Range(0, 1)) = 0
_Matcap4Screen ("Screen", Range(0, 1)) = 0
_Matcap4AddToLight ("Unlit Add", Range(0, 1)) = 0
[HideInInspector] s_end_Matcap3Blending ("Blending", Float) = 0

[HideInInspector] s_start_Matcap3Normal ("Custom Normal Map--{reference_property:_Matcap3CustomNormal,persistent_expand:true}", Float) = 0
[HideInInspector][ThryToggle(POI_MATCAP3_CUSTOM_NORMAL, true)] _Matcap3CustomNormal ("Custom Normal", Float) = 0
[Normal]_Matcap3NormalMap ("Normal Map--{reference_properties:[_Matcap3NormalMapPan, _Matcap3NormalMapUV, _Matcap3NormalMapScale]}", 2D) = "bump" { }
[HideInInspector][Vector2]_Matcap3NormalMapPan ("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)] _Matcap3NormalMapUV ("UV", Int) = 0
[HideInInspector]_Matcap3NormalMapScale ("Intensity", Range(0, 10)) = 1
[HideInInspector] s_end_Matcap3Normal ("", Float) = 0

[HideInInspector] s_start_Matcap3HueShift ("Hue Shift--{reference_property:_Matcap4HueShiftEnabled,persistent_expand:true}", Float) = 0
[HideInInspector][ToggleUI] _Matcap4HueShiftEnabled ("Hue Shift", Float) = 0
[ThryWideEnum(OKLab, 0, HSV, 1)] _Matcap4HueShiftColorSpace ("Color Space", Int) = 0
[ThryWideEnum(Hue Select, 0, Hue Shift, 1)] _Matcap4HueSelectOrShift ("Select or Shift", Int) = 1
_Matcap4HueShiftSpeed ("Shift Speed", Float) = 0
_Matcap4HueShift ("Hue Shift", Range(0, 1)) = 0
[HideInInspector] s_end_Matcap3HueShift ("", Float) = 0

[HideInInspector] s_start_Matcap3Smoothness ("Blur / Smoothness--{reference_property:_Matcap4SmoothnessEnabled,persistent_expand:true}", Float) = 0
[HideInInspector][ToggleUI] _Matcap4SmoothnessEnabled ("Blur / Smoothness", Float) = 0
_Matcap4Smoothness ("Smoothness", Range(0, 1)) = 1
[ToggleUI]_Matcap4MaskSmoothnessApply ("Apply Mask for Smoothness", Float) = 0
[Enum(R, 0, G, 1, B, 2, A, 3)]_Matcap4MaskSmoothnessChannel ("Mask Channel for Smoothness", Int) = 3
[HideInInspector] s_end_Matcap3Smoothness ("", Float) = 0

[HideInInspector] s_start_matcap3ApplyToAlpha ("Alpha Options--{persistent_expand:true,default_expand:false}", Float) = 0
_Matcap4AlphaOverride ("Override Alpha", Range(0, 1)) = 0
[ToggleUI] _Matcap4ApplyToAlphaEnabled ("Intensity To Alpha", Float) = 0
[ThryWideEnum(Greyscale, 0, Max, 1)] _Matcap4ApplyToAlphaSourceBlend ("Source Blend--{condition_showS:(_Matcap4ApplyToAlphaEnabled==1)}", Int) = 0
[ThryWideEnum(Add, 0, Multiply, 1)] _Matcap4ApplyToAlphaBlendType ("Blend Type--{condition_showS:(_Matcap4ApplyToAlphaEnabled==1)}", Int) = 0
_Matcap4ApplyToAlphaBlending ("Blending--{condition_showS:(_Matcap4ApplyToAlphaEnabled==1)}", Range(0, 1)) = 1.0
[HideInInspector] s_end_matcap3ApplyToAlpha ("", Float) = 0

[HideInInspector] s_start_Matcap4TPSMaskGroup ("Matcap TPS Mask--{reference_property:_Matcap4TPSDepthEnabled,persistent_expand:true,default_expand:false, condition_showS:(_TPSPenetratorEnabled==1)}", Float) = 0
[HideInInspector][ThryToggleUI(true)] _Matcap4TPSDepthEnabled ("TPS Depth Mask Enabled", Float) = 0
_Matcap4TPSMaskStrength ("TPS Mask Strength", Range(0, 1)) = 1
[HideInInspector] s_end_Matcap4TPSMaskGroup ("", Float) = 0

[HideInInspector] s_start_Matcap3AudioLink ("Audio Link ♫--{reference_property:_Matcap3ALEnabled,persistent_expand:true,default_expand:false, condition_showS:(_EnableAudioLink==1)}", Float) = 0
[HideInInspector][ToggleUI] _Matcap3ALEnabled ("Enable Audio Link", Float) = 0
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _Matcap3ALAlphaAddBand ("Alpha Band", Int) = 0
[VectorLabel(Min, Max)]_Matcap3ALAlphaAdd ("Alpha Mod", Vector) = (0, 0, 0, 0)
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _Matcap3ALEmissionAddBand ("Emission Band", Int) = 0
[VectorLabel(Min, Max)]_Matcap3ALEmissionAdd ("Emission Mod", Vector) = (0, 0, 0, 0)
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _Matcap3ALIntensityAddBand ("Intensity Band", Int) = 0
[VectorLabel(Min, Max)]_Matcap3ALIntensityAdd ("Intensity Mod", Vector) = (0, 0, 0, 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)]_Matcap3ALChronoPanType ("Chrono Pan Type--{condition_showS:(_Matcap4UVMode==3)}", Int) = 0
[Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _Matcap3ALChronoPanBand ("Chrono Pan Band--{condition_showS:(_Matcap4UVMode==3)}", Int) = 0
_Matcap3ALChronoPanSpeed ("Chrono Pan Speed--{condition_showS:(_Matcap4UVMode==3)}", Float) = 0
[HideInInspector] s_end_Matcap3AudioLink ("Audio Link", Float) = 0
[HideInInspector] m_end_Matcap4 ("Matcap 4", Float) = 0
//endex

#T#PoiMatcapKeywords
//ifex _MatcapEnable==0
#pragma shader_feature_local POI_MATCAP0
#pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
//endex
//ifex _Matcap2Enable==0
#pragma shader_feature COLOR_GRADING_HDR_3D
#pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
//endex
//ifex _Matcap3Enable==0
#pragma shader_feature_local POI_MATCAP2
#pragma shader_feature_local POI_MATCAP2_CUSTOM_NORMAL
//endex
//ifex _Matcap4Enable==0
#pragma shader_feature_local POI_MATCAP3
#pragma shader_feature_local POI_MATCAP3_CUSTOM_NORMAL
//endex

#T#PoiMatcapVariables
//ifex _MatcapEnable==0
#ifdef POI_MATCAP0
    #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
        Texture2D _Matcap;
        float4 _Matcap_ST;
        float4 _Matcap_TexelSize;
        float2 _MatcapPan;
        float _MatcapUV;
    #endif
    #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
        Texture2D _MatcapMask;
        float4 _MatcapMask_ST;
        float2 _MatcapMaskPan;
        float _MatcapMaskUV;
        float _MatcapMaskChannel;
    #endif
    #ifdef POI_MATCAP0_CUSTOM_NORMAL
        #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
            Texture2D _Matcap0NormalMap;
        #endif
        float4 _Matcap0NormalMap_ST;
        float2 _Matcap0NormalMapPan;
        float _Matcap0NormalMapUV;
        float _Matcap0NormalMapScale;
    #endif
    float _MatcapUVToBlend;
    float4 _MatCapBlendUV1;
    float _MatcapUVMode;
    float _MatcapMaskInvert;
    float _MatcapMaskGlobalMask;
    float _MatcapMaskGlobalMaskBlendType;
    float _MatcapBorder;
    float _MatcapRotation;
    float _MatcapSmoothnessEnabled;
    float _MatcapSmoothness;
    float _MatcapMaskSmoothnessChannel;
    float _MatcapMaskSmoothnessApply;
    float4 _MatcapColor;
    float _MatcapBaseColorMix;
    float _MatcapColorThemeIndex;
    float _MatcapIntensity;
    float _MatcapReplace;
    float _MatcapMultiply;
    float _MatcapAdd;
    float _MatcapAddToLight;
    float _MatcapMixed;
    float _MatcapScreen;
    float _MatcapAlphaOverride;
    float _MatcapEnable;
    float _MatcapLightMask;
    float _MatcapEmissionStrength;
    float _MatcapNormal;
    float _MatcapHueShiftEnabled;
    float _MatcapHueShiftColorSpace;
    float _MatcapHueSelectOrShift;
    float _MatcapHueShiftSpeed;
    float _MatcapHueShift;
    int _MatcapApplyToAlphaEnabled;
    int _MatcapApplyToAlphaSourceBlend;
    int _MatcapApplyToAlphaBlendType;
    float _MatcapApplyToAlphaBlending;
    float _MatcapTPSDepthEnabled;
    float _MatcapTPSMaskStrength;

    float _Matcap0ALEnabled;
    float _Matcap0ALAlphaAddBand;
    float4 _Matcap0ALAlphaAdd;
    float _Matcap0ALEmissionAddBand;
    float4 _Matcap0ALEmissionAdd;
    float _Matcap0ALIntensityAddBand;
    float4 _Matcap0ALIntensityAdd;
    float _Matcap0ALChronoPanType;
    float _Matcap0ALChronoPanBand;
    float _Matcap0ALChronoPanSpeed;
#endif
//endex
//ifex _Matcap2Enable==0
#ifdef COLOR_GRADING_HDR_3D
    #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
        Texture2D _Matcap2;
        float4 _Matcap2_ST;
        float4 _Matcap2_TexelSize;
        float2 _Matcap2Pan;
        float _Matcap2UV;
    #endif
    #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
        Texture2D _Matcap2Mask;
        float4 _Matcap2Mask_ST;
        float2 _Matcap2MaskPan;
        float _Matcap2MaskUV;
        float _Matcap2MaskChannel;
    #endif
    #ifdef POI_MATCAP1_CUSTOM_NORMAL
        #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
            Texture2D _Matcap1NormalMap;
        #endif
        float4 _Matcap1NormalMap_ST;
        float2 _Matcap1NormalMapPan;
        float _Matcap1NormalMapUV;
        float _Matcap1NormalMapScale;
    #endif
    float _Matcap2UVToBlend;
    float4 _MatCap2ndBlendUV1;
    float _Matcap2UVMode;
    float _Matcap2MaskInvert;
    float _Matcap2MaskGlobalMask;
    float _Matcap2MaskGlobalMaskBlendType;
    float _Matcap2Border;
    float _Matcap2Rotation;
    float _Matcap2SmoothnessEnabled;
    float _Matcap2Smoothness;
    float _Matcap2MaskSmoothnessChannel;
    float _Matcap2MaskSmoothnessApply;
    float4 _Matcap2Color;
    float _Matcap2BaseColorMix;
    float _Matcap2ColorThemeIndex;
    float _Matcap2Intensity;
    float _Matcap2Replace;
    float _Matcap2Multiply;
    float _Matcap2Add;
    float _Matcap2AddToLight;
    float _Matcap2Mixed;
    float _Matcap2Screen;
    float _Matcap2AlphaOverride;
    float _Matcap2Enable;
    float _Matcap2LightMask;
    float _Matcap2EmissionStrength;
    float _Matcap2Normal;
    float _Matcap2HueShiftEnabled;
    float _Matcap2HueShiftColorSpace;
    float _Matcap2HueSelectOrShift;
    float _Matcap2HueShiftSpeed;
    float _Matcap2HueShift;
    int _Matcap2ApplyToAlphaEnabled;
    int _Matcap2ApplyToAlphaSourceBlend;
    int _Matcap2ApplyToAlphaBlendType;
    float _Matcap2ApplyToAlphaBlending;
    float _Matcap2TPSDepthEnabled;
    float _Matcap2TPSMaskStrength;

    float _Matcap1ALEnabled;
    float _Matcap1ALAlphaAddBand;
    float4 _Matcap1ALAlphaAdd;
    float _Matcap1ALEmissionAddBand;
    float4 _Matcap1ALEmissionAdd;
    float _Matcap1ALIntensityAddBand;
    float4 _Matcap1ALIntensityAdd;
    float _Matcap1ALChronoPanType;
    float _Matcap1ALChronoPanBand;
    float _Matcap1ALChronoPanSpeed;
#endif
//endex

//ifex _Matcap3Enable==0
#ifdef POI_MATCAP2
    #if defined(PROP_MATCAP3) || !defined(OPTIMIZER_ENABLED)
        Texture2D _Matcap3;
        float4 _Matcap3_ST;
        float4 _Matcap3_TexelSize;
        float2 _Matcap3Pan;
        float _Matcap3UV;
    #endif
    #if defined(PROP_MATCAP3MASK) || !defined(OPTIMIZER_ENABLED)
        Texture2D _Matcap3Mask;
        float4 _Matcap3Mask_ST;
        float2 _Matcap3MaskPan;
        float _Matcap3MaskUV;
        float _Matcap3MaskChannel;
    #endif
    #ifdef POI_MATCAP2_CUSTOM_NORMAL
        #if defined(PROP_MATCAP2NORMALMAP) || !defined(OPTIMIZER_ENABLED)
            Texture2D _Matcap2NormalMap;
        #endif
        float4 _Matcap2NormalMap_ST;
        float2 _Matcap2NormalMapPan;
        float _Matcap2NormalMapUV;
        float _Matcap2NormalMapScale;
    #endif
    float _Matcap3UVToBlend;
    float4 _MatCap3rdBlendUV1;
    float _Matcap3UVMode;
    float _Matcap3MaskInvert;
    float _Matcap3MaskGlobalMask;
    float _Matcap3MaskGlobalMaskBlendType;
    float _Matcap3Border;
    float _Matcap3Rotation;
    float _Matcap3SmoothnessEnabled;
    float _Matcap3Smoothness;
    float _Matcap3MaskSmoothnessChannel;
    float _Matcap3MaskSmoothnessApply;
    float4 _Matcap3Color;
    float _Matcap3BaseColorMix;
    float _Matcap3ColorThemeIndex;
    float _Matcap3Intensity;
    float _Matcap3Replace;
    float _Matcap3Multiply;
    float _Matcap3Add;
    float _Matcap3AddToLight;
    float _Matcap3Mixed;
    float _Matcap3Screen;
    float _Matcap3AlphaOverride;
    float _Matcap3Enable;
    float _Matcap3LightMask;
    float _Matcap3EmissionStrength;
    float _Matcap3Normal;
    float _Matcap3HueShiftEnabled;
    float _Matcap3HueShiftColorSpace;
    float _Matcap3HueSelectOrShift;
    float _Matcap3HueShiftSpeed;
    float _Matcap3HueShift;
    int _Matcap3ApplyToAlphaEnabled;
    int _Matcap3ApplyToAlphaSourceBlend;
    int _Matcap3ApplyToAlphaBlendType;
    float _Matcap3ApplyToAlphaBlending;
    float _Matcap3TPSDepthEnabled;
    float _Matcap3TPSMaskStrength;

    float _Matcap2ALEnabled;
    float _Matcap2ALAlphaAddBand;
    float4 _Matcap2ALAlphaAdd;
    float _Matcap2ALEmissionAddBand;
    float4 _Matcap2ALEmissionAdd;
    float _Matcap2ALIntensityAddBand;
    float4 _Matcap2ALIntensityAdd;
    float _Matcap2ALChronoPanType;
    float _Matcap2ALChronoPanBand;
    float _Matcap2ALChronoPanSpeed;
#endif
//endex

//ifex _Matcap4Enable==0
#ifdef POI_MATCAP3
    #if defined(PROP_MATCAP4) || !defined(OPTIMIZER_ENABLED)
        Texture2D _Matcap4;
        float4 _Matcap4_ST;
        float4 _Matcap4_TexelSize;
        float2 _Matcap4Pan;
        float _Matcap4UV;
    #endif
    #if defined(PROP_MATCAP4MASK) || !defined(OPTIMIZER_ENABLED)
        Texture2D _Matcap4Mask;
        float4 _Matcap4Mask_ST;
        float2 _Matcap4MaskPan;
        float _Matcap4MaskUV;
        float _Matcap4MaskChannel;
    #endif
    #ifdef POI_MATCAP3_CUSTOM_NORMAL
        #if defined(PROP_MATCAP3NORMALMAP) || !defined(OPTIMIZER_ENABLED)
            Texture2D _Matcap3NormalMap;
        #endif
        float4 _Matcap3NormalMap_ST;
        float2 _Matcap3NormalMapPan;
        float _Matcap3NormalMapUV;
        float _Matcap3NormalMapScale;
    #endif
    float _Matcap4UVToBlend;
    float4 _MatCap4thBlendUV1;
    float _Matcap4UVMode;
    float _Matcap4MaskInvert;
    float _Matcap4MaskGlobalMask;
    float _Matcap4MaskGlobalMaskBlendType;
    float _Matcap4Border;
    float _Matcap4Rotation;
    float _Matcap4SmoothnessEnabled;
    float _Matcap4Smoothness;
    float _Matcap4MaskSmoothnessChannel;
    float _Matcap4MaskSmoothnessApply;
    float4 _Matcap4Color;
    float _Matcap4BaseColorMix;
    float _Matcap4ColorThemeIndex;
    float _Matcap4Intensity;
    float _Matcap4Replace;
    float _Matcap4Multiply;
    float _Matcap4Add;
    float _Matcap4AddToLight;
    float _Matcap4Mixed;
    float _Matcap4Screen;
    float _Matcap4AlphaOverride;
    float _Matcap4Enable;
    float _Matcap4LightMask;
    float _Matcap4EmissionStrength;
    float _Matcap4Normal;
    float _Matcap4HueShiftEnabled;
    float _Matcap4HueShiftColorSpace;
    float _Matcap4HueSelectOrShift;
    float _Matcap4HueShiftSpeed;
    float _Matcap4HueShift;
    int _Matcap4ApplyToAlphaEnabled;
    int _Matcap4ApplyToAlphaSourceBlend;
    int _Matcap4ApplyToAlphaBlendType;
    float _Matcap4ApplyToAlphaBlending;
    float _Matcap4TPSDepthEnabled;
    float _Matcap4TPSMaskStrength;

    float _Matcap3ALEnabled;
    float _Matcap3ALAlphaAddBand;
    float4 _Matcap3ALAlphaAdd;
    float _Matcap3ALEmissionAddBand;
    float4 _Matcap3ALEmissionAdd;
    float _Matcap3ALIntensityAddBand;
    float4 _Matcap3ALIntensityAdd;
    float _Matcap3ALChronoPanType;
    float _Matcap3ALChronoPanBand;
    float _Matcap3ALChronoPanSpeed;
#endif
//endex
struct MatcapAudioLinkData
{
    float matcapALEnabled;
    float matcapALAlphaAddBand;
    float4 matcapALAlphaAdd;
    float matcapALEmissionAddBand;
    float4 matcapALEmissionAdd;
    float matcapALIntensityAddBand;
    float4 matcapALIntensityAdd;
    float matcapALChronoPanType;
    float matcapALChronoPanBand;
    float matcapALChronoPanSpeed;
};

#T#PoiMatcapFunctions
//ifex _MatcapEnable==0 && _Matcap2Enable==0 && _Matcap3Enable==0 && _Matcap4Enable==0
void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMods poiMods, float add, float lightAdd, float multiply, float replace, float mixed, float screen, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask, uint globalMaskIndex, float globalMaskBlendType, in MatcapAudioLinkData matcapALD)
{
    if (matcapLightMask)
    {
        matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
    }
    if (globalMaskIndex > 0)
    {
        matcapMask = maskBlend(matcapMask, poiMods.globalMask[globalMaskIndex - 1], globalMaskBlendType);
    }
    
    #ifdef POI_AUDIOLINK
        if (matcapALD.matcapALEnabled > 0)
        {
            matcapColor.a = saturate(matcapColor.a + lerp(matcapALD.matcapALAlphaAdd.x, matcapALD.matcapALAlphaAdd.y, poiMods.audioLink[matcapALD.matcapALAlphaAddBand]));
            emissionStrength += lerp(matcapALD.matcapALEmissionAdd.x, matcapALD.matcapALEmissionAdd.y, poiMods.audioLink[matcapALD.matcapALEmissionAddBand]);
        }
    #endif

    poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, matcapColor.rgb, replace * matcapMask * matcapColor.a * .999999);
    poiFragData.baseColor.rgb *= lerp(1, matcapColor.rgb, multiply * matcapMask * matcapColor.a);
    poiFragData.baseColor.rgb += matcapColor.rgb * add * matcapMask * matcapColor.a;
    poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, blendScreen(poiFragData.baseColor.rgb, matcapColor.rgb), screen * matcapMask * matcapColor.a);
    #ifdef POI_PASS_BASE
        poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
    #endif
    poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * matcapColor.rgb, mixed * matcapMask * matcapColor.a);
    poiFragData.emission += matcapColor.rgb * emissionStrength * matcapMask * matcapColor.a;
}

void getMatcapUV(inout float2 matcapUV, in float2 matcapPan, in float matcapUVMode, in float matcapUVToBlend, in float2 matCapBlendUV, in float matcapRotation, in float matcapBorder, in float3 normal, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in float matcapNormalStrength, in MatcapAudioLinkData matcapALD)
{
    switch(matcapUVMode)
    {
        // Normal / UTS
        case 0:
            {
                float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal, 0))).rgb;
                float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
                float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
                float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
                
                matcapUV = noSknewViewNormal.rg * matcapBorder + 0.5;
                break;
        }
        // Top Pinch
        case 1:
            {
                float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
                float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
                matcapUV = float2(dot(worldViewRight, normal), dot(worldViewUp, normal)) * matcapBorder + 0.5;
                break;
        }
        // Custom Double Sided
        case 2:
            {
                float3 reflection = reflect(-poiCam.viewDir, normal);
                float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
                matcapUV = uv * matcapBorder + 0.5;
                break;
        }
        // Gradient
        case 3:
            {
                matcapUV = 1 - abs(dot(normal, poiCam.viewDir));
                #ifdef POI_AUDIOLINK
                    if (matcapALD.matcapALEnabled)
                    {
                        matcapUV += AudioLinkGetChronoTime(matcapALD.matcapALChronoPanType, matcapALD.matcapALChronoPanBand) * matcapALD.matcapALChronoPanSpeed;
                    }
                #endif
                break;
        }
    }
    matcapUV = lerp(matcapUV, poiMesh.uv[matcapUVToBlend], matCapBlendUV);
    matcapUV += matcapPan * _Time.x;
    matcapUV = RotateUV(matcapUV, matcapRotation * PI, float2(.5, .5), 1.0f);
    
    if (IsInMirror() && matcapUVMode != 3)
    {
        matcapUV.x = 1 - matcapUV.x;
    }
}

//endex
//ifex _MatcapEnable==0 && _Matcap2Enable==0 && _Matcap3Enable==0 && _Matcap4Enable==0
#if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D) || defined(POI_MATCAP2) || defined(POI_MATCAP3)
    void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
    {
        float4 matcap = 0;
        float matcapMask = 0;
        float4 matcap2 = 0;
        float matcap2Mask = 0;
        float4 matcap3 = 0;
        float matcap3Mask = 0;
        float4 matcap4 = 0;
        float matcap4Mask = 0;
        float2 matcapUV = 0;
        float matcapIntensity;
        struct MatcapAudioLinkData matcapALD;
        //endex

        //ifex _MatcapEnable==0
        // Matcap 1
        #ifdef POI_MATCAP0
            matcapALD.matcapALEnabled = _Matcap0ALEnabled;
            matcapALD.matcapALAlphaAddBand = _Matcap0ALAlphaAddBand;
            matcapALD.matcapALAlphaAdd = _Matcap0ALAlphaAdd;
            matcapALD.matcapALEmissionAddBand = _Matcap0ALEmissionAddBand;
            matcapALD.matcapALEmissionAdd = _Matcap0ALEmissionAdd;
            matcapALD.matcapALIntensityAddBand = _Matcap0ALIntensityAddBand;
            matcapALD.matcapALIntensityAdd = _Matcap0ALIntensityAdd;
            matcapALD.matcapALChronoPanType = _Matcap0ALChronoPanType;
            matcapALD.matcapALChronoPanBand = _Matcap0ALChronoPanBand;
            matcapALD.matcapALChronoPanSpeed = _Matcap0ALChronoPanSpeed;

            float3 normal0 = lerp(poiMesh.normals[0], poiMesh.normals[1], _MatcapNormal);
            #ifdef POI_MATCAP0_CUSTOM_NORMAL
                #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
                    normal0 = calculateNormal(poiMesh.normals[_MatcapNormal], poiMesh, _Matcap0NormalMap, _Matcap0NormalMap_ST, _Matcap0NormalMapPan, _Matcap0NormalMapUV, _Matcap0NormalMapScale);
                #endif
            #endif
            

            #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
                getMatcapUV(matcapUV, _MatcapPan.xy, _MatcapUVMode, _MatcapUVToBlend, _MatCapBlendUV1.xy, _MatcapRotation, _MatcapBorder, normal0, poiCam, poiLight, poiMesh, _MatcapNormal, matcapALD);
                if (_MatcapSmoothnessEnabled)
                {
                    float mipCount0 = 9;
                    if (_Matcap_TexelSize.z == 8192) mipCount0 = 13;
                    if (_Matcap_TexelSize.z == 4096) mipCount0 = 12;
                    if (_Matcap_TexelSize.z == 2048) mipCount0 = 11;
                    if (_Matcap_TexelSize.z == 1024) mipCount0 = 10;
                    if (_Matcap_TexelSize.z == 512) mipCount0 = 9;
                    if (_Matcap_TexelSize.z == 256) mipCount0 = 8;
                    if (_Matcap_TexelSize.z == 128) mipCount0 = 7;
                    if (_Matcap_TexelSize.z == 64) mipCount0 = 6;
                    if (_Matcap_TexelSize.z == 32) mipCount0 = 5;
                    
                    float matcapSmoothness = _MatcapSmoothness;

                    if (_MatcapMaskSmoothnessApply)
                    {
                        #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
                            matcapSmoothness *= POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan)[_MatcapMaskSmoothnessChannel];
                        #endif
                    }
                    matcapSmoothness = (1 - matcapSmoothness) * mipCount0;
                    matcap = UNITY_SAMPLE_TEX2D_SAMPLER_LOD(_Matcap, _trilinear_repeat, TRANSFORM_TEX(matcapUV, _Matcap), matcapSmoothness) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
                }
                else
                {
                    matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
                }
            #else
                matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
            #endif

            matcapIntensity = _MatcapIntensity;
            #ifdef POI_AUDIOLINK
                if (matcapALD.matcapALEnabled > 0)
                {
                    matcapIntensity += lerp(matcapALD.matcapALIntensityAdd.x, matcapALD.matcapALIntensityAdd.y, poiMods.audioLink[matcapALD.matcapALIntensityAddBand]);
                    matcapIntensity = max(0, matcapIntensity);
                }
            #endif
            matcap.rgb *= matcapIntensity;

            #ifndef POI_GRABPASS
                matcap.rgb = lerp(matcap.rgb, matcap.rgb * poiFragData.baseColor.rgb, _MatcapBaseColorMix);
            #endif

            //UNITY_BRANCH
            if (_MatcapHueShiftEnabled)
            {
                matcap.rgb = hueShift(matcap.rgb, _MatcapHueShift + _Time.x * _MatcapHueShiftSpeed, _MatcapHueShiftColorSpace, _MatcapHueSelectOrShift);
            }
            
            #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
                matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan)[_MatcapMaskChannel];
            #else
                matcapMask = 1;
            #endif
            
            if (_MatcapMaskInvert)
            {
                matcapMask = 1 - matcapMask;
            }
            
            #ifdef TPS_Penetrator
                if (_MatcapTPSDepthEnabled)
                {
                    matcapMask = lerp(0, matcapMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _MatcapTPSMaskStrength);
                }
            #endif

            poiFragData.alpha *= lerp(1, matcap.a, matcapMask * _MatcapAlphaOverride);
            


            if (_MatcapApplyToAlphaEnabled)
            {
                float matcapAlphaApplyValue = dot(matcap.rgb, float3(0.299, 0.587, 0.114)); // Greyscale
                if (_MatcapApplyToAlphaSourceBlend == 1) // Max

                {
                    matcapAlphaApplyValue = poiMax(matcap.rgb);
                }
                if (_MatcapApplyToAlphaBlendType == 0) // Add

                {
                    poiFragData.alpha += lerp(0, matcapAlphaApplyValue, _MatcapApplyToAlphaBlending);
                    poiFragData.alpha = saturate(poiFragData.alpha);
                }
                if (_MatcapApplyToAlphaBlendType == 1) // Multiply

                {
                    poiFragData.alpha *= lerp(1, matcapAlphaApplyValue, _MatcapApplyToAlphaBlending);
                }
            }
            
            blendMatcap(poiLight, poiFragData, poiMods, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, _MatcapScreen, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask, _MatcapMaskGlobalMask, _MatcapMaskGlobalMaskBlendType, matcapALD);
        #endif
        //endex
        //ifex _Matcap2Enable==0
        // Matcap 2
        #ifdef COLOR_GRADING_HDR_3D
            matcapALD.matcapALEnabled = _Matcap1ALEnabled;
            matcapALD.matcapALAlphaAddBand = _Matcap1ALAlphaAddBand;
            matcapALD.matcapALAlphaAdd = _Matcap1ALAlphaAdd;
            matcapALD.matcapALEmissionAddBand = _Matcap1ALEmissionAddBand;
            matcapALD.matcapALEmissionAdd = _Matcap1ALEmissionAdd;
            matcapALD.matcapALIntensityAddBand = _Matcap1ALIntensityAddBand;
            matcapALD.matcapALIntensityAdd = _Matcap1ALIntensityAdd;
            matcapALD.matcapALChronoPanType = _Matcap1ALChronoPanType;
            matcapALD.matcapALChronoPanBand = _Matcap1ALChronoPanBand;
            matcapALD.matcapALChronoPanSpeed = _Matcap1ALChronoPanSpeed;

            float3 normal1 = lerp(poiMesh.normals[0], poiMesh.normals[1], _Matcap2Normal);
            #ifdef POI_MATCAP1_CUSTOM_NORMAL
                #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
                    normal1 = calculateNormal(poiMesh.normals[_Matcap2Normal], poiMesh, _Matcap1NormalMap, _Matcap1NormalMap_ST, _Matcap1NormalMapPan, _Matcap1NormalMapUV, _Matcap1NormalMapScale);
                #endif
            #endif
            
            
            #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
                getMatcapUV(matcapUV, _Matcap2Pan.xy, _Matcap2UVMode, _Matcap2UVToBlend, _MatCap2ndBlendUV1.xy, _Matcap2Rotation, _Matcap2Border, normal1, poiCam, poiLight, poiMesh, _Matcap2Normal, matcapALD);
                if (_Matcap2SmoothnessEnabled)
                {
                    float mipCount2 = 9;
                    if (_Matcap2_TexelSize.z == 8192) mipCount2 = 13;
                    if (_Matcap2_TexelSize.z == 4096) mipCount2 = 12;
                    if (_Matcap2_TexelSize.z == 2048) mipCount2 = 11;
                    if (_Matcap2_TexelSize.z == 1024) mipCount2 = 10;
                    if (_Matcap2_TexelSize.z == 512) mipCount2 = 9;
                    if (_Matcap2_TexelSize.z == 256) mipCount2 = 8;
                    if (_Matcap2_TexelSize.z == 128) mipCount2 = 7;
                    if (_Matcap2_TexelSize.z == 64) mipCount2 = 6;
                    if (_Matcap2_TexelSize.z == 32) mipCount2 = 5;
                    
                    float matcap2Smoothness = _Matcap2Smoothness;
                    
                    if (_Matcap2MaskSmoothnessApply)
                    {
                        #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
                            matcap2Smoothness *= POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan)[_Matcap2MaskSmoothnessChannel];
                        #endif
                    }
                    matcap2Smoothness = (1 - matcap2Smoothness) * mipCount2;
                    matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER_LOD(_Matcap2, _trilinear_repeat, TRANSFORM_TEX(matcapUV, _Matcap2), matcap2Smoothness) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
                }
                else
                {
                    matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
                }
            #else
                matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
            #endif
            
            matcapIntensity = _Matcap2Intensity;
            #ifdef POI_AUDIOLINK
                if (matcapALD.matcapALEnabled > 0)
                {
                    matcapIntensity += lerp(matcapALD.matcapALIntensityAdd.x, matcapALD.matcapALIntensityAdd.y, poiMods.audioLink[matcapALD.matcapALIntensityAddBand]);
                    matcapIntensity = max(0, matcapIntensity);
                }
            #endif
            matcap2.rgb *= matcapIntensity;
            #ifndef POI_GRABPASS
                matcap2.rgb = lerp(matcap2.rgb, matcap2.rgb * poiFragData.baseColor.rgb, _Matcap2BaseColorMix);
            #endif
            
            #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
                matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan)[_Matcap2MaskChannel];
            #else
                matcap2Mask = 1;
            #endif
            if (_Matcap2MaskInvert)
            {
                matcap2Mask = 1 - matcap2Mask;
            }
            
            #ifdef TPS_Penetrator
                if (_Matcap2TPSDepthEnabled)
                {
                    matcap2Mask = lerp(0, matcap2Mask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Matcap2TPSMaskStrength);
                }
            #endif
            
            poiFragData.alpha *= lerp(1, matcap2.a, matcap2Mask * _Matcap2AlphaOverride);
            
            //UNITY_BRANCH
            if (_Matcap2HueShiftEnabled)
            {
                matcap2.rgb = hueShift(matcap2.rgb, _Matcap2HueShift + _Time.x * _Matcap2HueShiftSpeed, _Matcap2HueShiftColorSpace, _Matcap2HueSelectOrShift);
            }

            if (_Matcap2ApplyToAlphaEnabled)
            {
                float matcap2AlphaApplyValue = dot(matcap2.rgb, float3(0.299, 0.587, 0.114)); // Greyscale
                if (_Matcap2ApplyToAlphaSourceBlend == 1) // Max

                {
                    matcap2AlphaApplyValue = poiMax(matcap2.rgb);
                }
                if (_Matcap2ApplyToAlphaBlendType == 0) // Add

                {
                    poiFragData.alpha += lerp(0, matcap2AlphaApplyValue, _Matcap2ApplyToAlphaBlending);
                    poiFragData.alpha = saturate(poiFragData.alpha);
                }
                if (_Matcap2ApplyToAlphaBlendType == 1) // Multiply

                {
                    poiFragData.alpha *= lerp(1, matcap2AlphaApplyValue, _Matcap2ApplyToAlphaBlending);
                }
            }
            
            blendMatcap(poiLight, poiFragData, poiMods, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, _Matcap2Screen, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask, _Matcap2MaskGlobalMask, _Matcap2MaskGlobalMaskBlendType, matcapALD);
        #endif
        //endex
        //ifex _Matcap3Enable==0
        // Matcap 3
        #ifdef POI_MATCAP2
            
            matcapALD.matcapALEnabled = _Matcap2ALEnabled;
            matcapALD.matcapALAlphaAddBand = _Matcap2ALAlphaAddBand;
            matcapALD.matcapALAlphaAdd = _Matcap2ALAlphaAdd;
            matcapALD.matcapALEmissionAddBand = _Matcap2ALEmissionAddBand;
            matcapALD.matcapALEmissionAdd = _Matcap2ALEmissionAdd;
            matcapALD.matcapALIntensityAddBand = _Matcap2ALIntensityAddBand;
            matcapALD.matcapALIntensityAdd = _Matcap2ALIntensityAdd;
            matcapALD.matcapALChronoPanType = _Matcap2ALChronoPanType;
            matcapALD.matcapALChronoPanBand = _Matcap2ALChronoPanBand;
            matcapALD.matcapALChronoPanSpeed = _Matcap2ALChronoPanSpeed;

            float3 normal2 = lerp(poiMesh.normals[0], poiMesh.normals[1], _Matcap3Normal);
            #ifdef POI_MATCAP2_CUSTOM_NORMAL
                #if defined(PROP_MATCAP2NORMALMAP) || !defined(OPTIMIZER_ENABLED)
                    normal2 = calculateNormal(poiMesh.normals[_Matcap3Normal], poiMesh, _Matcap2NormalMap, _Matcap2NormalMap_ST, _Matcap2NormalMapPan, _Matcap2NormalMapUV, _Matcap2NormalMapScale);
                #endif
            #endif
            
            
            #if defined(PROP_MATCAP3) || !defined(OPTIMIZER_ENABLED)
                getMatcapUV(matcapUV, _Matcap3Pan.xy, _Matcap3UVMode, _Matcap3UVToBlend, _MatCap3rdBlendUV1.xy, _Matcap3Rotation, _Matcap3Border, normal2, poiCam, poiLight, poiMesh, _Matcap3Normal, matcapALD);
                if (_Matcap3SmoothnessEnabled)
                {
                    float mipCount3 = 9;
                    if (_Matcap3_TexelSize.z == 8192) mipCount3 = 13;
                    if (_Matcap3_TexelSize.z == 4096) mipCount3 = 12;
                    if (_Matcap3_TexelSize.z == 2048) mipCount3 = 11;
                    if (_Matcap3_TexelSize.z == 1024) mipCount3 = 10;
                    if (_Matcap3_TexelSize.z == 512) mipCount3 = 9;
                    if (_Matcap3_TexelSize.z == 256) mipCount3 = 8;
                    if (_Matcap3_TexelSize.z == 128) mipCount3 = 7;
                    if (_Matcap3_TexelSize.z == 64) mipCount3 = 6;
                    if (_Matcap3_TexelSize.z == 32) mipCount3 = 5;
                    
                    float matcap3Smoothness = _Matcap3Smoothness;
                    
                    if (_Matcap3MaskSmoothnessApply)
                    {
                        #if defined(PROP_MATCAP3MASK) || !defined(OPTIMIZER_ENABLED)
                            matcap3Smoothness *= POI2D_SAMPLER_PAN(_Matcap3Mask, _MainTex, poiUV(poiMesh.uv[_Matcap3MaskUV], _Matcap3Mask_ST), _Matcap3MaskPan)[_Matcap3MaskSmoothnessChannel];
                        #endif
                    }
                    matcap3Smoothness = (1 - matcap3Smoothness) * mipCount3;
                    matcap3 = UNITY_SAMPLE_TEX2D_SAMPLER_LOD(_Matcap3, _trilinear_repeat, TRANSFORM_TEX(matcapUV, _Matcap3), matcap3Smoothness) * float4(poiThemeColor(poiMods, _Matcap3Color.rgb, _Matcap3ColorThemeIndex), _Matcap3Color.a);
                }
                else
                {
                    matcap3 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap3, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap3)) * float4(poiThemeColor(poiMods, _Matcap3Color.rgb, _Matcap3ColorThemeIndex), _Matcap3Color.a);
                }
            #else
                matcap3 = float4(poiThemeColor(poiMods, _Matcap3Color.rgb, _Matcap3ColorThemeIndex), _Matcap3Color.a);
            #endif
            
            matcapIntensity = _Matcap3Intensity;
            #ifdef POI_AUDIOLINK
                if (matcapALD.matcapALEnabled > 0)
                {
                    matcapIntensity += lerp(matcapALD.matcapALIntensityAdd.x, matcapALD.matcapALIntensityAdd.y, poiMods.audioLink[matcapALD.matcapALIntensityAddBand]);
                    matcapIntensity = max(0, matcapIntensity);
                }
            #endif
            matcap3.rgb *= matcapIntensity;
            #ifndef POI_GRABPASS
                matcap3.rgb = lerp(matcap3.rgb, matcap3.rgb * poiFragData.baseColor.rgb, _Matcap3BaseColorMix);
            #endif
            
            #if defined(PROP_MATCAP3MASK) || !defined(OPTIMIZER_ENABLED)
                matcap3Mask = POI2D_SAMPLER_PAN(_Matcap3Mask, _MainTex, poiUV(poiMesh.uv[_Matcap3MaskUV], _Matcap3Mask_ST), _Matcap3MaskPan)[_Matcap3MaskChannel];
            #else
                matcap3Mask = 1;
            #endif
            if (_Matcap3MaskInvert)
            {
                matcap3Mask = 1 - matcap3Mask;
            }
            
            #ifdef TPS_Penetrator
                if (_Matcap3TPSDepthEnabled)
                {
                    matcap3Mask = lerp(0, matcap3Mask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Matcap3TPSMaskStrength);
                }
            #endif
            
            poiFragData.alpha *= lerp(1, matcap3.a, matcap3Mask * _Matcap3AlphaOverride);
            
            //UNITY_BRANCH
            if (_Matcap3HueShiftEnabled)
            {
                matcap3.rgb = hueShift(matcap3.rgb, _Matcap3HueShift + _Time.x * _Matcap3HueShiftSpeed, _Matcap3HueShiftColorSpace, _Matcap3HueSelectOrShift);
            }

            if (_Matcap3ApplyToAlphaEnabled)
            {
                float matcap3AlphaApplyValue = dot(matcap3.rgb, float3(0.299, 0.587, 0.114)); // Greyscale
                if (_Matcap3ApplyToAlphaSourceBlend == 1) // Max

                {
                    matcap3AlphaApplyValue = poiMax(matcap3.rgb);
                }
                if (_Matcap3ApplyToAlphaBlendType == 0) // Add

                {
                    poiFragData.alpha += lerp(0, matcap3AlphaApplyValue, _Matcap3ApplyToAlphaBlending);
                    poiFragData.alpha = saturate(poiFragData.alpha);
                }
                if (_Matcap3ApplyToAlphaBlendType == 1) // Multiply

                {
                    poiFragData.alpha *= lerp(1, matcap3AlphaApplyValue, _Matcap3ApplyToAlphaBlending);
                }
            }
            
            blendMatcap(poiLight, poiFragData, poiMods, _Matcap3Add, _Matcap3AddToLight, _Matcap3Multiply, _Matcap3Replace, _Matcap3Mixed, _Matcap3Screen, matcap3, matcap3Mask, _Matcap3EmissionStrength, _Matcap3LightMask, _Matcap3MaskGlobalMask, _Matcap3MaskGlobalMaskBlendType, matcapALD);
        #endif
        //endex
        //ifex _Matcap4Enable==0
        // Matcap 4
        #ifdef POI_MATCAP3

            matcapALD.matcapALEnabled = _Matcap3ALEnabled;
            matcapALD.matcapALAlphaAddBand = _Matcap3ALAlphaAddBand;
            matcapALD.matcapALAlphaAdd = _Matcap3ALAlphaAdd;
            matcapALD.matcapALEmissionAddBand = _Matcap3ALEmissionAddBand;
            matcapALD.matcapALEmissionAdd = _Matcap3ALEmissionAdd;
            matcapALD.matcapALIntensityAddBand = _Matcap3ALIntensityAddBand;
            matcapALD.matcapALIntensityAdd = _Matcap3ALIntensityAdd;
            matcapALD.matcapALChronoPanType = _Matcap3ALChronoPanType;
            matcapALD.matcapALChronoPanBand = _Matcap3ALChronoPanBand;
            matcapALD.matcapALChronoPanSpeed = _Matcap3ALChronoPanSpeed;

            float3 normal3 = lerp(poiMesh.normals[0], poiMesh.normals[1], _Matcap4Normal);
            #ifdef POI_MATCAP3_CUSTOM_NORMAL
                #if defined(PROP_MATCAP3NORMALMAP) || !defined(OPTIMIZER_ENABLED)
                    normal3 = calculateNormal(poiMesh.normals[_Matcap4Normal], poiMesh, _Matcap3NormalMap, _Matcap3NormalMap_ST, _Matcap3NormalMapPan, _Matcap3NormalMapUV, _Matcap3NormalMapScale);
                #endif
            #endif
            
            
            #if defined(PROP_MATCAP4) || !defined(OPTIMIZER_ENABLED)
                getMatcapUV(matcapUV, _Matcap4Pan.xy, _Matcap4UVMode, _Matcap4UVToBlend, _MatCap4thBlendUV1.xy, _Matcap4Rotation, _Matcap4Border, normal3, poiCam, poiLight, poiMesh, _Matcap4Normal, matcapALD);
                if (_Matcap4SmoothnessEnabled)
                {
                    float mipCount4 = 9;
                    if (_Matcap4_TexelSize.z == 8192) mipCount4 = 13;
                    if (_Matcap4_TexelSize.z == 4096) mipCount4 = 12;
                    if (_Matcap4_TexelSize.z == 2048) mipCount4 = 11;
                    if (_Matcap4_TexelSize.z == 1024) mipCount4 = 10;
                    if (_Matcap4_TexelSize.z == 512) mipCount4 = 9;
                    if (_Matcap4_TexelSize.z == 256) mipCount4 = 8;
                    if (_Matcap4_TexelSize.z == 128) mipCount4 = 7;
                    if (_Matcap4_TexelSize.z == 64) mipCount4 = 6;
                    if (_Matcap4_TexelSize.z == 32) mipCount4 = 5;
                    
                    float matcap4Smoothness = _Matcap4Smoothness;
                    
                    if (_Matcap4MaskSmoothnessApply)
                    {
                        #if defined(PROP_MATCAP4MASK) || !defined(OPTIMIZER_ENABLED)
                            matcap4Smoothness *= POI2D_SAMPLER_PAN(_Matcap4Mask, _MainTex, poiUV(poiMesh.uv[_Matcap4MaskUV], _Matcap4Mask_ST), _Matcap4MaskPan)[_Matcap4MaskSmoothnessChannel];
                        #endif
                    }
                    matcap4Smoothness = (1 - matcap4Smoothness) * mipCount4;
                    matcap4 = UNITY_SAMPLE_TEX2D_SAMPLER_LOD(_Matcap4, _trilinear_repeat, TRANSFORM_TEX(matcapUV, _Matcap4), matcap4Smoothness) * float4(poiThemeColor(poiMods, _Matcap4Color.rgb, _Matcap4ColorThemeIndex), _Matcap4Color.a);
                }
                else
                {
                    matcap4 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap4, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap4)) * float4(poiThemeColor(poiMods, _Matcap4Color.rgb, _Matcap4ColorThemeIndex), _Matcap4Color.a);
                }
            #else
                matcap4 = float4(poiThemeColor(poiMods, _Matcap4Color.rgb, _Matcap4ColorThemeIndex), _Matcap4Color.a);
            #endif
            
            matcapIntensity = _Matcap4Intensity;
            #ifdef POI_AUDIOLINK
                if (matcapALD.matcapALEnabled > 0)
                {
                    matcapIntensity += lerp(matcapALD.matcapALIntensityAdd.x, matcapALD.matcapALIntensityAdd.y, poiMods.audioLink[matcapALD.matcapALIntensityAddBand]);
                    matcapIntensity = max(0, matcapIntensity);
                }
            #endif
            matcap4.rgb *= matcapIntensity;
            #ifndef POI_GRABPASS
                matcap4.rgb = lerp(matcap4.rgb, matcap4.rgb * poiFragData.baseColor.rgb, _Matcap4BaseColorMix);
            #endif
            
            #if defined(PROP_MATCAP4MASK) || !defined(OPTIMIZER_ENABLED)
                matcap4Mask = POI2D_SAMPLER_PAN(_Matcap4Mask, _MainTex, poiUV(poiMesh.uv[_Matcap4MaskUV], _Matcap4Mask_ST), _Matcap4MaskPan)[_Matcap4MaskChannel];
            #else
                matcap4Mask = 1;
            #endif
            if (_Matcap4MaskInvert)
            {
                matcap4Mask = 1 - matcap4Mask;
            }
            
            #ifdef TPS_Penetrator
                if (_Matcap4TPSDepthEnabled)
                {
                    matcap4Mask = lerp(0, matcap4Mask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Matcap4TPSMaskStrength);
                }
            #endif
            
            poiFragData.alpha *= lerp(1, matcap4.a, matcap4Mask * _Matcap4AlphaOverride);
            
            //UNITY_BRANCH
            if (_Matcap4HueShiftEnabled)
            {
                matcap4.rgb = hueShift(matcap4.rgb, _Matcap4HueShift + _Time.x * _Matcap4HueShiftSpeed, _Matcap4HueShiftColorSpace, _Matcap4HueSelectOrShift);
            }

            if (_Matcap4ApplyToAlphaEnabled)
            {
                float matcap4AlphaApplyValue = dot(matcap4.rgb, float3(0.299, 0.587, 0.114)); // Greyscale
                if (_Matcap4ApplyToAlphaSourceBlend == 1) // Max

                {
                    matcap4AlphaApplyValue = poiMax(matcap4.rgb);
                }
                if (_Matcap4ApplyToAlphaBlendType == 0) // Add

                {
                    poiFragData.alpha += lerp(0, matcap4AlphaApplyValue, _Matcap4ApplyToAlphaBlending);
                    poiFragData.alpha = saturate(poiFragData.alpha);
                }
                if (_Matcap4ApplyToAlphaBlendType == 1) // Multiply

                {
                    poiFragData.alpha *= lerp(1, matcap4AlphaApplyValue, _Matcap4ApplyToAlphaBlending);
                }
            }
            
            blendMatcap(poiLight, poiFragData, poiMods, _Matcap4Add, _Matcap4AddToLight, _Matcap4Multiply, _Matcap4Replace, _Matcap4Mixed, _Matcap4Screen, matcap4, matcap4Mask, _Matcap4EmissionStrength, _Matcap4LightMask, _Matcap4MaskGlobalMask, _Matcap4MaskGlobalMaskBlendType, matcapALD);
        #endif
        //endex
        //ifex _MatcapEnable==0 && _Matcap2Enable==0 && _Matcap3Enable==0 && _Matcap4Enable==0

    }
#endif
//endex
#T#PoiMatcapFunctionCalls
//ifex _MatcapEnable==0 && _Matcap2Enable==0 && _Matcap3Enable==0 && _Matcap4Enable==0
#if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D) || defined(POI_MATCAP2) || defined(POI_MATCAP3)
    applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
#endif
//endex