From 9c9ffa838bd60c405038f60c9f5762f328f2a0d4 Mon Sep 17 00:00:00 2001 From: NoriDev Date: Wed, 25 Sep 2024 16:28:39 +0900 Subject: [PATCH 1/4] Update CHANGELOG_NRDV.md --- CHANGELOG_NRDV.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG_NRDV.md b/CHANGELOG_NRDV.md index db1db2a..adfbec3 100644 --- a/CHANGELOG_NRDV.md +++ b/CHANGELOG_NRDV.md @@ -33,3 +33,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changes - Add: 한국어(ko-KR) 지원 + +--- + +## [1.0.0] - 2024-08-24 +기반 LightLimitChanger 버전: 1.13.2 + +### Added +- Feat: Monochrome과 Monochrome Additive 설정을 분리하도록 변경(Poiyomi 전용) + +### Changes +- LLC가 비활성화 상태일 때 Monochrome 값을 머티리얼의 기본값으로 설정 From 2fcc6aa684bbbd005455f345824576670289a845 Mon Sep 17 00:00:00 2001 From: NoriDev Date: Wed, 25 Sep 2024 18:23:34 +0900 Subject: [PATCH 2/4] Update Poiyomi Toon 9.0.61 --- CHANGELOG_NRDV.md | 41 +- Editor/ShaderInfo/Poiyomi Toon.shader | 14738 +++++++++++++----------- 2 files changed, 7964 insertions(+), 6815 deletions(-) diff --git a/CHANGELOG_NRDV.md b/CHANGELOG_NRDV.md index adfbec3..15b7cf3 100644 --- a/CHANGELOG_NRDV.md +++ b/CHANGELOG_NRDV.md @@ -4,6 +4,37 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + + +## [1.x.x] - 2024-x-x +기반 LightLimitChanger 버전: 1.x.x + +### Changed +- Poiyomi Toon 셰이더 업데이트 (9.0.56 -> 9.0.61) + +--- + ## [1.0.4] - 2024-09-03 기반 LightLimitChanger 버전: 1.14.0 @@ -20,18 +51,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.0.2] - 2024-08-25 기반 LightLimitChanger 버전: 1.13.2 -### Changes -- Prefab 업데이트 - ### Added - 원본 LLC와 구분할 수 있도록 패치 네임 추가 +### Changed +- Prefab 업데이트 + --- ## [1.0.1] - 2024-08-25 기반 LightLimitChanger 버전: 1.13.2 -### Changes +### Changed - Add: 한국어(ko-KR) 지원 --- @@ -42,5 +73,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Feat: Monochrome과 Monochrome Additive 설정을 분리하도록 변경(Poiyomi 전용) -### Changes +### Changed - LLC가 비활성화 상태일 때 Monochrome 값을 머티리얼의 기본값으로 설정 diff --git a/Editor/ShaderInfo/Poiyomi Toon.shader b/Editor/ShaderInfo/Poiyomi Toon.shader index 03ee1f6..ec14e2b 100644 --- a/Editor/ShaderInfo/Poiyomi Toon.shader +++ b/Editor/ShaderInfo/Poiyomi Toon.shader @@ -1,7 +1,7 @@ // MIT License // Copyright (c) 2023 Poiyomi Inc. -// Original: https://github.com/poiyomi/PoiyomiToonShader/blob/d1f299654eba0bf5bef66cf0fa74142da95e4fb8/_PoiyomiShaders/Shaders/9.0/Toon/Poiyomi%20Toon.shader +// Original: https://github.com/poiyomi/PoiyomiToonShader/blob/52b73edcb11d194ae68084da06a2833248326237/_PoiyomiShaders/Shaders/9.0/Toon/Poiyomi%20Toon.shader (9.0.61) // This file is used for texture baking. @@ -27,7 +27,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" {value:6,actions:[{type:SET_PROPERTY,data:render_queue=3000},{type:SET_PROPERTY,data:_AlphaForceOpaque=0}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=4}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_SrcBlendAlpha=1}, {type:SET_PROPERTY,data:_DstBlendAlpha=1}, {type:SET_PROPERTY,data:_AddSrcBlend=2}, {type:SET_PROPERTY,data:_AddDstBlend=1}, {type:SET_PROPERTY,data:_AddSrcBlendAlpha=0}, {type:SET_PROPERTY,data:_AddDstBlendAlpha=1}, {type:SET_PROPERTY,data:_AlphaToCoverage=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}, {type:SET_PROPERTY,data:_OutlineSrcBlend=2}, {type:SET_PROPERTY,data:_OutlineDstBlend=0}, {type:SET_PROPERTY,data:_OutlineSrcBlendAlpha=1}, {type:SET_PROPERTY,data:_OutlineDstBlendAlpha=1}, {type:SET_PROPERTY,data:_OutlineBlendOp=0}, {type:SET_PROPERTY,data:_OutlineBlendOpAlpha=4}]}, {value:7,actions:[{type:SET_PROPERTY,data:render_queue=3000},{type:SET_PROPERTY,data:_AlphaForceOpaque=0}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=4}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=3}, {type:SET_PROPERTY,data:_SrcBlendAlpha=1}, {type:SET_PROPERTY,data:_DstBlendAlpha=1}, {type:SET_PROPERTY,data:_AddSrcBlend=2}, {type:SET_PROPERTY,data:_AddDstBlend=1}, {type:SET_PROPERTY,data:_AddSrcBlendAlpha=0}, {type:SET_PROPERTY,data:_AddDstBlendAlpha=1}, {type:SET_PROPERTY,data:_AlphaToCoverage=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}, {type:SET_PROPERTY,data:_OutlineSrcBlend=2}, {type:SET_PROPERTY,data:_OutlineDstBlend=3}, {type:SET_PROPERTY,data:_OutlineSrcBlendAlpha=1}, {type:SET_PROPERTY,data:_OutlineDstBlendAlpha=1}, {type:SET_PROPERTY,data:_OutlineBlendOp=0}, {type:SET_PROPERTY,data:_OutlineBlendOpAlpha=4}]} }]}]}", Int) = 0 - + [HideInInspector] m_mainCategory ("Color & Normals--{button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/color-and-normals/main},hover:Documentation}}", Float) = 0 //Main-main _Color ("Color & Alpha--{reference_property:_ColorThemeIndex}", Color) = (1, 1, 1, 1) @@ -42,15 +42,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos, 5, Local Pos, 8, Polar UV, 6, Distorted UV, 7)] _BumpMapUV ("UV", Int) = 0 [HideInInspector]_BumpScale ("Intensity", Range(0, 10)) = 1 [HideInInspector][ToggleUI]_BumpMapStochastic ("Stochastic Sampling", Float) = 0 - [sRGBWarning]_AlphaMask ("Alpha Map--{reference_properties:[_AlphaMaskPan, _AlphaMaskUV, _AlphaMaskInvert, _MainAlphaMaskMode, _AlphaMaskScale, _AlphaMaskValue], alts:[_AlphaMap]}", 2D) = "white" { } + [sRGBWarning]_AlphaMask ("Alpha Map--{reference_properties:[_AlphaMaskPan, _AlphaMaskUV, _AlphaMaskInvert, _MainAlphaMaskMode, _AlphaMaskBlendStrength, _AlphaMaskValue], alts:[_AlphaMap]}", 2D) = "white" { } [HideInInspector][Vector2]_AlphaMaskPan ("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)] _AlphaMaskUV ("UV", Int) = 0 [HideInInspector][ThryWideEnum(Off, 0, Replace, 1, Multiply, 2, Add, 3, Subtract, 4)]_MainAlphaMaskMode ("Blend Mode", Int) = 2 - [HideInInspector]_AlphaMaskScale ("Blend Strength", Float) = 1 + [HideInInspector]_AlphaMaskBlendStrength ("Blend Strength", Float) = 1 [HideInInspector]_AlphaMaskValue ("Blend Offset", Float) = 0 [HideInInspector][ToggleUI]_AlphaMaskInvert ("Invert", Float) = 0 _Cutoff ("Alpha Cutoff", Range(0, 1.001)) = 0.5 - + //ifex _MainColorAdjustToggle==0 [HideInInspector] m_start_ColorAdjust ("Color Adjust--{reference_property:_MainColorAdjustToggle,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/color-and-normals/color-adjust},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(COLOR_GRADING_HDR)] _MainColorAdjustToggle ("Adjust Colors", Float) = 0 @@ -59,13 +59,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos, 5, Local Pos, 8, Polar UV, 6, Distorted UV, 7)] _MainColorAdjustTextureUV ("UV", Int) = 0 _Saturation ("Saturation", Range(-1, 10)) = 0 _MainBrightness ("Brightness", Range(-1, 1)) = 0 - + [HideInInspector] s_start_MainHueShift ("Hue Shift--{reference_property:_MainHueShiftToggle,persistent_expand:true,default_expand:true}", Float) = 1 [HideInInspector][ThryToggleUI(true)] _MainHueShiftToggle (" Hue Shift", Float) = 0 + [ThryWideEnum(OKLab, 0, HSV, 1)] _MainHueShiftColorSpace ("Color Space", Int) = 0 [ToggleUI]_MainHueShiftReplace ("Hue Replace?", Float) = 1 _MainHueShift ("Hue Shift", Range(0, 1)) = 0 _MainHueShiftSpeed ("Hue Shift Speed", Float) = 0 - + [HideInInspector] s_start_MainHueShiftAL ("Hue Shift Audio Link--{reference_property:_MainHueALCTEnabled,persistent_expand:true,default_expand:false, condition_showS:(_EnableAudioLink==1)}", Float) = 0 [HideInInspector][ThryToggleUI(true)]_MainHueALCTEnabled ("Hue Shift Audio Link", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)]_MainALHueShiftBand ("Band", Int) = 0 @@ -73,13 +74,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _MainHueALMotionSpeed ("Motion Speed", Float) = 1 [HideInInspector] s_end_MainHueShiftAL ("Audio Link", Float) = 0 [HideInInspector] s_end_MainHueShift ("Name Motion", Float) = 0 - + [HideInInspector] s_start_ColorAdjustColorGrading ("Color Grading--{reference_property:_ColorGradingToggle, persistent_expand:true}", Float) = 0 [HideInInspector][ToggleUI] _ColorGradingToggle ("Color Grading", Float) = 0 [NoScaleOffset] _MainGradationTex ("Gradation Map", 2D) = "white" { } _MainGradationStrength ("Gradation Strength", Range(0, 1)) = 0 [HideInInspector] s_end_ColorAdjustColorGrading ("Color Grading", Float) = 0 - + [HideInInspector] s_start_MainHueShiftGlobalMask ("Global Mask--{persistent_expand:true}", Float) = 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)] _MainHueGlobalMask ("Hue--{reference_property:_MainHueGlobalMaskBlendType}", Int) = 0 [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _MainHueGlobalMaskBlendType ("Blending", Int) = 2 @@ -90,13 +91,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector] s_end_MainHueShiftGlobalMask ("Global Mask", Float) = 0 [HideInInspector] m_end_ColorAdjust ("Color Adjust", Float) = 0 //endex - + [HideInInspector] m_start_Alpha ("Alpha Options--{button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/color-and-normals/alpha-options},hover:Documentation}}", Float) = 0 [ToggleUI]_AlphaForceOpaque ("Force Opaque", Float) = 1 _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.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)] _AlphaGlobalMask ("Global Mask--{reference_property:_AlphaGlobalMaskBlendType}", Int) = 0 [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _AlphaGlobalMaskBlendType ("Blending", Int) = 2 - + //ifex _AlphaToCoverage==0 && isNotAnimated(_AlphaToCoverage) [HideInInspector] s_start_AlphaToCoverage ("Alpha To Coverage--{reference_property:_AlphaToCoverage,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI] _AlphaToCoverage ("A2CToggle", Float) = 0 @@ -104,7 +105,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _AlphaMipScale ("Mip Level Alpha Scale", Range(0, 1)) = 0.25 [HideInInspector] s_end_AlphaToCoverage ("Alpha To Coverage", Float) = 0 //endex - + //ifex _AlphaDithering==0 && isNotAnimated(_AlphaDithering) [HideInInspector] s_start_AlphaDithering ("Dithering--{reference_property:_AlphaDithering,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI] _AlphaDithering ("Dithering", Float) = 0 @@ -112,7 +113,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _AlphaDitherBias ("Dither Bias", Range(0, 1)) = 0 [HideInInspector] s_end_AlphaDithering ("Alpha To Coverage", Float) = 0 //endex - + //ifex _AlphaDistanceFade==0 && isNotAnimated(_AlphaDistanceFade) [HideInInspector] s_start_AlphaDistanceFade ("Distance Alpha / Distance Fade--{reference_property:_AlphaDistanceFade,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI] _AlphaDistanceFade ("Distance Alpha", Float) = 0 @@ -124,7 +125,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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)] _AlphaDistanceFadeGlobalMask ("Global Mask", Int) = 0 [HideInInspector] s_end_AlphaDistanceFade ("Distance Alpha / Distance Fade", Float) = 0 //endex - + //ifex _AlphaFresnel==0 && isNotAnimated(_AlphaFresnel) [HideInInspector] s_start_AlphaFresnel ("Fresnel Alpha--{reference_property:_AlphaFresnel,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI] _AlphaFresnel ("Fresnel Alpha", Float) = 0 @@ -135,7 +136,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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)] _AlphaFresnelGlobalMask ("Global Mask", Int) = 0 [HideInInspector] s_end_AlphaFresnel ("Fresnel Alpha", Float) = 0 //endex - + //ifex _AlphaAngular==0 && isNotAnimated(_AlphaAngular) [HideInInspector] s_start_AlphaAngular ("Angular Alpha--{reference_property:_AlphaAngular,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI] _AlphaAngular ("Angular Alpha", Float) = 0 @@ -150,21 +151,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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)] _AlphaAngularGlobalMask ("Global Mask", Int) = 0 [HideInInspector] s_end_AlphaAngular ("Name", Float) = 0 //endex - + //ifex _AlphaAudioLinkEnabled==0 && isNotAnimated(_AlphaAudioLinkEnabled) [HideInInspector] s_start_ALAlpha ("Alpha Audio Link--{reference_property:_AlphaAudioLinkEnabled,persistent_expand:true,default_expand:false, condition_showS:(_EnableAudioLink==1)}", Float) = 0 [HideInInspector][ToggleUI]_AlphaAudioLinkEnabled ("Alpha Audio Link", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AlphaAudioLinkAddBand ("Add Band", Int) = 0 [VectorLabel(Min, Max)]_AlphaAudioLinkAddRange ("Add Range", Vector) = (0, 0, 0) [HideInInspector] s_end_ALAlpha ("Alpha Audio Link", Float) = 0 - + [HideInInspector] s_start_AlphaAdvanced ("Advanced--{persistent_expand:true,default_expand:false}", Float) = 0 [ToggleUI]_AlphaPremultiply ("Alpha Premultiply", Float) = 0 _AlphaBoostFA ("Boost Transparency in ForwardAdd--{condition_showS:(_AddBlendOp==4)}", Range(1, 100)) = 10 [HideInInspector] s_end_AlphaAdvanced ("Advanced", Float) = 0 //endex [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0 - + //ifex _DetailEnabled==0 [HideInInspector] m_start_DetailOptions ("Details--{reference_property:_DetailEnabled,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/color-and-normals/details},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(FINALPASS)]_DetailEnabled ("Enable", Float) = 0 @@ -172,7 +173,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][Vector2]_DetailMaskPan ("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)] _DetailMaskUV ("UV", Int) = 0 [HideInInspector][ToggleUI]_DetailMaskStochastic ("Stochastic Sampling", Float) = 0 - + [HideInInspector] s_start_DetailTexture ("Detail Texture--{persistent_expand:false,default_expand:true}", Float) = 0 _DetailTint ("Tint--{reference_property:_DetailTintThemeIndex}", Color) = (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)] _DetailTintThemeIndex ("", Int) = 0 @@ -185,7 +186,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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)] _DetailTexGlobalMask ("Global Mask--{reference_property:_DetailTexGlobalMaskBlendType}", Int) = 0 [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6 , Replace, 0)]_DetailTexGlobalMaskBlendType ("Blending", Range(0, 1)) = 2 [HideInInspector] s_end_DetailTexture ("Detail Texture", Float) = 0 - + [HideInInspector] s_start_DetailNormal ("Detail Normal--{persistent_expand:false,default_expand:true}", Float) = 0 [Normal]_DetailNormalMap ("Detail Normal--{reference_properties:[_DetailNormalMapPan, _DetailNormalMapUV, _DetailNormalMapScale, _DetailNormalMapStochastic]}", 2D) = "bump" { } [HideInInspector]_DetailNormalMapScale ("Intensity", Range(0, 10)) = 1 @@ -197,7 +198,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector] s_end_DetailNormal ("Detail Normal", Float) = 0 [HideInInspector] m_end_DetailOptions ("Details", Float) = 0 //endex - + //ifex _VertexManipulationsEnabled==0 [HideInInspector] m_start_vertexManipulation ("Vertex Options--{reference_property:_VertexManipulationsEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/color-and-normals/vertex-options},hover:YouTube}}", Float) = 0 [HideInInspector][ThryToggle(AUTO_EXPOSURE)]_VertexManipulationsEnabled ("Enabled", Float) = 0 @@ -206,7 +207,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _VertexManipulationLocalScale ("Scale", Vector) = (1, 1, 1, 1) [Vector3]_VertexManipulationLocalRotation ("Rotation", Vector) = (0, 0, 0, 1) [Vector3]_VertexManipulationLocalRotationSpeed ("Rotation Speed", Vector) = (0, 0, 0, 1) - + [HideInInspector] s_start_VertexManipulationHeight ("Height Map--{persistent_expand:true,default_expand:true}", Float) = 1 [sRGBWarning]_VertexManipulationHeightMask ("Height Map--{reference_properties:[_VertexManipulationHeightMaskPan, _VertexManipulationHeightMaskUV, _VertexManipulationHeightMaskChannel]}", 2D) = "white" { } [HideInInspector][Vector2]_VertexManipulationHeightMaskPan ("Panning", Vector) = (0, 0, 0, 0) @@ -215,20 +216,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _VertexManipulationHeight ("Height", Float) = 0 _VertexManipulationHeightBias ("Map Bias", Range(0, 1)) = 0 [HideInInspector] s_end_VertexManipulationHeight ("Height Map", Float) = 0 - + [HideInInspector] s_start_vertexRounding ("Vertex Rounding (Blocky/PS1)--{reference_property:_VertexRoundingEnabled,persistent_expand:true,default_expand:true}", Float) = 0 [HideInInspector][ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0 [Enum(World, 0, Local, 1)]_VertexRoundingSpace ("Rounding Space", Int) = 0 _VertexRoundingDivision ("Rounding Interval", Float) = 0.02 [HideInInspector] s_end_vertexRounding ("Vertex Rounding (Blocky/PS1)", Float) = 0 - + [HideInInspector] s_start_VertexBarrelMode ("Barrel Distortion--{reference_property:_VertexBarrelMode,persistent_expand:true}", Float) = 0 [HideInInspector][ThryToggleUI(true)]_VertexBarrelMode (" Barrel Mode", Float) = 0 _VertexBarrelWidth ("Barrel Width", Float) = 0.2 _VertexBarrelAlpha ("Barrel Alpha", Range(0, 1)) = 0 _VertexBarrelHeight ("Barrel Height", Range(0, 1)) = 0 [HideInInspector] s_end_VertexBarrelMode ("Barrel Distortion", Float) = 0 - + [HideInInspector] s_start_VertexSphereMode ("Sphere Distortion--{reference_property:_VertexSphereMode,persistent_expand:true}", Float) = 0 [HideInInspector][ThryToggleUI(true)]_VertexSphereMode (" Sphere Mode", Float) = 0 _VertexSphereRadius ("Sphere Radius", Range(0, 1)) = 1 @@ -236,7 +237,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _VertexSphereAlpha ("Sphere Alpha", Range(0, 1)) = 0 [Vector3]_VertexSphereCenter ("Sphere Center", Vector) = (0, 0, 0, 1) [HideInInspector] s_end_VertexSphereMode ("Sphere Distortion", Float) = 0 - + [HideInInspector] s_start_VertexTornadoMode ("Tornado--{reference_property:_VertexTornadoMode,persistent_expand:true}", Float) = 0 [HideInInspector][ThryToggleUI(true)]_VertexTornadoMode (" Tornado", Float) = 0 _VertexTornadoRadius ("Radius", Float) = .2 @@ -245,23 +246,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _VertexTornadoTopHeight ("Top Height", Float) = 1 _VertexTornadoBaseHeight ("Bottom Height", Float) = 0 [HideInInspector] s_end_VertexTornadoMode ("Tornado", Float) = 0 - + [HideInInspector] s_start_VertAL ("Audio Link--{reference_property:_VertexAudioLinkEnabled,persistent_expand:true,default_expand:true,condition_showS:(_EnableAudioLink==1)}", Float) = 0 [HideInInspector][ThryToggleUI(true)]_VertexAudioLinkEnabled ("Audio Link", Float) = 0 - + [HideInInspector] s_start_LocalTranslation ("Local Translation--{persistent_expand:true,default_expand:true}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _VertexLocalTranslationALBand ("Band", Int) = 0 [Vector3]_VertexLocalTranslationALMin ("Translation Min", Vector) = (0, 0, 0) [Vector3]_VertexLocalTranslationALMax ("Translation Max", Vector) = (0, 0, 0) [HideInInspector] s_end_LocalTranslation ("Local Translation", Float) = 0 - + [HideInInspector] s_start_LocalRotation ("Local Rotation--{persistent_expand:true,default_expand:true}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _VertexLocalRotationALBandX ("Band X", Int) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _VertexLocalRotationALBandY ("Band Y", Int) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _VertexLocalRotationALBandZ ("Band Z", Int) = 0 [Vector3]_VertexLocalRotationAL ("Rotation", Vector) = (0, 0, 0) [HideInInspector] s_end_LocalRotation ("Local Rotation", Float) = 0 - + [HideInInspector] s_start_ContinuousRotation ("Continuous Rotation--{persistent_expand:true,default_expand:true}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _VertexLocalRotationCTALBandX ("Band X", 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)]_VertexLocalRotationCTALTypeX ("Motion Type X", Int) = 0 @@ -271,29 +272,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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)]_VertexLocalRotationCTALTypeZ ("Motion Type Z", Int) = 0 [Vector3]_VertexLocalRotationCTALSpeed ("Speed", Vector) = (0, 0, 0) [HideInInspector] s_end_ContinuousRotation ("Continuous Rotation", Float) = 0 - + [HideInInspector] s_start_VertexScale ("Vertex Scale--{persistent_expand:true,default_expand:true}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _VertexLocalScaleALBand ("Band", Int) = 0 _VertexLocalScaleALMin ("Scale Min", Vector) = (0, 0, 0, 0) _VertexLocalScaleALMax ("Scale Max", Vector) = (0, 0, 0, 0) [HideInInspector] s_end_VertexScale ("Vertex Scale", Float) = 0 - + [HideInInspector] s_start_WorldTranslation ("World Translation--{persistent_expand:true,default_expand:true}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _VertexWorldTranslationALBand ("Band", Int) = 0 [Vector3]_VertexWorldTranslationALMin ("World Translation Min", Vector) = (0, 0, 0) [Vector3]_VertexWorldTranslationALMax ("World Translation Max", Vector) = (0, 0, 0) [HideInInspector] s_end_WorldTranslation ("World Translation", Float) = 0 - + [HideInInspector] s_start_ALVertexHeight ("Vertex Height--{persistent_expand:true,default_expand:true}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _VertexManipulationHeightBand ("Band", Int) = 0 [VectorLabel(Min, Max)]_VertexManipulationHeightAL ("Height", Vector) = (0, 0, 0) [HideInInspector] s_end_ALVertexHeight ("Vertex Height", Float) = 0 - + [HideInInspector] s_start_vertexRoundingAL ("Vertex Rounding--{persistent_expand:true,default_expand:true}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _VertexRoundingRangeBand ("Band", Int) = 0 [VectorLabel(Min, Max)]_VertexRoundingRangeAL ("Range", Vector) = (0, 0, 0) [HideInInspector] s_end_VertexRoundingAL ("Vertex Rounding", Float) = 0 - + [HideInInspector] s_start_ALSpectrumMotion ("Spectrum Motion--{reference_property:_VertexSpectrumMotion,persistent_expand:true,default_expand:true}", Float) = 0 [HideInInspector][ThryToggleUI(true)]_VertexSpectrumMotion ("Spectrum Motion", Float) = 0 [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexSpectrumUV ("UV", Int) = 0 @@ -301,12 +302,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _VertexSpectrumOffsetMin ("Offset Min", Vector) = (0, 0, 0) _VertexSpectrumOffsetMax ("Offset Max", Vector) = (0, .1, 0) [HideInInspector] s_end_ALSpectrumMotion ("Spectrum Motion", Float) = 0 - + [HideInInspector] s_end_VertAL ("Audio Link", Float) = 0 - + [HideInInspector] m_end_vertexManipulation ("Vertex Options", Float) = 0 //endex - + //ifex _VertexGlitchingEnabled==0 [HideInInspector] m_start_vertexGlitching ("Vertex Glitching--{reference_property:_VertexGlitchingEnabled}", Float) = 0 [HideInInspector][ThryToggle(POI_VERTEX_GLITCHING)]_VertexGlitchingEnabled ("Enabled", Float) = 0 @@ -316,16 +317,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _VertexGlitchStrength ("Glitch Strength", Range(0, 10)) = 1 [HideInInspector] s_start_VertexGlitchTexture ("Glitch Texture--{reference_property:_VertexGlitchingUseTexture,persistent_expand:true,default_expand:true}", Float) = 1 [HideInInspector][ThryToggle(POI_VERTEX_GLITCHING_TEXTURE, true)]_VertexGlitchingUseTexture ("Use Texture", Float) = 0 - [sRGBWarning][ThryRGBAPacker(R Both, G Right, B Left, A unused, linear, false)]_VertexGlitchMap ("Glitch Map [Expand]", 2D) = "white" { } + [sRGBWarning][ThryRGBAPacker(R Both, G Right, B Left, A unused, linear, false)]_VertexGlitchMap ("Glitch Map [Click to Expand]", 2D) = "white" { } _VertexGlitchDensity ("Glitch Density", Range(0, 50)) = 10 _VertexGlitchMapPanSpeed ("Glitch Map Pan Speed", Range(0, 100)) = 10 [HideInInspector] s_end_VertexGlitchTexture ("Glitch Texture", Float) = 0 - + [HideInInspector] s_start_VertexGlitchMirror ("Mirror--{reference_property:_VertexGlitchMirrorEnable,persistent_expand:true}", Float) = 0 [HideInInspector][ThryToggleUI(true)]_VertexGlitchMirrorEnable ("Mirror", Float) = 0 [ThryWideEnum(Show In Both, 0, Show Only In Mirror, 1, Dont Show In Mirror, 2)] _VertexGlitchMirror ("Show in mirror", Int) = 0 [HideInInspector] s_end_VertexGlitchMirror ("Mirror", Float) = 0 - + [HideInInspector] s_start_ALVertexGlitching ("Audio Link--{reference_property:_VertexGlitchingAudioLinkEnabled,persistent_expand:true,default_expand:false, condition_showS:(_EnableAudioLink==1)}", Float) = 0 [ThryToggleUI(true)]_VertexGlitchingAudioLinkEnabled ("Audio Link", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, VU Intensity, 4)] _VertexGlitchingAudioLinkBand ("Glitch Band", Int) = 0 @@ -333,7 +334,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector] s_end_ALVertexGlitching ("Audio Link", Float) = 0 [HideInInspector] m_end_vertexGlitching ("Vertex Glitching", Float) = 0 //endex - + //ifex _MainVertexColoringEnabled==0 [HideInInspector] m_start_MainVertexColors ("Vertex Colors--{reference_property:_MainVertexColoringEnabled,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/color-and-normals/vertex-colors},hover:Documentation}}", Float) = 0 [HideInInspector][ToggleUI]_MainVertexColoringEnabled ("Enable", Float) = 0 @@ -342,7 +343,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _MainUseVertexColorAlpha ("Use Vertex Color Alpha", Range(0, 1)) = 0 [HideInInspector] m_end_MainVertexColors ("Vertex Colors", Float) = 0 //endex - + //ifex _BackFaceEnabled!=1 // Back Face Textures and Emission [HideInInspector] m_start_backFace ("Back Face--{reference_property:_BackFaceEnabled,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/color-and-normals/back-face},hover:Documentation}}", Float) = 0 @@ -357,13 +358,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos, 5, Local Pos, 8, Polar UV, 6, Distorted UV, 7)]_BackFaceMaskUV ("UV#", Int) = 0 [HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)]_BackFaceMaskChannel ("Channel", Float) = 0 _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0 - + [HideInInspector] s_start_BackFaceHueShift ("Hue Shift--{reference_property:_BackFaceHueShiftEnabled,persistent_expand:true}", Float) = 0 [HideInInspector][ToggleUI]_BackFaceHueShiftEnabled ("Hue Shift", Float) = 0 + [ThryWideEnum(OKLab, 0, HSV, 1)] _BackFaceShiftColorSpace ("Color Space", Int) = 0 _BackFaceHueShift ("Shift", Range(0, 1)) = 0 _BackFaceHueShiftSpeed ("Shift Speed", Float) = 0 [HideInInspector] s_end_BackFaceHueShift ("Hue Shift", Float) = 0 - + [HideInInspector] s_start_BackfaceMods ("Backface Mods--{persistent_expand:true,default_expand:false}", Float) = 0 _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1 [ToggleUI]_BackFaceReplaceAlpha ("Replace Alpha", Float) = 0 @@ -371,17 +373,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector] s_end_BackfaceMods ("Backface Mods", Float) = 0 [HideInInspector] m_end_backFace ("Back Face", Float) = 0 //endex - + //ifex _RGBMaskEnabled==0 [HideInInspector] m_start_RGBMask ("RGBA Color Masking--{reference_property:_RGBMaskEnabled,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/color-and-normals/rgba-color-masking},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(VIGNETTE)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0 [ThryWideEnum(Texture, 0, Vertex Color, 1)]_RGBMaskType ("Mask Type", int) = 0 - - [sRGBWarning][ThryRGBAPacker(R Mask, G Mask, B Mask, A Mask, Linear, false)]_RGBMask ("Masks [Expand]--{reference_properties:[_RGBMaskPan, _RGBMaskUV], condition_showS:_RGBMaskType==0}", 2D) = "white" { } + + [sRGBWarning][ThryRGBAPacker(R Mask, G Mask, B Mask, A Mask, Linear, false)]_RGBMask ("Masks [Click to Expand]--{reference_properties:[_RGBMaskPan, _RGBMaskUV], condition_showS:_RGBMaskType==0}", 2D) = "white" { } [HideInInspector][Vector2]_RGBMaskPan ("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)]_RGBMaskUV ("UV", int) = 0 - - [sRGBWarning][ThryRGBAPacker(Red Metallic, Green Metallic, Blue Metallic, Alpha Metallic, Linear, false)]_RGBAMetallicMaps ("Metallic Maps [Expand]--{reference_properties:[_RGBAMetallicMapsPan, _RGBAMetallicMapsUV, _RGBAMetallicMapsStochastic, _RGBARedMetallicInvert, _RGBAGreenMetallicInvert, _RGBABlueMetallicInvert, _RGBAAlphaMetallicInvert]}", 2D) = "white" { } + + [sRGBWarning][ThryRGBAPacker(Red Metallic, Green Metallic, Blue Metallic, Alpha Metallic, Linear, false)]_RGBAMetallicMaps ("Metallic Maps [Click to Expand]--{reference_properties:[_RGBAMetallicMapsPan, _RGBAMetallicMapsUV, _RGBAMetallicMapsStochastic, _RGBARedMetallicInvert, _RGBAGreenMetallicInvert, _RGBABlueMetallicInvert, _RGBAAlphaMetallicInvert]}", 2D) = "white" { } [HideInInspector][Vector2]_RGBAMetallicMapsPan ("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)]_RGBAMetallicMapsUV ("UV", Int) = 0 [HideInInspector][ToggleUI]_RGBAMetallicMapsStochastic ("Stochastic Sampling", Float) = 0 @@ -389,8 +391,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][ToggleUI]_RGBAGreenMetallicInvert ("Invert G", Float) = 0 [HideInInspector][ToggleUI]_RGBABlueMetallicInvert ("Invert B", Float) = 0 [HideInInspector][ToggleUI]_RGBAAlphaMetallicInvert ("Invert A", Float) = 0 - - [sRGBWarning][ThryRGBAPacker(Red Smoothness, Green Smoothness, Blue Smoothness, Alpha Smoothness, Linear, false)]_RGBASmoothnessMaps ("Smoothness Maps [Expand]--{reference_properties:[_RGBASmoothnessMapsPan, _RGBASmoothnessMapsUV, _RGBASmoothnessMapsStochastic, _RGBARedSmoothnessInvert, _RGBAGreenSmoothnessInvert, _RGBABlueSmoothnessInvert, _RGBAAlphaSmoothnessInvert]}", 2D) = "white" { } + + [sRGBWarning][ThryRGBAPacker(Red Smoothness, Green Smoothness, Blue Smoothness, Alpha Smoothness, Linear, false)]_RGBASmoothnessMaps ("Smoothness Maps [Click to Expand]--{reference_properties:[_RGBASmoothnessMapsPan, _RGBASmoothnessMapsUV, _RGBASmoothnessMapsStochastic, _RGBARedSmoothnessInvert, _RGBAGreenSmoothnessInvert, _RGBABlueSmoothnessInvert, _RGBAAlphaSmoothnessInvert]}", 2D) = "white" { } [HideInInspector][Vector2]_RGBASmoothnessMapsPan ("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)]_RGBASmoothnessMapsUV ("UV", Int) = 0 [HideInInspector][ToggleUI]_RGBASmoothnessMapsStochastic ("Stochastic Sampling", Float) = 0 @@ -398,7 +400,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][ToggleUI]_RGBAGreenSmoothnessInvert ("Invert G", Float) = 0 [HideInInspector][ToggleUI]_RGBABlueSmoothnessInvert ("Invert B", Float) = 0 [HideInInspector][ToggleUI]_RGBAAlphaSmoothnessInvert ("Invert A", Float) = 0 - + [HideInInspector] s_start_RGBRed ("Red--{reference_property:_RGBARedEnable,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_RGBARedEnable ("Enable Red", Float) = 0 [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Lighten, 5, Screen, 6, Subtract, 7, Add, 8, Overlay, 9, Mixed, 20)]_RGBARedBlendType ("Blend Mode", Range(0, 1)) = 0 @@ -412,7 +414,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)]_RgbRedMaskChannel ("Mask Channel", Int) = 0 [HideInInspector][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)] _RgbRedGlobalMaskChannel ("Global Mask--{reference_property:_RgbRedGlobalMaskBlendType}", Int) = 0 [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _RgbRedGlobalMaskBlendType ("Blending", Range(0, 1)) = 2 - + [Normal]_RgbNormalR ("Normal--{reference_properties:[_RgbNormalRPan, _RgbNormalRUV, _RgbNormalRStochastic, _RgbNormalRedBlendMode, _RgbNormalRMaskChannel, _RgbNormalRGlobalMaskChannel]}", 2D) = "bump" { } [HideInInspector][Vector2]_RgbNormalRPan ("Pan", 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)]_RgbNormalRUV ("UV", int) = 0 @@ -423,7 +425,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _RgbNormalRGlobalMaskBlendType ("Blending", Range(0, 1)) = 2 _RgbNormalRScale ("Normal Intensity", Range(0, 10)) = 0 _RGBARedEmissionStrength ("Emission Strength", Range(0, 20)) = 0 - + [ToggleUI]_RGBAPBRRedEnabled ("Metallics & Smoothness", Float) = 0 [ThryToggleUI(true)]_RGBARedPBRSplitMaskSample ("Custom Sampling--{condition_showS:(_RGBAPBRRedEnabled==1)}", Float) = 0 [VectorLabel(tX, tY, oX, oY)]_RGBARedPBRMaskScaleTiling ("Tiling/Offset--{condition_showS:(_RGBARedPBRSplitMaskSample==1&&_RGBAPBRRedEnabled==1)}", Vector) = (1, 1, 0, 0) @@ -431,7 +433,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ToggleUI]_RGBARedPBRSplitMaskStochastic ("Stochastic Sampling--{condition_showS:(_RGBARedPBRSplitMaskSample==1&&_RGBAPBRRedEnabled==1)}", Float) = 0 [Vector2]_RGBARedPBRMasksPan ("Panning--{condition_showS:(_RGBARedPBRSplitMaskSample==1&&_RGBAPBRRedEnabled==1)}", Vector) = (0, 0, 0, 0) [HideInInspector] s_end_RGBRed ("Red", Float) = 0 - + [HideInInspector] s_start_RGBGreen ("Green--{reference_property:_RGBAGreenEnable,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_RGBAGreenEnable ("Enable Green", Float) = 0 [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Lighten, 5, Screen, 6, Subtract, 7, Add, 8, Overlay, 9, Mixed, 20)]_RGBAGreenBlendType ("Blend Mode", Range(0, 1)) = 0 @@ -445,7 +447,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)]_RgbGreenMaskChannel ("Mask Channel", Int) = 1 [HideInInspector][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)] _RgbGreenGlobalMaskChannel ("Global Mask--{reference_property:_RgbGreenGlobalMaskBlendType}", Int) = 0 [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _RgbGreenGlobalMaskBlendType ("Blending", Range(0, 1)) = 2 - + [Normal]_RgbNormalG ("Normal--{reference_properties:[_RgbNormalGPan, _RgbNormalGUV, _RgbNormalGStochastic, _RgbNormalGreenBlendMode, _RgbNormalGMaskChannel, _RgbNormalGGlobalMaskChannel]}", 2D) = "bump" { } [HideInInspector][Vector2]_RgbNormalGPan ("Pan", 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)]_RgbNormalGUV ("UV", int) = 0 @@ -456,7 +458,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _RgbNormalGGlobalMaskBlendType ("Blending", Range(0, 1)) = 2 _RgbNormalGScale ("Normal Intensity", Range(0, 10)) = 0 _RGBAGreenEmissionStrength ("Emission Strength", Range(0, 20)) = 0 - + [ToggleUI]_RGBAPBRGreenEnabled ("Metallics & Smoothness", Float) = 0 [ThryToggleUI(true)]_RGBAGreenPBRSplitMaskSample ("Custom Sampling--{condition_showS:(_RGBAPBRGreenEnabled==1)}", Float) = 0 [VectorLabel(tX, tY, oX, oY)]_RGBAGreenPBRMaskScaleTiling ("Tiling/Offset--{condition_showS:(_RGBAGreenPBRSplitMaskSample==1&&_RGBAPBRGreenEnabled==1)}", Vector) = (1, 1, 0, 0) @@ -464,7 +466,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ToggleUI]_RGBAGreenPBRSplitMaskStochastic ("Stochastic Sampling--{condition_showS:(_RGBAGreenPBRSplitMaskSample==1&&_RGBAPBRGreenEnabled==1)}", Float) = 0 [Vector2]_RGBAGreenPBRMasksPan ("Panning--{condition_showS:(_RGBAGreenPBRSplitMaskSample==1&&_RGBAPBRGreenEnabled==1)}", Vector) = (0, 0, 0, 0) [HideInInspector] s_end_RGBGreen ("Green", Float) = 0 - + [HideInInspector] s_start_RGBBlue ("Blue--{reference_property:_RGBABlueEnable,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_RGBABlueEnable ("Enable Blue", Float) = 0 [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Lighten, 5, Screen, 6, Subtract, 7, Add, 8, Overlay, 9, Mixed, 20)]_RGBABlueBlendType ("Blend Mode", Range(0, 1)) = 0 @@ -478,7 +480,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)]_RgbBlueMaskChannel ("Mask Channel", Int) = 2 [HideInInspector][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)] _RgbBlueGlobalMaskChannel ("Global Mask--{reference_property:_RgbBlueGlobalMaskBlendType}", Int) = 0 [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _RgbBlueGlobalMaskBlendType ("Blending", Range(0, 1)) = 2 - + [Normal]_RgbNormalB ("Normal--{reference_properties:[_RgbNormalBPan, _RgbNormalBUV, _RgbNormalBStochastic, _RgbNormalBlueBlendMode, _RgbNormalBMaskChannel, _RgbNormalBGlobalMaskChannel]}", 2D) = "bump" { } [HideInInspector][Vector2]_RgbNormalBPan ("Pan", 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)]_RgbNormalBUV ("UV", int) = 0 @@ -489,7 +491,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _RgbNormalBGlobalMaskBlendType ("Blending", Range(0, 1)) = 2 _RgbNormalBScale ("Normal Intensity", Range(0, 10)) = 0 _RGBABlueEmissionStrength ("Emission Strength", Range(0, 20)) = 0 - + [ToggleUI]_RGBAPBRBlueEnabled ("Metallics & Smoothness", Float) = 0 [ThryToggleUI(true)]_RGBABluePBRSplitMaskSample ("Custom Sampling--{condition_showS:(_RGBAPBRBlueEnabled==1)}", Float) = 0 [VectorLabel(tX, tY, oX, oY)]_RGBABluePBRMaskScaleTiling ("Tiling/Offset--{condition_showS:(_RGBABluePBRSplitMaskSample==1&&_RGBAPBRBlueEnabled==1)}", Vector) = (1, 1, 0, 0) @@ -497,7 +499,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ToggleUI]_RGBABluePBRSplitMaskStochastic ("Stochastic Sampling--{condition_showS:(_RGBABluePBRSplitMaskSample==1&&_RGBAPBRBlueEnabled==1)}", Float) = 0 [Vector2]_RGBABluePBRMasksPan ("Panning--{condition_showS:(_RGBABluePBRSplitMaskSample==1&&_RGBAPBRBlueEnabled==1)}", Vector) = (0, 0, 0, 0) [HideInInspector] s_end_RGBBlue ("Blue", Float) = 0 - + [HideInInspector] s_start_RGBAlpha ("Alpha--{reference_property:_RGBAAlphaEnable,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_RGBAAlphaEnable ("Enable Alpha", Float) = 0 [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Lighten, 5, Screen, 6, Subtract, 7, Add, 8, Overlay, 9, Mixed, 20)]_RGBAAlphaBlendType ("Blend Mode", Range(0, 1)) = 0 @@ -511,7 +513,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)]_RgbAlphaMaskChannel ("Mask Channel", Int) = 3 [HideInInspector][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)] _RgbAlphaGlobalMaskChannel ("Global Mask--{reference_property:_RgbAlphaGlobalMaskBlendType}", Int) = 0 [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _RgbAlphaGlobalMaskBlendType ("Blending", Range(0, 1)) = 2 - + [Normal]_RgbNormalA ("Normal--{reference_properties:[_RgbNormalAPan, _RgbNormalAUV, _RgbNormalAStochastic, _RgbNormalAlphaBlendMode,_RgbNormalAMaskChannel, _RgbNormalAGlobalMaskChannel]}", 2D) = "bump" { } [HideInInspector][Vector2]_RgbNormalAPan ("Pan", 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)]_RgbNormalAUV ("UV", int) = 0 @@ -522,7 +524,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _RgbNormalAGlobalMaskBlendType ("Blending", Range(0, 1)) = 2 _RgbNormalAScale ("Normal Intensity", Range(0, 10)) = 0 _RGBAAlphaEmissionStrength ("Emission Strength", Range(0, 20)) = 0 - + [ToggleUI]_RGBAPBRAlphaEnabled ("Metallics & Smoothness", Float) = 0 [ThryToggleUI(true)]_RGBAAlphaPBRSplitMaskSample ("Custom Sampling--{condition_showS:(_RGBAPBRAlphaEnabled==1)}", Float) = 0 [VectorLabel(tX, tY, oX, oY)]_RGBAAlphaPBRMaskScaleTiling ("Tiling/Offset--{condition_showS:(_RGBAAlphaPBRSplitMaskSample==1&&_RGBAPBRAlphaEnabled==1)}", Vector) = (1, 1, 0, 0) @@ -532,13 +534,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector] s_end_RGBAlpha ("Alpha", Float) = 0 [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0 //endex - + + //ifex _DecalEnabled==0 && _DecalEnabled1==0 && _DecalEnabled2==0 && _DecalEnabled3==0 // Decal Texture + //[HideInInspector] m_start_DecalSection ("Decals Group 0--{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 ("Decal RGBA Mask--{reference_properties:[_DecalMaskPan, _DecalMaskUV]}", 2D) = "white" { } + [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 (" TPS Depth Enabled", Float) = 0 _Decal0TPSMaskStrength ("Mask r Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1 @@ -546,7 +554,6 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _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 0--{reference_property:_DecalEnabled}", Float) = 0 @@ -558,30 +565,42 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _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, _DecalOverrideAlpha]}", 2D) = "white" { } + [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 - [HideInInspector][ToggleUI]_DecalOverrideAlpha ("Override Alpha--{reference_property:_Decal0OverrideAlphaMode}", Float) = 0 - [HideInInspector][Enum(Everywhere, 0, Decal Bounds, 1)] _Decal0OverrideAlphaMode ("Mode", 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 ("Blending", Range(0, 1)) = 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 _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][NoAnimate][ThryToggle(true)]_Decal0ChannelSeparationEnable ("Chromatic Aberration", Float) = 0 _Decal0ChannelSeparation ("Intensity", Float) = 0 @@ -590,7 +609,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _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 @@ -637,30 +656,42 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _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, _DecalOverrideAlpha1]}", 2D) = "white" { } + [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 - [HideInInspector][ToggleUI]_DecalOverrideAlpha1 ("Override Alpha--{reference_property:_Decal1OverrideAlphaMode}", Float) = 0 - [HideInInspector][Enum(Everywhere, 0, Decal Bounds, 1)] _Decal1OverrideAlphaMode ("Mode", Int) = 0 - + _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 ("Blending", Range(0, 1)) = 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 _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][NoAnimate][ThryToggle(true)]_Decal1ChannelSeparationEnable ("Chromatic Aberration", Float) = 0 _Decal1ChannelSeparation ("Intensity", Float) = 0 @@ -669,7 +700,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _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 @@ -716,30 +747,42 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _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, _DecalOverrideAlpha2]}", 2D) = "white" { } + [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 - [HideInInspector][ToggleUI]_DecalOverrideAlpha2 ("Override Alpha--{reference_property:_Decal2OverrideAlphaMode}", Float) = 0 - [HideInInspector][Enum(Everywhere, 0, Decal Bounds, 1)] _Decal2OverrideAlphaMode ("Mode", Int) = 0 - + _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 ("Blending", Range(0, 1)) = 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 _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][NoAnimate][ThryToggle(true)]_Decal2ChannelSeparationEnable ("Chromatic Aberration", Float) = 0 _Decal2ChannelSeparation ("Intensity", Float) = 0 @@ -748,7 +791,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _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 @@ -795,30 +838,42 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _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 - [HideInInspector][ToggleUI]_DecalOverrideAlpha3 ("Override Alpha--{reference_property:_Decal3OverrideAlphaMode}", Float) = 0 - [HideInInspector][Enum(Everywhere, 0, Decal Bounds, 1)] _Decal3OverrideAlphaMode ("Mode", Int) = 0 - + _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 ("Blending", Range(0, 1)) = 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 _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][NoAnimate][ThryToggle(true)]_Decal3ChannelSeparationEnable ("Chromatic Aberration", Float) = 0 _Decal3ChannelSeparation ("Intensity", Float) = 0 @@ -827,7 +882,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _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 @@ -864,7 +919,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector] m_end_Decal3 ("Decal 0", Float) = 0 //endex [HideInInspector] m_end_DecalSection ("Decal", Float) = 0 - + //endex + //ifex _NormalCorrect==0 [HideInInspector] m_start_normalCorrect (" Normal Correct--{reference_property:_NormalCorrect}}", Float) = 0 [HideInInspector][ThryToggle(POI_NORMALCORRECT)]_NormalCorrect ("Enable", Float) = 0 @@ -872,9 +928,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Vector3]_NormalCorrectOrigin ("Origin", Vector) = (0,0.4,-0.025) [HideInInspector] m_end_normalCorrect ("", Float) = 0 //endex - + [HideInInspector] m_lightingCategory ("Shading", Float) = 0 - + [HideInInspector] m_start_PoiLightData ("Light Data--{button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/light-data},hover:Documentation}}", Float) = 0 // Lighting Data [sRGBWarning][ThryRGBAPacker(R, G, B, A, Linear, false)]_LightingAOMaps ("AO Maps (expand)--{reference_properties:[_LightingAOMapsPan, _LightingAOMapsUV,_LightDataAOStrengthR,_LightDataAOStrengthG,_LightDataAOStrengthB,_LightDataAOStrengthA, _LightDataAOGlobalMaskR]}", 2D) = "white" { } @@ -945,14 +1001,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryWideEnum(Direct Color, 0, Indirect Color, 1, Light Map, 2, Attenuation, 3, N Dot L, 4, Half Dir, 5, Direction, 6, Add Color, 7, Add Attenuation, 8, Add Shadow, 9, Add N Dot L, 10)] _LightingDebugVisualize ("Visualize", Int) = 0 [HideInInspector] s_end_LightDataDebug ("Debug", Float) = 0 [HideInInspector] m_end_PoiLightData ("Light Data", Float) = 0 - + //ifex _ShadingEnabled==0 [HideInInspector] m_start_PoiShading (" Shading--{reference_property:_ShadingEnabled,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/main},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(VIGNETTE_MASKED)]_ShadingEnabled ("Enable Shading", Float) = 1 [KeywordEnum(TextureRamp, Multilayer Math, Wrapped, Skin, ShadeMap, Flat, Realistic, Cloth, SDF)] _LightingMode ("Lighting Type", Float) = 5 - + _LightingShadowColor ("Shadow Tint--{condition_showS:(_LightingMode!=4 && _LightingMode!=1 && _LightingMode!=5)}", Color) = (1, 1, 1) - + //ifex _LightingMode!=0 // Texture Ramp [NoScaleOffset][sRGBWarning(true)][Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_showS:(_LightingMode==0)}", 2D) = "white" { } @@ -960,10 +1016,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _ToonRampCount ("Ramp Count--{condition_showS:(_LightingMode==0)}", Int) = 1 [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)]_ToonRampUVSelector ("Ramp Selector UV--{condition_showS:(_LightingMode==0)}", Int) = 1 //endex - + //ifex _LightingMode!=1 // Multilayer Math - [sRGBWarning]_MultilayerMathBlurMap ("Blur Map--{reference_properties:[_MultilayerMathBlurMapPan, _MultilayerMathBlurMapUV], condition_showS:(_LightingMode==1)}", 2D) = "white" { } [HideInInspector] s_start_MultilayerMath1stLayer ("Shadow Layer 1--{persistent_expand:true,default_expand:true, condition_showS:(_LightingMode==1)}", Float) = 1 [sRGBWarning(true)]_ShadowColorTex ("Color Tex--{reference_properties:[_ShadowColorTexPan, _ShadowColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { } @@ -976,7 +1031,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _ShadowBlur ("Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1 _ShadowReceive ("Receive Shadow--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0 [HideInInspector] s_end_MultilayerMath1stLayer ("Shadow Layer 1}", Float) = 1 - + [HideInInspector] s_start_MultilayerMath2ndLayer ("Shadow Layer 2--{persistent_expand:true,default_expand:false, condition_showS:(_LightingMode==1)}", Float) = 0 [sRGBWarning(true)]_Shadow2ndColorTex ("Color Tex--{reference_properties:[_Shadow2ndColorTexPan, _Shadow2ndColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { } [HideInInspector][Vector2]_Shadow2ndColorTexPan ("Panning", Vector) = (0, 0, 0, 0) @@ -986,7 +1041,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _Shadow2ndBlur ("Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.3 _Shadow2ndReceive ("Receive Shadow--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0 [HideInInspector] s_end_MultilayerMath2ndLayer ("Shadow Layer 2", Float) = 0 - + [HideInInspector] s_start_MultilayerMath3rdLayer ("Shadow Layer 3--{persistent_expand:true,default_expand:false, condition_showS:(_LightingMode==1)}", Float) = 0 [sRGBWarning(true)]_Shadow3rdColorTex ("Color Tex--{reference_properties:[_Shadow3rdColorTexPan, _Shadow3rdColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { } [HideInInspector][Vector2]_Shadow3rdColorTexPan ("Panning", Vector) = (0, 0, 0, 0) @@ -996,12 +1051,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _Shadow3rdBlur ("Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1 _Shadow3rdReceive ("Receive Shadow--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0 [HideInInspector] s_end_MultilayerMath3rdLayer ("Shadow Layer 3", Float) = 0 - + [HideInInspector] s_start_MultilayerMathBorder ("Border--{persistent_expand:true,default_expand:true, condition_showS:(_LightingMode==1)}", Float) = 1 _ShadowBorderColor ("Color--{condition_showS:(_LightingMode==1)}", Color) = (1, 0, 0, 1) _ShadowBorderRange ("Border Range--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0 [HideInInspector] s_end_MultilayerMathBorder ("Border", Float) = 1 - + [HideInInspector] s_start_MultilayerMathBorderMap ("Shadow Border Map--{reference_property:_ShadowBorderMapToggle, persistent_expand:true,default_expand:false, condition_showS:(_LightingMode==1)}", Float) = 0 [HideInInspector][ToggleUI] _ShadowBorderMapToggle ("Shadow Border Map Toggle", Float) = 0 _ShadowBorderMask ("Shadow Border Map--{reference_properties:[_ShadowBorderMaskPan, _ShadowBorderMaskUV]}", 2D) = "white" { } @@ -1012,11 +1067,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [VectorToSliders(1st Min, n0.01, p1.01, 1st Max, n0.01, p1.01, 2nd Min, n0.01, p1.01, 2nd Max, n0.01, p1.01)]_ShadowAOShift ("Shadow AO Shift", Vector) = (0, 1, 0, 1) [VectorToSliders(3rd Min, n0.01, p1.01, 3rd Max, n0.01, p1.01)]_ShadowAOShift2 ("Shadow AO Shift", Vector) = (0, 1, 0, 1) [HideInInspector] s_end_MultilayerMathBorderMap ("Shadow Border Map", Float) = 1 - + [ToggleUI]_LightingMulitlayerNonLinear ("Non Linear Lightmap--{condition_showS:(_LightingMode==1)}", Float) = 1 _ShadowMainStrength ("Base Color Blend--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0 //endex - + //ifex _LightingMode!=2 // Wrapped _LightingWrappedColor ("LightSide Color--{condition_showS:(_LightingMode==2)}", Color) = (1, 1, 1, 1) @@ -1025,7 +1080,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _LightingGradientStart ("Gradient Start--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0 _LightingGradientEnd ("Gradient End--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = .5 //endex - + // Shade Maps //ifex _LightingMode!=4 _1st_ShadeColor ("1st ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1) @@ -1048,7 +1103,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _1st2nd_Shades_Feather ("1st/2nd_Shades_Feather--{condition_showS:(_LightingMode==4)}", Range(0.0001, 1)) = 0.0001 [Enum(Replace, 0, Multiply, 1)]_ShadingShadeMapBlendType ("Blend Mode--{condition_showS:(_LightingMode==4)}", Int) = 0 //endex - + // Skin Shading //ifex _LightingMode!=3 [sRGBWarning]_SkinLUT ("LUT--{condition_showS:(_LightingMode==3)}", 2D) = "white" { } @@ -1062,7 +1117,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][Vector3]_SssTransmissionAbsorption ("Absorption--{condition_showS:(_LightingMode==3)}", Vector) = (-8, -40, -64, 0) [HideInInspector][Vector3]_SssColorBleedAoWeights ("AO Color Bleed--{condition_showS:(_LightingMode==3)}", Vector) = (0.4, 0.15, 0.13, 0) //endex - + + //ifex _LightingMode!=5 + // Flat + [ToggleUI]_ForceFlatRampedLightmap ("Force Ramped Lightmap--{condition_showS:(_LightingMode==5)}", Range(0, 1)) = 1 + //endex + //ifex _LightingMode!=7 // Cloth [NonModifiableTextureData] [NoScaleOffset] _ClothDFG ("MultiScatter Cloth DFG--{condition_showS:(_LightingMode==7)}", 2D) = "black" { } @@ -1075,7 +1135,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _ClothReflectance ("Reflectance--{condition_showS:(_LightingMode==7)}", Range(0.35, 1)) = 0.5 _ClothSmoothness ("Smoothness--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0.5 //endex - + //ifex _LightingMode!=8 // SDF [sRGBWarning]_SDFShadingTexture ("SDF--{reference_properties:[_SDFShadingTexturePan, _SDFShadingTextureUV],condition_showS:(_LightingMode==8)}", 2D) = "white" { } @@ -1085,11 +1145,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Vector3]_SDFForward ("Forward Direction--{condition_showS:(_LightingMode==8)}", Vector) = (0, 0, 1, 0) [Vector3]_SDFLeft ("Left Direction--{condition_showS:(_LightingMode==8)}", Vector) = (-1, 0, 0, 0) //endex - + // Generic _ShadowStrength ("Shadow Strength--{condition_showS:(_LightingMode<=4 || _LightingMode==8)}", Range(0, 1)) = 1 _LightingIgnoreAmbientColor ("Ignore Indirect Shadow Color--{condition_showS:(_LightingMode<=3 || _LightingMode==8)}", Range(0, 1)) = 1 - + // Additive [Space(15)] [HideInInspector] s_start_ShadingAddPass ("Add Pass (Point & Spot Lights)--{persistent_expand:true,default_expand:false}", Float) = 0 @@ -1098,20 +1158,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _LightingAdditiveGradientEnd ("Gradient End--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = .5 [HideInInspector] s_end_ShadingAddPass ("Add Pass", Float) = 0 //_LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1 //TODO-implement this - + [HideInInspector] s_start_ShadingGlobalMask ("Global Masks--{persistent_expand:true,default_expand:false}", Float) = 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)] _ShadingRampedLightMapApplyGlobalMaskIndex ("LightMap to Global Mask--{reference_property:_ShadingRampedLightMapApplyGlobalMaskBlendType}", Int) = 0 [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _ShadingRampedLightMapApplyGlobalMaskBlendType ("Blending", Int) = 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)] _ShadingRampedLightMapInverseApplyGlobalMaskIndex ("Inversed LightMap to Global Mask--{reference_property:_ShadingRampedLightMapInverseApplyGlobalMaskBlendType}", Int) = 0 [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _ShadingRampedLightMapInverseApplyGlobalMaskBlendType ("Blending", Int) = 2 [HideInInspector] s_end_ShadingGlobalMask ("Global Masks", Float) = 0 - + [HideInInspector] m_end_PoiShading ("Shading", Float) = 0 //endex - + //ifex _EnableAniso==0 - - [HideInInspector] m_start_Aniso (" Anisotropics--{reference_property:_EnableAniso}", Float) = 0 + + [HideInInspector] m_start_Aniso (" Anisotropics--{reference_property:_EnableAniso, button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/anisotropics},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(POI_ANISOTROPICS)]_EnableAniso ("Enable Aniso", Float) = 0 [sRGBWarning(true)][ThryRGBAPacker(RGB Color, A Offset, linear, false)]_AnisoColorMap ("Color & Offset--{reference_properties:[_AnisoColorMapPan, _AnisoColorMapUV]}", 2D) = "white" { } [HideInInspector][Vector2]_AnisoColorMapPan ("Panning", Vector) = (0, 0, 0, 0) @@ -1121,7 +1181,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][Vector2]_AnisoNoiseMapPan ("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)] _AnisoNoiseMapUV ("UV", Int) = 0 */ - + _AnisoReplace ("Replace Blending", Range(0, 1)) = 0 _AnisoAdd ("Add Blending", Range(0, 1)) = 1 [Space(6)] @@ -1130,7 +1190,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _AnisoUseBaseColor ("Mix Base Color", 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)] _AnisoGlobalMask ("Global Mask--{reference_property:_AnisoGlobalMaskBlendType}", Int) = 0 [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _AnisoGlobalMaskBlendType ("Blending", Int) = 2 - + [HideInInspector] s_start_AnisoTopLayer ("Top Layer--{persistent_expand:true,default_expand:true}", Float) = 1 _Aniso0Power ("Power", Range(0, 1)) = 0 _Aniso0Strength ("Strength", Range(0, 1)) = 1 @@ -1143,7 +1203,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _Aniso0Edge ("Edge--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = .5 _Aniso0Blur ("Blur--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = 0 [HideInInspector] s_end_AnisoTopLayer ("Top Layer", Float) = 1 - + [HideInInspector] s_start_AnisoBottomLayer ("Bottom Layer--{persistent_expand:true,default_expand:false}", Float) = 0 _Aniso1Power ("Power", Range(0, 1)) = .1 _Aniso1Strength ("Strength", Range(0, 1)) = 1 @@ -1156,10 +1216,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _Aniso1Edge ("Edge--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = .5 _Aniso1Blur ("Blur--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = 0 [HideInInspector] s_end_AnisoBottomLayer ("Bottom Layer", Float) = 0 - + [HideInInspector] m_end_Ansio ("Anisotropics", Float) = 0 //endex - + // First Matcap //ifex _MatcapEnable==0 [HideInInspector] m_start_matcap ("Matcap 0--{reference_property:_MatcapEnable,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/matcap},hover:Documentation}}", Float) = 0 @@ -1177,7 +1237,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _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) @@ -1188,7 +1248,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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 @@ -1197,7 +1257,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _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" { } @@ -1205,20 +1265,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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 _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 @@ -1226,12 +1287,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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 @@ -1246,7 +1307,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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 1--{reference_property:_Matcap2Enable,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/matcap},hover:Documentation}}", Float) = 0 @@ -1264,7 +1325,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _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) @@ -1275,7 +1336,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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 @@ -1284,7 +1345,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _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" { } @@ -1292,20 +1353,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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 _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 @@ -1313,12 +1375,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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 @@ -1333,7 +1395,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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 2--{reference_property:_Matcap3Enable,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/matcap},hover:Documentation}}", Float) = 0 @@ -1351,7 +1413,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _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) @@ -1362,7 +1424,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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 @@ -1371,7 +1433,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _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" { } @@ -1379,20 +1441,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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 _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 @@ -1400,12 +1463,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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 @@ -1420,7 +1483,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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 3--{reference_property:_Matcap4Enable,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/matcap},hover:Documentation}}", Float) = 0 @@ -1438,7 +1501,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _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) @@ -1449,7 +1512,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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 @@ -1458,7 +1521,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _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" { } @@ -1466,20 +1529,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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 _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 @@ -1487,12 +1551,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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 @@ -1507,7 +1571,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector] s_end_Matcap3AudioLink ("Audio Link", Float) = 0 [HideInInspector] m_end_Matcap4 ("Matcap 4", Float) = 0 //endex - + //ifex _CubeMapEnabled==0 [HideInInspector] m_start_CubeMap ("CubeMap--{reference_property:_CubeMapEnabled,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/cubemap},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(_CUBEMAP)]_CubeMapEnabled ("Enable CubeMap", Float) = 0 @@ -1520,12 +1584,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][Vector3]_CubeMapRotationPan ("Panning in Degrees", Vector) = (0, 0, 0, 0) [ThryWideEnum(Replace, 0, Multiply, 1, Add, 2)]_CubemapBlendType ("Blending", Float) = 0 _CubeMapBlendAmount ("Blend Alpha", Range(0, 1)) = 1 - + _CubeMapIntensity ("Brightness", Range(0, 5)) = 1 _CubeMapEmissionStrength ("Emission Strength", Range(0, 20)) = 0 _CubeMapSmoothness ("Smoothness", Range(0, 1)) = 1 [Enum(Vertex, 0, Pixel, 1)] _CubeMapNormal ("Normal to use", Int) = 1 - + [HideInInspector] s_start_CubeMapMasking ("Masking--{persistent_expand:true,default_expand:true}", Float) = 1 [sRGBWarning]_CubeMapMask ("Mask--{reference_properties:[_CubeMapMaskPan, _CubeMapMaskUV, _CubeMapMaskChannel, _CubeMapMaskInvert]}", 2D) = "white" { } [HideInInspector][Vector2]_CubeMapMaskPan ("Panning", Vector) = (0, 0, 0, 0) @@ -1536,7 +1600,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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)] _CubeMapMaskGlobalMask ("Global Mask--{reference_property:_CubeMapMaskGlobalMaskBlendType}", Int) = 0 [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)]_CubeMapMaskGlobalMaskBlendType ("Blending", Range(0, 1)) = 2 [HideInInspector] s_end_CubeMapMasking ("Masking", Float) = 0 - + [HideInInspector] s_start_CubeMapColorAdjust ("Color Adjust--{reference_property:_CubeMapHueShiftEnabled,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_CubeMapHueShiftEnabled ("Enabled", Float) = 0 _CubeMapHueShiftSpeed ("Hue Shift Speed", Float) = 0 @@ -1545,15 +1609,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _CubeMapContrast ("Contrast", Range(-1, 10)) = 1 _CubeMapSaturation ("Saturation", Range(-1, 10)) = 1 [HideInInspector] s_end_CubeMapColorAdjust ("", Float) = 0 - + [HideInInspector] m_end_CubeMap ("CubeMap", Float) = 0 //endex - + //ifex _EnableRimLighting==0 [HideInInspector] m_start_rimLight1Options ("Rim Lighting 0--{reference_property:_EnableRimLighting,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/rim-lighting},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0 [KeywordEnum(Poiyomi, UTS2, LilToon)] _RimStyle ("Style", Float) = 0 - + [sRGBWarning]_Set_RimLightMask ("Set_RimLightMask--{reference_properties:[_Set_RimLightMaskPan, _Set_RimLightMaskUV, _Set_RimLightMaskChannel], condition_showS:_RimStyle==1}", 2D) = "white" { } [HideInInspector][Vector2]_Set_RimLightMaskPan ("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)] _Set_RimLightMaskUV ("UV", Int) = 0 @@ -1561,10 +1625,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [sRGBWarning][ThryRGBAPacker(Mask, Bias, linear, false)]_RimMask ("Mask & Bias--{reference_properties:[_RimMaskPan, _RimMaskUV, _RimMaskChannel, _RimMaskInvert, _RimBiasIntensity], condition_showS:_RimStyle==0}", 2D) = "white" { } [HideInInspector][Vector2]_RimMaskPan ("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)] _RimMaskUV ("UV", Int) = 0 - [HideInInspector][ToggleUI]_RimMaskInvert("Invert Mask", Float) = 0 - [HideInInspector]_RimBiasIntensity("Bias Intensity", Range(0,1)) = 0 + [HideInInspector][ToggleUI]_RimMaskInvert ("Invert Mask", Float) = 0 + [HideInInspector]_RimBiasIntensity ("Bias Intensity", Range(0, 1)) = 0 [HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)]_RimMaskChannel ("Channel", Float) = 0 - + [HideInInspector] s_start_RimLight0Color ("Color & Blending--{persistent_expand:true,default_expand:true, condition_showS:_RimStyle==0||_RimStyle==1}", Float) = 1 [sRGBWarning(true)]_RimTex ("Rim Texture--{reference_properties:[_RimTexPan, _RimTexUV], condition_showS:_RimStyle==0}", 2D) = "white" { } [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0) @@ -1579,7 +1643,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _Tweak_RimLightMaskLevel ("Tweak_RimLightMaskLevel--{ condition_showS:_RimStyle==1}", Range(-1, 1)) = 0 _Is_LightColor_RimLight ("Mix Light Color--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 1 [HideInInspector] s_end_RimLight0Color ("Color & Brightness", Float) = 0 - + [HideInInspector] s_start_RimLight0ShapeControls ("Shape Controls--{persistent_expand:true,default_expand:true, condition_showS:_RimStyle==0||_RimStyle==1}", Float) = 1 _RimWidth ("Width--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0.8 _RimSharpness ("Sharpness--{ condition_showS:_RimStyle==0}", Range(0, 1)) = .25 @@ -1590,7 +1654,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _RimLight_InsideMask ("Inside Mask--{ condition_showS:_RimStyle==1}", Range(0.0001, 1)) = 0.0001 [Toggle(_)] _RimLight_FeatherOff ("Feather Off--{ condition_showS:_RimStyle==1}", Float) = 0 [HideInInspector] s_end_RimLight0ShapeControls ("Shape Controls", Float) = 0 - + [HideInInspector] s_start_RimLight0LightDirMask ("Light Direction Mask--{reference_property:_RimShadowToggle,persistent_expand:true,default_expand:false, condition_showS:_RimStyle==0}", Float) = 0 [HideInInspector][ToggleUI] _RimShadowToggle ("Light Direction Mask}", Float) = 0 [Enum(Shadow Map, 0, Custom, 1)]_RimShadowMaskRampType ("Light Falloff Type", Int) = 0 @@ -1599,7 +1663,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [MultiSlider]_RimShadowAlpha ("Hide In Shadow--{ condition_showS:_RimShadowMaskRampType==1}", Vector) = (0.0, 0.0, 0, 1) _RimShadowWidth ("Shrink In Shadow", Range(0, 1)) = 0 [HideInInspector] s_end_RimLight0LightDirMask ("Light Direction Mask", Float) = 0 - + // UTS2 [HideInInspector] s_start_RimLightDirectionMask ("Light Direction Mask--{persistent_expand:true,default_expand:false, condition_showS:_RimStyle==1}", Float) = 0 [ToggleUI] _LightDirection_MaskOn ("Light Direction Mask--{ condition_showS:_RimStyle==1}", Float) = 0 @@ -1612,8 +1676,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Toggle(_)] _Ap_RimLight_FeatherOff ("Ap Feather Off--{ condition_showS:_Add_Antipodean_RimLight==1&&_RimStyle==1}", Float) = 0 [HideInInspector] s_end_RimLightDirectionMask ("Light Direction Mask", Float) = 0 // Liltoon - [HDR][Gamma]_RimColor ("Rim Color--{condition_showS:_RimStyle==2,reference_property:_RimLightColorThemeIndex}", Color) = (0.66,0.5,0.48,1) - [sRGBWarning(true)] _RimColorTex ("Color / Mask--{condition_showS:_RimStyle==2,reference_properties:[_RimColorTexPan, _RimColorTexUV]}", 2D) = "white" {} + [HDR][Gamma]_RimColor ("Rim Color--{condition_showS:_RimStyle==2,reference_property:_RimLightColorThemeIndex}", Color) = (0.66, 0.5, 0.48, 1) + [sRGBWarning(true)] _RimColorTex ("Color / Mask--{condition_showS:_RimStyle==2,reference_properties:[_RimColorTexPan, _RimColorTexUV]}", 2D) = "white" { } [HideInInspector][Vector2] _RimColorTexPan ("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)] _RimColorTexUV ("UV", Int) = 0 _RimMainStrength ("Main Color Blend--{condition_showS:_RimStyle==2}", Range(0, 1)) = 0 @@ -1627,31 +1691,32 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _RimVRParallaxStrength ("VR Parallax Strength--{condition_showS:_RimStyle==2}", Range(0, 1)) = 1 // [ToggleUI]_RimApplyTransparency ("Apply Transparency--{condition_showS:_RimStyle==2}", Int) = 1 [ThryWideEnum(Replace, 0, Add, 1, Screen, 2, Multiply, 3)]_RimBlendMode ("Blend Mode--{condition_showS:_RimStyle==2}", Int) = 1 - + [HideInInspector] s_start_liltoon_rim_lightdir ("Light Direction--{persistent_expand:true,default_expand:false, condition_showS:_RimStyle==2}", Float) = 0 _RimDirStrength ("Light direction strength", Range(0, 1)) = 0 _RimDirRange ("Direction Light Width", Range(-1, 1)) = 0 _RimIndirRange ("Indirection Light Width", Range(-1, 1)) = 0 - [HDR][Gamma]_RimIndirColor ("Indirection Color", Color) = (1,1,1,1) + [HDR][Gamma]_RimIndirColor ("Indirection Color", Color) = (1, 1, 1, 1) _RimIndirBorder ("Indirection Border", Range(0, 1)) = 0.5 _RimIndirBlur ("Indirection Blur", Range(0, 1)) = 0.1 [HideInInspector] s_end_liltoon_rim_lightdir ("", Float) = 0 - + [HideInInspector] s_start_RimLight0HueShift ("Hue Shift--{reference_property:_RimHueShiftEnabled,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI] _RimHueShiftEnabled ("Hue Shift", Float) = 0 + [ThryWideEnum(OKLab, 0, HSV, 1)] _RimHueShiftColorSpace ("Color Space", Int) = 0 _RimHueShiftSpeed ("Shift Speed", Float) = 0 _RimHueShift ("Hue Shift", Range(0, 1)) = 0 [HideInInspector] s_end_RimLight0HueShift ("Hue Shift", Float) = 0 - + [HideInInspector] s_start_RimLight0GlobalMasking ("Alpha & Global Masking--{persistent_expand:true,default_expand:false}", Float) = 0 [ThryWideEnum(Off, 0, Add, 1, Multiply, 2)]_RimApplyAlpha ("Apply to Alpha--{ condition_showS:_Rim2Style==0}", Int) = 0 _RimApplyAlphaBlend ("Apply to Alpha Blend--{ condition_showS:_Rim2Style==0}", Range(0, 1)) = 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)] _RimGlobalMask (" Global Mask--{reference_property:_RimGlobalMaskBlendType}", Int) = 0 [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _RimGlobalMaskBlendType ("Blending", Int) = 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)] _RimApplyGlobalMaskIndex (" Apply to Global Mask--{reference_property:_RimApplyGlobalMaskBlendType,condition_showS:_RimStyle==0}", Int) = 0 - [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6 , Replace, 0)] _RimApplyGlobalMaskBlendType ("Blending", Int) = 2 + [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _RimApplyGlobalMaskBlendType ("Blending", Int) = 2 [HideInInspector] s_end_RimLight0GlobalMasking ("Alpha & Global Masking", Float) = 0 - + [HideInInspector] m_start_RimAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1&&_RimStyle==0}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkRimWidthBand ("Width Add Band", Int) = 0 [VectorLabel(Min, Max)] _AudioLinkRimWidthAdd ("Width Add", Vector) = (0, 0, 0, 0) @@ -1664,13 +1729,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector] m_end_RimAudioLink ("Audio Link", Float) = 0 [HideInInspector] m_end_rim1LightOptions ("Rim Lighting", Float) = 0 //endex - + // Second Rim Lighting //ifex _EnableRim2Lighting==0 [HideInInspector] m_start_rim2LightOptions ("Rim Lighting 1--{reference_property:_EnableRim2Lighting,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/rim-lighting},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(POI_RIM2)]_EnableRim2Lighting ("Enable Rim2 Lighting", Float) = 0 [KeywordEnum(Poiyomi, UTS2, LilToon)] _Rim2Style ("Style", Float) = 0 - + [sRGBWarning]_Set_Rim2LightMask ("Set_RimLightMask--{reference_properties:[_Set_Rim2LightMaskPan, _Set_Rim2LightMaskUV, _Set_Rim2LightMaskChannel], condition_showS:_Rim2Style==1}", 2D) = "white" { } [HideInInspector][Vector2]_Set_Rim2LightMaskPan ("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)] _Set_Rim2LightMaskUV ("UV", Int) = 0 @@ -1678,10 +1743,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [sRGBWarning][ThryRGBAPacker(Mask, Bias, linear, false)]_Rim2Mask ("Mask & Bias--{reference_properties:[_Rim2MaskPan, _Rim2MaskUV, _Rim2MaskChannel, _Rim2MaskInvert, _Rim2BiasIntensity], condition_showS:_Rim2Style==0}", 2D) = "white" { } [HideInInspector][Vector2]_Rim2MaskPan ("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)] _Rim2MaskUV ("UV", Int) = 0 - [HideInInspector][ToggleUI]_Rim2MaskInvert("Invert Mask", Float) = 0 - [HideInInspector]_Rim2BiasIntensity("Bias Intensity", Range(0,1)) = 0 + [HideInInspector][ToggleUI]_Rim2MaskInvert ("Invert Mask", Float) = 0 + [HideInInspector]_Rim2BiasIntensity ("Bias Intensity", Range(0, 1)) = 0 [HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)]_Rim2MaskChannel ("Channel", Float) = 0 - + [HideInInspector] s_start_RimLight1Color ("Color & Blending--{persistent_expand:true,default_expand:true, condition_showS:_Rim2Style==0||_Rim2Style==1}", Float) = 1 [sRGBWarning(true)]_Rim2Tex ("Rim Texture--{reference_properties:[_Rim2TexPan, _Rim2TexUV], condition_showS:_Rim2Style==0}", 2D) = "white" { } [HideInInspector][Vector2]_Rim2TexPan ("Panning", Vector) = (0, 0, 0, 0) @@ -1696,7 +1761,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _Tweak_Rim2LightMaskLevel ("Tweak_RimLightMaskLevel--{ condition_showS:_Rim2Style==1}", Range(-1, 1)) = 0 _Is_LightColor_Rim2Light ("Mix Light Color--{ condition_showS:_Rim2Style==1}", Range(0, 1)) = 1 [HideInInspector] s_end_RimLight1Color ("Color & Brightness", Float) = 0 - + [HideInInspector] s_start_RimLight1ShapeControls ("Shape Controls--{persistent_expand:true,default_expand:true, condition_showS:_Rim2Style==0||_Rim2Style==1}", Float) = 1 _Rim2Width ("Width--{ condition_showS:_Rim2Style==0}", Range(0, 1)) = 0.8 _Rim2Sharpness ("Sharpness--{ condition_showS:_Rim2Style==0}", Range(0, 1)) = .25 @@ -1707,7 +1772,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _Rim2Light_InsideMask ("Inside Mask--{ condition_showS:_Rim2Style==1}", Range(0.0001, 1)) = 0.0001 [Toggle(_)] _Rim2Light_FeatherOff ("Feather Off--{ condition_showS:_Rim2Style==1}", Float) = 0 [HideInInspector] s_end_RimLight1ShapeControls ("Shape Controls", Float) = 0 - + [HideInInspector] s_start_RimLight1LightDirMask ("Light Direction Mask--{reference_property:_Rim2ShadowToggle,persistent_expand:true,default_expand:false, condition_showS:_Rim2Style==0}", Float) = 0 [HideInInspector][ToggleUI] _Rim2ShadowToggle ("Light Direction Mask", Float) = 0 [Enum(Shadow Map, 0, Custom, 1)]_Rim2ShadowMaskRampType ("Light Falloff Type", Int) = 0 @@ -1716,7 +1781,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [MultiSlider]_Rim2ShadowAlpha ("Hide In Shadow--{ condition_showS:_Rim2ShadowMaskRampType==1}", Vector) = (0.0, 0.0, 0, 1) _Rim2ShadowWidth ("Shrink In Shadow", Range(0, 1)) = 0 [HideInInspector] s_end_RimLight1LightDirMask ("Light Direction Mask", Float) = 0 - + // UTS2 [HideInInspector] s_start_RimLight2DirectionMask ("Light Direction Mask--{persistent_expand:true,default_expand:false, condition_showS:_Rim2Style==1}", Float) = 0 [HideInInspector][ToggleUI] _LightDirection_MaskOn2 ("Light Direction Mask--{ condition_showS:_Rim2Style==1}", Float) = 0 @@ -1728,10 +1793,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _Ap_Rim2Light_Power ("Ap Power--{ condition_showS:_Add_Antipodean_Rim2Light==1&&_Rim2Style==1}", Range(0, 1)) = 0.1 [Toggle(_)] _Ap_Rim2Light_FeatherOff ("Ap Feather Off--{ condition_showS:_Add_Antipodean_Rim2Light==1&&_Rim2Style==1}", Float) = 0 [HideInInspector] s_end_RimLight2DirectionMask ("Light Direction Mask", Float) = 0 - + // Liltoon - [HDR][Gamma]_Rim2Color ("Rim Color--{condition_showS:_Rim2Style==2,reference_property:_Rim2LightColorThemeIndex}", Color) = (0.66,0.5,0.48,1) - [sRGBWarning(true)] _Rim2ColorTex ("Color / Mask--{condition_showS:_Rim2Style==2,reference_properties:[_Rim2ColorTexPan, _Rim2ColorTexUV]}", 2D) = "white" {} + [HDR][Gamma]_Rim2Color ("Rim Color--{condition_showS:_Rim2Style==2,reference_property:_Rim2LightColorThemeIndex}", Color) = (0.66, 0.5, 0.48, 1) + [sRGBWarning(true)] _Rim2ColorTex ("Color / Mask--{condition_showS:_Rim2Style==2,reference_properties:[_Rim2ColorTexPan, _Rim2ColorTexUV]}", 2D) = "white" { } [HideInInspector][Vector2] _Rim2ColorTexPan ("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)] _Rim2ColorTexUV ("UV", Int) = 0 _Rim2MainStrength ("Main Color Blend--{condition_showS:_Rim2Style==2}", Range(0, 1)) = 0 @@ -1749,26 +1814,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _Rim2DirStrength ("Light direction strength", Range(0, 1)) = 0 _Rim2DirRange ("Direction Light Width", Range(-1, 1)) = 0 _Rim2IndirRange ("Indirection Light Width", Range(-1, 1)) = 0 - [HDR][Gamma]_Rim2IndirColor ("Indirection Color", Color) = (1,1,1,1) + [HDR][Gamma]_Rim2IndirColor ("Indirection Color", Color) = (1, 1, 1, 1) _Rim2IndirBorder ("Indirection Border", Range(0, 1)) = 0.5 _Rim2IndirBlur ("Indirection Blur", Range(0, 1)) = 0.1 [HideInInspector] s_end_liltoon_rim2_lightdir ("", Float) = 0 - + [HideInInspector] s_start_RimLight1HueShift ("Hue Shift--{reference_property:_Rim2HueShiftEnabled,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI] _Rim2HueShiftEnabled ("Hue Shift", Float) = 0 + [ThryWideEnum(OKLab, 0, HSV, 1)] _Rim2HueShiftColorSpace ("Color Space", Int) = 0 _Rim2HueShiftSpeed ("Shift Speed", Float) = 0 _Rim2HueShift ("Hue Shift", Range(0, 1)) = 0 [HideInInspector] s_end_RimLight1HueShift ("Hue Shift", Float) = 0 - + [HideInInspector] s_start_RimLight1GlobalMasking ("Alpha & Global Masking--{persistent_expand:true,default_expand:false}", Float) = 0 [ThryWideEnum(Off, 0, Add, 1, Multiply, 2)]_Rim2ApplyAlpha ("Intensity to Alpha--{ condition_showS:_Rim2Style==0}", Int) = 0 _Rim2ApplyAlphaBlend ("Intensity to Alpha Blend--{ condition_showS:_Rim2Style==0}", Range(0, 1)) = 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)] _Rim2GlobalMask ("Global Mask--{reference_property:_Rim2GlobalMaskBlendType}", Int) = 0 - [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6 , Replace, 0)] _Rim2GlobalMaskBlendType ("Blending", Int) = 2 + [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _Rim2GlobalMaskBlendType ("Blending", Int) = 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)] _Rim2ApplyGlobalMaskIndex ("Apply to Global Mask--{reference_property:_Rim2ApplyGlobalMaskBlendType,condition_showS:_Rim2Style==0}", Int) = 0 - [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6 , Replace, 0)] _Rim2ApplyGlobalMaskBlendType ("Blending", Int) = 2 + [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _Rim2ApplyGlobalMaskBlendType ("Blending", Int) = 2 [HideInInspector] s_end_RimLight1GlobalMasking ("Alpha & Global Masking", Float) = 0 - + [HideInInspector] m_start_Rim2AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1&&_Rim2Style==0}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkRim2WidthBand ("Width Add Band", Int) = 0 [VectorLabel(Min, Max)] _AudioLinkRim2WidthAdd ("Width Add", Vector) = (0, 0, 0, 0) @@ -1781,19 +1847,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector] m_end_Rim2AudioLink ("Audio Link", Float) = 0 [HideInInspector] m_end_rim2LightOptions ("Rim2 Lighting", Float) = 0 //endex - + //ifex _EnableDepthRimLighting==0 [HideInInspector] m_start_depthRimLightOptions ("Depth Rim Lighting--{reference_property:_EnableDepthRimLighting,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/depth-rim-lighting},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(_POI_DEPTH_RIMLIGHT)]_EnableDepthRimLighting ("", Float) = 0 [Enum(vertex, 0, pixel, 1)] _DepthRimNormalToUse ("Normal To Use", Int) = 1 [ThryWideEnum(Two Samples, 0, Ten Samples, 1)] _DepthRimType ("Rim Type", Int) = 0 - + [HideInInspector] s_start_FixedRimShapeControl ("Shape Control--{persistent_expand:true,default_expand:true}", Float) = 1 _DepthRimWidth ("Width", Range(0, 1)) = .2 _DepthRimSharpness ("Depth", Range(0, 1)) = .2 [ToggleUI]_DepthRimHideInShadow ("Hide In Shadow", Float) = 0 [HideInInspector] s_end_FixedRimShapeControl ("Shape Control", Float) = 0 - + [HideInInspector] s_start_FixedRimColor ("Color--{persistent_expand:true,default_expand:true}", Float) = 1 _DepthRimMixBaseColor ("Use Base Color", Range(0, 1)) = 0 _DepthRimMixLightColor ("Light Color Mix", Range(0, 1)) = 0 @@ -1810,11 +1876,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector] s_end_FixedRimBlending ("Blending", Float) = 0 [HideInInspector] m_end_depthRimLightOptions ("Rim Lighting", Float) = 0 //endex - + //ifex _SubsurfaceScattering==0 [HideInInspector] m_start_subsurfaceScattering ("Subsurface Scattering--{reference_property:_SubsurfaceScattering}}", Float) = 0 [HideInInspector][ThryToggle(POI_SUBSURFACESCATTERING)]_SubsurfaceScattering ("Enable", Float) = 0 - + _SSSColor ("Subsurface Color", Color) = (1, 0, 0, 1) [sRGBWarning(true)][ThryRGBAPacker(RGB Color, A Thickness, linear, false)]_SSSThicknessMap ("Color & Thickness--{reference_properties:[_SSSThicknessMapPan, _SSSThicknessMapUV, _SSSThicknessMapChannel]}", 2D) = "white" { } [HideInInspector][Vector2]_SSSThicknessMapPan ("Panning", Vector) = (0, 0, 0, 0) @@ -1825,10 +1891,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _SSSSpread ("Light Spread", Range(1, 100)) = 5 _SSSDistortion ("Light Distortion", Range(0, 1)) = 1 _SSSBaseColorMix ("Base Color Mix", Range(0, 1)) = 0 - + [HideInInspector] m_end_subsurfaceScattering ("", Float) = 0 //endex - + //ifex _MochieBRDF==0 [HideInInspector] m_start_brdf ("Reflections & Specular--{reference_property:_MochieBRDF,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/reflections-and-specular},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(MOCHIE_PBR)]_MochieBRDF ("Enable", Float) = 0 @@ -1838,8 +1904,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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)] _MochieReflectionTintThemeIndex ("", Int) = 0 _MochieSpecularTint ("Specular Tint--{reference_property:_MochieSpecularTintThemeIndex}", 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)] _MochieSpecularTintThemeIndex ("", Int) = 0 - - [sRGBWarning][ThryRGBAPacker(R Metallic Map, G Smoothness Map, B Reflection Mask, A Specular Mask, linear, false)]_MochieMetallicMaps ("Packed Maps [Expand]--{reference_properties:[_MochieMetallicMapsPan, _MochieMetallicMapsUV, _MochieMetallicMapsStochastic, _MochieMetallicMapsMetallicChannel, _MochieMetallicMapsRoughnessChannel, _MochieMetallicMapsReflectionMaskChannel, _MochieMetallicMapsSpecularMaskChannel, _MochieMetallicMapInvert, _MochieRoughnessMapInvert, _MochieReflectionMaskInvert, _MochieSpecularMaskInvert]}", 2D) = "white" { } + + [sRGBWarning][ThryRGBAPacker(R Metallic Map, G Smoothness Map, B Reflection Mask, A Specular Mask, linear, false)]_MochieMetallicMaps ("Packed Maps [Click to Expand]--{reference_properties:[_MochieMetallicMapsPan, _MochieMetallicMapsUV, _MochieMetallicMapsStochastic, _MochieMetallicMapsMetallicChannel, _MochieMetallicMapsRoughnessChannel, _MochieMetallicMapsReflectionMaskChannel, _MochieMetallicMapsSpecularMaskChannel, _MochieMetallicMapInvert, _MochieRoughnessMapInvert, _MochieReflectionMaskInvert, _MochieSpecularMaskInvert]}", 2D) = "white" { } [HideInInspector][Vector2]_MochieMetallicMapsPan ("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)]_MochieMetallicMapsUV ("UV", Int) = 0 [HideInInspector][ToggleUI]_MochieMetallicMapsStochastic ("Stochastic Sampling", Float) = 0 @@ -1862,13 +1928,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _BRDFTPSReflectionMaskStrength ("Reflection Mask Strength--{condition_showS:(_BRDFTPSDepthEnabled==1)}", Range(0, 1)) = 1 _BRDFTPSSpecularMaskStrength ("Specular Mask Strength--{condition_showS:(_BRDFTPSDepthEnabled==1)}", Range(0, 1)) = 1 [HideInInspector] s_end_BRDFTPSMaskGroup ("", Float) = 0 - + [HideInInspector] s_start_PBRSecondSpecular ("2nd Specular--{reference_property:_Specular2ndLayer,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_Specular2ndLayer ("2nd Specular", Float) = 0 _MochieSpecularStrength2 ("Visibility", Range(0, 5)) = 1 _MochieRoughnessMultiplier2 ("Smoothness", Range(0, 1)) = 1 [HideInInspector] s_end_PBRSecondSpecular ("Name", Float) = 0 - + [HideInInspector] s_start_PBRSplitMaskSample ("Split Mask Sampling--{reference_property:_PBRSplitMaskSample,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_PBRSplitMaskSample ("Split Mask Sampling", Float) = 0 [VectorLabel(tX, tY, oX, oY)]_PBRMaskScaleTiling ("Tiling/Offset", Vector) = (1, 1, 0, 0) @@ -1876,7 +1942,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ToggleUI]_PBRSplitMaskStochastic ("Stochastic Sampling", Float) = 0 [Vector2]_MochieMetallicMasksPan ("Panning", Vector) = (0, 0, 0, 0) [HideInInspector] s_end_PBRSplitMaskSample ("Split Mask Sampling", Float) = 0 - + [HideInInspector] s_start_brdfadvanced ("GSAA & Advanced Controls--{persistent_expand:true,default_expand:false}", Float) = 0 [ToggleUI]_MochieLitFallback ("Lit Fallback", Float) = 1 [ToggleUI]_IgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0 @@ -1895,10 +1961,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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)] _MochieSpecularStrengthGlobalMask ("Specular Strength--{reference_property:_MochieSpecularStrengthGlobalMaskBlendType}", Int) = 0 [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _MochieSpecularStrengthGlobalMaskBlendType ("Blending", Int) = 2 [HideInInspector] s_end_brdfadvanced ("", Float) = 0 - + [HideInInspector] m_end_brdf ("", Float) = 0 //endex - + //ifex _ClearCoatBRDF==0 [HideInInspector] m_start_clearCoat ("Clear Coat--{reference_property:_ClearCoatBRDF,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/clear-coat},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(POI_CLEARCOAT)]_ClearCoatBRDF ("Enable", Float) = 0 @@ -1911,7 +1977,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _ClearCoatSpecularTint ("Specular Tint--{reference_property:_ClearCoatSpecularTintThemeIndex}", 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)] _ClearCoatSpecularTintThemeIndex ("", Int) = 0 [Space(8)] - [sRGBWarning][ThryRGBAPacker(ClearCoat Mask, Smoothness Map, Reflection Mask, Specular Mask, linear, false)]_ClearCoatMaps ("Packed Maps [Expand]--{reference_properties:[_ClearCoatMapsPan, _ClearCoatMapsUV, _ClearCoatMapsStochastic, _ClearCoatMapsClearCoatMaskChannel, _ClearCoatMapsRoughnessChannel, _ClearCoatMapsReflectionMaskChannel, _ClearCoatMapsSpecularMaskChannel, _ClearCoatMaskInvert, _ClearCoatSmoothnessMapInvert, _ClearCoatReflectionMaskInvert, _ClearCoatSpecularMaskInvert]}", 2D) = "white" { } + [sRGBWarning][ThryRGBAPacker(ClearCoat Mask, Smoothness Map, Reflection Mask, Specular Mask, linear, false)]_ClearCoatMaps ("Packed Maps [Click to Expand]--{reference_properties:[_ClearCoatMapsPan, _ClearCoatMapsUV, _ClearCoatMapsStochastic, _ClearCoatMapsClearCoatMaskChannel, _ClearCoatMapsRoughnessChannel, _ClearCoatMapsReflectionMaskChannel, _ClearCoatMapsSpecularMaskChannel, _ClearCoatMaskInvert, _ClearCoatSmoothnessMapInvert, _ClearCoatReflectionMaskInvert, _ClearCoatSpecularMaskInvert]}", 2D) = "white" { } [HideInInspector][Vector2]_ClearCoatMapsPan ("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)]_ClearCoatMapsUV ("UV", Int) = 0 [HideInInspector][ToggleUI]_ClearCoatMapsStochastic ("Stochastic Sampling", Float) = 0 @@ -1926,7 +1992,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Space(4)] [ThryTexture][NoScaleOffset]_ClearCoatFallback ("Fallback Cubemap", Cube) = "" { } [ToggleUI]_ClearCoatForceFallback ("Force Fallback", Int) = 0 - + [HideInInspector] m_start_clearcoatadvanced ("Advanced", Float) = 0 [ToggleUI]_ClearCoatLitFallback ("Lit Fallback", Float) = 1 [ToggleUI]_CCIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0 @@ -1935,14 +2001,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryToggleUI(true)]_ClearCoatGSAAEnabled (" GSAA", Float) = 1 _ClearCoatGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15 _ClearCoatGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1 - + [HideInInspector] s_start_ClearCoatTPSMaskGroup ("TPS Mask--{reference_property:_ClearCoatTPSDepthMaskEnabled, persistent_expand:true,default_expand:false,condition_showS:(_TPSPenetratorEnabled==1)}", Float) = 0 [HideInInspector][ToggleUI] _ClearCoatTPSDepthMaskEnabled ("TPS Depth Enabled", Float) = 0 _ClearCoatTPSMaskStrength ("Mask Strength}", Range(0, 1)) = 1 [HideInInspector] s_end_ClearCoatTPSMaskGroup ("", Float) = 0 - + [HideInInspector] m_end_clearcoatadvanced ("", Float) = 0 - + [HideInInspector] m_start_clearcoatglobalmask ("Global Mask", Float) = 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)] _ClearCoatGlobalMask ("ClearCoat--{reference_property:_ClearCoatGlobalMaskBlendType}", Int) = 0 [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _ClearCoatGlobalMaskBlendType ("Blending", Int) = 2 @@ -1953,10 +2019,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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)] _ClearCoatSpecularStrengthGlobalMask ("Specular Strength--{reference_property:_ClearCoatSpecularStrengthGlobalMaskBlendType}", Int) = 0 [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _ClearCoatSpecularStrengthGlobalMaskBlendType ("Blending", Int) = 2 [HideInInspector] m_end_clearcoatglobalmask ("", Float) = 0 - + [HideInInspector] m_end_clearCoat ("", Float) = 0 //endex - + //ifex _EnableEnvironmentalRim==0 [HideInInspector] m_start_reflectionRim ("Environmental Rim--{reference_property:_EnableEnvironmentalRim,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/environmental-rim},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(POI_ENVIRORIM)]_EnableEnvironmentalRim ("Enable", Float) = 0 @@ -1971,38 +2037,39 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1 [HideInInspector] m_end_reflectionRim ("", Float) = 0 //endex - + //ifex _StylizedSpecular==0 [HideInInspector] m_start_stylizedSpec (" Stylized Specular--{reference_property:_StylizedSpecular,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/stylized-specular},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(POI_STYLIZED_StylizedSpecular)]_StylizedSpecular ("Enable", Float) = 0 - + [sRGBWarning(true)][ThryTexture]_HighColor_Tex ("Specular Map--{reference_properties:[_HighColor_TexPan, _HighColor_TexUV]}", 2D) = "white" { } [HideInInspector][Vector2]_HighColor_TexPan ("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)]_HighColor_TexUV ("UV", Int) = 0 _HighColor ("Tint--{reference_property:_HighColorThemeIndex}", 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)] _HighColorThemeIndex ("", Int) = 0 - [sRGBWarning]_Set_HighColorMask ("Mask--{reference_properties:[_Set_HighColorMaskPan, _Set_HighColorMaskUV, _Set_HighColorMaskChannel, _Tweak_HighColorMaskLevel]}", 2D) = "white" { } + [sRGBWarning]_Set_HighColorMask ("Mask--{reference_properties:[_Set_HighColorMaskPan, _Set_HighColorMaskUV, _Set_HighColorMaskChannel, _Tweak_HighColorMaskLevel, _StylizedSpecularInvertMask]}", 2D) = "white" { } [HideInInspector][Vector2]_Set_HighColorMaskPan ("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)]_Set_HighColorMaskUV ("UV", Int) = 0 [HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)]_Set_HighColorMaskChannel ("Channel", Float) = 1 [HideInInspector]_Tweak_HighColorMaskLevel ("Mask Level", Range(-1, 1)) = 0 + [HideInInspector][ToggleUI]_StylizedSpecularInvertMask ("Invert Mask", Float) = 0 [ThryWideEnum(Toon, 0, Realistic, 1)]_Is_SpecularToHighColor ("Specular Mode", Float) = 0 [ThryWideEnum(Replace, 0, Add, 1, Screen, 2, Multiply, 3)]_Is_BlendAddToHiColor ("Color Blend Mode", Int) = 0 _StylizedSpecularStrength ("Strength", Float) = 1 [ToggleUI] _UseLightColor ("Use Light Color", Float) = 1 - + [HideInInspector] s_start_StylizedSpecularLayer0 ("Layer 1--{persistent_expand:true,default_expand:true}", Float) = 1 _HighColor_Power ("Size", Range(0, 1)) = 0.2 _StylizedSpecularFeather ("Feather--{condition_showS:(_Is_SpecularToHighColor==0)}", Range(0, 1)) = 0 _Layer1Strength ("Strength", Range(0, 1)) = 1 [HideInInspector] s_end_StylizedSpecularLayer0 ("Layer 1", Float) = 0 - + [HideInInspector] s_start_StylizedSpecularLayer1 ("Layer 2--{persistent_expand:true,default_expand:true}", Float) = 1 _Layer2Size ("Size", Range(0, 1)) = 0 _StylizedSpecular2Feather ("Feather--{condition_showS:(_Is_SpecularToHighColor==0)}", Range(0, 1)) = 0 _Layer2Strength ("Strength", Range(0, 1)) = 0 [HideInInspector] s_end_StylizedSpecularLayer1 ("Layer 2", Float) = 0 - + [HideInInspector] s_start_StylizedSpecularAdvanced ("Advanced--{persistent_expand:true,default_expand:false}", Float) = 0 [ToggleUI] _StylizedSpecularIgnoreNormal ("Ignore Normal", Float) = 0 [ToggleUI] _StylizedSpecularIgnoreShadow ("Ignore Shadow", Float) = 0 @@ -2010,9 +2077,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector] s_end_StylizedSpecularAdvanced ("Advanced", Float) = 0 [HideInInspector] m_end_stylizedSpec ("", Float) = 0 //endex - + //ifex _BacklightEnabled!=1 - [HideInInspector] m_start_backlight ("Backlight--{reference_property:_BacklightEnabled}", Float) = 0 + [HideInInspector] m_start_backlight ("Backlight--{reference_property:_BacklightEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/backlight},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(POI_BACKLIGHT)]_BacklightEnabled ("Backlight Enabled", Float) = 0 [HDR][Gamma] _BacklightColor ("Color", Color) = (0.85, 0.8, 0.7, 1.0) [sRGBWarning(true)] _BacklightColorTex ("Texture--{reference_properties:[_BacklightColorTexPan, _BacklightColorTexUV]}", 2D) = "white" { } @@ -2028,9 +2095,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ToggleUI] _BacklightBackfaceMask ("Backface Mask", Int) = 1 [HideInInspector] m_end_backlight ("Backlight", Float) = 0 //endex - + //ifex _LTCGIEnabled!=1 - [HideInInspector] m_start_LTCGI ("LTCGI (REWORK SOON)--{reference_property:_LTCGIEnabled}", Float) = 0 + [HideInInspector] m_start_LTCGI ("LTCGI (REWORK SOON)--{reference_property:_LTCGIEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/shading/ltcgi},hover:Documentation}}", Float) = 0 [HideInInspector] [ThryToggle(POI_LTCGI)]_LTCGIEnabled ("LTCGI Enabled", Float) = 0 [Helpbox(1)] _LTCGI_Attribution ("This section uses LTCGI by _pi_, click for 'github.com/pimaker/ltcgi'--{onClick:{type:URL,data:https://github.com/pimaker/ltcgi}}", Float) = 0 [ToggleUI] _LTCGI_AnimToggle ("Anim Toggle", Int) = 1 @@ -2043,21 +2110,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _LTCGI_Metallic ("Metallic--{condition_showS:(_LTCGI_UsePBR==0 || _MochieBRDF==0)}", Range(0, 1)) = 0.0 [HideInInspector] m_end_LTCGI ("LTCGI", Float) = 0 //endex - + [HideInInspector] m_OutlineCategory (" Outlines--{reference_property:_EnableOutlines,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/outlines/main},hover:Documentation}}", Float) = 0 //ifex _EnableOutlines!=1 // Outline Vertex [HideInInspector][ToggleUI]_EnableOutlines ("Enable Outlines", float) = 0 [Enum(Basic, 1, Rim Light, 2, Directional, 3, DropShadow, 4)]_OutlineExpansionMode ("Mode", Int) = 1 [Enum(Local, 0, World, 1)]_OutlineSpace ("Space", Int) = 0 - + _LineWidth ("Outline Size", Float) = 1 [sRGBWarning]_OutlineMask ("Outline Size Mask--{reference_properties:[_OutlineMaskPan, _OutlineMaskUV, _OutlineMaskChannel]}", 2D) = "white" { } [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)] _LineColorThemeIndex ("", Int) = 0 [HideInInspector][Vector2]_OutlineMaskPan ("Panning", Vector) = (0, 0, 0, 0) [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _OutlineMaskUV ("UV", Int) = 0 [HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)]_OutlineMaskChannel ("Channel", Float) = 0 - + [sRGBWarning(true)]_OutlineTexture ("Outline Texture--{reference_properties:[_OutlineTexturePan, _OutlineTextureUV]}", 2D) = "white" { } [HideInInspector][Vector2]_OutlineTexturePan ("Outline Texture Pan", 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)] _OutlineTextureUV ("UV", Int) = 0 @@ -2068,13 +2135,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _OutlineEmission ("Outline Emission", Range(0, 20)) = 0 _OutlineTintMix ("MainTex blend", Range(0, 1)) = 0 [ToggleUI]_PoiUTSStyleOutlineBlend ("UTS2 style Blend", Float) = 0 - + [HideInInspector] s_start_OutlineColorAdjust ("Color Adjust--{reference_property:_OutlineHueShift,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ThryToggleUI(true)]_OutlineHueShift ("Color Adjust", Float) = 0 [VectorToSliders(Hue, 0, 1, Saturation, 0, 2, Value, 0, 2, Gamma, 0.01, 2)]_OutlineTexHSVG ("HSVG", Vector) = (0, 1, 1, 1) _OutlineHueOffsetSpeed ("Shift Speed", Float) = 0 [HideInInspector] s_end_OutlineColorAdjust ("Color Adjust", Float) = 0 - + [HideInInspector] s_start_OutlineAlphaDistanceFade ("Distance Alpha--{reference_property:_OutlineAlphaDistanceFade,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ThryToggleUI(true)] _OutlineAlphaDistanceFade ("Distance Alpha", Float) = 0 [Enum(Object Position, 0, Pixel Position, 1)] _OutlineAlphaDistanceFadeType ("Pos To Use", Int) = 1 @@ -2083,49 +2150,50 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _OutlineAlphaDistanceFadeMin ("Min Distance", Float) = 0 _OutlineAlphaDistanceFadeMax ("Max Distance", Float) = 0 [HideInInspector] s_end_OutlineAlphaDistanceFade ("Distance Alpha", Float) = 0 - + [HideInInspector] s_start_OutlineFixedSize ("Fixed Size Over Distance--{reference_property:_OutlineFixedSize,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ThryToggleUI(true)]_OutlineFixedSize ("Fixed Size", Float) = 1 _OutlineFixWidth ("Fixed Width ", Range(0, 1)) = .5 _OutlinesMaxDistance ("Fixed Size Max Distance", Float) = 1 [HideInInspector] s_end_OutlineFixedSize ("Color Adjust", Float) = 0 - + [HideInInspector] s_start_OutlineLighting ("Lighting--{reference_property:_OutlineLit,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_OutlineLit ("Enable Lighting", Float) = 1 _OutlineShadowStrength ("Shadow Strength", Range(0, 1)) = 0 [HideInInspector] s_end_OutlineLighting ("Lighting", Float) = 0 - + [HideInInspector] s_start_VertexColors ("Vertex Colors--{persistent_expand:true,default_expand:false}", Float) = 0 [ToggleUI]_OutlineUseVertexColorNormals ("Vertex Color Normals", Float) = 0 [Enum(Off, 0, R, 1, G, 2, B, 3, A, 4)]_OutlineVertexColorMask ("Vertex Color Mask", Float) = 0 _OutlineVertexColorMaskStrength ("VC Mask Strength--{condition_showS:(_OutlineVertexColorMask!=0)}", Range(0, 1)) = 1 [HideInInspector] s_end_VertexColors ("Vertex Colors", Float) = 0 - + [HideInInspector] s_start_OutlineRenderingOptions ("Rendering Options--{persistent_expand:true,default_expand:false}", Float) = 0 [ToggleUI]_OutlineClipAtZeroWidth ("Clip 0 Width", Float) = 0 [ToggleUI]_OutlineOverrideAlpha ("Override Base Alpha", Float) = 0 _Offset_Z ("Cam Z Offset", Float) = 0 [Enum(UnityEngine.Rendering.CullMode)] _OutlineCull ("Cull", Float) = 1 + [Enum(Off, 0, On, 1)] _OutlineZWrite ("ZWrite", Int) = 1 [Enum(UnityEngine.Rendering.CompareFunction)] _OutlineZTest ("ZTest", Float) = 4 [HideInInspector] s_end_OutlineRenderingOptions ("Rendering Options", Float) = 0 - + [HideInInspector] m_start_OutlineAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkOutlineSizeBand ("Size Band", Int) = 0 [VectorLabel(Min, Max)]_AudioLinkOutlineSize ("Size Mod", Vector) = (0, 0, 0, 0) [Space(7)] [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkOutlineEmissionBand ("Emission Band", Int) = 0 [VectorLabel(Min, Max)]_AudioLinkOutlineEmission ("Emission Mod", Vector) = (0, 0, 0, 0) - + [HideInInspector] s_start_outline_al_color ("Color--{reference_property:_OutlineALColorEnabled,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_OutlineALColorEnabled ("Enable", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkOutlineColorBand ("Band", Int) = 0 [VectorLabel(Min, Max)]_AudioLinkOutlineColorMod ("Replace", Vector) = (0, 1, 0, 0) _AudioLinkOutlineColor ("Color", Color) = (1, 1, 1, 1) [HideInInspector] s_end_outline_al_color ("Color--{draw_border:true}", Float) = 0 - + [HideInInspector] m_end_OutlineAudioLink ("Audio Link", Float) = 0 //endex - + [HideInInspector] m_specialFXCategory ("Special FX", Float) = 0 //ifex _EnableUDIMDiscardOptions==0 // SPECIALFX_PROPERTIES @@ -2135,30 +2203,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Helpbox(1)]_UDIMDiscardHelpbox ("UV Tile Discard requires special model setup. Place object UVs on different UV Tiles.", Int) = 0 [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)]_UDIMDiscardUV ("Discard UV", Int) = 0 [Enum(Vertex (Faster), 0, Pixel (Slower), 1)] _UDIMDiscardMode ("Discard Mode", Int) = 0 - + [ThryMultiFloats(true, _UDIMDiscardRow3_1, _UDIMDiscardRow3_2, _UDIMDiscardRow3_3)] _UDIMDiscardRow3_0("v = 3", Float) = 0 [HideInInspector] _UDIMDiscardRow3_1("", Float) = 0 [HideInInspector] _UDIMDiscardRow3_2("", Float) = 0 [HideInInspector] _UDIMDiscardRow3_3("", Float) = 0 - + [ThryMultiFloats(true, _UDIMDiscardRow2_1, _UDIMDiscardRow2_2, _UDIMDiscardRow2_3)] _UDIMDiscardRow2_0("v = 2", Float) = 0 [HideInInspector] _UDIMDiscardRow2_1("", Float) = 0 [HideInInspector] _UDIMDiscardRow2_2("", Float) = 0 [HideInInspector] _UDIMDiscardRow2_3("", Float) = 0 - + [ThryMultiFloats(true, _UDIMDiscardRow1_1, _UDIMDiscardRow1_2, _UDIMDiscardRow1_3)] _UDIMDiscardRow1_0("v = 1", Float) = 0 [HideInInspector] _UDIMDiscardRow1_1("", Float) = 0 [HideInInspector] _UDIMDiscardRow1_2("", Float) = 0 [HideInInspector] _UDIMDiscardRow1_3("", Float) = 0 - + [ThryMultiFloats(true, _UDIMDiscardRow0_1, _UDIMDiscardRow0_2, _UDIMDiscardRow0_3)] _UDIMDiscardRow0_0("v = 0", Float) = 0 [HideInInspector] _UDIMDiscardRow0_1("", Float) = 0 [HideInInspector] _UDIMDiscardRow0_2("", Float) = 0 [HideInInspector] _UDIMDiscardRow0_3("", Float) = 0 - + [HideInInspector] m_end_udimdiscardOptions ("UV Tile Discard", Float) = 0 //endex - + //ifex _EnableDepthBulge==0 [HideInInspector] m_start_DepthBulge ("Depth Bulge--{reference_property:_EnableDepthBulge}", Float) = 0 [HideInInspector][ThryToggle(POI_DEPTHBULGE)] _EnableDepthBulge ("Bulge", Float) = 0 @@ -2170,7 +2238,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _DepthBulgeHeight ("Bulge Height", Range(-0.2, 0.2)) = 0.02 [HideInInspector] m_end_DepthBulge ("Depth Bulge", Float) = 0 //endex - + //ifex _EnableDissolve==0 [HideInInspector] m_start_dissolve ("Dissolve--{reference_property:_EnableDissolve,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/special-fx/dissolve},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0 @@ -2210,7 +2278,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Enum(Off, 0, Red, 1, Green, 2, Blue, 3, Alpha, 4)]_DissolveUseVertexColors ("VertexColor Mask", Int) = 0 [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert", Float) = 0 _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0 - + [Space(10)] [ThryToggleUI(true)] _EnableDissolveAudioLink (" Audio Link--{ condition_showS:_EnableAudioLink==1}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDissolveAlphaBand ("Dissolve Alpha Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0 @@ -2218,7 +2286,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Space(7)] [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkDissolveDetailBand ("Dissolve Detail Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0 [VectorLabel(Min, Max)]_AudioLinkDissolveDetail ("Dissolve Detail Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0) - + // Spherical Dissolve [HideInInspector] m_start_SphericalDissolve ("Spherical--{condition_showS:(_DissolveType==3)}", Float) = 0 [Vector3] _SphericalDissolveCenter ("Center Point", Vector) = (0, 0, 0) @@ -2226,7 +2294,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ToggleUI] _SphericalDissolveInvert ("Invert", Float) = 0 [ToggleUI] _SphericalDissolveClamp ("Clamp Dissolve", Float) = 0 [HideInInspector] m_end_SphericalDissolve ("Spherical", Float) = 0 - + // Point to Point Dissolve [HideInInspector] m_start_pointToPoint ("Point to Point--{condition_showS:(_DissolveType==2)}", Float) = 0 [Enum(Local, 0, World, 1, Vertex Colors, 2)] _DissolveP2PWorldLocal ("World/Local", Int) = 0 @@ -2235,7 +2303,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0) [ToggleUI]_DissolveP2PClamp ("Clamp Dissolve", Float) = 0 [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0 - + // CenterOut Dissolve [HideInInspector] m_start_CenterOutDissolve ("CenterOut--{condition_showS:(_DissolveType==4)}", Float) = 0 [Enum(View Direction, 1, Custom Direction, 2, Light Direction, 3)] _CenterOutDissolveMode ("CenterOut Mode", Int) = 1 @@ -2244,16 +2312,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _CenterOutDissolveNormals ("Use Pixel Normals", Range(0, 1)) = 0 _CenterOutDissolvePower ("Power", Range(.1, 5)) = 1 [HideInInspector] m_end_CenterOutDissolve ("CenterOut", Float) = 0 - + [HideInInspector] m_start_dissolveHueShift ("Hue Shift--{reference_property:_DissolveHueShiftEnabled}", Float) = 0 [HideInInspector][ToggleUI]_DissolveHueShiftEnabled ("Dissolved Enabled", Float) = 0 + [ThryWideEnum(OKLab, 0, HSV, 1)] _DissolveHueShiftColorSpace ("Color Space", Int) = 0 _DissolveHueShiftSpeed ("Dissolved Speed", Float) = 0 _DissolveHueShift ("Dissolved Shift", Range(0, 1)) = 0 + [ToggleUI]_DissolveEdgeHueShiftEnabled ("Edge Enabled", Float) = 0 + [ThryWideEnum(OKLab, 0, HSV, 1)] _DissolveEdgeHueShiftColorSpace ("Color Space", Int) = 0 _DissolveEdgeHueShiftSpeed ("Edge Speed", Float) = 0 _DissolveEdgeHueShift ("Edge Shift", Range(0, 1)) = 0 [HideInInspector] m_end_dissolveHueShift ("Hue Shift", Float) = 0 - + [HideInInspector] m_start_UVTileDissolve ("UV Tile Dissolve--{reference_property:_UVTileDissolveEnabled}", Float) = 0 [HideInInspector][ToggleUI]_UVTileDissolveEnabled ("Enabled", Float) = 0 [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)]_UVTileDissolveUV ("UV Tile UV", Int) = 0 @@ -2264,21 +2335,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _UVTileDissolveAlpha_Row3_2 ("Row 3 Column 2", Range(-1, 1)) = 0 _UVTileDissolveAlpha_Row3_3 ("Row 3 Column 3", Range(-1, 1)) = 0 [HideInInspector] m_end_UVTileDissolveRow3 ("Row 3", Float) = 0 - + [HideInInspector] m_start_UVTileDissolveRow2 ("Row 2 Alpha", Float) = 0 _UVTileDissolveAlpha_Row2_0 ("Row 2 Column 0", Range(-1, 1)) = 0 _UVTileDissolveAlpha_Row2_1 ("Row 2 Column 1", Range(-1, 1)) = 0 _UVTileDissolveAlpha_Row2_2 ("Row 2 Column 2", Range(-1, 1)) = 0 _UVTileDissolveAlpha_Row2_3 ("Row 2 Column 3", Range(-1, 1)) = 0 [HideInInspector] m_end_UVTileDissolveRow2 ("Row 2", Float) = 0 - + [HideInInspector] m_start_UVTileDissolveRow1 ("Row 1 Alpha", Float) = 0 _UVTileDissolveAlpha_Row1_0 ("Row 1 Column 0", Range(-1, 1)) = 0 _UVTileDissolveAlpha_Row1_1 ("Row 1 Column 1", Range(-1, 1)) = 0 _UVTileDissolveAlpha_Row1_2 ("Row 1 Column 2", Range(-1, 1)) = 0 _UVTileDissolveAlpha_Row1_3 ("Row 1 Column 3", Range(-1, 1)) = 0 [HideInInspector] m_end_UVTileDissolveRow1 ("Row 1", Float) = 0 - + [HideInInspector] m_start_UVTileDissolveRow0 ("Row 0 Alpha", Float) = 0 _UVTileDissolveAlpha_Row0_0 ("Row 0 Column 0", Range(-1, 1)) = 0 _UVTileDissolveAlpha_Row0_1 ("Row 0 Column 1", Range(-1, 1)) = 0 @@ -2286,7 +2357,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _UVTileDissolveAlpha_Row0_3 ("Row 0 Column 3", Range(-1, 1)) = 0 [HideInInspector] m_end_UVTileDissolveRow0 ("Row 0", Float) = 0 [HideInInspector] m_end_UVTileDissolve ("UV Tile Dissolve", Float) = 0 - + // Locked in anim sldiers [HideInInspector] m_start_BonusSliders ("Locked In Anim Sliders", Float) = 0 _DissolveAlpha0 ("Dissolve Alpha 0", Range(-1, 1)) = 0 @@ -2302,11 +2373,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector] m_end_BonusSliders ("Locked In Sliders", Float) = 0 [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0 //endex - + //ifex _EnableFlipbook==0 - [HideInInspector] m_start_flipBook ("Flipbook--{reference_property:_EnableFlipbook,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/special-fx/flipbook},hover:Documentation}}", Float) = 0 + [HideInInspector] m_start_flipBook ("Flipbook 0--{reference_property:_EnableFlipbook,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/special-fx/flipbook},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0 - + _FlipbookColor ("Color & alpha--{reference_property:_FlipbookColorThemeIndex}", 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)] _FlipbookColorThemeIndex ("", Int) = 0 [TextureArray]_FlipbookTexArray ("Texture Array--{reference_properties:[_FlipbookTexArrayPan, _FlipbookTexArrayUV, _FlipbookTiled, _FlipbookColorReplaces]}", 2DArray) = "" { } @@ -2325,41 +2396,42 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0 _FlipbookFPS ("FPS", Float) = 30.0 _FlipbookFrameOffset("Frame Offset", Float) = 0 - + [HideInInspector] s_start_Positioning ("Positioning--{persistent_expand:true,default_expand:true}", Float) = 1 [VectorLabel(sX, sY, oX, oY)]_FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0) [VectorLabel(L, R, D, U)]_FlipbookSideOffset ("Side Offset", Vector) = (0, 0, 0, 0) _FlipbookRotation ("Rotation", Range(0, 360)) = 0 _FlipbookRotationSpeed ("Rotation Speed", Float) = 0 [HideInInspector] s_end_Positioning ("", Float) = 0 - + [HideInInspector] s_start_FlipbookManualFrameControl ("Manual Frame Control--{reference_property:_FlipbookManualFrameControl,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ThryToggleUI(true)]_FlipbookManualFrameControl ("Manual Frame Control", Float) = 0 _FlipbookCurrentFrame ("Current Frame", Float) = 0 [HideInInspector] s_end_FlipbookManualFrameControl ("", Float) = 0 - + [HideInInspector] s_start_FlipbookStartAndEnd ("Start/End Frame Loop--{reference_property:_FlipbookStartAndEnd,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ThryToggleUI(true)]_FlipbookStartAndEnd ("Start and End Frames", Float) = 0 _FlipbookStartFrame ("Start Frame", Float) = 0 _FlipbookEndFrame ("End Frame", Float) = 0 [HideInInspector] s_end_FlipbookStartAndEnd ("", Float) = 0 - + [HideInInspector] s_start_FlipbookCrossfade ("Frame Crossfade--{reference_property:_FlipbookCrossfadeEnabled,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ThryToggleUI(true)]_FlipbookCrossfadeEnabled ("Crossfade", Float) = 0 [MultiSlider]_FlipbookCrossfadeRange ("Fade Range", Vector) = (0.75, 1, 0, 1) [HideInInspector] s_end_FlipbookCrossfade ("", Float) = 0 - + [HideInInspector] s_start_FlipbookHueShift ("Hue Shift--{reference_property:_FlipbookHueShiftEnabled,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ThryToggleUI(true)]_FlipbookHueShiftEnabled ("Hue Shift", Float) = 0 + [ThryWideEnum(OKLab, 0, HSV, 1)] _FlipbookHueShiftColorSpace ("Color Space", Int) = 0 _FlipbookHueShiftSpeed ("Shift Speed", Float) = 0 _FlipbookHueShift ("", Range(0, 1)) = 0 [HideInInspector] s_end_FlipbookHueShift ("Hue Shift", Float) = 0 - + [HideInInspector] s_start_FlipBookAdvanced ("Advanced--{persistent_expand:true,default_expand:false}", Float) = 0 [ToggleUI]_FlipbookIntensityControlsAlpha ("Color Intensity To Alpha", Float) = 0 [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Overide Material Alpha", Float) = 0 [HideInInspector] s_end_FlipBookAdvanced ("", Float) = 0 - + //Flipbook audio link [HideInInspector] m_start_FlipbookAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkFlipbookScaleBand ("Scale Band", Int) = 0 @@ -2381,11 +2453,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector] m_end_FlipbookAudioLink ("Audio Link", Float) = 0 [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0 //endex - + //ifex _EnableEmission==0 //Emission 1 [HideInInspector] m_start_emissionOptions ("Emission 0--{reference_property:_EnableEmission,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/special-fx/emission},hover:Documentation}}", Float) = 0 - [HideInInspector][ThryToggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0 + [HideInInspector][ThryToggle(_EMISSION)]_EnableEmission ("Enable Emission 0", Float) = 0 [sRGBWarning]_EmissionMask ("Emission Mask--{reference_properties:[_EmissionMaskPan, _EmissionMaskUV, _EmissionMaskChannel, _EmissionMaskInvert, _EmissionMask0GlobalMask]}", 2D) = "white" { } [HideInInspector][Vector2]_EmissionMaskPan ("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)] _EmissionMaskUV ("UV", Int) = 0 @@ -2393,7 +2465,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][ToggleUI]_EmissionMaskInvert ("Invert", Float) = 0 [HideInInspector][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)] _EmissionMask0GlobalMask ("Global Mask--{reference_property:_EmissionMask0GlobalMaskBlendType}", Int) = 0 [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)]_EmissionMask0GlobalMaskBlendType ("Blending", Range(0, 1)) = 2 - + [HDR]_EmissionColor ("Emission Color--{reference_property:_EmissionColorThemeIndex}", 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)] _EmissionColorThemeIndex ("", Int) = 0 [sRGBWarning(true)][Gradient]_EmissionMap ("Emission Map--{reference_properties:[_EmissionMapPan, _EmissionMapUV]}", 2D) = "white" { } @@ -2402,20 +2474,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _EmissionStrength ("Emission Strength", Range(0, 20)) = 0 [ToggleUI]_EmissionBaseColorAsMap ("Use Base Colors", Float) = 0 [ToggleUI]_EmissionReplace0 ("Override Base Color", Float) = 0 - + [HideInInspector] s_start_EmissionHueShift0 ("Color Adjust--{reference_property:_EmissionHueShiftEnabled,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_EmissionHueShiftEnabled ("Hue Shift", Float) = 0 + [ThryWideEnum(OKLab, 0, HSV, 1)] _EmissionHueShiftColorSpace ("Color Space", Int) = 0 _EmissionSaturation("Saturation", Range(-1, 10)) = 0 _EmissionHueShift ("Hue Shift", Range(0, 1)) = 0 _EmissionHueShiftSpeed ("Hue Shift Speed", Float) = 0 [HideInInspector] s_end_EmissionHueShift0 ("", Float) = 0 - + // Center out emission [HideInInspector] s_start_EmissionCenterOut0 ("Center Out--{reference_property:_EmissionCenterOutEnabled,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_EmissionCenterOutEnabled ("Center Out", Float) = 0 _EmissionCenterOutSpeed ("Flow Speed", Float) = 5 [HideInInspector] s_end_EmissionCenterOut0 ("", Float) = 0 - + // Glow in the dark Emission [HideInInspector] s_start_EmissionLightBased0 ("Light Based--{reference_property:_EnableGITDEmission,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_EnableGITDEmission ("Light Based", Float) = 0 @@ -2425,7 +2498,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _GITDEMinLight ("Min Lighting", Range(0, 1)) = 0 _GITDEMaxLight ("Max Lighting", Range(0, 1)) = 1 [HideInInspector] s_end_EmissionLightBased0 ("", Float) = 0 - + // Blinking Emission [HideInInspector] s_start_EmissionBlinking0 ("Blinking--{reference_property:_EmissionBlinkingEnabled,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_EmissionBlinkingEnabled ("Blinking", Float) = 0 @@ -2434,7 +2507,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _EmissiveBlink_Velocity ("Emissive Blink Velocity", Float) = 4 _EmissionBlinkingOffset ("Offset", Float) = 0 [HideInInspector] s_end_EmissionBlinking0 ("", Float) = 0 - + // Scrolling Emission [HideInInspector] s_start_ScrollingEmission0 ("Scrolling--{reference_property:_ScrollingEmission,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI] _ScrollingEmission ("Scrolling", Float) = 0 @@ -2447,19 +2520,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _EmissiveScroll_Interval ("Interval", Float) = 20 _EmissionScrollingOffset ("Offset", Float) = 0 [HideInInspector] s_end_ScrollingEmission0 ("", Float) = 0 - + [Space(4)] [ThryToggleUI(true)] _EmissionAL0Enabled (" Audio Link--{ condition_showS:_EnableAudioLink==1}", Float) = 0 [HideInInspector] s_start_EmissionAL0Multiply ("Strength Multiply--{persistent_expand:true,default_expand:false, condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _EmissionAL0MultipliersBand ("Band", Int) = 0 [VectorLabel(Min, Max)]_EmissionAL0Multipliers ("Multiplier", Vector) = (1, 1, 0, 0) [HideInInspector] s_end_EmissionAL0Multiply ("Strength Multiply", Float) = 0 - + [HideInInspector] s_start_EmissionAL0Add ("Strength Add--{persistent_expand:true,default_expand:false, condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _EmissionAL0StrengthBand ("Band", Int) = 0 [VectorLabel(Min, Max)]_EmissionAL0StrengthMod ("Strength", Vector) = (0, 0, 0, 0) [HideInInspector] s_end_EmissionAL0Add ("Strength Add", Float) = 0 - + [HideInInspector] s_start_EmissionAL0COut ("Center Out--{persistent_expand:true,default_expand:false, condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkEmission0CenterOutBand ("Band", Int) = 0 [VectorLabel(Min, Max)] _AudioLinkEmission0CenterOut ("Strength", Vector) = (0, 0, 0, 0) @@ -2471,7 +2544,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _EnableEmission1==0 // Second Emission [HideInInspector] m_start_emission1Options ("Emission 1--{reference_property:_EnableEmission1,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/special-fx/emission},hover:Documentation}}", Float) = 0 - [HideInInspector][ThryToggle(POI_EMISSION_1)]_EnableEmission1 ("Enable Emission 2", Float) = 0 + [HideInInspector][ThryToggle(POI_EMISSION_1)]_EnableEmission1 ("Enable Emission 0", Float) = 0 [sRGBWarning]_EmissionMask1 ("Emission Mask--{reference_properties:[_EmissionMask1Pan, _EmissionMask1UV, _EmissionMask1Channel, _EmissionMaskInvert1, _EmissionMask1GlobalMask]}", 2D) = "white" { } [HideInInspector][Vector2]_EmissionMask1Pan ("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)] _EmissionMask1UV ("UV", Int) = 0 @@ -2487,20 +2560,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0 [ToggleUI]_EmissionBaseColorAsMap1 ("Use Base Colors", Float) = 0 [ToggleUI]_EmissionReplace1 ("Override Base Color", Float) = 0 - + [HideInInspector] s_start_EmissionHueShift1 ("Color Adjust--{reference_property:_EmissionHueShiftEnabled1,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_EmissionHueShiftEnabled1 ("Hue Shift", Float) = 0 + [ThryWideEnum(OKLab, 0, HSV, 1)] _EmissionHueShiftColorSpace1 ("Color Space", Int) = 0 _EmissionSaturation1("Saturation", Range(-1, 10)) = 0 _EmissionHueShift1 ("Hue Shift", Range(0, 1)) = 0 _EmissionHueShiftSpeed1 ("Hue Shift Speed", Float) = 0 [HideInInspector] s_end_EmissionHueShift1 ("", Float) = 0 - + // Second Center Out Enission [HideInInspector] s_start_EmissionCenterOutEnabled1 ("Center Out--{reference_property:_EmissionCenterOutEnabled1,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_EmissionCenterOutEnabled1 ("Center Out", Float) = 0 _EmissionCenterOutSpeed1 ("Flow Speed", Float) = 5 [HideInInspector] s_end_EmissionCenterOutEnabled1 ("", Float) = 0 - + // Second Glow In The Dark Emission [HideInInspector] s_start_EmissionLightBased1 ("Light Based--{reference_property:_EnableGITDEmission1,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_EnableGITDEmission1 ("Light Based", Float) = 0 @@ -2510,7 +2584,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _GITDEMinLight1 ("Min Lighting", Range(0, 1)) = 0 _GITDEMaxLight1 ("Max Lighting", Range(0, 1)) = 1 [HideInInspector] s_end_EmissionLightBased1 ("", Float) = 0 - + // Second Blinking Emission [HideInInspector] s_start_EmissionBlinking1 ("Blinking--{reference_property:_EmissionBlinkingEnabled1,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_EmissionBlinkingEnabled1 ("Blinking", Float) = 0 @@ -2519,7 +2593,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _EmissiveBlink_Velocity1 ("Emissive Blink Velocity", Float) = 4 _EmissionBlinkingOffset1 ("Offset", Float) = 0 [HideInInspector] s_end_EmissionBlinking1 ("", Float) = 0 - + // Second Scrolling Emission [HideInInspector] s_start_EmissionScrolling1 ("Scrolling--{reference_property:_ScrollingEmission1,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI] _ScrollingEmission1 ("Scrolling", Float) = 0 @@ -2532,32 +2606,32 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _EmissiveScroll_Interval1 ("Interval", Float) = 20 _EmissionScrollingOffset1 ("Offset", Float) = 0 [HideInInspector] s_end_EmissionScrolling1 ("", Float) = 0 - + [Space(4)] [ThryToggleUI(true)] _EmissionAL1Enabled (" Audio Link--{ condition_showS:_EnableAudioLink==1}", Float) = 0 [HideInInspector] s_start_EmissionAL1Multiply ("Strength Multiply--{persistent_expand:true,default_expand:false, condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _EmissionAL1MultipliersBand ("Band", Int) = 0 [VectorLabel(Min, Max)]_EmissionAL1Multipliers ("Multiplier", Vector) = (1, 1, 0, 0) [HideInInspector] s_end_EmissionAL1Multiply ("Strength Multiply", Float) = 0 - + [HideInInspector] s_start_EmissionAL1Add ("Strength Add--{persistent_expand:true,default_expand:false, condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _EmissionAL1StrengthBand ("Band", Int) = 0 [VectorLabel(Min, Max)]_EmissionAL1StrengthMod ("Strength Add", Vector) = (0, 0, 0, 0) [HideInInspector] s_end_EmissionAL1Add ("Strength Add", Float) = 0 - + [HideInInspector] s_start_EmissionAL1COut ("Center Out--{persistent_expand:true,default_expand:false, condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkEmission1CenterOutBand ("Band", Int) = 0 [VectorLabel(Min, Max)] _AudioLinkEmission1CenterOut ("Strength", Vector) = (0, 0, 0, 0) _AudioLinkEmission1CenterOutSize ("Intensity Threshold", Range(0, 1)) = 0 _AudioLinkEmission1CenterOutDuration ("Duration--{tooltip:''How much AL history is used. Negative values reverse direction'', condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Range(-1, 1)) = 1 [HideInInspector] s_end_EmissionAL1COut ("Center Out", Float) = 0 - + [HideInInspector] m_end_emission1Options ("", Float) = 0 //endex //ifex _EnableEmission2==0 // Third Emission [HideInInspector] m_start_emission2Options ("Emission 2--{reference_property:_EnableEmission2,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/special-fx/emission},hover:Documentation}}", Float) = 0 - [HideInInspector][ThryToggle(POI_EMISSION_2)]_EnableEmission2 ("Enable Emission 2", Float) = 0 + [HideInInspector][ThryToggle(POI_EMISSION_2)]_EnableEmission2 ("Enable Emission 0", Float) = 0 [sRGBWarning]_EmissionMask2 ("Emission Mask--{reference_properties:[_EmissionMask2Pan, _EmissionMask2UV, _EmissionMask2Channel, _EmissionMaskInvert2, _EmissionMask2GlobalMask]}", 2D) = "white" { } [HideInInspector][Vector2]_EmissionMask2Pan ("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)] _EmissionMask2UV ("UV", Int) = 0 @@ -2573,20 +2647,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _EmissionStrength2 ("Emission Strength", Range(0, 20)) = 0 [ToggleUI]_EmissionBaseColorAsMap2 ("Use Base Colors", Float) = 0 [ToggleUI]_EmissionReplace2 ("Override Base Color", Float) = 0 - + [HideInInspector] s_start_EmissionHueShift2 ("Color Adjust--{reference_property:_EmissionHueShiftEnabled2,persistent_expand:true,default_expand:false}", Float) = 0 [ToggleUI]_EmissionHueShiftEnabled2 ("Hue Shift", Float) = 0 + [ThryWideEnum(OKLab, 0, HSV, 1)] _EmissionHueShiftColorSpace2 ("Color Space", Int) = 0 _EmissionSaturation2("Saturation", Range(-1, 10)) = 0 _EmissionHueShift2 ("Hue Shift", Range(0, 1)) = 0 _EmissionHueShiftSpeed2 ("Hue Shift Speed", Float) = 0 [HideInInspector] s_end_EmissionHueShift2 ("", Float) = 0 - + // Third Center Out Enission [HideInInspector] s_start_EmissionCenterOut2 ("Center Out--{reference_property:_EmissionCenterOutEnabled2,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_EmissionCenterOutEnabled2 ("Center Out", Float) = 0 _EmissionCenterOutSpeed2 ("Flow Speed", Float) = 5 [HideInInspector] s_end_EmissionCenterOutEnabled2 ("", Float) = 0 - + // Third Glow In The Dark Emission [HideInInspector] s_start_EmissionLightBased2 ("Light Based--{reference_property:_EnableGITDEmission2,persistent_expand:true,default_expand:false}", Float) = 0 [ToggleUI]_EnableGITDEmission2 ("Light Based", Float) = 0 @@ -2596,7 +2671,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _GITDEMinLight2 ("Min Lighting", Range(0, 1)) = 0 _GITDEMaxLight2 ("Max Lighting", Range(0, 1)) = 1 [HideInInspector] s_end_EmissionLightBased2 ("", Float) = 0 - + // Third Blinking Emission [HideInInspector] s_start_EmissionBlinking2 ("Blinking--{reference_property:_EmissionBlinkingEnabled2,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_EmissionBlinkingEnabled2 ("Blinking", Float) = 0 @@ -2605,7 +2680,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _EmissiveBlink_Velocity2 ("Emissive Blink Velocity", Float) = 4 _EmissionBlinkingOffset2 ("Offset", Float) = 0 [HideInInspector] s_end_EmissionBlinking2 ("", Float) = 0 - + // Third Scrolling Emission [HideInInspector] s_start_EmissionScrolling2 ("Scrolling--{reference_property:_ScrollingEmission2,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI] _ScrollingEmission2 ("Scrolling", Float) = 0 @@ -2618,19 +2693,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _EmissiveScroll_Interval2 ("Interval", Float) = 20 _EmissionScrollingOffset2 ("Offset", Float) = 0 [HideInInspector] s_end_EmissionScrolling2 ("", Float) = 0 - + [Space(4)] [ThryToggleUI(true)] _EmissionAL2Enabled (" Audio Link--{ condition_showS:_EnableAudioLink==1}", Float) = 0 [HideInInspector]s_start_EmissionAL2Multiply ("Strength Multiply--{persistent_expand:true,default_expand:false, condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _EmissionAL2MultipliersBand ("Emission Multiplier Band", Int) = 0 [VectorLabel(Min, Max)]_EmissionAL2Multipliers ("Emission Multiplier", Vector) = (1, 1, 0, 0) [HideInInspector]s_end_EmissionAL2Multiply ("Strength Multiply", Float) = 0 - + [HideInInspector]s_start_EmissionAL2Add ("Strength Add--{persistent_expand:true,default_expand:false, condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _EmissionAL2StrengthBand ("Band", Int) = 0 [VectorLabel(Min, Max)]_EmissionAL2StrengthMod ("Strength Add", Vector) = (0, 0, 0, 0) [HideInInspector]s_end_EmissionAL2Add ("Strength Add", Float) = 0 - + [HideInInspector]s_start_EmissionAL2COut ("Center Out--{persistent_expand:true,default_expand:false, condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkEmission2CenterOutBand ("Band", Int) = 0[VectorLabel(Min, Max)] _AudioLinkEmission2CenterOut ("Strength", Vector) = (0, 0, 0, 0) @@ -2639,7 +2714,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector]s_end_EmissionAL2COut ("Center Out", Float) = 0 [HideInInspector] m_end_emission2Options ("", Float) = 0 //endex - + //ifex _EnableEmission3==0 // Fourth Emission [HideInInspector] m_start_emission3Options ("Emission 3--{reference_property:_EnableEmission3,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/special-fx/emission},hover:Documentation}}", Float) = 0 @@ -2659,20 +2734,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _EmissionStrength3 ("Emission Strength", Range(0, 20)) = 0 [ToggleUI]_EmissionBaseColorAsMap3 ("Use Base Colors", Float) = 0 [ToggleUI]_EmissionReplace3 ("Override Base Color", Float) = 0 - + [HideInInspector] s_start_EmissionHueShift3 ("Color Adjust--{reference_property:_EmissionHueShiftEnabled3,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_EmissionHueShiftEnabled3 ("Hue Shift", Float) = 0 + [ThryWideEnum(OKLab, 0, HSV, 1)] _EmissionHueShiftColorSpace3 ("Color Space", Int) = 0 _EmissionSaturation3("Saturation", Range(-1, 10)) = 0 _EmissionHueShift3 ("Hue Shift", Range(0, 1)) = 0 _EmissionHueShiftSpeed3 ("Hue Shift Speed", Float) = 0 [HideInInspector] s_end_EmissionHueShift3 ("", Float) = 0 - + // Fourth Center Out Enission [HideInInspector] s_start_EmissionCenterOutEnabled3 ("Center Out--{reference_property:_EmissionCenterOutEnabled3,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_EmissionCenterOutEnabled3 ("Center Out", Float) = 0 _EmissionCenterOutSpeed3 ("Flow Speed", Float) = 5 [HideInInspector] s_end_EmissionCenterOutEnabled3 ("", Float) = 0 - + // Fourth Glow In The Dark Emission [HideInInspector] s_start_EmissionLightBased3 ("Light Based--{reference_property:_EnableGITDEmission3,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_EnableGITDEmission3 ("Light Based", Float) = 0 @@ -2682,7 +2758,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _GITDEMinLight3 ("Min Lighting", Range(0, 1)) = 0 _GITDEMaxLight3 ("Max Lighting", Range(0, 1)) = 1 [HideInInspector] s_end_EmissionLightBased3 ("", Float) = 0 - + // Fourth Blinking Emission [HideInInspector] s_start_EmissionBlinking3 ("Blinking--{reference_property:_EmissionBlinkingEnabled3,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_EmissionBlinkingEnabled3 ("Blinking", Float) = 0 @@ -2691,7 +2767,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _EmissiveBlink_Velocity3 ("Emissive Blink Velocity", Float) = 4 _EmissionBlinkingOffset3 ("Offset", Float) = 0 [HideInInspector] s_end_EmissionBlinking3 ("", Float) = 0 - + // Fourth Scrolling Emission [HideInInspector] s_start_EmissionScrolling3 ("Scrolling--{reference_property:_ScrollingEmission3,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI] _ScrollingEmission3 ("Scrolling", Float) = 0 @@ -2704,30 +2780,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _EmissiveScroll_Interval3 ("Interval", Float) = 20 _EmissionScrollingOffset3 ("Offset", Float) = 0 [HideInInspector] s_end_EmissionScrolling3 ("", Float) = 0 - + [Space(4)] [ThryToggleUI(true)] _EmissionAL3Enabled (" Audio Link--{ condition_showS:_EnableAudioLink==1}", Float) = 0 - + [HideInInspector] s_start_EmissionAL3Multiply ("Strength Multiply--{persistent_expand:true,default_expand:false, condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _EmissionAL3MultipliersBand ("Bands", Int) = 0 [VectorLabel(Min, Max)]_EmissionAL3Multipliers ("Multipliers", Vector) = (1, 1, 0, 0) [HideInInspector] s_end_EmissionAL3Multiply ("Strength Multiply", Float) = 0 - + [HideInInspector] s_start_EmissionAL3Add ("Strength Add--{persistent_expand:true,default_expand:false, condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _EmissionAL3StrengthBand ("Strength Add Bands", Int) = 0 [VectorLabel(Min, Max)]_EmissionAL3StrengthMod ("Strength Adds", Vector) = (0, 0, 0, 0) [HideInInspector] s_end_EmissionAL3Add ("Strength Add", Float) = 0 - + [HideInInspector] s_start_EmissionAL3COut ("Center Out--{persistent_expand:true,default_expand:false, condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkEmission3CenterOutBand ("Bands", Int) = 0 [VectorLabel(Min, Max)] _AudioLinkEmission3CenterOut ("Strengths", Vector) = (0, 0, 0, 0) _AudioLinkEmission3CenterOutSize ("Intensity Thresholds", Range(0, 1)) = 0 _AudioLinkEmission3CenterOutDuration ("Duration", Range(-1, 1)) = 1 [HideInInspector] s_end_EmissionAL3COut ("Center Out", Float) = 0 - + [HideInInspector] m_end_emission3Options ("", Float) = 0 //endex - + // Glitter //ifex _GlitterEnable==0 [HideInInspector] m_start_glitter ("Glitter / Sparkle--{reference_property:_GlitterEnable,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/special-fx/glitter},hover:Documentation}}", Float) = 0 @@ -2738,7 +2814,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Mode", Int) = 0 _GlitterUseNormals ("Use Normals", Range(0, 1)) = 0 [IntRange]_GlitterLayers ("Layers", Range(1, 4)) = 2 - + [HideInInspector] s_start_GlitterColorAndShape ("Shape & Color--{persistent_expand:true,default_expand:true}", Float) = 1 _GlitterTexture ("Shape Texture", 2D) = "white" { } [sRGBWarning(true)]_GlitterColorMap ("Color Map--{reference_properties:[_GlitterColorMapPan, _GlitterColorMapUV]}", 2D) = "white" { } @@ -2751,7 +2827,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [MultiSlider]_GlitterMinMaxSaturation ("Saturation Range--{condition_showS:(_GlitterRandomColors==1)}", Vector) = (0.8, 1, 0, 1) [MultiSlider]_GlitterMinMaxBrightness ("Brightness Range--{condition_showS:(_GlitterRandomColors==1)}", Vector) = (0.8, 1, 0, 1) [HideInInspector] s_end_GlitterColorAndShape ("Color", Float) = 0 - + [HideInInspector] s_start_GlitterPositionSize ("Position & Size--{persistent_expand:true,default_expand:true}", Float) = 01 _GlitterFrequency ("Glitter Density", Float) = 300.0 _GlitterSize ("Glitter Size--{condition_show:(_GlitterRandomSize==0)}", Range(0, 1)) = .3 @@ -2760,7 +2836,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ToggleUI]_GlitterRandomSize ("Random Size", Float) = 0 [MultiSlider]_GlitterMinMaxSize ("Size Range--{condition_show:(_GlitterRandomSize==1)}", Vector) = (0.1, 0.5, 0, 1) [HideInInspector] s_end_GlitterPositionSize ("Position & Size", Float) = 0 - + [HideInInspector] s_start_GlitterSparkleControl ("Sparkle Control--{persistent_expand:true,default_expand:true}", Float) = 1 _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0 _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3 @@ -2771,13 +2847,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _GlitterContrast ("Post Contrast--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(1, 1000)) = 300 _GlitterJaggyFix ("Distant Jaggy Fix--{condition_show:{type:PROPERTY_BOOL,data:_GlitterShape==1}}", Range(0, .1)) = .0 [HideInInspector] s_end_GlitterSparkleControl ("Sparkle Control", Float) = 0 - + [HideInInspector] s_start_GlitterRotationSection ("Rotations--{persistent_expand:true,default_expand:false}", Float) = 0 [ToggleUI]_GlitterRandomRotation ("Random Offset", Float) = 0 _GlitterTextureRotation ("Constant Speed", Float) = 0 [VectorLabel(Min, Max)]_GlitterRandomRotationSpeed ("Random Speed Range", Vector) = (0, 0, 0, 0) [HideInInspector] s_end_GlitterRotationSection ("Rotations", Float) = 0 - + [HideInInspector] s_start_GlitterMask ("Masking & Light Masking--{persistent_expand:true,default_expand:false}", Float) = 0 [sRGBWarning]_GlitterMask ("Glitter Mask--{reference_properties:[_GlitterMaskPan, _GlitterMaskUV, _GlitterMaskChannel, _GlitterMaskInvert]}", 2D) = "white" { } [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0) @@ -2789,35 +2865,36 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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)] _GlitterMaskGlobalMask ("Global Mask--{reference_property:_GlitterMaskGlobalMaskBlendType}", Int) = 0 [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)]_GlitterMaskGlobalMaskBlendType ("Blending", Range(0, 1)) = 2 [HideInInspector] s_end_GlitterMask ("Masking", Float) = 0 - + [HideInInspector] s_start_GlitterHueShiftSection ("Hue Shift--{reference_property:_GlitterHueShiftEnabled, persistent_expand:true,default_expand:false)}", Float) = 0 [HideInInspector][ToggleUI]_GlitterHueShiftEnabled ("Enable Hue Shift", Float) = 0 + [ThryWideEnum(OKLab, 0, HSV, 1)] _GlitteHueShiftColorSpace ("Color Space", Int) = 0 _GlitterHueShiftSpeed ("Shift Speed", Float) = 0 _GlitterHueShift ("Hue Shift", Range(0, 1)) = 0 [HideInInspector] s_end_GlitterHueShiftSection ("Hue Shift--{reference_property:_ShadowBorderMapToggle, persistent_expand:true,default_expand:false)}", Float) = 0 - + [HideInInspector] s_start_GlitterAudioLink ("Audio Link ♫--{reference_property:_GlitterALEnabled,persistent_expand:true,default_expand:false, condition_showS:(_EnableAudioLink==1)}", Float) = 0 [HideInInspector][ToggleUI] _GlitterALEnabled ("Enable Audio Link", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _GlitterALAlphaAddBand ("Alpha Band", Int) = 0 [VectorLabel(Min, Max)]_GlitterALAlphaAdd ("Alpha Mod", Vector) = (0, 0, 0, 0) - + [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _GlitterALMaxBrightnessBand ("Max Brightness Band", Int) = 0 [VectorLabel(Min, Max)]_GlitterALMaxBrightnessAdd ("Max Brightness Mod", Vector) = (0, 0, 0, 0) - + [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _GlitterALSizeAddBand ("Size Band", Int) = 0 [VectorLabel(Min, Max)]_GlitterALSizeAdd ("Size 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)]_GlitterALChronoSparkleSpeedType ("Chrono Sparkle Type", Int) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _GlitterALChronoSparkleSpeedBand ("Chrono Sparkle Band", Int) = 0 _GlitterALChronoSparkleSpeed ("Chrono Sparkle Speed", Float) = 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)]_GlitterALChronoRotationSpeedType ("Chrono Rotation Type", Int) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _GlitterALChronoRotationSpeedBand ("Chrono Rotation Band", Int) = 0 _GlitterALChronoRotationSpeed ("Chrono Rotation Speed", Float) = 0 [HideInInspector] s_end_GlitterAudioLink ("Audio Link", Float) = 0 [HideInInspector] m_end_glitter ("Glitter / Sparkle", Float) = 0 //endex - + //ifex _EnablePathing==0 [HideInInspector] m_start_pathing ("Pathing--{reference_property: _EnablePathing,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/special-fx/pathing},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(POI_PATHING)] _EnablePathing ("Enable Pathing", Float) = 0 @@ -2830,12 +2907,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [sRGBWarning(true)][ThryRGBAPacker(RGB Color, A Mask, sRGB, false)]_PathingColorMap ("Color & Mask (Expand)--{reference_properties:[_PathingColorMapPan, _PathingColorMapUV]}", 2D) = "white" { } [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos, 5, Local Pos, 8, Polar UV, 6, Distorted UV, 7)]_PathingColorMapUV ("UV", Int) = 0 [HideInInspector][Vector2]_PathingColorMapPan ("Panning", Vector) = (0, 0, 0, 0) - + [Enum(Fill, 0, Path, 1, Loop, 2)]_PathTypeR ("R Path Type", Float) = 0 [Enum(Fill, 0, Path, 1, Loop, 2)]_PathTypeG ("G Path Type", Float) = 0 [Enum(Fill, 0, Path, 1, Loop, 2)]_PathTypeB ("B Path Type", Float) = 0 [Enum(Fill, 0, Path, 1, Loop, 2)]_PathTypeA ("A Path Type", Float) = 0 - + [HDR]_PathColorR ("R Color--{reference_property:_PathColorRThemeIndex}", Color) = (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)] _PathColorRThemeIndex ("", Int) = 0 [HDR]_PathColorG ("G Color--{reference_property:_PathColorGThemeIndex}", Color) = (1, 1, 1) @@ -2844,17 +2921,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [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)] _PathColorBThemeIndex ("", Int) = 0 [HDR]_PathColorA ("A Color--{reference_property:_PathColorAThemeIndex}", Color) = (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)] _PathColorAThemeIndex ("", Int) = 0 - + [VectorLabel(R,G,B,A)]_PathEmissionStrength ("Emission Strength", Vector) = (0.0, 0.0, 0.0, 0.0) [VectorLabel(R,G,B,A)]_PathSoftness ("Softness", Vector) = (1, 1, 1, 1) [VectorLabel(R,G,B,A)]_PathSpeed ("Speed", Vector) = (1.0, 1.0, 1.0, 1.0) [VectorLabel(R,G,B,A)]_PathWidth ("Length", Vector) = (0.03, 0.03, 0.03, 0.03) - + [Header(Timing Options)] [VectorLabel(R,G,B,A)]_PathTime ("Manual Timing", Vector) = (-999.0, -999.0, -999.0, -999.0) [VectorLabel(R,G,B,A)]_PathOffset ("Timing Offset", Vector) = (0.0, 0.0, 0.0, 0.0) [VectorLabel(R,G,B,A)]_PathSegments ("Path Segments", Vector) = (0.0, 0.0, 0.0, 0.0) - + [HideInInspector] m_start_PathAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0 // Time Offsets [ThryToggleUI(true)]_PathALTimeOffset (" Time Offset", Float) = 0 @@ -2889,19 +2966,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Space(4)] [ThryToggleUI(true)]_PathALHistory (" History", Float) = 0 [Enum(Mask, 0, Override, 1)] _PathALHistoryMode ("History Mode--{condition_showS:(_PathALHistory==1)}", Float) = 0 - + [ToggleUI]_PathALHistoryR ("R History--{condition_showS:(_PathALHistory==1)}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _PathALHistoryBandR ("R Band--{condition_showS:(_PathALHistory==1 && _PathALHistoryR==1)}", Int) = 0 [MultiSlider]_PathALHistoryRangeR ("R Range--{condition_showS:(_PathALHistory==1 && _PathALHistoryR==1)}", Vector) = (0, 1, 0, 1) - + [ToggleUI]_PathALHistoryG ("G History--{condition_showS:(_PathALHistory==1)}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _PathALHistoryBandG ("G Band--{condition_showS:(_PathALHistory==1 && _PathALHistoryG==1)}", Int) = 0 [MultiSlider]_PathALHistoryRangeG ("G Range--{condition_showS:(_PathALHistory==1 && _PathALHistoryG==1)}", Vector) = (0, 1, 0, 1) - + [ToggleUI]_PathALHistoryB ("B History--{condition_showS:(_PathALHistory==1)}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _PathALHistoryBandB ("B Band--{condition_showS:(_PathALHistory==1 && _PathALHistoryB==1)}", Int) = 0 [MultiSlider]_PathALHistoryRangeB ("B Range--{condition_showS:(_PathALHistory==1 && _PathALHistoryB==1)}", Vector) = (0, 1, 0, 1) - + [ToggleUI]_PathALHistoryA ("A History--{condition_showS:(_PathALHistory==1)}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _PathALHistoryBandA ("A Band--{condition_showS:(_PathALHistory==1 && _PathALHistoryA==1)}", Int) = 0 [MultiSlider]_PathALHistoryRangeA ("A Range--{condition_showS:(_PathALHistory==1 && _PathALHistoryA==1)}", Vector) = (0, 1, 0, 1) @@ -2939,7 +3016,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector] m_end_PathAudioLink ("", Float) = 0 [HideInInspector] m_end_pathing ("", Float) = 0 //endex - + //ifex _EnableMirrorOptions==0 [HideInInspector] m_start_mirrorOptions ("Mirror/Camera Visibility--{reference_property:_EnableMirrorOptions,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/special-fx/mirror},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(POI_MIRROR)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0 @@ -2951,7 +3028,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryToggleUI(True)]_VisibilityVRCCameraVR ("Camera (VR)--{condition_showS:(_VisibilityMode==1)}", Int) = 1 [ThryToggleUI(True)]_VisibilityVRCCameraDesktop ("Camera (Desktop)--{condition_showS:(_VisibilityMode==1)}", Int) = 1 [ThryToggleUI(True)]_VisibilityVRCCameraScreenshot ("Screenshot--{condition_showS:(_VisibilityMode==1)}", Int) = 1 - + [HideInInspector] s_start_MirrorTexture ("Mirror Texture & Color--{reference_property:_MirrorTextureEnabled,persistent_expand:true,default_expand:true}", Float) = 1 [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Lighten, 5, Screen, 6, Subtract, 7, Add, 8, Overlay, 9, Mixed, 20)]_MirrorTextureBlendType ("Blending", Range(0, 1)) = 0 _MirrorColor ("Color--{reference_property:_MirrorColorThemeIndex}", Color) = (1, 1, 1, 1) @@ -2962,12 +3039,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos, 5, Local Pos, 8, Polar UV, 6, Distorted UV, 7)] _MirrorTextureUV ("UV", Int) = 0 [ThryToggleUI(True)]_MirrorTextureForceEnabled ("Test", Float) = 0 [HideInInspector] s_end_MirrorTexture ("", Float) = 0 - + [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0 //endex - + //ifex _EnableTouchGlow==0 - [HideInInspector] m_start_depthFX ("Depth FX--{reference_property:_EnableTouchGlow}", Float) = 0 + [HideInInspector] m_start_depthFX ("Depth FX--{reference_property:_EnableTouchGlow, button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/special-fx/depth-fx},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(GRAIN)]_EnableTouchGlow ("Enable Depth FX", Float) = 0 [Helpbox(1)]_DepthFXWarning ("Depth FX doesn't write to depth, which can break certain transparent effects like custom fog and raymarching", Int) = 0 [sRGBWarning]_DepthMask ("Mask--{reference_properties:[_DepthMaskPan, _DepthMaskUV, _DepthMaskChannel, _DepthMaskGlobalMask]}", 2D) = "white" { } @@ -2976,7 +3053,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)]_DepthMaskChannel ("Channel", Float) = 0 [HideInInspector][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)] _DepthMaskGlobalMask ("Global Mask--{reference_property:_DepthMaskGlobalMaskBlendType}", Int) = 0 [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)]_DepthMaskGlobalMaskBlendType ("Blending", Range(0, 1)) = 2 - + [HideInInspector] s_start_DepthFXColorEmission ("Color & Emission--{reference_property:_DepthColorToggle,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_DepthColorToggle ("Color & Emission", Float) = 0 [ThryWideEnum(Replace, 0, Multiply, 1, Add, 2)] _DepthColorBlendMode ("Blend Type", Int) = 0 @@ -2991,7 +3068,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _DepthColorMinValue ("Min Color Blend", Range(0, 1)) = 1 _DepthColorMaxValue ("Max Color Blend", Range(0, 1)) = 0 [HideInInspector] s_end_DepthFXColorEmission ("", Float) = 0 - + [HideInInspector] s_start_DepthAlpha ("Alpha--{reference_property:_DepthAlphaToggle,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_DepthAlphaToggle ("Alpha", Float) = 0 _DepthAlphaMinDepth ("Min Depth", Float) = 0 @@ -3001,14 +3078,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector] s_end_DepthAlpha ("", Float) = 0 [HideInInspector] m_end_depthFX ("Depth FX", Float) = 0 //endex - + //ifex _TextEnabled==0 // MSDF OVERLAY [HideInInspector] m_start_Text ("Stats Overlay--{reference_property:_TextEnabled,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/special-fx/stats-overlay},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(EFFECT_BUMP)]_TextEnabled ("Text", Float) = 0 [sRGBWarning]_TextGlyphs ("Font Array", 2D) = "black" { } _TextPixelRange ("Pixel Range", Float) = 4.0 - + // FPS [HideInInspector] m_start_TextFPS ("FPS--{reference_property:_TextFPSEnabled}", Float) = 0 [HideInInspector][ToggleUI]_TextFPSEnabled ("FPS Text", Float) = 0 @@ -3022,7 +3099,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1) [VectorLabel(L, D, R, U)]_TextFPSPadding ("Padding Reduction", Vector) = (0, 0, 0, 0) [HideInInspector] m_end_TextFPS ("FPS", Float) = 0 - + // POSITION [HideInInspector] m_start_TextPosition ("Position--{reference_property:_TextPositionEnabled}", Float) = 0 [HideInInspector][ToggleUI]_TextPositionEnabled ("Position Text", Float) = 0 @@ -3036,7 +3113,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1) [VectorLabel(L, D, R, U)]_TextPositionPadding ("Padding Reduction", Vector) = (0, 0, 0, 0) [HideInInspector] m_end_TextPosition ("Position", Float) = 0 - + // INSTANCE TIME [HideInInspector] m_start_TextInstanceTime ("Instance Time--{reference_property:_TextTimeEnabled}", Float) = 0 [HideInInspector][ToggleUI]_TextTimeEnabled ("Time Text", Float) = 0 @@ -3049,7 +3126,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1) [VectorLabel(L, D, R, U)]_TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0) [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0 - + // NUMERIC OVERLAY [HideInInspector] m_start_TextNumeric ("Numeric (WIP)--{reference_property:_TextNumericEnabled}", Float) = 0 [HideInInspector][ToggleUI]_TextNumericEnabled ("Numeric Text", Float) = 0 @@ -3066,10 +3143,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Vector2]_TextNumericScale ("Scale", Vector) = (1, 1, 1, 1) [VectorLabel(L, D, R, U)]_TextNumericPadding ("Padding Reduction", Vector) = (0, 0, 0, 0) [HideInInspector] m_end_TextNumeric ("Numeric", Float) = 0 - + [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0 //endex - + //ifex _FXProximityColor==0 [HideInInspector] m_start_FXProximityColor ("Proximity Color--{reference_property:_FXProximityColor,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/special-fx/proximity-color},hover:Documentation}}", Float) = 0 [HideInInspector][ToggleUI]_FXProximityColor ("Enable", Float) = 0 @@ -3083,29 +3160,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ToggleUI]_FXProximityColorBackFace ("Force BackFace Color", Float) = 0 [HideInInspector] m_end_FXProximityColor ("", Float) = 0 //endex - + //ifex _PoiInternalParallax==0 [HideInInspector] m_start_internalparallax (" Internal Parallax--{reference_property:_PoiInternalParallax}", Float) = 0 [HideInInspector][ThryToggle(POI_INTERNALPARALLAX)]_PoiInternalParallax ("Enable", Float) = 0 - + [Enum(Basic, 0, HeightMap, 1)] _ParallaxInternalHeightmapMode ("Parallax Mode", Int) = 0 - + [ThryRGBAPacker(RGB Color, A Height, sRGB, false)][sRGBWarning(true)]_ParallaxInternalMap ("Internal Map--{reference_properties:[_ParallaxInternalMapPan, _ParallaxInternalPanDepthSpeed, _ParallaxInternalHeightFromAlpha]}", 2D) = "black" { } [HideInInspector][Vector2]_ParallaxInternalMapPan ("Panning", Vector) = (0, 0, 1, 1) [HideInInspector][Vector2]_ParallaxInternalPanDepthSpeed ("Per Level Pan Multiplier", Vector) = (0, 0, 1, 1) [HideInInspector][ToggleUI]_ParallaxInternalHeightFromAlpha ("Height From Alpha", Float) = 0 - + [sRGBWarning][ThryTexture]_ParallaxInternalMapMask ("Mask--{reference_properties:[_ParallaxInternalMapMaskPan, _ParallaxInternalMapMaskUV, _ParallaxInternalMapMaskChannel]}", 2D) = "white" { } [HideInInspector][Vector2]_ParallaxInternalMapMaskPan ("Panning", Vector) = (0, 0, 0, 0) [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _ParallaxInternalMapMaskUV ("UV", Int) = 0 [HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)]_ParallaxInternalMapMaskChannel ("Channel", Float) = 0 - + [HideInInspector] s_start_ParallaxInternalLayerControls ("Layer Controls--{persistent_expand:true,default_expand:true}", Float) = 1 [IntRange]_ParallaxInternalIterations ("Parallax Internal Iterations", Range(1, 50)) = 4 _ParallaxInternalMinDepth ("Min Depth", Float) = 0 _ParallaxInternalMaxDepth ("Max Depth", Float) = 0.1 [HideInInspector] s_end_ParallaxInternalLayerControls ("", Float) = 0 - + [HideInInspector] s_start_ParallaxInternalLayerColoring ("Layer Colors--{persistent_expand:true,default_expand:true}", Float) = 1 _ParallaxInternalMinFade ("Min Depth Brightness", Range(0, 5)) = 1.0 _ParallaxInternalMaxFade ("Max Depth Brightness", Range(0, 5)) = 0.1 @@ -3117,7 +3194,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Lighten, 5, Screen, 6, Subtract, 7, Add, 8, Overlay, 9, Mixed, 20)] _ParallaxInternalSurfaceBlendMode ("Surface Blend Mode", Int) = 8 [HideInInspector] s_end_ParallaxInternalLayerColoring ("", Float) = 0 // [Vector2]_ParallaxInternalPanSpeed ("Pan Speed", Vector) = (0, 0, 0, 0) - + [HideInInspector] s_start_ParallaxInternalHueShift ("Hue Shift--{reference_property:_ParallaxInternalHueShiftEnabled,persistent_expand:true,default_expand:false}", Float) = 0 [HideInInspector][ToggleUI]_ParallaxInternalHueShiftEnabled ("Hue Shift", Float) = 0 _ParallaxInternalHueShift ("Hue Shift", Range(0, 1)) = 0 @@ -3125,10 +3202,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _ParallaxInternalHueShiftPerLevel ("Hue Shift Per Level", Float) = 0 [HideInInspector] s_end_ParallaxInternalHueShift ("", Float) = 0 // _ParallaxInternalHueShiftPerLevelSpeed ("Hue Shift Per Level Speed", Float) = 0 - + [HideInInspector] m_end_internalparallax ("Internal Parallax", Float) = 0 //endex - + //ifex _VideoEffectsEnable==0 [HideInInspector] m_start_videoEffects ("Video Effects--{reference_property:_VideoEffectsEnable}", Float) = 0 [HideInInspector][ThryToggle(POI_VIDEO_EFFECTS)]_VideoEffectsEnable ("Enable VideoEffects", Float) = 0 @@ -3147,21 +3224,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // [ToggleUI]_VideoRepeatVideoTexture ("Clamp To UV", Float) = 0 _VideoSaturation ("Saturation", Range(-1, 3)) = 0 _VideoContrast ("Contrast boost", Range(0, 3)) = 0 - + [HideInInspector] m_end_VideoSettings ("Video Texture Settings", Float) = 0 - + [HideInInspector] m_start_CRT ("CRT Options--{condition_showS:(_VideoType==2)}", Float) = 0 _VideoCRTRefreshRate ("Refresh Rate", Float) = 24 _VideoCRTPixelEnergizedTime ("Pixel Fade Time", Float) = 1.9 [HideInInspector] m_end_CRT ("CRT Options", Float) = 0 - + [HideInInspector] m_start_Gameboy ("Gameboy Options--{condition_showS:(_VideoType==4)}", Float) = 0 [sRGBWarning(true)][Gradient]_VideoGameboyRamp ("Color Ramp", 2D) = "white" { } [HideInInspector] m_end_Gameboy ("Gameboy Options", Float) = 0 - + [HideInInspector] m_end_videoEffects ("Video Effects", Float) = 0 //endex - + //ifex _VoronoiEnabled!=1 [HideInInspector] m_start_voronoi ("Voronoi--{reference_property:_VoronoiEnabled}", Int) = 0 [HideInInspector][ThryToggle(POI_VORONOI)]_VoronoiEnabled ("Voronoi Enabled", Int) = 0 @@ -3169,20 +3246,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Enum(Local, 0, World, 1, UV, 2)] _VoronoiSpace ("Space", Int) = 0 [Enum(Color and Emission, 0, Just Emission, 1)] _VoronoiBlend ("Blend", Int) = 0 [ToggleUI]_VoronoiAffectsMaterialAlpha ("Affects Material Alpha", Int) = 0 - + [sRGBWarning] _VoronoiMask ("Mask--{reference_properties:[_VoronoiMaskPan, _VoronoiMaskUV, _VoronoiMaskChannel]}", 2D) = "white" { } [HideInInspector][Vector2] _VoronoiMaskPan ("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)] _VoronoiMaskUV ("UV", Int) = 0 [HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)] _VoronoiMaskChannel ("Channel", 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)] _VoronoiGlobalMask ("Global Mask--{reference_property:_VoronoiGlobalMaskBlendType}", Int) = 0 [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _VoronoiGlobalMaskBlendType ("Blending", Int) = 2 - + [sRGBWarning] _VoronoiNoise ("Noise--{reference_properties:[_VoronoiNoisePan, _VoronoiNoiseUV, _VoronoiNoiseChannel]}", 2D) = "black" { } [HideInInspector][Vector2] _VoronoiNoisePan ("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)] _VoronoiNoiseUV ("UV", Int) = 0 [HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)] _VoronoiNoiseChannel ("Channel", Int) = 0 - + _VoronoiNoiseIntensity ("Noise Intensity", Range(0, 1)) = .1 _VoronoiOuterColor ("Outer Color", Color) = (0, 0, 0, 1) _VoronoiOuterEmissionStrength ("Outer Emission", Range(0, 20)) = 0 @@ -3192,13 +3269,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _VoronoiPower ("Power", Float) = 0.45454545 _VoronoiScale ("Scale", Float) = 5.0 [Vector3]_VoronoiSpeed ("Speed", Vector) = (1.0, 1.0, 1.0) - + [HideInInspector] m_start_voronoiRandom ("Voronoi Random Cell Color--{reference_property:_VoronoiEnableRandomCellColor}", Int) = 0 [HideInInspector][ToggleUI]_VoronoiEnableRandomCellColor ("Rando Cell Col", Int) = 0 [MultiSlider]_VoronoiRandomMinMaxSaturation ("Saturation Range", Vector) = (0.8, 1, 0, 1) [MultiSlider]_VoronoiRandomMinMaxBrightness ("Brightness Range", Vector) = (0.8, 1, 0, 1) [HideInInspector] m_end_voronoiRandom ("Voronoi Random Cell Color", Float) = 0 - + [HideInInspector] m_start_VoronoiAudioLink ("Audio Link ♫--{condition_showS:_EnableAudioLink==1}", Float) = 0 [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkVoronoiInnerEmissionBand ("Inner Emission Band", Int) = 0 [VectorLabel(Min, Max)]_AudioLinkVoronoiInnerEmission ("Inner Emission Mod", Vector) = (0, 0, 0, 0) @@ -3222,12 +3299,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3, Volume, 4)] _AudioLinkVoronoiChronoSpeedZBand ("Speed Z Band", Int) = 0 _AudioLinkVoronoiChronoSpeedZSpeed ("Speed Z", Float) = 0 [HideInInspector] m_end_VoronoiAudioLink ("Audio Link", Float) = 0 - + [HideInInspector] m_end_voronoi ("Voronoi", Float) = 0 //endex - + //ifex _EnableAudioLink==0 - [HideInInspector] m_AudioLinkCategory (" Audio Link--{reference_property:_EnableAudioLink}", Float) = 0 + [HideInInspector] m_AudioLinkCategory (" Audio Link--{reference_property:_EnableAudioLink, button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/audio-link/},hover:Documentation}}", Float) = 0 [HideInInspector] m_start_audioLink ("Audio Link", Float) = 0 [HideInInspector][ThryToggle(POI_AUDIOLINK)] _EnableAudioLink ("Enabled", Float) = 0 [Helpbox(1)] _AudioLinkHelp ("This section houses the global controls for audio link. Controls for individual features are in their respective sections. (Emission, Dissolve, etc...)", Int) = 0 @@ -3242,7 +3319,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _AudioLinkSmoothingHighMid ("High Mid", Range(0, 1)) = 0 _AudioLinkSmoothingTreble ("Treble", Range(0, 1)) = 0 [HideInInspector] m_end_audioLink ("Audio Link", Float) = 0 - + [HideInInspector] m_start_audioLinkOverrides ("Overrides", Float) = 0 [HideInInspector] s_start_AudioLinkBandOverrides ("Band Overrides--{reference_property:_AudioLinkBandOverridesEnabled,persistent_expand:true,default_expand:true}", Float) = 1 [HideInInspector][ToggleUI] _AudioLinkBandOverridesEnabled ("Band Overrides", Float) = 0 @@ -3251,10 +3328,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector] m_end_audioLinkOverrides ("Overrides", Float) = 0 //endex //ifex _EnableALDecal==0 - [HideInInspector] m_start_ALDecalSpectrum ("AL ♫ Spectrum--{ reference_property:_EnableALDecal}", Float) = 0 + [HideInInspector] m_start_ALDecalSpectrum ("AL ♫ Spectrum--{ reference_property:_EnableALDecal, button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/audio-link/spectrum},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(POI_AL_DECAL)]_EnableALDecal ("Enable AL Decal", Float) = 0 [HideInInspector][ThryWideEnum(lil Spectrum, 0)] _ALDecalType ("AL Type--{ condition_showS:_EnableAudioLink==1}", Int) = 0 - + [ThryHeaderLabel(Transform, 13)] [Space(4)] [Enum(Normal, 0, Circle, 1)] _ALDecalUVMode ("UV Mode", Float) = 0 @@ -3265,29 +3342,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _ALUVRotationSpeed ("Rotation Speed", Float) = 0 _ALDecalLineWidth ("Line Width", Range(0, 1)) = 1.0 _ALDecaldCircleDimensions ("Cirlce Dimensions--{ condition_showS:_ALDecalUVMode==1}", Vector) = (0, 1, 0, 1) - + [Space][ThryHeaderLabel(Volume, 13)] [Space(4)] _ALDecalVolumeStep ("Volume Step Num (0 = Off)", Float) = 0.0 _ALDecalVolumeClipMin ("Volume Clip Min", Range(0, 1)) = 0.0 _ALDecalVolumeClipMax ("Volume Clip Max", Range(0, 1)) = 1.0 - + [Space][ThryHeaderLabel(Band, 13)] [Space(4)] _ALDecalBandStep ("Band Step Num (0 = Off)", Float) = 0.0 _ALDecalBandClipMin ("Band Clip Min", Range(0, 1)) = 0.0 _ALDecalBandClipMax ("Band Clip Max", Range(0, 1)) = 1.0 - + [Space][ThryToggleUI(true)]_ALDecalShapeClip (" Shape Clip", Float) = 0 _ALDecalShapeClipVolumeWidth ("Volume Width--{ condition_showS:_ALDecalShapeClip==1}", Range(0, 1)) = 0.5 _ALDecalShapeClipBandWidth ("Band Width--{ condition_showS:_ALDecalShapeClip==1}", Range(0, 1)) = 0.5 - + [Space][ThryHeaderLabel(Audio Mods, 13)] [Space(4)] _ALDecalVolume ("Volume", Int) = 0.5 _ALDecalBaseBoost ("Bass Boost", Float) = 5.0 _ALDecalTrebleBoost ("Treble Boost", Float) = 1.0 - + [Space][ThryHeaderLabel(Colors and Blending, 13)] [Space(4)] [sRGBWarning(true)][ThryRGBAPacker(RGB Color, A Mask, sRGB, false)]_ALDecalColorMask ("Color & Mask--{reference_properties:[_ALDecalColorMaskPan, _ALDecalColorMaskUV]}", 2D) = "white" { } @@ -3310,14 +3387,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _ALDecalGlobalMaskBlendType ("Blending", Int) = 2 [HideInInspector] m_end_ALDecalSpectrum ("AL ♫ Spectrum", Float) = 0 //endex - + //ifex _EnableVolumeColor==0 - [HideInInspector] m_start_ALVolumeColor ("AL ♫ Volume Color--{ reference_property:_EnableVolumeColor}", Float) = 0 + [HideInInspector] m_start_ALVolumeColor ("AL ♫ Volume Color--{ reference_property:_EnableVolumeColor, button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/audio-link/volume-color},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(POI_AL_VOLUMECOLOR)]_EnableVolumeColor ("Enable AL Volume Color", Float) = 0 [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _ALVolumeColorUV ("UV", Int) = 0 [Enum(X, 0, Y, 1)] _ALVolumeColorDirection ("UV Direction", Int) = 0 [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Lighten, 5, Screen, 6, Subtract, 7, Add, 8, Overlay, 9, Mixed, 20)]_ALVolumeColorBlendType ("Blend Type", Range(0, 1)) = 0 - + _ALVolumeColorBlendAlpha ("Alpha", Range(0,1)) = 1 _ALVolumeColorLow ("Volume Color Low--{reference_property:_ALVolumeColorLowThemeIndex}", Color) = (0, 0, 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)] _ALVolumeColorLowThemeIndex ("", Int) = 0 @@ -3328,16 +3405,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _ALVolumeColorHigh ("Volume Color High--{reference_property:_ALVolumeColorHighThemeIndex}", Color) = (1, 0, 0) [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)] _ALVolumeColorHighThemeIndex ("", Int) = 0 _ALHighEmission ("High Emission", Range(0, 20)) = 0 - + [HideInInspector] m_end_ALVolumeColor ("AL ♫ Volume Color", Float) = 0 //endex - + [HideInInspector] m_modifierCategory ("Global Modifiers & Data", Float) = 0 [HideInInspector] m_start_PoiGlobalCategory ("Global Data and Masks", Float) = 0 //ifex _BlackLightMaskingEnabled==0 [HideInInspector] m_start_BlackLightMasking ("BlackLight Masking--{reference_property:_BlackLightMaskingEnabled}", Float) = 0 [HideInInspector][ThryToggle(POI_BLACKLIGHTMASKING)] _BlackLightMaskingEnabled ("BlackLight Masking Enabled", Float) = 0 - + [ThryHeaderLabel(One, 13)] _BlackLightMasking0Key ("Key", Float) = 1 [Vector2] _BlackLightMasking0Range ("Range", Vector) = (0.1, 0.5, 0, 0) @@ -3361,10 +3438,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Vector2] _BlackLightMasking3Range ("Range", Vector) = (0.1, 0.5, 0, 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)] _BlackLightMasking3GlobalMaskIndex ("Apply to Global Mask--{reference_property:_BlackLightMasking3GlobalMaskBlendType}", Int) = 0 [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)]_BlackLightMasking3GlobalMaskBlendType ("Blending", Range(0, 1)) = 0 - + [HideInInspector] m_end_BlackLightMasking ("BlackLight Masking", Float) = 0 //endex - + [HideInInspector] m_start_GlobalThemes ("Global Themes--{button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/color-and-normals/global-themes},hover:Documentation}}", Float) = 0 [HideInInspector] m_start_GlobalThemeColor0 ("Theme Color 0", Float) = 0 [HDR]_GlobalThemeColor0 ("Theme Color 0", Color ) = (1, 1, 1, 1) @@ -3395,13 +3472,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _GlobalThemeValue3 ("Value Adjust", Range(-1, 1)) = 0 [HideInInspector] m_end_GlobalThemeColor3 ("Theme Color 3", Float) = 0 [HideInInspector] m_end_GlobalThemes ("Global Themes", Float ) = 0 - - [HideInInspector] m_start_GlobalMask ("Global Mask", Float) = 0 - + + [HideInInspector] m_start_GlobalMask ("Global Mask--{button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/modifiers/global-masks},hover:Documentation}}", Float) = 0 + //ifex _GlobalMaskTexturesEnable==0 [HideInInspector] m_start_GlobalMaskTextures ("Textures--{reference_property:_GlobalMaskTexturesEnable}", Float) = 0 [HideInInspector][ThryToggle(POI_GLOBALMASK_TEXTURES)] _GlobalMaskTexturesEnable ("Global Mask Textures Enable", Float) = 0 - + [sRGBWarning][ThryRGBAPacker(R, G, B, A, linear, false)]_GlobalMaskTexture0 ("Global Mask Texture 1--{reference_properties:[_GlobalMaskTexture0Pan, _GlobalMaskTexture0SplitTilingOffset_G, _GlobalMaskTexture0SplitPan_G, _GlobalMaskTexture0SplitTilingOffset_B, _GlobalMaskTexture0SplitPan_B, _GlobalMaskTexture0SplitTilingOffset_A, _GlobalMaskTexture0SplitPan_A, _GlobalMaskTexture0Split, _GlobalMaskTexture0UV]}", 2D) = "white" { } [HideInInspector][Vector2]_GlobalMaskTexture0Pan ("Panning", Vector) = (0, 0, 0, 0) [ThryHeaderLabel(G Channel)] @@ -3415,7 +3492,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][Vector2]_GlobalMaskTexture0SplitPan_A ("Panning--{condition_showS:(_GlobalMaskTexture0Split==1)}", Vector) = (0, 0, 0, 0) [HideInInspector][ToggleUI] _GlobalMaskTexture0Split ("Split Sampling", Int) = 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)]_GlobalMaskTexture0UV ("UV", Int) = 0 - + [sRGBWarning][ThryRGBAPacker(R, G, B, A, linear, false)]_GlobalMaskTexture1 ("Global Mask Texture 2--{reference_properties:[_GlobalMaskTexture1Pan, _GlobalMaskTexture1SplitTilingOffset_G, _GlobalMaskTexture1SplitPan_G, _GlobalMaskTexture1SplitTilingOffset_B, _GlobalMaskTexture1SplitPan_B, _GlobalMaskTexture1SplitTilingOffset_A, _GlobalMaskTexture1SplitPan_A, _GlobalMaskTexture1Split, _GlobalMaskTexture1UV]}", 2D) = "white" { } [HideInInspector][Vector2]_GlobalMaskTexture1Pan ("Panning", Vector) = (0, 0, 0, 0) [ThryHeaderLabel(G Channel)] @@ -3429,7 +3506,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][Vector2]_GlobalMaskTexture1SplitPan_A ("Panning--{condition_showS:(_GlobalMaskTexture1Split==1)}", Vector) = (0, 0, 0, 0) [HideInInspector][ToggleUI] _GlobalMaskTexture1Split ("Split Sampling", Int) = 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)]_GlobalMaskTexture1UV ("UV", Int) = 0 - + [sRGBWarning][ThryRGBAPacker(R, G, B, A, linear, false)]_GlobalMaskTexture2 ("Global Mask Texture 3--{reference_properties:[_GlobalMaskTexture2Pan, _GlobalMaskTexture2SplitTilingOffset_G, _GlobalMaskTexture2SplitPan_G, _GlobalMaskTexture2SplitTilingOffset_B, _GlobalMaskTexture2SplitPan_B, _GlobalMaskTexture2SplitTilingOffset_A, _GlobalMaskTexture2SplitPan_A, _GlobalMaskTexture2Split, _GlobalMaskTexture2UV]}", 2D) = "white" { } [HideInInspector][Vector2]_GlobalMaskTexture2Pan ("Panning", Vector) = (0, 0, 0, 0) [ThryHeaderLabel(G Channel)] @@ -3443,7 +3520,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][Vector2]_GlobalMaskTexture2SplitPan_A ("Panning--{condition_showS:(_GlobalMaskTexture2Split==1)}", Vector) = (0, 0, 0, 0) [HideInInspector][ToggleUI] _GlobalMaskTexture2Split ("Split Sampling", Int) = 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)]_GlobalMaskTexture2UV ("UV", Int) = 0 - + [sRGBWarning][ThryRGBAPacker(R, G, B, A, linear, false)]_GlobalMaskTexture3 ("Global Mask Texture 4--{reference_properties:[_GlobalMaskTexture3Pan, _GlobalMaskTexture3SplitTilingOffset_G, _GlobalMaskTexture3SplitPan_G, _GlobalMaskTexture3SplitTilingOffset_B, _GlobalMaskTexture3SplitPan_B, _GlobalMaskTexture3SplitTilingOffset_A, _GlobalMaskTexture3SplitPan_A, _GlobalMaskTexture3Split, _GlobalMaskTexture3UV]}", 2D) = "white" { } [HideInInspector][Vector2]_GlobalMaskTexture3Pan ("Panning", Vector) = (0, 0, 0, 0) [ThryHeaderLabel(G Channel)] @@ -3457,10 +3534,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][Vector2]_GlobalMaskTexture3SplitPan_A ("Panning--{condition_showS:(_GlobalMaskTexture3Split==1)}", Vector) = (0, 0, 0, 0) [HideInInspector][ToggleUI] _GlobalMaskTexture3Split ("Split Sampling", Int) = 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)]_GlobalMaskTexture3UV ("UV", Int) = 0 - + [HideInInspector] m_end_GlobalMaskTextures ("Global Mask Textures", Float) = 0 //endex - + //ifex _GlobalMaskVertexColorRed==0 && _GlobalMaskVertexColorGreen==0 && _GlobalMaskVertexColorBlue==0 && _GlobalMaskVertexColorAlpha==0 [HideInInspector] m_start_GlobalMaskVertexColors ("Vertex Colors", Int) = 0 [ToggleUI] _GlobalMaskVertexColorLinearSpace ("Linear Colors", Float) = 1 @@ -3474,9 +3551,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][ThryWideEnum(Add, 7, Subtract, 1, Multiply, 2, Divide, 3, Min, 4, Max, 5, Average, 6, Replace, 0)] _GlobalMaskVertexColorAlphaBlendType ("Blending", Int) = 2 [HideInInspector] m_end_GlobalMaskVertexColors ("Vertex Colors", Int) = 0 //endex - + [HideInInspector] m_start_GlobalMaskModifiers ("Modifiers", Float) = 0 - + //ifex _GlobalMaskModifiersBackfaceEnable==0 [HideInInspector] m_start_GlobalMaskModifiersBackface ("Backface Masking--{reference_property:_GlobalMaskModifiersBackfaceEnable}", Float) = 0 [HideInInspector][NoAnimate][ThryToggleUI(true)] _GlobalMaskModifiersBackfaceEnable ("Global Mask Backface Enable", Float) = 0 @@ -3498,7 +3575,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Enum(Both, 0, Back Only, 1, Front Only, 2)] _GlobalMaskBackface_15 ("4A", Int) = 0 [HideInInspector] m_end_GlobalMaskModifiersBackface ("", Float) = 0 //endex - + //ifex _GlobalMaskModifiersMirrorEnable==0 [HideInInspector] m_start_GlobalMaskModifiersMirror ("Mirror Masking--{reference_property:_GlobalMaskModifiersMirrorEnable}", Float) = 0 [HideInInspector][NoAnimate][ThryToggleUI(true)] _GlobalMaskModifiersMirrorEnable ("Global Mask Mirror Enable", Float) = 0 @@ -3521,7 +3598,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Enum(Both, 0, Only Outside Mirror, 1, Only In Mirror, 2)] _GlobalMaskMirror_15 ("4A", Int) = 0 [HideInInspector] m_end_GlobalMaskModifiersMirror ("", Float) = 0 //endex - + //ifex _GlobalMaskModifiersCameraEnable==0 [HideInInspector] m_start_GlobalMaskModifiersCamera ("Camera Masking--{reference_property:_GlobalMaskModifiersCameraEnable}", Float) = 0 [HideInInspector][NoAnimate][ThryToggleUI(true)] _GlobalMaskModifiersCameraEnable ("Global Mask Camera Enable", Float) = 0 @@ -3544,11 +3621,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Enum(Both, 0, Only Outside Camera, 1, Only In Camera, 2)] _GlobalMaskCamera_15 ("4A", Int) = 0 [HideInInspector] m_end_GlobalMaskModifiersCamera ("", Float) = 0 //endex - + //ifex _GlobalMaskModifiersDistanceEnable==0 [HideInInspector] m_start_GlobalMaskModifiersDistance ("Distance Masking--{reference_property:_GlobalMaskModifiersDistanceEnable}", Float) = 0 [HideInInspector][NoAnimate][ThryToggleUI(true)] _GlobalMaskModifiersDistanceEnable ("Global Mask Camera Enable", Float) = 0 - + //ifex _GlobalMaskDistanceEnable_0==0// [Vector2] _GlobalMaskDistance_0 ("1R", Vector) = (1,2,0,0) [HideInInspector] m_start_GlobalMaskDistanceM_0 ("1R--{reference_property:_GlobalMaskDistanceEnable_0}", Float) = 0 [HideInInspector][ThryToggleUI(true)] _GlobalMaskDistanceEnable_0 ("", Int) = 0 @@ -3560,7 +3637,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryWideEnum(Replace, 0, Multiply, 2)] _GlobalMaskDistanceBlendType_0 ("Blending", Int) = 0 [HideInInspector] m_end_GlobalMaskDistanceM_0 ("", Float) = 0 //endex - + //ifex _GlobalMaskDistanceEnable_1==0 [HideInInspector] m_start_GlobalMaskDistanceM_1 ("1G--{reference_property:_GlobalMaskDistanceEnable_1}", Float) = 0 [HideInInspector][ThryToggleUI(true)] _GlobalMaskDistanceEnable_1 ("", Int) = 0 @@ -3572,7 +3649,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryWideEnum(Replace, 0, Multiply, 2)] _GlobalMaskDistanceBlendType_1 ("Blending", Int) = 0 [HideInInspector] m_end_GlobalMaskDistanceM_1 ("", Float) = 0 //endex - + //ifex _GlobalMaskDistanceEnable_2==0 [HideInInspector] m_start_GlobalMaskDistanceM_2 ("1B--{reference_property:_GlobalMaskDistanceEnable_2}", Float) = 0 [HideInInspector][ThryToggleUI(true)] _GlobalMaskDistanceEnable_2 ("", Int) = 0 @@ -3584,7 +3661,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryWideEnum(Replace, 0, Multiply, 2)] _GlobalMaskDistanceBlendType_2 ("Blending", Int) = 0 [HideInInspector] m_end_GlobalMaskDistanceM_2 ("", Float) = 0 //endex - + //ifex _GlobalMaskDistanceEnable_3==0 [HideInInspector] m_start_GlobalMaskDistanceM_3 ("1A--{reference_property:_GlobalMaskDistanceEnable_3}", Float) = 0 [HideInInspector][ThryToggleUI(true)] _GlobalMaskDistanceEnable_3 ("", Int) = 0 @@ -3596,7 +3673,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryWideEnum(Replace, 0, Multiply, 2)] _GlobalMaskDistanceBlendType_3 ("Blending", Int) = 0 [HideInInspector] m_end_GlobalMaskDistanceM_3 ("", Float) = 0 //endex - + //ifex _GlobalMaskDistanceEnable_4==0 [HideInInspector] m_start_GlobalMaskDistanceM_4 ("2R--{reference_property:_GlobalMaskDistanceEnable_4}", Float) = 0 [HideInInspector][ThryToggleUI(true)] _GlobalMaskDistanceEnable_4 ("", Int) = 0 @@ -3608,7 +3685,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryWideEnum(Replace, 0, Multiply, 2)] _GlobalMaskDistanceBlendType_4 ("Blending", Int) = 0 [HideInInspector] m_end_GlobalMaskDistanceM_4 ("", Float) = 0 //endex - + //ifex _GlobalMaskDistanceEnable_5==0 [HideInInspector] m_start_GlobalMaskDistanceM_5 ("2G--{reference_property:_GlobalMaskDistanceEnable_5}", Float) = 0 [HideInInspector][ThryToggleUI(true)] _GlobalMaskDistanceEnable_5 ("", Int) = 0 @@ -3620,7 +3697,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryWideEnum(Replace, 0, Multiply, 2)] _GlobalMaskDistanceBlendType_5 ("Blending", Int) = 0 [HideInInspector] m_end_GlobalMaskDistanceM_5 ("", Float) = 0 //endex - + //ifex _GlobalMaskDistanceEnable_6==0 [HideInInspector] m_start_GlobalMaskDistanceM_6 ("2B--{reference_property:_GlobalMaskDistanceEnable_6}", Float) = 0 [HideInInspector][ThryToggleUI(true)] _GlobalMaskDistanceEnable_6 ("", Int) = 0 @@ -3632,7 +3709,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryWideEnum(Replace, 0, Multiply, 2)] _GlobalMaskDistanceBlendType_6 ("Blending", Int) = 0 [HideInInspector] m_end_GlobalMaskDistanceM_6 ("", Float) = 0 //endex - + //ifex _GlobalMaskDistanceEnable_7==0 [HideInInspector] m_start_GlobalMaskDistanceM_7 ("2A--{reference_property:_GlobalMaskDistanceEnable_7}", Float) = 0 [HideInInspector][ThryToggleUI(true)] _GlobalMaskDistanceEnable_7 ("", Int) = 0 @@ -3644,7 +3721,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryWideEnum(Replace, 0, Multiply, 2)] _GlobalMaskDistanceBlendType_7 ("Blending", Int) = 0 [HideInInspector] m_end_GlobalMaskDistanceM_7 ("", Float) = 0 //endex - + //ifex _GlobalMaskDistanceEnable_8==0 [HideInInspector] m_start_GlobalMaskDistanceM_8 ("3R--{reference_property:_GlobalMaskDistanceEnable_8}", Float) = 0 [HideInInspector][ThryToggleUI(true)] _GlobalMaskDistanceEnable_8 ("", Int) = 0 @@ -3656,7 +3733,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryWideEnum(Replace, 0, Multiply, 2)] _GlobalMaskDistanceBlendType_8 ("Blending", Int) = 0 [HideInInspector] m_end_GlobalMaskDistanceM_8 ("", Float) = 0 //endex - + //ifex _GlobalMaskDistanceEnable_9==0 [HideInInspector] m_start_GlobalMaskDistanceM_9 ("3G--{reference_property:_GlobalMaskDistanceEnable_9}", Float) = 0 [HideInInspector][ThryToggleUI(true)] _GlobalMaskDistanceEnable_9 ("", Int) = 0 @@ -3668,7 +3745,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryWideEnum(Replace, 0, Multiply, 2)] _GlobalMaskDistanceBlendType_9 ("Blending", Int) = 0 [HideInInspector] m_end_GlobalMaskDistanceM_9 ("", Float) = 0 //endex - + //ifex _GlobalMaskDistanceEnable_10==0 [HideInInspector] m_start_GlobalMaskDistanceM_10 ("3B--{reference_property:_GlobalMaskDistanceEnable_10}", Float) = 0 [HideInInspector][ThryToggleUI(true)] _GlobalMaskDistanceEnable_10 ("", Int) = 0 @@ -3680,7 +3757,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryWideEnum(Replace, 0, Multiply, 2)] _GlobalMaskDistanceBlendType_10 ("Blending", Int) = 0 [HideInInspector] m_end_GlobalMaskDistanceM_10 ("", Float) = 0 //endex - + //ifex _GlobalMaskDistanceEnable_11==0 [HideInInspector] m_start_GlobalMaskDistanceM_11 ("3A--{reference_property:_GlobalMaskDistanceEnable_11}", Float) = 0 [HideInInspector][ThryToggleUI(true)] _GlobalMaskDistanceEnable_11 ("", Int) = 0 @@ -3692,7 +3769,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryWideEnum(Replace, 0, Multiply, 2)] _GlobalMaskDistanceBlendType_11 ("Blending", Int) = 0 [HideInInspector] m_end_GlobalMaskDistanceM_11 ("", Float) = 0 //endex - + //ifex _GlobalMaskDistanceEnable_12==0 [HideInInspector] m_start_GlobalMaskDistanceM_12 ("4R--{reference_property:_GlobalMaskDistanceEnable_12}", Float) = 0 [HideInInspector][ThryToggleUI(true)] _GlobalMaskDistanceEnable_12 ("", Int) = 0 @@ -3704,7 +3781,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryWideEnum(Replace, 0, Multiply, 2)] _GlobalMaskDistanceBlendType_12 ("Blending", Int) = 0 [HideInInspector] m_end_GlobalMaskDistanceM_12 ("", Float) = 0 //endex - + //ifex _GlobalMaskDistanceEnable_13==0 [HideInInspector] m_start_GlobalMaskDistanceM_13 ("4G--{reference_property:_GlobalMaskDistanceEnable_13}", Float) = 0 [HideInInspector][ThryToggleUI(true)] _GlobalMaskDistanceEnable_13 ("", Int) = 0 @@ -3716,7 +3793,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryWideEnum(Replace, 0, Multiply, 2)] _GlobalMaskDistanceBlendType_13 ("Blending", Int) = 0 [HideInInspector] m_end_GlobalMaskDistanceM_13 ("", Float) = 0 //endex - + //ifex _GlobalMaskDistanceEnable_14==0 [HideInInspector] m_start_GlobalMaskDistanceM_14 ("4B--{reference_property:_GlobalMaskDistanceEnable_14}", Float) = 0 [HideInInspector][ThryToggleUI(true)] _GlobalMaskDistanceEnable_14 ("", Int) = 0 @@ -3728,7 +3805,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryWideEnum(Replace, 0, Multiply, 2)] _GlobalMaskDistanceBlendType_14 ("Blending", Int) = 0 [HideInInspector] m_end_GlobalMaskDistanceM_14 ("", Float) = 0 //endex - + //ifex _GlobalMaskDistanceEnable_15==0 [HideInInspector] m_start_GlobalMaskDistanceM_15 ("4A--{reference_property:_GlobalMaskDistanceEnable_15}", Float) = 0 [HideInInspector][ThryToggleUI(true)] _GlobalMaskDistanceEnable_15 ("", Int) = 0 @@ -3740,17 +3817,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryWideEnum(Replace, 0, Multiply, 2)] _GlobalMaskDistanceBlendType_15 ("Blending", Int) = 0 [HideInInspector] m_end_GlobalMaskDistanceM_15 ("", Float) = 0 //endex - + [HideInInspector] m_end_GlobalMaskModifiersDistance ("", Float) = 0 //endex - + [HideInInspector] m_end_GlobalMaskModifiers ("", Float) = 0 - + //ifex _GlobalMaskOptionsEnable==0 [HideInInspector] m_start_GlobalMaskOptions ("Options--{reference_property:_GlobalMaskOptionsEnable}", Float) = 0 [HideInInspector][NoAnimate][ThryToggleUI(true)] _GlobalMaskOptionsEnable ("Global Mask Options Enable", Float) = 0 [Enum(Sliders, 0, Min Max Sliders, 1, Force Toggles, 2)] _GlobalMaskOptionsType ("Type", Int) = 0 - + //ifex _GlobalMaskOptionsType!=0 [HideInInspector] s_start_GlobalMaskOptionsSliders ("Options--{persistent_expand:true,default_expand:false,condition_showS:_GlobalMaskOptionsType==0}", Int) = 0 _GlobalMaskSlider_0 ("1R", Range(-1, 1)) = 0 @@ -3771,7 +3848,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _GlobalMaskSlider_15 ("4A", Range(-1, 1)) = 0 [HideInInspector] s_end_GlobalMaskOptionsSliders ("", Int) = 0 //endex - + //ifex _GlobalMaskOptionsType!=1 [HideInInspector] s_start_GlobalMaskOptionsMinMaxSliders ("Options--{persistent_expand:true,default_expand:false,condition_showS:_GlobalMaskOptionsType==1}", Int) = 0 [MultiSlider] _GlobalMaskMinMaxSlider_0 ("1R", Vector) = (0, 1, 0, 1) @@ -3792,7 +3869,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [MultiSlider] _GlobalMaskMinMaxSlider_15 ("4A", Vector) = (0, 1, 0, 1) [HideInInspector] s_end_GlobalMaskOptionsMinMaxSliders ("", Int) = 0 //endex - + //ifex _GlobalMaskOptionsType!=2 [HideInInspector] s_start_GlobalMaskOptionsForceToggles ("Options--{persistent_expand:true,default_expand:false,condition_showS:_GlobalMaskOptionsType==2}", Int) = 0 [ThryHeaderLabel(Force On)] @@ -3832,12 +3909,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ToggleUI] _GlobalMaskToggleOff_15 ("4A", Int) = 0 [HideInInspector] s_end_GlobalMaskOptionsForceToggles ("", Int) = 0 //endex - + [HideInInspector] m_end_GlobalMaskOptions ("Global Mask Options", Float) = 0 //endex - + [HideInInspector] m_end_GlobalMask ("Global Mask", Float) = 0 - + [HideInInspector] m_end_PoiGlobalCategory ("Global Data and Masks ", Float) = 0 [HideInInspector] m_start_PoiUVCategory ("UVs", Float) = 0 [HideInInspector] m_start_Stochastic ("Stochastic Sampling", Float) = 0 @@ -3852,7 +3929,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _StochasticHexFallOffPower("Falloff Power", Range(0, 20)) = 7 [HideInInspector] s_end_hextile ("Hextile", Float) = 0 [HideInInspector] m_end_Stochastic ("Stochastic Sampling", Float) = 0 - + //ifex _EnableDistortion==0 [HideInInspector] m_start_uvDistortion (" Distortion UV--{reference_property:_EnableDistortion}", Float) = 0 [HideInInspector][ThryToggle(USER_LUT)] _EnableDistortion ("Enabled", Float) = 0 @@ -3879,7 +3956,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector] m_end_DistortionAudioLink ("Audio Link", Float) = 0 [HideInInspector] m_end_uvDistortion ("Distortion UV", Float) = 0 //endex - + [HideInInspector] m_start_uvLocalWorld ("Local World UV", Float) = 0 [ThryWideEnum(X, 0, Y, 1, Z, 2, Zero, 3, VColor R, 4, VColor G, 5, VColor B, 6, VColor A, 7)] _UVModLocalPos0 ("Local X", Int) = 0 [ThryWideEnum(X, 0, Y, 1, Z, 2, Zero, 3, VColor R, 4, VColor G, 5, VColor B, 6, VColor A, 7)] _UVModLocalPos1 ("Local Y", Int) = 1 @@ -3887,12 +3964,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [ThryWideEnum(X, 0, Y, 1, Z, 2, Zero, 3)] _UVModWorldPos0 ("World X", Int) = 0 [ThryWideEnum(X, 0, Y, 1, Z, 2, Zero, 3)] _UVModWorldPos1 ("World Y", Int) = 2 [HideInInspector] m_end_uvLocalWorld ("Local World UV", Float) = 0 - + [HideInInspector] m_start_uvPanosphere ("Panosphere UV", Float) = 0 [ToggleUI] _StereoEnabled ("Stereo Enabled", Float) = 0 [ToggleUI] _PanoUseBothEyes ("Perspective Correct (VR)", Float) = 1 [HideInInspector] m_end_uvPanosphere ("Panosphere UV", Float) = 0 - + [HideInInspector] m_start_uvPolar ("Polar UV", Float) = 0 [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos, 5, Local Pos, 8)] _PolarUV ("UV", Int) = 0 [Vector2]_PolarCenter ("Center Coordinate", Vector) = (.5, .5, 0, 0) @@ -3900,16 +3977,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _PolarLengthScale ("Length Scale", Float) = 1 _PolarSpiralPower ("Spiral Power", Float) = 0 [HideInInspector] m_end_uvPolar ("Polar UV", Float) = 0 - + //ifex _PoiParallax==0 - [HideInInspector] m_start_parallax (" Parallax Heightmapping--{reference_property:_PoiParallax}", Float) = 0 + [HideInInspector] m_start_parallax (" Parallax Heightmapping--{reference_property:_PoiParallax, button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/modifiers/uvs/parallax},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(POI_PARALLAX)]_PoiParallax ("Enable", Float) = 0 [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos, 5, Local Pos, 8, Polar UV, 6, Distorted UV, 7)]_ParallaxUV ("Applies To: ", Int) = 0 - + [sRGBWarning][ThryTexture]_HeightMap ("Heightmap--{reference_properties:[_HeightMapPan, _HeightMapUV]}", 2D) = "white" { } [HideInInspector][Vector2]_HeightMapPan ("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)]_HeightMapUV ("UV", Int) = 0 - + [sRGBWarning][ThryTexture]_Heightmask ("Mask--{reference_properties:[_HeightmaskPan, _HeightmaskUV, _HeightmaskChannel, _HeightmaskInvert]}", 2D) = "white" { } [HideInInspector][Vector2]_HeightmaskPan ("Panning", Vector) = (0, 0, 0, 0) [HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)]_HeightmaskChannel ("Channel", Float) = 0 @@ -3930,10 +4007,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // [ThryToggle]_ParallaxWorldPos ("World Pos", Float) = 0 // [ThryToggle]_ParallaxPolar ("Polar", Float) = 0 // [ThryToggle]_ParallaxDist ("Distorted UV", Float) = 0 - + [HideInInspector] m_end_parallax ("Parallax Heightmapping", Float) = 0 //endex - + [HideInInspector] m_end_PoiUVCategory ("UVs ", Float) = 0 [HideInInspector] m_start_PoiPostProcessingCategory ("Post Processing", Float) = 0 [HideInInspector] m_start_PPAnimations ("PP Animations--{button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/post-processing/pp-animations},hover:Documentation}}", Float) = 0 @@ -3943,7 +4020,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _PPEmissionMultiplier ("Emission Multiplier", Float) = 1 _PPFinalColorMultiplier ("Final Color Multiplier", Float) = 1 [HideInInspector] m_end_PPAnimations ("PP Animations ", Float) = 0 - + //ifex _PostProcess==0 [HideInInspector] m_start_postprocess ("Post Processing--{reference_property:_PostProcess,button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/post-processing/main},hover:Documentation}}", Float) = 0 [HideInInspector][ThryToggle(POSTPROCESS)]_PostProcess ("Enable", Float) = 0 @@ -3952,7 +4029,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector][Enum(R, 0, G, 1, B, 2, A, 3)]_PPMaskChannel ("Channel", Float) = 0 [HideInInspector][ToggleUI]_PPMaskInvert ("Invert", Float) = 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)]_PPMaskUV ("UV", Int) = 0 - + + [ThryWideEnum(OKLab, 0, HSV, 1)] _PPHueShiftColorSpace ("Hue Color Space", Int) = 0 _PPHue ("Hue", Range(0, 1)) = 0 [HDR]_PPTint ("Tint", Color) = (1, 1, 1, 1) [VectorLabel(R,G,B)]_PPRGB ("RGB", Vector) = (1, 1, 1, 1) @@ -3961,15 +4039,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _PPBrightness ("Brightness", Float) = 1 _PPLightness ("Lightness", Float) = 0 _PPHDR ("HDR", Float) = 0 - + [ThryToggleUI(true)]_PPPosterization (" Posterization", Float) = 0 _PPPosterizationAmount ("Steps--{condition_showS:(_PPPosterization==1)}", Range(1, 30)) = 4 - + [HideInInspector] m_end_postprocess ("", Float) = 0 //endex - + [HideInInspector] m_end_PoiPostProcessingCategory ("Post Processing ", Float) = 0 - + [HideInInspector] m_thirdpartyCategory ("Third Party", Float) = 0 //ifex _BSSEnabled!=1 [HideInInspector] m_start_BeatsaberOptions ("Beatsaber support--{reference_property:_BSSEnabled}", int) = 0 @@ -3979,12 +4057,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Helpbox] _BSSHelpBox2 ("Glow is handled through the various emission options found in the shader!", int) = 0 [ThryRichLabel] _BSSSpacer2 ("―――――――[IMPORTANT]―――――――", int) = 0 [ThryRichLabel] _BSSSpacer3 ("", int) = 0 - + [HideInInspector]s_start_CCopt("Custom Colors:--{reference_property:_CustomColors}", int) = 1 [HideInInspector][MaterialToggle] _CustomColors ("", Float) = 0 [Helpbox] _BSSHelpBox3 ("To properly support custom colors on assets like sabers when material locking. you MUST right click the ''Color & Alpha'' property at the top and set it to ''Animated.''", int) = 0 [HideInInspector]s_end_CCopt("Custom Color Toggle:", int) = 1 - + //ifex _BSSBloomfog!=1 [HideInInspector] m_start_BeatsaberBloomFog ("Bloom & Height fog--{reference_property:_BSSBloomfog}", int) = 0 [ThryToggle(POIBS_BLOOMFOG)][HideInInspector] _BSSBloomfog ("Enable Bloomfog", int) = 0 @@ -3999,10 +4077,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector]s_end_heightFogOpt("", int) = 1 [HideInInspector] m_end_BeatsaberBloomFog ("", int) = 0 //endex - + [HideInInspector] m_end_BeatsaberOptions ("", Float) = 0 //endex - + [HideInInspector] m_renderingCategory ("Rendering--{button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/rendering/main},hover:Documentation}}", Float) = 0 [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2 [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4 @@ -4011,11 +4089,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" _OffsetFactor ("Offset Factor", Float) = 0.0 _OffsetUnits ("Offset Units", Float) = 0.0 [ToggleUI]_RenderingReduceClipDistance ("Reduce Clip Distance", Float) = 0 + [ToggleUI] _ZClip ("Z Clip", Float) = 1 [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0 + //[ToggleUI]_Conservative ("Conservative", Float) = 0 [ToggleUI]_FlipBackfaceNormals ("Flip Backface Normals", Int) = 1 [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown [ToggleUI] _RenderingEarlyZEnabled ("Early Z", Float) = 0 - + // Blending Options [HideInInspector] m_start_blending ("Blending--{button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/rendering/blending},hover:Documentation}}", Float) = 0 [Enum(Thry.BlendOp)]_BlendOp ("RGB Blend Op", Int) = 0 @@ -4025,7 +4105,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Enum(Thry.BlendOp)]_AddBlendOp ("RGB Blend Op", Int) = 4 [Enum(UnityEngine.Rendering.BlendMode)] _AddSrcBlend ("RGB Source Blend", Int) = 1 [Enum(UnityEngine.Rendering.BlendMode)] _AddDstBlend ("RGB Destination Blend", Int) = 1 - + [HideInInspector] m_start_alphaBlending ("Advanced Alpha Blending", Float) = 0 [Enum(Thry.BlendOp)]_BlendOpAlpha ("Alpha Blend Op", Int) = 0 [Enum(UnityEngine.Rendering.BlendMode)] _SrcBlendAlpha ("Alpha Source Blend", Int) = 1 @@ -4035,9 +4115,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Enum(UnityEngine.Rendering.BlendMode)] _AddSrcBlendAlpha ("Alpha Source Blend", Int) = 0 [Enum(UnityEngine.Rendering.BlendMode)] _AddDstBlendAlpha ("Alpha Destination Blend", Int) = 1 [HideInInspector] m_end_alphaBlending ("Advanced Alpha Blending", Float) = 0 - + [HideInInspector] m_end_blending ("Blending", Float) = 0 - + //ifex _EnableOutlines!=1 // Outline Blending Options [HideInInspector] m_start_outlineBlending ("Outline Blending", Float) = 0 @@ -4051,7 +4131,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [HideInInspector] m_end_outlineAlphaBlending ("Advanced Alpha Blending", Float) = 0 [HideInInspector] m_end_outlineBlending ("Outline Blending", Float) = 0 //endex - + // Stencils [HideInInspector] m_start_StencilPassOptions ("Stencil--{button_help:{text:Tutorial,action:{type:URL,data:https://www.poiyomi.com/rendering/stencil},hover:Documentation}}", Float) = 0 [ThryWideEnum(Simple, 0, Front Face vs Back Face, 1)] _StencilType ("Stencil Type", Float) = 0 @@ -4062,7 +4142,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op--{condition_showS:(_StencilType==0)}", Float) = 0 [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op--{condition_showS:(_StencilType==0)}", Float) = 0 [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function--{condition_showS:(_StencilType==0)}", Float) = 8 - + [HideInInspector] m_start_StencilPassBackOptions("Back--{condition_showS:(_StencilType==1)}", Float) = 0 [Helpbox(1)] _FFBFStencilHelp0 ("Front Face and Back Face Stencils only work when locked in due to Unity's Stencil managment", Int) = 0 [Enum(UnityEngine.Rendering.StencilOp)] _StencilBackPassOp ("Back Pass Op", Float) = 0 @@ -4070,7 +4150,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Enum(UnityEngine.Rendering.StencilOp)] _StencilBackZFailOp ("Back ZFail Op", Float) = 0 [Enum(UnityEngine.Rendering.CompareFunction)] _StencilBackCompareFunction ("Back Compare Function", Float) = 8 [HideInInspector] m_end_StencilPassBackOptions("Back", Float) = 0 - + [HideInInspector] m_start_StencilPassFrontOptions("Front--{condition_showS:(_StencilType==1)}", Float) = 0 [Helpbox(1)] _FFBFStencilHelp1 ("Front Face and Back Face Stencils only work when locked in due to Unity's Stencil managment", Int) = 0 [Enum(UnityEngine.Rendering.StencilOp)] _StencilFrontPassOp ("Front Pass Op", Float) = 0 @@ -4078,13 +4158,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Enum(UnityEngine.Rendering.StencilOp)] _StencilFrontZFailOp ("Front ZFail Op", Float) = 0 [Enum(UnityEngine.Rendering.CompareFunction)] _StencilFrontCompareFunction ("Front Compare Function", Float) = 8 [HideInInspector] m_end_StencilPassFrontOptions("Front", Float) = 0 - + [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0 - + //ifex _EnableOutlines!=1 // Outline Stencil [HideInInspector] m_start_OutlineStencil ("Outline Stencil", Float) = 0 - + [ThryWideEnum(Simple, 0, Front Face vs Back Face, 1)] _OutlineStencilType ("Stencil Type", Float) = 0 [IntRange] _OutlineStencilRef ("Stencil Reference Value", Range(0, 255)) = 0 [IntRange] _OutlineStencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255 @@ -4093,7 +4173,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilFailOp ("Stencil Fail Op--{condition_showS:(_OutlineStencilType==0)}", Float) = 0 [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilZFailOp ("Stencil ZFail Op--{condition_showS:(_OutlineStencilType==0)}", Float) = 0 [Enum(UnityEngine.Rendering.CompareFunction)] _OutlineStencilCompareFunction ("Stencil Compare Function--{condition_showS:(_OutlineStencilType==0)}", Float) = 8 - + [HideInInspector] m_start_OutlineStencilPassBackOptions ("Back--{condition_showS:(_OutlineStencilType==1)}", Float) = 0 [Helpbox(1)] _FFBFOutlineStencilHelp0 ("Front Face and Back Face Stencils only work when locked in due to Unity's Stencil managment", Int) = 0 [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilBackPassOp ("Back Pass Op", Float) = 0 @@ -4101,7 +4181,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilBackZFailOp ("Back ZFail Op", Float) = 0 [Enum(UnityEngine.Rendering.CompareFunction)] _OutlineStencilBackCompareFunction ("Back Compare Function", Float) = 8 [HideInInspector] m_end_OutlineStencilPassBackOptions ("Back", Float) = 0 - + [HideInInspector] m_start_OutlineStencilPassFrontOptions ("Front--{condition_showS:(_OutlineStencilType==1)}", Float) = 0 [Helpbox(1)] _FFBFOutlineStencilHelp1 ("Front Face and Back Face Stencils only work when locked in due to Unity's Stencil managment", Int) = 0 [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilFrontPassOp ("Front Pass Op", Float) = 0 @@ -4109,26 +4189,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilFrontZFailOp ("Front ZFail Op", Float) = 0 [Enum(UnityEngine.Rendering.CompareFunction)] _OutlineStencilFrontCompareFunction ("Front Compare Function", Float) = 8 [HideInInspector] m_end_OutlineStencilPassFrontOptions ("Front", Float) = 0 - + [HideInInspector] m_end_OutlineStencil ("Outline Stencil", Float) = 0 //endex - + } SubShader { Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "VRCFallback" = "Standard" } - + //ifex _RenderingEarlyZEnabled==0 - + Pass { Name "EarlyZ" Tags { "LightMode" = "ForwardBase" } - + ZWrite On Cull [_Cull] ColorMask 0 - + CGPROGRAM /* // Disable warnings we aren't interested in @@ -4143,80 +4223,80 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex 0==0 #pragma skip_optimizations d3d11 //endex - + #pragma shader_feature_local _STOCHASTICMODE_DELIOT_HEITZ _STOCHASTICMODE_HEXTILE _STOCHASTICMODE_NONE - + //ifex _MainColorAdjustToggle==0 #pragma shader_feature COLOR_GRADING_HDR //endex - + //#pragma shader_feature KEYWORD - + #pragma skip_variants LIGHTMAP_ON DYNAMICLIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK DIRLIGHTMAP_COMBINED _MIXED_LIGHTING_SUBTRACTIVE #pragma skip_variants DECALS_OFF DECALS_3RT DECALS_4RT DECAL_SURFACE_GRADIENT _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 #pragma skip_variants _ADDITIONAL_LIGHT_SHADOWS #pragma skip_variants PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 #pragma skip_variants _SCREEN_SPACE_OCCLUSION - + //ifex _GlobalMaskTexturesEnable==0 #pragma shader_feature_local POI_GLOBALMASK_TEXTURES //endex - + //ifex _EnableUDIMDiscardOptions==0 #pragma shader_feature_local POI_UDIMDISCARD //endex - + //ifex _EnableDistortion==0 #pragma shader_feature USER_LUT //endex - + //ifex _PoiParallax==0 #pragma shader_feature_local POI_PARALLAX //endex - + //ifex _EnableAudioLink==0 #pragma shader_feature_local POI_AUDIOLINK //endex - + //ifex _BlackLightMaskingEnabled==0 #pragma shader_feature_local POI_BLACKLIGHTMASKING //endex - + //ifex _DetailEnabled==0 #pragma shader_feature FINALPASS //endex - + //ifex _VertexManipulationsEnabled==0 #pragma shader_feature AUTO_EXPOSURE //endex - + //ifex _VertexGlitchingEnabled==0 #pragma shader_feature_local POI_VERTEX_GLITCHING #pragma shader_feature_local POI_VERTEX_GLITCHING_TEXTURE //endex - + //ifex _EnableDepthBulge==0 #pragma shader_feature_local POI_DEPTHBULGE //endex - + //ifex _BackFaceEnabled!=1 #pragma shader_feature_local POI_BACKFACE //endex - + //ifex _RGBMaskEnabled==0 #pragma shader_feature VIGNETTE #pragma shader_feature GEOM_TYPE_MESH //endex - + //ifex _LTCGIEnabled!=1 #pragma shader_feature_local POI_LTCGI //endex - + //ifex _ShadingEnabled==0 #pragma shader_feature_local VIGNETTE_MASKED #pragma shader_feature_local _LIGHTINGMODE_TEXTURERAMP _LIGHTINGMODE_MULTILAYER_MATH _LIGHTINGMODE_SHADEMAP _LIGHTINGMODE_REALISTIC _LIGHTINGMODE_WRAPPED _LIGHTINGMODE_SKIN _LIGHTINGMODE_FLAT _LIGHTINGMODE_CLOTH _LIGHTINGMODE_SDF //endex - + //ifex _DecalEnabled==0 #pragma shader_feature GEOM_TYPE_BRANCH //endex @@ -4229,15 +4309,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _DecalEnabled3==0 #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW //endex - + //ifex _EnableDissolve==0 #pragma shader_feature DISTORT //endex - + //ifex _EnableAniso==0 #pragma shader_feature_local POI_ANISOTROPICS //endex - + //ifex _MatcapEnable==0 #pragma shader_feature_local POI_MATCAP0 #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL @@ -4254,23 +4334,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #pragma shader_feature_local POI_MATCAP3 #pragma shader_feature_local POI_MATCAP3_CUSTOM_NORMAL //endex - + //ifex _CubeMapEnabled==0 #pragma shader_feature_local _CUBEMAP //endex - + //ifex _EnableALDecal==0 #pragma shader_feature_local POI_AL_DECAL //endex - + //ifex _EnableVolumeColor==0 #pragma shader_feature_local POI_AL_VOLUMECOLOR //endex - + //ifex _EnableFlipbook==0 #pragma shader_feature _SUNDISK_HIGH_QUALITY //endex - + //ifex _EnableEmission==0 #pragma shader_feature _EMISSION //endex @@ -4283,7 +4363,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _EnableEmission3==0 #pragma shader_feature_local POI_EMISSION_3 //endex - + //ifex _EnableRimLighting==0 #pragma shader_feature_local _GLOSSYREFLECTIONS_OFF #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2 _RIMSTYLE_LILTOON @@ -4292,70 +4372,70 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #pragma shader_feature_local POI_RIM2 #pragma shader_feature_local _RIM2STYLE_POIYOMI _RIM2STYLE_UTS2 _RIM2STYLE_LILTOON //endex - + //ifex _EnableDepthRimLighting==0 #pragma shader_feature_local _POI_DEPTH_RIMLIGHT //endex - + //ifex _GlitterEnable==0 #pragma shader_feature _SUNDISK_SIMPLE //endex - + //ifex _SubsurfaceScattering==0 #pragma shader_feature_local POI_SUBSURFACESCATTERING //endex - + //ifex _MochieBRDF==0 #pragma shader_feature_local MOCHIE_PBR //endex //ifex _ClearCoatBRDF==0 #pragma shader_feature_local POI_CLEARCOAT //endex - + //ifex _EnableEnvironmentalRim==0 #pragma shader_feature_local POI_ENVIRORIM //endex - + //ifex _StylizedSpecular==0 #pragma shader_feature_local POI_STYLIZED_StylizedSpecular //endex - + //ifex _EnablePathing==0 #pragma shader_feature_local POI_PATHING //endex - + //ifex _EnableMirrorOptions==0 #pragma shader_feature_local POI_MIRROR //endex - + //ifex _EnableTouchGlow==0 #pragma shader_feature GRAIN //endex - + //ifex _TextEnabled==0 #pragma shader_feature EFFECT_BUMP //endex - + //ifex _PostProcess==0 #pragma shader_feature_local POSTPROCESS //endex - + //ifex _PoiInternalParallax==0 #pragma shader_feature_local POI_INTERNALPARALLAX //endex - + //ifex _NormalCorrect==0 #pragma shader_feature_local POI_NORMALCORRECT //endex - + //ifex _VideoEffectsEnable==0 #pragma shader_feature_local POI_VIDEO_EFFECTS //endex - + //ifex _BacklightEnabled!=1 #pragma shader_feature_local POI_BACKLIGHT //endex - + //ifex _BSSEnabled!=1 #pragma shader_feature_local POIBS_ENABLE //ifex _BSSBloomfog!=1 @@ -4363,15 +4443,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #pragma shader_feature_local BSSBLOOMFOGTYPE_HEIGHT //endex //endex - + //ifex _VoronoiEnabled!=1 #pragma shader_feature_local POI_VORONOI //endex - + #pragma multi_compile_instancing #pragma multi_compile_fog #define POI_PASS_EARLYZ - + // UNITY Includes #include "UnityCG.cginc" #include "UnityStandardUtils.cginc" @@ -4382,16 +4462,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #include "UnityMetaPass.cginc" #endif #pragma vertex vert - + #pragma fragment frag - + #define DielectricSpec float4(0.04, 0.04, 0.04, 1.0 - 0.04) #define PI float(3.14159265359) #define Epsilon float(1e-10) - + #define POI2D_SAMPLE_TEX2D_SAMPLERGRAD(tex, samplertex, coord, dx, dy) tex.SampleGrad(sampler##samplertex, coord, dx, dy) #define POI2D_SAMPLE_TEX2D_SAMPLERGRADD(tex, samp, uv, pan, dx, dy) tex.SampleGrad(samp, POI_PAN_UV(uv, pan), dx, dy) - + #define POI_PAN_UV(uv, pan) (uv + _Time.x * pan) #define POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, POI_PAN_UV(uv, pan))) #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, dx, dy) (POI2D_SAMPLE_TEX2D_SAMPLERGRAD(tex, texSampler, POI_PAN_UV(uv, pan), dx, dy)) @@ -4404,29 +4484,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv)) #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, POI_PAN_UV(uv, pan))) #define POI_SAMPLE_CUBE_LOD(tex, samp, uv, lod) texCUBElod(tex, float4(uv, 0, lod)) - + #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED) #define POI_SAMPLE_SCREEN(tex, samp, uv) tex.Sample(samp, float3(uv, unity_StereoEyeIndex)) #else #define POI_SAMPLE_SCREEN(tex, samp, uv) tex.Sample(samp, uv) #endif - + // When using, properties won't properly lock at optimize time; needs macro evaluation implemented // #define POI2D_MAINTEX_SAMPLER_PAN_INLINED(tex, poiMesh) (POI2D_SAMPLER_PAN(tex, _MainTex, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Pan)) - + #define POI_SAFE_RGB0 float4(mainTexture.rgb * .0001, 0) #define POI_SAFE_RGB1 float4(mainTexture.rgb * .0001, 1) #define POI_SAFE_RGBA mainTexture - + #if defined(UNITY_COMPILER_HLSL) #define PoiInitStruct(type, name) name = (type)0; #else #define PoiInitStruct(type, name) #endif - + #define POI_ERROR(poiMesh, gridSize) lerp(float3(1, 0, 1), float3(0, 0, 0), fmod(floor((poiMesh.worldPos.x) * gridSize) + floor((poiMesh.worldPos.y) * gridSize) + floor((poiMesh.worldPos.z) * gridSize), 2) == 0) #define POI_NAN (asfloat(-1)) - + #define POI_MODE_OPAQUE 0 #define POI_MODE_CUTOUT 1 #define POI_MODE_FADE 2 @@ -4436,17 +4516,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define POI_MODE_MULTIPLICATIVE 6 #define POI_MODE_2XMULTIPLICATIVE 7 #define POI_MODE_TRANSCLIPPING 9 - + /* Texture2D ; float4 _ST; float2 Pan; float UV; float Stochastic; - + [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )] */ - + //ifex _EnableAudioLink==0 #ifdef POI_AUDIOLINK // Map of where features in AudioLink are. @@ -4479,7 +4559,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define ALPASS_FILTEREDVU uint2(24, 28) //Size: 4, 4 #define ALPASS_FILTEREDVU_INTENSITY uint2(24, 28) //Size: 4, 1 #define ALPASS_FILTEREDVU_MARKER uint2(24, 29) //Size: 4, 1 - + // Some basic constants to use (Note, these should be compatible with // future version of AudioLink, but may change. #define AUDIOLINK_SAMPHIST 3069 // Internal use for algos, do not change. @@ -4498,7 +4578,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define AUDIOLINK_DELAY_COEFFICIENT_MAX 0.9 #define AUDIOLINK_DFT_Q 4.0 #define AUDIOLINK_TREBLE_CORRECTION 5.0 - + // ColorChord constants #define COLORCHORD_EMAXBIN 192 #define COLORCHORD_IIR_DECAY_1 0.90 @@ -4508,13 +4588,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define COLORCHORD_NOTE_CLOSEST 3.0 #define COLORCHORD_NEW_NOTE_GAIN 8.0 #define COLORCHORD_MAX_NOTES 10 - + uniform float4 _AudioTexture_TexelSize; - + #ifdef SHADER_TARGET_SURFACE_ANALYSIS #define AUDIOLINK_STANDARD_INDEXING #endif - + // Mechanism to index into texture. #ifdef AUDIOLINK_STANDARD_INDEXING sampler2D _AudioTexture; @@ -4528,15 +4608,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" uniform float4 _Stored_TexelSize; #endif //endex - + float _RenderingEarlyZEnabled; - + float _IgnoreFog; float _RenderingReduceClipDistance; int _FlipBackfaceNormals; float _AddBlendOp; float _Cull; - + float4 _Color; float _ColorThemeIndex; UNITY_DECLARE_TEX2D(_MainTex); @@ -4562,7 +4642,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaMaskUV; float _AlphaMaskInvert; float _MainAlphaMaskMode; - float _AlphaMaskScale; + float _AlphaMaskBlendStrength; float _AlphaMaskValue; #endif float _Cutoff; @@ -4575,25 +4655,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _MainColorAdjustTexture_ST; float2 _MainColorAdjustTexturePan; float _MainColorAdjustTextureUV; + float _MainHueShiftColorSpace; float _MainHueShiftToggle; float _MainHueShiftReplace; float _MainHueShift; float _MainHueShiftSpeed; float _Saturation; float _MainBrightness; - + float _MainHueALCTEnabled; float _MainALHueShiftBand; float _MainALHueShiftCTIndex; float _MainHueALMotionSpeed; - + float _MainHueGlobalMask; float _MainHueGlobalMaskBlendType; float _MainSaturationGlobalMask; float _MainSaturationGlobalMaskBlendType; float _MainBrightnessGlobalMask; float _MainBrightnessGlobalMaskBlendType; - + #if defined(PROP_MAINGRADATIONTEX) || !defined(OPTIMIZER_ENABLED) Texture2D _MainGradationTex; #endif @@ -4601,11 +4682,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _MainGradationStrength; #endif //endex - + SamplerState sampler_linear_clamp; SamplerState sampler_linear_repeat; SamplerState sampler_trilinear_repeat; - + //ifex _GlobalMaskTexturesEnable==0 #ifdef POI_GLOBALMASK_TEXTURES #if defined(PROP_GLOBALMASKTEXTURE0) || !defined(OPTIMIZER_ENABLED) @@ -4621,7 +4702,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _GlobalMaskTexture0SplitPan_B; float4 _GlobalMaskTexture0SplitTilingOffset_A; float4 _GlobalMaskTexture0SplitPan_A; - + #if defined(PROP_GLOBALMASKTEXTURE1) || !defined(OPTIMIZER_ENABLED) Texture2D _GlobalMaskTexture1; #endif @@ -4635,7 +4716,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _GlobalMaskTexture1SplitPan_B; float4 _GlobalMaskTexture1SplitTilingOffset_A; float4 _GlobalMaskTexture1SplitPan_A; - + #if defined(PROP_GLOBALMASKTEXTURE2) || !defined(OPTIMIZER_ENABLED) Texture2D _GlobalMaskTexture2; #endif @@ -4649,7 +4730,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _GlobalMaskTexture2SplitPan_B; float4 _GlobalMaskTexture2SplitTilingOffset_A; float4 _GlobalMaskTexture2SplitPan_A; - + #if defined(PROP_GLOBALMASKTEXTURE3) || !defined(OPTIMIZER_ENABLED) Texture2D _GlobalMaskTexture3; #endif @@ -4668,7 +4749,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _GlobalMaskOptionsEnable==0 float _GlobalMaskOptionsEnable; int _GlobalMaskOptionsType; - + //ifex _GlobalMaskOptionsType!=0 float _GlobalMaskSlider_0; float _GlobalMaskSlider_1; @@ -4687,7 +4768,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskSlider_14; float _GlobalMaskSlider_15; //endex - + //ifex _GlobalMaskOptionsType!=1 float2 _GlobalMaskMinMaxSlider_0; float2 _GlobalMaskMinMaxSlider_1; @@ -4706,7 +4787,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _GlobalMaskMinMaxSlider_14; float2 _GlobalMaskMinMaxSlider_15; //endex - + //ifex _GlobalMaskOptionsType!=2 int _GlobalMaskToggleOn_0; int _GlobalMaskToggleOff_0; @@ -4761,7 +4842,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskBackface_14; float _GlobalMaskBackface_15; //endex - + //ifex _GlobalMaskModifiersMirrorEnable==0 float _GlobalMaskModifiersMirrorEnable; float _GlobalMaskMirrorVisibilityMode; @@ -4782,7 +4863,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskMirror_14; float _GlobalMaskMirror_15; //endex - + //ifex _GlobalMaskModifiersCameraEnable==0 float _GlobalMaskModifiersCameraEnable; float _GlobalMaskCamera_0; @@ -4802,10 +4883,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskCamera_14; float _GlobalMaskCamera_15; //endex - + //ifex _GlobalMaskModifiersDistanceEnable==0 int _GlobalMaskModifiersDistanceEnable; - + //ifex _GlobalMaskDistanceEnable_0==0 int _GlobalMaskDistanceEnable_0; int _GlobalMaskDistanceType_0; @@ -4815,7 +4896,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_0; int _GlobalMaskDistanceBlendType_0; //endex - + //ifex _GlobalMaskDistanceEnable_1==0 int _GlobalMaskDistanceEnable_1; int _GlobalMaskDistanceType_1; @@ -4825,7 +4906,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_1; int _GlobalMaskDistanceBlendType_1; //endex - + //ifex _GlobalMaskDistanceEnable_2==0 int _GlobalMaskDistanceEnable_2; int _GlobalMaskDistanceType_2; @@ -4835,7 +4916,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_2; int _GlobalMaskDistanceBlendType_2; //endex - + //ifex _GlobalMaskDistanceEnable_3==0 int _GlobalMaskDistanceEnable_3; int _GlobalMaskDistanceType_3; @@ -4845,7 +4926,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_3; int _GlobalMaskDistanceBlendType_3; //endex - + //ifex _GlobalMaskDistanceEnable_4==0 int _GlobalMaskDistanceEnable_4; int _GlobalMaskDistanceType_4; @@ -4855,7 +4936,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_4; int _GlobalMaskDistanceBlendType_4; //endex - + //ifex _GlobalMaskDistanceEnable_5==0 int _GlobalMaskDistanceEnable_5; int _GlobalMaskDistanceType_5; @@ -4865,7 +4946,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_5; int _GlobalMaskDistanceBlendType_5; //endex - + //ifex _GlobalMaskDistanceEnable_6==0 int _GlobalMaskDistanceEnable_6; int _GlobalMaskDistanceType_6; @@ -4875,7 +4956,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_6; int _GlobalMaskDistanceBlendType_6; //endex - + //ifex _GlobalMaskDistanceEnable_7==0 int _GlobalMaskDistanceEnable_7; int _GlobalMaskDistanceType_7; @@ -4885,7 +4966,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_7; int _GlobalMaskDistanceBlendType_7; //endex - + //ifex _GlobalMaskDistanceEnable_8==0 int _GlobalMaskDistanceEnable_8; int _GlobalMaskDistanceType_8; @@ -4895,7 +4976,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_8; int _GlobalMaskDistanceBlendType_8; //endex - + //ifex _GlobalMaskDistanceEnable_9==0 int _GlobalMaskDistanceEnable_9; int _GlobalMaskDistanceType_9; @@ -4905,7 +4986,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_9; int _GlobalMaskDistanceBlendType_9; //endex - + //ifex _GlobalMaskDistanceEnable_10==0 int _GlobalMaskDistanceEnable_10; int _GlobalMaskDistanceType_10; @@ -4915,7 +4996,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_10; int _GlobalMaskDistanceBlendType_10; //endex - + //ifex _GlobalMaskDistanceEnable_11==0 int _GlobalMaskDistanceEnable_11; int _GlobalMaskDistanceType_11; @@ -4925,7 +5006,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_11; int _GlobalMaskDistanceBlendType_11; //endex - + //ifex _GlobalMaskDistanceEnable_12==0 int _GlobalMaskDistanceEnable_12; int _GlobalMaskDistanceType_12; @@ -4935,7 +5016,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_12; int _GlobalMaskDistanceBlendType_12; //endex - + //ifex _GlobalMaskDistanceEnable_13==0 int _GlobalMaskDistanceEnable_13; int _GlobalMaskDistanceType_13; @@ -4945,7 +5026,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_13; int _GlobalMaskDistanceBlendType_13; //endex - + //ifex _GlobalMaskDistanceEnable_14==0 int _GlobalMaskDistanceEnable_14; int _GlobalMaskDistanceType_14; @@ -4955,7 +5036,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_14; int _GlobalMaskDistanceBlendType_14; //endex - + //ifex _GlobalMaskDistanceEnable_15==0 int _GlobalMaskDistanceEnable_15; int _GlobalMaskDistanceType_15; @@ -4966,7 +5047,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _GlobalMaskDistanceBlendType_15; //endex //endex - + int _GlobalMaskVertexColorLinearSpace; //ifex _GlobalMaskVertexColorRed==0 int _GlobalMaskVertexColorRed; @@ -4984,7 +5065,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _GlobalMaskVertexColorAlpha; int _GlobalMaskVertexColorAlphaBlendType; //endex - + //ifex _EnableUDIMDiscardOptions==0 #ifdef POI_UDIMDISCARD float _UDIMDiscardMode; @@ -5007,17 +5088,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _UDIMDiscardRow0_3; #endif //endex - + //ifex _EnableAudioLink==0 #ifdef POI_AUDIOLINK float _AudioLinkDelay; float _AudioLinkAnimToggle; - + float _AudioLinkSmoothingBass; float _AudioLinkSmoothingLowMid; float _AudioLinkSmoothingHighMid; float _AudioLinkSmoothingTreble; - + float _DebugWaveform; float _DebugDFT; float _DebugBass; @@ -5030,12 +5111,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DebugAutocorrelator; float _DebugChronotensity; float _AudioLinkCCStripY; - + float _AudioLinkBandOverridesEnabled; float4 _AudioLinkBandOverrideSliders; #endif //endex - + //ifex _VertexManipulationsEnabled==0 #ifdef AUTO_EXPOSURE float4 _VertexManipulationLocalTranslation; @@ -5053,16 +5134,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VertexRoundingEnabled; int _VertexRoundingSpace; float _VertexRoundingDivision; - + //AL float _VertexAudioLinkEnabled; float3 _VertexLocalTranslationALMin; float3 _VertexLocalTranslationALMax; float _VertexLocalTranslationALBand; - + float3 _VertexLocalRotationAL; float _VertexLocalRotationALBand; - + float3 _VertexLocalRotationCTALSpeed; float _VertexLocalRotationCTALBandX; float _VertexLocalRotationCTALBandY; @@ -5070,39 +5151,39 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VertexLocalRotationCTALTypeX; float _VertexLocalRotationCTALTypeY; float _VertexLocalRotationCTALTypeZ; - + float4 _VertexLocalScaleALMin; float4 _VertexLocalScaleALMax; float _VertexLocalScaleALBand; - + float3 _VertexWorldTranslationALMin; float3 _VertexWorldTranslationALMax; float _VertexWorldTranslationALBand; - + float2 _VertexManipulationHeightAL; float _VertexManipulationHeightBand; - + float2 _VertexRoundingRangeAL; float _VertexRoundingRangeBand; - + float _VertexBarrelMode; float _VertexBarrelWidth; float _VertexBarrelAlpha; float _VertexBarrelHeight; - + float _VertexSphereMode; float _VertexSphereRadius; float _VertexSphereHeight; float _VertexSphereAlpha; float4 _VertexSphereCenter; - + float _VertexTornadoMode; float _VertexTornadoRadius; float _VertexTornadoSpeed; float _VertexTornadoIntensity; float _VertexTornadoBaseHeight; float _VertexTornadoTopHeight; - + float _VertexSpectrumMotion; float3 _VertexSpectrumOffsetMin; float3 _VertexSpectrumOffsetMax; @@ -5110,7 +5191,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VertexSpectrumUVDirection; #endif //endex - + //ifex _VertexGlitchingEnabled==0 #ifdef POI_VERTEX_GLITCHING //Vertex Glitching @@ -5123,17 +5204,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VertexGlitchFrequency; float _VertexGlitchStrength; float _VertexGlitchDensity; - + float _VertexGlitchMirrorEnable; float _VertexGlitchMirror; - + float _VertexGlitchMapPanSpeed; float _VertexGlitchingAudioLinkEnabled; float _VertexGlitchingAudioLinkBand; float _VertexGlitchingAudiolinkOverride; #endif //endex - + //ifex _EnableDissolve==0 #ifdef DISTORT float _DissolveType; @@ -5147,35 +5228,35 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _DissolveTextureColor; float _DissolveEdgeColorThemeIndex; float _DissolveTextureColorThemeIndex; - + #if defined(PROP_DISSOLVETOTEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _DissolveToTexture; #endif float4 _DissolveToTexture_ST; float2 _DissolveToTexturePan; float _DissolveToTextureUV; - + #if defined(PROP_DISSOLVENOISETEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _DissolveNoiseTexture; #endif float4 _DissolveNoiseTexture_ST; float2 _DissolveNoiseTexturePan; float _DissolveNoiseTextureUV; - + #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED) Texture2D _DissolveDetailNoise; #endif float4 _DissolveDetailNoise_ST; float2 _DissolveDetailNoisePan; float _DissolveDetailNoiseUV; - + #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _DissolveMask; #endif float4 _DissolveMask_ST; float2 _DissolveMaskPan; float _DissolveMaskUV; - + float _DissolveMaskGlobalMask; float _DissolveMaskGlobalMaskBlendType; float _DissolveApplyGlobalMaskIndex; @@ -5191,27 +5272,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DissolveInvertNoise; float _DissolveInvertDetailNoise; float _DissolveToEmissionStrength; - + // Point to Point float _DissolveP2PWorldLocal; float _DissolveP2PEdgeLength; float _DissolveP2PClamp; float4 _DissolveStartPoint; float4 _DissolveEndPoint; - + // Spherical float3 _SphericalDissolveCenter; float _SphericalDissolveRadius; float _SphericalDissolveInvert; float _SphericalDissolveClamp; - + // CenterOut float _CenterOutDissolveMode; float3 _CenterOutDissolveDirection; float _CenterOutDissolveInvert; float _CenterOutDissolveNormals; float _CenterOutDissolvePower; - + // World Dissolve float _DissolveWorldShape; float4 _DissolveShapePosition; @@ -5219,12 +5300,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DissolveShapeScale; float _DissolveInvertShape; float _DissolveShapeEdgeLength; - + // UV Tile Dissolve float _UVTileDissolveEnabled; float _UVTileDissolveDiscardAtMax; float _UVTileDissolveUV; - + float _UVTileDissolveAlpha_Row3_0; float _UVTileDissolveAlpha_Row3_1; float _UVTileDissolveAlpha_Row3_2; @@ -5241,7 +5322,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _UVTileDissolveAlpha_Row0_1; float _UVTileDissolveAlpha_Row0_2; float _UVTileDissolveAlpha_Row0_3; - + float _DissolveAlpha0; float _DissolveAlpha1; float _DissolveAlpha2; @@ -5256,19 +5337,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DissolveEmissionSide; float _DissolveEmission1Side; float _DissolveUseVertexColors; - + float4 edgeColor; float edgeAlpha; float dissolveAlpha; float4 dissolveToTexture; - + + float _DissolveHueShiftColorSpace; + float _DissolveEdgeHueShiftColorSpace; float _DissolveHueShiftEnabled; float _DissolveHueShiftSpeed; float _DissolveHueShift; float _DissolveEdgeHueShiftEnabled; float _DissolveEdgeHueShiftSpeed; float _DissolveEdgeHueShift; - + // Audio Link #ifdef POI_AUDIOLINK fixed _EnableDissolveAudioLink; @@ -5279,7 +5362,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableMirrorOptions==0 #ifdef POI_MIRROR float _VisibilityMode; @@ -5303,7 +5386,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VisibilityVRCCameraScreenshot; #endif //endex - + //ifex _BSSEnabled!=1 #ifdef POIBS_ENABLE float _CustomColors; @@ -5313,10 +5396,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _FogScale; float _FogHeightOffset; float _FogHeightScale; - + uniform float2 _CustomFogTextureToScreenRatio; uniform float _StereoCameraEyeOffset; - + uniform float _CustomFogOffset; uniform float _CustomFogAttenuation; uniform float _CustomFogHeightFogStartY; @@ -5326,7 +5409,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex #endif //endex - + struct appdata { float4 vertex : POSITION; @@ -5339,9 +5422,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 uv3 : TEXCOORD3; uint vertexId : SV_VertexID; UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO }; - + struct VertexOut { float4 pos : SV_POSITION; @@ -5354,14 +5436,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 lightmapUV : TEXCOORD7; float2 fogCoord: TEXCOORD10; UNITY_SHADOW_COORDS(11) - + UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; - + struct PoiMesh { - + // 0 Vertex normal // 1 Fragment normal float3 normals[2]; @@ -5384,8 +5466,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 parallaxUV; float2 dx; float2 dy; + uint isRightHand; }; - + struct PoiCam { float3 viewDir; @@ -5402,9 +5485,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 screenUV; float vDotN; float4 worldDirection; - + }; - + struct PoiMods { float4 Mask; @@ -5419,10 +5502,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float globalMask[16]; float ALTime[8]; }; - + struct PoiLight { - + float3 direction; float attenuation; float attenuationStrength; @@ -5455,7 +5538,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float directLuminance; float indirectLuminance; float finalLuminance; - + #if defined(VERTEXLIGHT_ON) // Non Important Lights float4 vDotNL; @@ -5472,17 +5555,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" half4 vertexVDotNH; half4 vDotLH; #endif - + }; - + struct PoiVertexLights { - + float3 direction; float3 color; float attenuation; }; - + struct PoiFragData { float smoothness; @@ -5490,34 +5573,34 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float metallic; float specularMask; float reflectionMask; - + float3 baseColor; float3 finalColor; float alpha; float3 emission; float toggleVertexLights; }; - + float4 poiTransformClipSpacetoScreenSpaceFrag(float4 clipPos) { float4 positionSS = float4(clipPos.xyz * clipPos.w, clipPos.w); positionSS.xy = positionSS.xy / _ScreenParams.xy; return positionSS; } - + // glsl_mod behaves better on negative numbers, and // in some situations actually outperforms HLSL's fmod() #ifndef glsl_mod #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y)))) #endif - + uniform float random_uniform_float_only_used_to_stop_compiler_warnings = 0.0f; - + float2 poiUV(float2 uv, float4 tex_st) { return uv * tex_st.xy + tex_st.zw; } - + float2 vertexUV(in VertexOut o, int index) { switch(index) @@ -5534,7 +5617,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return o.uv[0].xy; } } - + float2 vertexUV(in appdata v, int index) { switch(index) @@ -5551,67 +5634,67 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return v.uv0.xy; } } - + //Lighting Helpers float calculateluminance(float3 color) { return color.r * 0.299 + color.g * 0.587 + color.b * 0.114; } - + // Set by VRChat (as of open beta 1245) // _VRChatCameraMode: 0 => Normal, 1 => VR HandCam, 2 => Desktop Handcam, 3 => Screenshot/Photo // _VRChatMirrorMode: 0 => Normal, 1 => Mirror (VR), 2 => Mirror (Deskie) float _VRChatCameraMode; float _VRChatMirrorMode; - + float VRCCameraMode() { return _VRChatCameraMode; } - + float VRCMirrorMode() { return _VRChatMirrorMode; } - + bool IsInMirror() { return unity_CameraProjection[2][0] != 0.f || unity_CameraProjection[2][1] != 0.f; } - + bool IsOrthographicCamera() { return unity_OrthoParams.w == 1 || UNITY_MATRIX_P[3][3] == 1; } - + float shEvaluateDiffuseL1Geomerics_local(float L0, float3 L1, float3 n) { // average energy float R0 = max(0, L0); - + // avg direction of incoming light float3 R1 = 0.5f * L1; - + // directional brightness float lenR1 = length(R1); - + // linear angle between normal and direction 0-1 //float q = 0.5f * (1.0f + dot(R1 / lenR1, n)); //float q = dot(R1 / lenR1, n) * 0.5 + 0.5; float q = dot(normalize(R1), n) * 0.5 + 0.5; q = saturate(q); // Thanks to ScruffyRuffles for the bug identity. - + // power for q // lerps from 1 (linear) to 3 (cubic) based on directionality float p = 1.0f + 2.0f * lenR1 / R0; - + // dynamic range constant // should vary between 4 (highly directional) and 0 (ambient) float a = (1.0f - lenR1 / R0) / (1.0f + lenR1 / R0); - + return R0 * (a + (1.0f - a) * (p + 1.0f) * pow(q, p)); } - + half3 BetterSH9(half4 normal) { float3 indirect; @@ -5623,9 +5706,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirect += SHEvalLinearL2(normal); return indirect; } - + // Silent's code ends here - + float3 getCameraForward() { #if UNITY_SINGLE_PASS_STEREO @@ -5637,7 +5720,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif return normalize(p2 - p1); } - + half3 GetSHLength() { half3 x, x1; @@ -5649,7 +5732,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" x1.b = length(unity_SHBb); return x + x1; } - + float3 BoxProjection(float3 direction, float3 position, float4 cubemapPosition, float3 boxMin, float3 boxMax) { #if UNITY_SPECCUBE_BOX_PROJECTION @@ -5663,22 +5746,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif return direction; } - + float poiMax(float2 i) { return max(i.x, i.y); } - + float poiMax(float3 i) { return max(max(i.x, i.y), i.z); } - + float poiMax(float4 i) { return max(max(max(i.x, i.y), i.z), i.w); } - + float3 calculateNormal(in float3 baseNormal, in PoiMesh poiMesh, in Texture2D normalTexture, in float4 normal_ST, in float2 normalPan, in float normalUV, in float normalIntensity) { float3 normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(normalTexture, _MainTex, poiUV(poiMesh.uv[normalUV], normal_ST), normalPan), normalIntensity); @@ -5688,42 +5771,42 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" normal.z * baseNormal ); } - + float remap(float x, float minOld, float maxOld, float minNew = 0, float maxNew = 1) { return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); } - + float2 remap(float2 x, float2 minOld, float2 maxOld, float2 minNew = 0, float2 maxNew = 1) { return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); } - + float3 remap(float3 x, float3 minOld, float3 maxOld, float3 minNew = 0, float3 maxNew = 1) { return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); } - + float4 remap(float4 x, float4 minOld, float4 maxOld, float4 minNew = 0, float4 maxNew = 1) { return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); } - + float remapClamped(float minOld, float maxOld, float x, float minNew = 0, float maxNew = 1) { return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); } - + float2 remapClamped(float2 minOld, float2 maxOld, float2 x, float2 minNew, float2 maxNew) { return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); } - + float3 remapClamped(float3 minOld, float3 maxOld, float3 x, float3 minNew, float3 maxNew) { return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); } - + float4 remapClamped(float4 minOld, float4 maxOld, float4 x, float4 minNew, float4 maxNew) { return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); @@ -5732,7 +5815,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return ((height * - 1) + 1) * (poiCam.tangentViewDir.xy / poiCam.tangentViewDir.z); } - + /* 0: Zero float4(0.0, 0.0, 0.0, 0.0), 1: One float4(1.0, 1.0, 1.0, 1.0), @@ -5746,7 +5829,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 9: SrcAlphaSaturate saturate(sourceColor.aaaa), 10: OneMinusSrcAlpha float4(1.0, 1.0, 1.0, 1.0) - sourceColor.aaaa, */ - + float4 poiBlend(const float sourceFactor, const float4 sourceColor, const float destinationFactor, const float4 destinationColor, const float4 blendFactor) { float4 sA = 1 - blendFactor; @@ -5763,10 +5846,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" saturate(sourceColor.aaaa), 1 - sA, }; - + return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA); } - + // Average float blendAverage(float base, float blend) { @@ -5776,40 +5859,40 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return (base + blend) / 2.0; } - + // Color burn float blendColorBurn(float base, float blend) { return (blend == 0.0) ? blend : max((1.0 - ((1.0 - base) * rcp(random_uniform_float_only_used_to_stop_compiler_warnings + blend))), 0.0); } - + float3 blendColorBurn(float3 base, float3 blend) { return float3(blendColorBurn(base.r, blend.r), blendColorBurn(base.g, blend.g), blendColorBurn(base.b, blend.b)); } - + // Color Dodge float blendColorDodge(float base, float blend) { return (blend == 1.0) ? blend : min(base / (1.0 - blend), 1.0); } - + float3 blendColorDodge(float3 base, float3 blend) { return float3(blendColorDodge(base.r, blend.r), blendColorDodge(base.g, blend.g), blendColorDodge(base.b, blend.b)); } - + // Darken float blendDarken(float base, float blend) { return min(blend, base); } - + float3 blendDarken(float3 base, float3 blend) { return float3(blendDarken(base.r, blend.r), blendDarken(base.g, blend.g), blendDarken(base.b, blend.b)); } - + // Exclusion float blendExclusion(float base, float blend) { @@ -5819,18 +5902,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return base + blend - 2.0 * base * blend; } - + // Reflect float blendReflect(float base, float blend) { return (blend == 1.0) ? blend : min(base * base / (1.0 - blend), 1.0); } - + float3 blendReflect(float3 base, float3 blend) { return float3(blendReflect(base.r, blend.r), blendReflect(base.g, blend.g), blendReflect(base.b, blend.b)); } - + // Glow float blendGlow(float base, float blend) { @@ -5840,18 +5923,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return blendReflect(blend, base); } - + // Overlay float blendOverlay(float base, float blend) { return base < 0.5 ? (2.0 * base * blend) : (1.0 - 2.0 * (1.0 - base) * (1.0 - blend)); } - + float3 blendOverlay(float3 base, float3 blend) { return float3(blendOverlay(base.r, blend.r), blendOverlay(base.g, blend.g), blendOverlay(base.b, blend.b)); } - + // Hard Light float blendHardLight(float base, float blend) { @@ -5861,77 +5944,77 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return blendOverlay(blend, base); } - + // Vivid light float blendVividLight(float base, float blend) { return (blend < 0.5) ? blendColorBurn(base, (2.0 * blend)) : blendColorDodge(base, (2.0 * (blend - 0.5))); } - + float3 blendVividLight(float3 base, float3 blend) { return float3(blendVividLight(base.r, blend.r), blendVividLight(base.g, blend.g), blendVividLight(base.b, blend.b)); } - + // Hard mix float blendHardMix(float base, float blend) { return (blendVividLight(base, blend) < 0.5) ? 0.0 : 1.0; } - + float3 blendHardMix(float3 base, float3 blend) { return float3(blendHardMix(base.r, blend.r), blendHardMix(base.g, blend.g), blendHardMix(base.b, blend.b)); } - + // Lighten float blendLighten(float base, float blend) { return max(blend, base); } - + float3 blendLighten(float3 base, float3 blend) { return float3(blendLighten(base.r, blend.r), blendLighten(base.g, blend.g), blendLighten(base.b, blend.b)); } - + // Linear Burn float blendLinearBurn(float base, float blend) { // Note : Same implementation as BlendSubtractf return max(base + blend - 1.0, 0.0); } - + float3 blendLinearBurn(float3 base, float3 blend) { // Note : Same implementation as BlendSubtract return max(base + blend - float3(1.0, 1.0, 1.0), float3(0.0, 0.0, 0.0)); } - + // Linear Dodge float blendLinearDodge(float base, float blend) { // Note : Same implementation as BlendAddf return min(base + blend, 1.0); } - + float3 blendLinearDodge(float3 base, float3 blend) { // Note : Same implementation as BlendAdd return base + blend; } - + // Linear light float blendLinearLight(float base, float blend) { return blend < 0.5 ? blendLinearBurn(base, (2.0 * blend)) : blendLinearDodge(base, (2.0 * (blend - 0.5))); } - + float3 blendLinearLight(float3 base, float3 blend) { return float3(blendLinearLight(base.r, blend.r), blendLinearLight(base.g, blend.g), blendLinearLight(base.b, blend.b)); } - + // Multiply float blendMultiply(float base, float blend) { @@ -5941,7 +6024,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return base * blend; } - + // Negation float blendNegation(float base, float blend) { @@ -5951,7 +6034,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend); } - + // Normal float blendNormal(float base, float blend) { @@ -5961,7 +6044,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return blend; } - + // Phoenix float blendPhoenix(float base, float blend) { @@ -5971,83 +6054,83 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return min(base, blend) - max(base, blend) + float3(1.0, 1.0, 1.0); } - + // Pin light float blendPinLight(float base, float blend) { return (blend < 0.5) ? blendDarken(base, (2.0 * blend)) : blendLighten(base, (2.0 * (blend - 0.5))); } - + float3 blendPinLight(float3 base, float3 blend) { return float3(blendPinLight(base.r, blend.r), blendPinLight(base.g, blend.g), blendPinLight(base.b, blend.b)); } - + // Screen float blendScreen(float base, float blend) { return 1.0 - ((1.0 - base) * (1.0 - blend)); } - + float3 blendScreen(float3 base, float3 blend) { return float3(blendScreen(base.r, blend.r), blendScreen(base.g, blend.g), blendScreen(base.b, blend.b)); } - + // Soft Light float blendSoftLight(float base, float blend) { return (blend < 0.5) ? (2.0 * base * blend + base * base * (1.0 - 2.0 * blend)) : (sqrt(base) * (2.0 * blend - 1.0) + 2.0 * base * (1.0 - blend)); } - + float3 blendSoftLight(float3 base, float3 blend) { return float3(blendSoftLight(base.r, blend.r), blendSoftLight(base.g, blend.g), blendSoftLight(base.b, blend.b)); } - + // Subtract float blendSubtract(float base, float blend) { return max(base - blend, 0.0); } - + float3 blendSubtract(float3 base, float3 blend) { return max(base - blend, 0.0); } - + // Difference float blendDifference(float base, float blend) { return abs(base - blend); } - + float3 blendDifference(float3 base, float3 blend) { return abs(base - blend); } - + // Divide float blendDivide(float base, float blend) { return base / max(blend, 0.0001); } - + float3 blendDivide(float3 base, float3 blend) { return base / max(blend, 0.0001); } - + float blendMixed(float base, float blend) { return base + base * blend; } - + float3 blendMixed(float3 base, float3 blend) { return base + base * blend; } - + float3 customBlend(float3 base, float3 blend, float blendType, float alpha = 1) { float3 output = base; @@ -6066,7 +6149,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return output; } - + float3 customBlend(float base, float blend, float blendType, float alpha = 1) { float3 output = base; @@ -6084,7 +6167,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return output; } - + #define REPLACE 0 #define SUBSTRACT 1 #define MULTIPLY 2 @@ -6093,7 +6176,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define MAX 5 #define AVERAGE 6 #define ADD 7 - + float maskBlend(float baseMask, float blendMask, float blendType) { float output = 0; @@ -6110,7 +6193,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return saturate(output); } - + float globalMaskBlend(float baseMask, float globalMaskIndex, float blendType, PoiMods poiMods) { if (globalMaskIndex == 0) @@ -6122,27 +6205,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return maskBlend(baseMask, poiMods.globalMask[globalMaskIndex - 1], blendType); } } - + float random(float2 p) { return frac(sin(dot(p, float2(12.9898, 78.2383))) * 43758.5453123); } - + float2 random2(float2 p) { return frac(sin(float2(dot(p, float2(127.1, 311.7)), dot(p, float2(269.5, 183.3)))) * 43758.5453); } - + float3 random3(float2 p) { return frac(sin(float3(dot(p, float2(127.1, 311.7)), dot(p, float2(269.5, 183.3)), dot(p, float2(248.3, 315.9)))) * 43758.5453); } - + float3 random3(float3 p) { return frac(sin(float3(dot(p, float3(127.1, 311.7, 248.6)), dot(p, float3(269.5, 183.3, 423.3)), dot(p, float3(248.3, 315.9, 184.2)))) * 43758.5453); } - + float3 randomFloat3(float2 Seed, float maximum) { return (.5 + float3( @@ -6151,7 +6234,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453) ) * .5) * (maximum); } - + float3 randomFloat3Range(float2 Seed, float Range) { return (float3( @@ -6160,7 +6243,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453) ) * 2 - 1) * Range; } - + float3 randomFloat3WiggleRange(float2 Seed, float Range, float wiggleSpeed, float timeOffset) { float3 rando = (float3( @@ -6171,7 +6254,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float speed = 1 + wiggleSpeed; return float3(sin(((_Time.x + timeOffset) + rando.x * PI) * speed), sin(((_Time.x + timeOffset) + rando.y * PI) * speed), sin(((_Time.x + timeOffset) + rando.z * PI) * speed)) * Range; } - + void poiDither(float4 In, float4 ScreenPosition, out float4 Out) { float2 uv = ScreenPosition.xy * _ScreenParams.xy; @@ -6192,7 +6275,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" static const float HCLmaxL = 0.530454533953517; // == exp(HCLgamma / HCLy0) - 0.5 static const float3 wref = float3(1.0, 1.0, 1.0); #define TAU 6.28318531 - + float3 HUEtoRGB(in float H) { float R = abs(H * 6 - 3) - 1; @@ -6200,7 +6283,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float B = 2 - abs(H * 6 - 4); return saturate(float3(R, G, B)); } - + float3 RGBtoHCV(in float3 RGB) { // Based on work by Sam Hocevar and Emil Persson @@ -6210,27 +6293,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float H = abs((Q.w - Q.y) / (6 * C + Epsilon) + Q.z); return float3(H, C, Q.x); } - - float3 HSVtoRGB(in float3 HSV) - { - float3 RGB = HUEtoRGB(HSV.x); - return ((RGB - 1) * HSV.y + 1) * HSV.z; + + float3 RGBtoHSV(float3 c){ + float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); + float4 p = lerp(float4(c.bg, K.wz), float4(c.gb, K.xy), step(c.b, c.g)); + float4 q = lerp(float4(p.xyw, c.r), float4(c.r, p.yzx), step(p.x, c.r)); + + float d = q.x - min(q.w, q.y); + float e = 1.0e-10; + return float3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); } - - float3 RGBtoHSV(in float3 RGB) - { - float3 HCV = RGBtoHCV(RGB); - float S = HCV.y / (HCV.z + Epsilon); - return float3(HCV.x, S, HCV.z); + + float3 HSVtoRGB(float3 c){ + float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); + float3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www); + return c.z * lerp(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); } - + float3 HSLtoRGB(in float3 HSL) { float3 RGB = HUEtoRGB(HSL.x); float C = (1 - abs(2 * HSL.z - 1)) * HSL.y; return (RGB - 0.5) * C + HSL.z; } - + float3 RGBtoHSL(in float3 RGB) { float3 HCV = RGBtoHCV(RGB); @@ -6238,24 +6324,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon); return float3(HCV.x, S, L); } - + void DecomposeHDRColor(in float3 linearColorHDR, out float3 baseLinearColor, out float exposure) { // Optimization/adaptation of https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/GUI/ColorMutator.cs#L23 but skips weird photoshop stuff float maxColorComponent = max(linearColorHDR.r, max(linearColorHDR.g, linearColorHDR.b)); bool isSDR = maxColorComponent <= 1.0; - + float scaleFactor = isSDR ? 1.0 : (1.0 / maxColorComponent); exposure = isSDR ? 0.0 : log(maxColorComponent) * 1.44269504089; // ln(2) - + baseLinearColor = scaleFactor * linearColorHDR; } - + float3 ApplyHDRExposure(float3 linearColor, float exposure) { return linearColor * pow(2, exposure); } - + // Transforms an RGB color using a matrix. Note that S and V are absolute values here float3 ModifyViaHSV(float3 color, float h, float s, float v) { @@ -6265,12 +6351,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" colorHSV.z = saturate(colorHSV.z + v); return HSVtoRGB(colorHSV); } - + float3 ModifyViaHSV(float3 color, float3 HSVMod) { return ModifyViaHSV(color, HSVMod.x, HSVMod.y, HSVMod.z); } - + float4x4 brightnessMatrix(float brightness) { return float4x4( @@ -6280,11 +6366,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" brightness, brightness, brightness, 1 ); } - + float4x4 contrastMatrix(float contrast) { float t = (1.0 - contrast) / 2.0; - + return float4x4( contrast, 0, 0, 0, 0, contrast, 0, 0, @@ -6292,22 +6378,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" t, t, t, 1 ); } - + float4x4 saturationMatrix(float saturation) { float3 luminance = float3(0.3086, 0.6094, 0.0820); - + float oneMinusSat = 1.0 - saturation; - + float3 red = luminance.x * oneMinusSat; red += float3(saturation, 0, 0); - + float3 green = luminance.y * oneMinusSat; green += float3(0, saturation, 0); - + float3 blue = luminance.z * oneMinusSat; blue += float3(0, 0, saturation); - + return float4x4( red, 0, green, 0, @@ -6315,7 +6401,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, 0, 0, 1 ); } - + float4 PoiColorBCS(float4 color, float brightness, float contrast, float saturation) { return mul(color, mul(brightnessMatrix(brightness), mul(contrastMatrix(contrast), saturationMatrix(saturation)))); @@ -6324,68 +6410,87 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return mul(float4(color, 1), mul(brightnessMatrix(brightness), mul(contrastMatrix(contrast), saturationMatrix(saturation)))).rgb; } - + float3 linear_srgb_to_oklab(float3 c) { float l = 0.4122214708 * c.x + 0.5363325363 * c.y + 0.0514459929 * c.z; float m = 0.2119034982 * c.x + 0.6806995451 * c.y + 0.1073969566 * c.z; float s = 0.0883024619 * c.x + 0.2817188376 * c.y + 0.6299787005 * c.z; - + float l_ = pow(l, 1.0 / 3.0); float m_ = pow(m, 1.0 / 3.0); float s_ = pow(s, 1.0 / 3.0); - + return float3( 0.2104542553 * l_ + 0.7936177850 * m_ - 0.0040720468 * s_, 1.9779984951 * l_ - 2.4285922050 * m_ + 0.4505937099 * s_, 0.0259040371 * l_ + 0.7827717662 * m_ - 0.8086757660 * s_ ); } - + float3 oklab_to_linear_srgb(float3 c) { float l_ = c.x + 0.3963377774 * c.y + 0.2158037573 * c.z; float m_ = c.x - 0.1055613458 * c.y - 0.0638541728 * c.z; float s_ = c.x - 0.0894841775 * c.y - 1.2914855480 * c.z; - + float l = l_ * l_ * l_; float m = m_ * m_ * m_; float s = s_ * s_ * s_; - + return float3( + 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s, - 1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s, - 0.0041960863 * l - 0.7034186147 * m + 1.7076147010 * s ); } - + float3 hueShift(float3 color, float shift) { - float3 oklab = linear_srgb_to_oklab(max(color, 0.0000000001)); + float3 oklab = linear_srgb_to_oklab(color); + float chroma = length(oklab.yz); + + if (chroma < 1e-5) { + // No hue to shift for achromatic colors + return color; + } + float hue = atan2(oklab.z, oklab.y); hue += shift * PI * 2; // Add the hue shift - - float chroma = length(oklab.yz); + oklab.y = cos(hue) * chroma; oklab.z = sin(hue) * chroma; - + return oklab_to_linear_srgb(oklab); } - - float3 hueShift(float4 color, float shift) + + float3 hueShiftHSV(float3 color, float hueOffset) { - return hueShift(color.rgb, shift); + float3 hsv = float3(hueOffset, 0, 0); + float3 hsvCol = RGBtoHSV(color); + return HSVtoRGB(hsvCol + hsv); } - - /* - float3 hueShift(float3 color, float hueOffset) + + float3 hueShift(float3 color, float shift, float ColorSpace) + { + switch(ColorSpace) + { + // OkLab Hue Shift + case 0.0: + return hueShift(color, shift); + // HSV Hue Shift + case 1.0: + return hueShiftHSV(color, shift); + default: + return float3(1.0, 0.0, 0.0); + } + } + + float3 hueShift(float4 color, float shift, float ColorSpace) { - color = RGBtoHSV(color); - color.x = frac(hueOffset +color.x); - return HSVtoRGB(color); + return hueShift(color.rgb, shift, ColorSpace); } - */ - + // LCH float xyzF(float t) { @@ -6395,7 +6500,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655)); } - + float4x4 poiRotationMatrixFromAngles(float x, float y, float z) { float angleX = radians(x); @@ -6405,7 +6510,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1); - + float angleY = radians(y); c = cos(angleY); s = sin(angleY); @@ -6413,7 +6518,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, 1, 0, 0, - s, 0, c, 0, 0, 0, 0, 1); - + float angleZ = radians(z); c = cos(angleZ); s = sin(angleZ); @@ -6421,10 +6526,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); - + return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix); } - + float4x4 poiRotationMatrixFromAngles(float3 angles) { float angleX = radians(angles.x); @@ -6434,7 +6539,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1); - + float angleY = radians(angles.y); c = cos(angleY); s = sin(angleY); @@ -6442,7 +6547,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, 1, 0, 0, - s, 0, c, 0, 0, 0, 0, 1); - + float angleZ = radians(angles.z); c = cos(angleZ); s = sin(angleZ); @@ -6450,10 +6555,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); - + return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix); } - + float3 getCameraPosition() { #ifdef USING_STEREO_MATRICES @@ -6461,7 +6566,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif return _WorldSpaceCameraPos; } - + float2 calcPixelScreenUVs(half4 grabPos) { half2 uv = grabPos.xy / (grabPos.w + 0.0000000001); @@ -6470,60 +6575,60 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else uv.xy *= _ScreenParams.xy; #endif - + return uv; } - + float CalcMipLevel(float2 texture_coord) { float2 dx = ddx(texture_coord); float2 dy = ddy(texture_coord); float delta_max_sqr = max(dot(dx, dx), dot(dy, dy)); - + return 0.5 * log2(delta_max_sqr); } - + float inverseLerp(float A, float B, float T) { return (T - A) / (B - A); } - + float inverseLerp2(float2 a, float2 b, float2 value) { float2 AB = b - a; float2 AV = value - a; return dot(AV, AB) / dot(AB, AB); } - + float inverseLerp3(float3 a, float3 b, float3 value) { float3 AB = b - a; float3 AV = value - a; return dot(AV, AB) / dot(AB, AB); } - + float inverseLerp4(float4 a, float4 b, float4 value) { float4 AB = b - a; float4 AV = value - a; return dot(AV, AB) / dot(AB, AB); } - + /* MIT License - + Copyright (c) 2019 wraikny - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -6531,29 +6636,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + VertexTransformShader is dependent on: */ - + float4 quaternion_conjugate(float4 v) { return float4( v.x, -v.yzw ); } - + float4 quaternion_mul(float4 v1, float4 v2) { float4 result1 = (v1.x * v2 + v1 * v2.x); - + float4 result2 = float4( - dot(v1.yzw, v2.yzw), cross(v1.yzw, v2.yzw) ); - + return float4(result1 + result2); } - + // angle : radians float4 get_quaternion_from_angle(float3 axis, float angle) { @@ -6561,45 +6666,45 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float cs = cos(angle * 0.5); return float4(axis * sn, cs); } - + float4 quaternion_from_vector(float3 inVec) { return float4(0.0, inVec); } - + float degree_to_radius(float degree) { return ( degree / 180.0 * PI ); } - + float3 rotate_with_quaternion(float3 inVec, float3 rotation) { float4 qx = get_quaternion_from_angle(float3(1, 0, 0), radians(rotation.x)); float4 qy = get_quaternion_from_angle(float3(0, 1, 0), radians(rotation.y)); float4 qz = get_quaternion_from_angle(float3(0, 0, 1), radians(rotation.z)); - + #define MUL3(A, B, C) quaternion_mul(quaternion_mul((A), (B)), (C)) float4 quaternion = normalize(MUL3(qx, qy, qz)); float4 conjugate = quaternion_conjugate(quaternion); - + float4 inVecQ = quaternion_from_vector(inVec); - + float3 rotated = ( MUL3(quaternion, inVecQ, conjugate) ).yzw; - + return rotated; } - + float4 transform(float4 input, float4 pos, float4 rotation, float4 scale) { input.rgb *= (scale.xyz * scale.w); input = float4(rotate_with_quaternion(input.xyz, rotation.xyz * rotation.w) + (pos.xyz * pos.w), input.w); return input; } - + float2 RotateUV(float2 _uv, float _radian, float2 _piv, float _time) { float RotateUV_ang = _radian; @@ -6607,17 +6712,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float RotateUV_sin = sin(_time * RotateUV_ang); return (mul(_uv - _piv, float2x2(RotateUV_cos, -RotateUV_sin, RotateUV_sin, RotateUV_cos)) + _piv); } - + /* MIT END */ - + float3 RotateAroundAxis(float3 original, float3 axis, float radian) { float s = sin(radian); float c = cos(radian); float one_minus_c = 1.0 - c; - + axis = normalize(axis); float3x3 rot_mat = { one_minus_c * axis.x * axis.x + c, one_minus_c * axis.x * axis.y - axis.z * s, one_minus_c * axis.z * axis.x + axis.y * s, @@ -6626,14 +6731,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" }; return mul(rot_mat, original); } - + float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex) { float3 outputColor = srcColor; if (themeIndex != 0) { themeIndex = max(themeIndex - 1, 0); - + if (themeIndex <= 3) { outputColor = poiMods.globalColorTheme[themeIndex]; @@ -6650,7 +6755,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return outputColor; } - + float3 lilToneCorrection(float3 c, float4 hsvg) { // gamma @@ -6666,7 +6771,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // hsv - > rgb return hsv.z - hsv.z * hsv.y + hsv.z * hsv.y * saturate(abs(frac(hsv.x + float3(1.0, 2.0 / 3.0, 1.0 / 3.0)) * 6.0 - 3.0) - 1.0); } - + float3 lilBlendColor(float3 dstCol, float3 srcCol, float3 srcA, int blendMode) { float3 ad = dstCol + srcCol; @@ -6678,24 +6783,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (blendMode == 3) outCol = mu; // Multiply return lerp(dstCol, outCol, srcA); } - + float lilIsIn0to1(float f) { float value = 0.5 - abs(f - 0.5); return saturate(value / clamp(fwidth(value), 0.0001, 1.0)); } - + float lilIsIn0to1(float f, float nv) { float value = 0.5 - abs(f - 0.5); return saturate(value / clamp(fwidth(value), 0.0001, nv)); } - + float poiEdgeLinearNoSaturate(float value, float border) { return (value - border) / clamp(fwidth(value), 0.0001, 1.0); } - + float3 poiEdgeLinearNoSaturate(float value, float3 border) { return float3( @@ -6704,29 +6809,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" (value - border.z) / clamp(fwidth(value), 0.0001, 1.0) ); } - + float poiEdgeLinearNoSaturate(float value, float border, float blur) { float borderMin = saturate(border - blur * 0.5); float borderMax = saturate(border + blur * 0.5); return (value - borderMin) / saturate(borderMax - borderMin + fwidth(value)); } - + float poiEdgeLinearNoSaturate(float value, float border, float blur, float borderRange) { float borderMin = saturate(border - blur * 0.5 - borderRange); float borderMax = saturate(border + blur * 0.5); return (value - borderMin) / saturate(borderMax - borderMin + fwidth(value)); } - + float poiEdgeNonLinearNoSaturate(float value, float border) { // return (value - border) / clamp(fwidth(value), 0.0001, 1.0); - + float fwidthValue = fwidth(value); return smoothstep(border - fwidthValue, border + fwidthValue, value); } - + float poiEdgeNonLinearNoSaturate(float value, float border, float blur) { float fwidthValue = fwidth(value); @@ -6734,7 +6839,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float borderMax = saturate(border + blur * 0.5); return smoothstep(borderMin - fwidthValue, borderMax + fwidthValue, value); } - + float poiEdgeNonLinearNoSaturate(float value, float border, float blur, float borderRange) { float fwidthValue = fwidth(value); @@ -6742,32 +6847,32 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float borderMax = saturate(border + blur * 0.5); return smoothstep(borderMin - fwidthValue, borderMax + fwidthValue, value); } - + float poiEdgeNonLinear(float value, float border) { return saturate(poiEdgeNonLinearNoSaturate(value, border)); } - + float poiEdgeNonLinear(float value, float border, float blur) { return saturate(poiEdgeNonLinearNoSaturate(value, border, blur)); } - + float poiEdgeNonLinear(float value, float border, float blur, float borderRange) { return saturate(poiEdgeNonLinearNoSaturate(value, border, blur, borderRange)); } - + float poiEdgeLinear(float value, float border) { return saturate(poiEdgeLinearNoSaturate(value, border)); } - + float poiEdgeLinear(float value, float border, float blur) { return saturate(poiEdgeLinearNoSaturate(value, border, blur)); } - + float poiEdgeLinear(float value, float border, float blur, float borderRange) { return saturate(poiEdgeLinearNoSaturate(value, border, blur, borderRange)); @@ -6777,12 +6882,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return LinearToGammaSpace(col); } - + float3 OpenLitSRGBToLinear(float3 col) { return GammaToLinearSpace(col); } - + float OpenLitLuminance(float3 rgb) { #if defined(UNITY_COLORSPACE_GAMMA) @@ -6791,7 +6896,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return dot(rgb, float3(0.0396819152, 0.458021790, 0.00609653955)); #endif } - + float3 AdjustLitLuminance(float3 rgb, float targetLuminance) { float currentLuminance; @@ -6800,11 +6905,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else currentLuminance = dot(rgb, float3(0.0396819152, 0.458021790, 0.00609653955)); #endif - + float luminanceRatio = targetLuminance / currentLuminance; return rgb * luminanceRatio; } - + float3 ClampLuminance(float3 rgb, float minLuminance, float maxLuminance) { float currentLuminance = dot(rgb, float3(0.299, 0.587, 0.114)); @@ -6813,19 +6918,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float luminanceRatio = clamp(min(maxRatio, max(minRatio, 1.0)), 0.0, 1.0); return lerp(rgb, rgb * luminanceRatio, luminanceRatio < 1.0); } - + float3 MaxLuminance(float3 rgb, float maxLuminance) { float currentLuminance = dot(rgb, float3(0.299, 0.587, 0.114)); float luminanceRatio = (currentLuminance != 0) ? maxLuminance / max(currentLuminance, 0.00001) : 1.0; return lerp(rgb, rgb * luminanceRatio, currentLuminance > maxLuminance); } - + float OpenLitGray(float3 rgb) { return dot(rgb, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); } - + void OpenLitShadeSH9ToonDouble(float3 lightDirection, out float3 shMax, out float3 shMin) { #if !defined(LIGHTMAP_ON) @@ -6853,13 +6958,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" shMin = 0.0; #endif } - + float3 OpenLitComputeCustomLightDirection(float4 lightDirectionOverride) { float3 customDir = length(lightDirectionOverride.xyz) * normalize(mul((float3x3)unity_ObjectToWorld, lightDirectionOverride.xyz)); return lightDirectionOverride.w ? customDir : lightDirectionOverride.xyz; // .w isn't doc'd anywhere and is always 0 unless end user changes it + } - + float3 OpenLitLightingDirectionForSH9() { float3 mainDir = _WorldSpaceLightPos0.xyz * OpenLitLuminance(_LightColor0.rgb); @@ -6870,12 +6976,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 sh9Dir = 0; float3 sh9DirAbs = 0; #endif - + float3 lightDirectionForSH9 = sh9Dir + mainDir; lightDirectionForSH9 = dot(lightDirectionForSH9, lightDirectionForSH9) < 0.000001 ? 0 : normalize(lightDirectionForSH9); return lightDirectionForSH9; } - + float3 OpenLitLightingDirection(float4 lightDirectionOverride) { float3 mainDir = _WorldSpaceLightPos0.xyz * OpenLitLuminance(_LightColor0.rgb); @@ -6887,28 +6993,28 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 sh9DirAbs = 0; #endif float3 customDir = OpenLitComputeCustomLightDirection(lightDirectionOverride); - + return normalize(sh9DirAbs + mainDir + customDir); } - + float3 OpenLitLightingDirection() { float4 customDir = float4(0.001, 0.002, 0.001, 0.0); return OpenLitLightingDirection(customDir); } - + inline float4 CalculateFrustumCorrection() { float x1 = -UNITY_MATRIX_P._31 / (UNITY_MATRIX_P._11 * UNITY_MATRIX_P._34); float x2 = -UNITY_MATRIX_P._32 / (UNITY_MATRIX_P._22 * UNITY_MATRIX_P._34); return float4(x1, x2, 0, UNITY_MATRIX_P._33 / UNITY_MATRIX_P._34 + x1 * UNITY_MATRIX_P._13 + x2 * UNITY_MATRIX_P._23); } - + inline float CorrectedLinearEyeDepth(float z, float B) { return 1.0 / (z / UNITY_MATRIX_P._34 + B); } - + // Silent's code float2 sharpSample(float4 texelSize, float2 p) { @@ -6918,7 +7024,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" p = (p - 0.5) * texelSize.xy; return p; } - + void applyToGlobalMask(inout PoiMods poiMods, int index, int blendType, float val) { float valBlended = saturate(maskBlend(poiMods.globalMask[index], val, blendType)); @@ -6942,7 +7048,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" case 15: poiMods.globalMask[15] = valBlended; break; } } - + void assignValueToVectorFromIndex(inout float4 vec, int index, float value) { switch(index) @@ -6953,7 +7059,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" case 3: vec[3] = value; break; } } - + // SNose float3 mod289(float3 x) { @@ -6967,7 +7073,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return mod289(((x * 34.0) + 1.0) * x); } - + float snoise(float2 v) { const float4 C = float4(0.211324865405187, // (3.0 - sqrt(3.0)) / 6.0 @@ -6983,7 +7089,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" i = mod289(i); // Avoid truncation effects in permutation float3 p = permute(permute(i.y + float3(0.0, i1.y, 1.0)) + i.x + float3(0.0, i1.x, 1.0)); - + float3 m = max(0.5 - float3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0); m = m * m ; m = m * m ; @@ -6997,35 +7103,35 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" g.yz = a0.yz * x12.xz + h.yz * x12.yw; return 130.0 * dot(m, g); } - + float nsqDistance(float2 a, float2 b) { return dot(a - b, a - b); } - + float poiInvertToggle(in float value, in float toggle) { return (toggle == 0 ? value : 1 - value); } - + float3 PoiBlendNormal(float3 dstNormal, float3 srcNormal) { return float3(dstNormal.xy + srcNormal.xy, dstNormal.z * srcNormal.z); } - + float3 lilTransformDirOStoWS(float3 directionOS, bool doNormalize) { if (doNormalize) return normalize(mul((float3x3)unity_ObjectToWorld, directionOS)); else return mul((float3x3)unity_ObjectToWorld, directionOS); } - + float2 poiGetWidthAndHeight(Texture2D tex) { uint width, height; tex.GetDimensions(width, height); return float2(width, height); } - + float2 poiGetWidthAndHeight(Texture2DArray tex) { uint width, height, element; @@ -7034,25 +7140,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } //ifex _EnableAudioLink==0 #ifdef POI_AUDIOLINK - + // Convenient mechanism to read from the AudioLink texture that handles reading off the end of one line and onto the next above it. float4 AudioLinkDataMultiline(uint2 xycoord) { return AudioLinkData(uint2(xycoord.x % AUDIOLINK_WIDTH, xycoord.y + xycoord.x / AUDIOLINK_WIDTH)); } - + // Mechanism to sample between two adjacent pixels and lerp between them, like "linear" supesampling float4 AudioLinkLerp(float2 xy) { return lerp(AudioLinkData(xy), AudioLinkData(xy + int2(1, 0)), frac(xy.x)); } - + // Same as AudioLinkLerp but properly handles multiline reading. float4 AudioLinkLerpMultiline(float2 xy) { return lerp(AudioLinkDataMultiline(xy), AudioLinkDataMultiline(xy + float2(1, 0)), frac(xy.x)); } - + //Tests to see if Audio Link texture is available bool AudioLinkIsAvailable() { @@ -7064,7 +7170,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return _AudioTexture_TexelSize.z > 16; #endif } - + //Get version of audiolink present in the world, 0 if no audiolink is present float AudioLinkGetVersion() { @@ -7074,7 +7180,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else dims = _AudioTexture_TexelSize.zw; #endif - + if (dims.x >= 128) return AudioLinkData(ALPASS_GENERALVU).x; else if (dims.x > 16) @@ -7082,17 +7188,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" else return 0; } - + // This pulls data from this texture. #define AudioLinkGetSelfPixelData(xy) _SelfTexture2D[xy] - + // Extra utility functions for time. uint AudioLinkDecodeDataAsUInt(uint2 indexloc) { uint4 rpx = AudioLinkData(indexloc); return rpx.r + rpx.g * 1024 + rpx.b * 1048576 + rpx.a * 1073741824; } - + //Note: This will truncate time to every 134,217.728 seconds (~1.5 days of an instance being up) to prevent floating point aliasing. // if your code will alias sooner, you will need to use a different function. It should be safe to use this on all times. float AudioLinkDecodeDataAsSeconds(uint2 indexloc) @@ -7101,15 +7207,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //Can't just divide by float. Bug in Unity's HLSL compiler. return float(time / 1000) + float(time % 1000) / 1000.; } - + #define ALDecodeDataAsSeconds(x) AudioLinkDecodeDataAsSeconds(x) #define ALDecodeDataAsUInt(x) AudioLinkDecodeDataAsUInt(x) - + float AudioLinkRemap(float t, float a, float b, float u, float v) { return ((t - a) / (b - a)) * (v - u) + u; } - + float3 AudioLinkHSVtoRGB(float3 HSV) { float3 RGB = 0; @@ -7147,11 +7253,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float M = HSV.z - C; return RGB + M; } - + float3 AudioLinkCCtoRGB(float bin, float intensity, int rootNote) { float note = bin / AUDIOLINK_EXPBINS; - + float hue = 0.0; note *= 12.0; note = glsl_mod(4. - note + rootNote, 12.0); @@ -7177,48 +7283,48 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float val = intensity - 0.1; return AudioLinkHSVtoRGB(float3(fmod(hue, 1.0), 1.0, clamp(val, 0.0, 1.0))); } - + // Sample the amplitude of a given frequency in the DFT, supports frequencies in [13.75; 14080]. float4 AudioLinkGetAmplitudeAtFrequency(float hertz) { float note = AUDIOLINK_EXPBINS * log2(hertz / AUDIOLINK_BOTTOM_FREQUENCY); return AudioLinkLerpMultiline(ALPASS_DFT + float2(note, 0)); } - + // Sample the amplitude of a given semitone in an octave. Octave is in [0; 9] while note is [0; 11]. float AudioLinkGetAmplitudeAtNote(float octave, float note) { float quarter = note * 2.0; return AudioLinkLerpMultiline(ALPASS_DFT + float2(octave * AUDIOLINK_EXPBINS + quarter, 0)); } - + // Get a reasonable drop-in replacement time value for _Time.y with the // given chronotensity index [0; 7] and AudioLink band [0; 3]. float AudioLinkGetChronoTime(uint index, uint band) { return (AudioLinkDecodeDataAsUInt(ALPASS_CHRONOTENSITY + uint2(index, band))) / 100000.0; } - + // Get a chronotensity value in the interval [0; 1], modulated by the speed input, // with the given chronotensity index [0; 7] and AudioLink band [0; 3]. float AudioLinkGetChronoTimeNormalized(uint index, uint band, float speed) { return frac(AudioLinkGetChronoTime(index, band) * speed); } - + // Get a chronotensity value in the interval [0; interval], modulated by the speed input, // with the given chronotensity index [0; 7] and AudioLink band [0; 3]. float AudioLinkGetChronoTimeInterval(uint index, uint band, float speed, float interval) { return AudioLinkGetChronoTimeNormalized(index, band, speed) * interval; } - + float getBandAtTime(float band, float time, float size = 1.0f) { //return remap(UNITY_SAMPLE_TEX2D(_AudioTexture, float2(time * width, band/128.0)).r, min(size,.9999), 1); return remapClamped(min(size, .9999), 1, AudioLinkData(ALPASS_AUDIOBASS + uint2(time * AUDIOLINK_WIDTH, band)).r); } - + fixed3 maximize(fixed3 c) { if (c.x == 0 && c.y == 0 && c.z == 0) @@ -7226,11 +7332,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" else return c / max(c.r, max(c.g, c.b)); } - + void initPoiAudioLink(inout PoiMods poiMods) { if (!_AudioLinkAnimToggle) return; - + if (AudioLinkIsAvailable()) { poiMods.audioLinkAvailable = true; @@ -7245,25 +7351,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalColorTheme[5] = AudioLinkData( ALPASS_CCCOLORS + uint2( 1, 0 ) ); poiMods.globalColorTheme[6] = AudioLinkData( ALPASS_CCCOLORS + uint2( 2, 0 ) ); poiMods.globalColorTheme[7] = AudioLinkData( ALPASS_CCCOLORS + uint2( 3, 0 ) ); - + poiMods.globalColorTheme[4] = float4(maximize(AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) )),1.0); poiMods.globalColorTheme[5] = float4(maximize(AudioLinkData( ALPASS_CCCOLORS + uint2( 1, 0 ) )),1.0); poiMods.globalColorTheme[6] = float4(maximize(AudioLinkData( ALPASS_CCCOLORS + uint2( 2, 0 ) )),1.0); poiMods.globalColorTheme[7] = float4(maximize(AudioLinkData( ALPASS_CCCOLORS + uint2( 3, 0 ) )),1.0); */ - + poiMods.globalColorTheme[4] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(2, 0))[0], AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0); poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0))[0], AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0); poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0))[0], AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0); poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0))[0], AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0); - + poiMods.globalColorTheme[8] = AudioLinkData(ALPASS_THEME_COLOR0); poiMods.globalColorTheme[9] = AudioLinkData(ALPASS_THEME_COLOR1); poiMods.globalColorTheme[10] = AudioLinkData(ALPASS_THEME_COLOR2); poiMods.globalColorTheme[11] = AudioLinkData(ALPASS_THEME_COLOR3); return; } - + if (_AudioLinkBandOverridesEnabled) { poiMods.audioLinkAvailable = true; @@ -7273,7 +7379,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.audioLink[3] = _AudioLinkBandOverrideSliders.w; } } - + void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) { if (_DebugWaveform) @@ -7322,21 +7428,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.emission += (AudioLinkDecodeDataAsUInt(ALPASS_CHRONOTENSITY + uint2(1, 0)) % 1000000) / 1000000.0; } } - + void SetupAudioLink(inout PoiFragData poiFragData, inout PoiMods poiMods, in PoiMesh poiMesh) { initPoiAudioLink(poiMods); DebugVisualizer(poiFragData, poiMesh, poiMods); - + if (_AudioLinkCCStripY) { poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].y * AUDIOLINK_WIDTH, 0)).rgb * .5; } } - + #endif //endex - + //ifex _BSSEnabled!=1 #ifdef POIBS_ENABLE //ifex _BSSBloomfog!=1 @@ -7351,7 +7457,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" (screenPosNormalized.y + - 0.5) * _CustomFogTextureToScreenRatio.y + 0.5 ,clipPos.z,clipPos.w); } - + inline float GetHeightFogIntensity(float3 worldPos, float fogHeightOffset, float fogHeightScale) { float heightFogIntensity = _CustomFogHeightFogHeight + _CustomFogHeightFogStartY; @@ -7360,7 +7466,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" heightFogIntensity = clamp(heightFogIntensity, 0, 1); return ((-heightFogIntensity * 2) + 3) * (heightFogIntensity * heightFogIntensity); } - + inline float GetFogIntensity(float3 distance, float fogStartOffset, float fogScale) { float fogIntensity = max(dot(distance, distance) + - fogStartOffset, 0); @@ -7372,7 +7478,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex #endif //endex - + VertexOut vert( #ifndef POI_TESSELLATED appdata v @@ -7389,7 +7495,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v); #endif UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - + //ifex _EnableUDIMDiscardOptions==0 #ifdef POI_UDIMDISCARD UNITY_BRANCH @@ -7402,20 +7508,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" udim += (v.uv1.xy * (_UDIMDiscardUV == 1)); udim += (v.uv2.xy * (_UDIMDiscardUV == 2)); udim += (v.uv3.xy * (_UDIMDiscardUV == 3)); - + float isDiscarded = 0; float4 xMask = float4( (udim.x >= 0 && udim.x < 1), (udim.x >= 1 && udim.x < 2), (udim.x >= 2 && udim.x < 3), (udim.x >= 3 && udim.x < 4)); - + isDiscarded += (udim.y >= 0 && udim.y < 1) * dot(float4(_UDIMDiscardRow0_0, _UDIMDiscardRow0_1, _UDIMDiscardRow0_2, _UDIMDiscardRow0_3), xMask); isDiscarded += (udim.y >= 1 && udim.y < 2) * dot(float4(_UDIMDiscardRow1_0, _UDIMDiscardRow1_1, _UDIMDiscardRow1_2, _UDIMDiscardRow1_3), xMask); isDiscarded += (udim.y >= 2 && udim.y < 3) * dot(float4(_UDIMDiscardRow2_0, _UDIMDiscardRow2_1, _UDIMDiscardRow2_2, _UDIMDiscardRow2_3), xMask); isDiscarded += (udim.y >= 3 && udim.y < 4) * dot(float4(_UDIMDiscardRow3_0, _UDIMDiscardRow3_1, _UDIMDiscardRow3_2, _UDIMDiscardRow3_3), xMask); - + isDiscarded *= any(float4(udim.y >= 0, udim.y < 4, udim.x >= 0, udim.x < 4)); // never discard outside 4x4 grid in pos coords - + // Use a threshold so that there's some room for animations to be close to 0, but not exactly 0 const float threshold = 0.001; if(isDiscarded > threshold) // Early Return skips rest of vertex shader @@ -7425,7 +7531,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _VertexManipulationsEnabled==0 #ifdef AUTO_EXPOSURE float4 audioLinkBands = 0; @@ -7444,7 +7550,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" audioLinkBands.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r; audioLinkBands.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r; audioLinkBands.w = AudioLinkData(ALPASS_AUDIOTREBLE).r; - + if (any(_VertexLocalTranslationALMin) || any(_VertexLocalTranslationALMax)) { ALLocalTranslation = lerp(_VertexLocalTranslationALMin, _VertexLocalTranslationALMax, audioLinkBands[_VertexLocalTranslationALBand]); @@ -7481,37 +7587,37 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } #endif - + // Local Transformation float4 rotation = float4(_VertexManipulationLocalRotation.xyz + float3(180, 0, 0) + _VertexManipulationLocalRotationSpeed * _Time.x + ALrotation + CTALRotation, _VertexManipulationLocalRotation.w); v.normal = rotate_with_quaternion(v.normal, rotation.xyz); v.tangent.xyz = rotate_with_quaternion(v.tangent.xyz, rotation.xyz); v.vertex = transform(v.vertex, _VertexManipulationLocalTranslation + float4(ALLocalTranslation, 0) + ALSpectrumLocalOffset, rotation, _VertexManipulationLocalScale + float4(ALScale, 0)); o.normal = UnityObjectToWorldNormal(v.normal); - + #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED) float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(vertexUV(v, _VertexManipulationHeightMaskUV), _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0))[_VertexManipulationHeightMaskChannel] - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal; #else float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal; #endif - + if (_VertexBarrelMode) { v.vertex.xz = lerp(v.vertex.xz, normalize(v.vertex.xz) * _VertexBarrelWidth + v.vertex.xz * _VertexBarrelHeight, _VertexBarrelAlpha); } - + if (_VertexSphereMode) { v.vertex.xyz = lerp(v.vertex.xyz, normalize(v.vertex.xyz + _VertexSphereCenter.xyz) * _VertexSphereRadius + v.vertex.xyz * _VertexSphereHeight, _VertexSphereAlpha); } - + if (_VertexTornadoMode) { v.vertex.xz = lerp(v.vertex.xz, float3(v.vertex.xz + float2(cos(_Time.y * _VertexTornadoSpeed + v.vertex.y * _VertexTornadoIntensity) * _VertexTornadoRadius, sin(_Time.y * _VertexTornadoSpeed + v.vertex.y * _VertexTornadoIntensity) * _VertexTornadoRadius), v.vertex.y), smoothstep(_VertexTornadoBaseHeight, _VertexTornadoTopHeight, v.vertex.y)); } - + v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz; - + // rounding UNITY_BRANCH if (_VertexRoundingEnabled) @@ -7530,7 +7636,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _EnableDissolve==0 #ifdef DISTORT UNITY_BRANCH @@ -7543,41 +7649,41 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" dissolveUdim += (v.uv1.xy * (_UVTileDissolveUV == 1)); dissolveUdim += (v.uv2.xy * (_UVTileDissolveUV == 2)); dissolveUdim += (v.uv3.xy * (_UVTileDissolveUV == 3)); - + float isDiscardedFromDissolve = 0; float4 xMaskDissolve = float4((dissolveUdim.x >= 0 && dissolveUdim.x < 1), (dissolveUdim.x >= 1 && dissolveUdim.x < 2), (dissolveUdim.x >= 2 && dissolveUdim.x < 3), (dissolveUdim.x >= 3 && dissolveUdim.x < 4)); - + isDiscardedFromDissolve += (dissolveUdim.y >= 0 && dissolveUdim.y < 1) * dot(float4(_UVTileDissolveAlpha_Row0_0, _UVTileDissolveAlpha_Row0_1, _UVTileDissolveAlpha_Row0_2, _UVTileDissolveAlpha_Row0_3), xMaskDissolve); isDiscardedFromDissolve += (dissolveUdim.y >= 1 && dissolveUdim.y < 2) * dot(float4(_UVTileDissolveAlpha_Row1_0, _UVTileDissolveAlpha_Row1_1, _UVTileDissolveAlpha_Row1_2, _UVTileDissolveAlpha_Row1_3), xMaskDissolve); isDiscardedFromDissolve += (dissolveUdim.y >= 2 && dissolveUdim.y < 3) * dot(float4(_UVTileDissolveAlpha_Row2_0, _UVTileDissolveAlpha_Row2_1, _UVTileDissolveAlpha_Row2_2, _UVTileDissolveAlpha_Row2_3), xMaskDissolve); isDiscardedFromDissolve += (dissolveUdim.y >= 3 && dissolveUdim.y < 4) * dot(float4(_UVTileDissolveAlpha_Row3_0, _UVTileDissolveAlpha_Row3_1, _UVTileDissolveAlpha_Row3_2, _UVTileDissolveAlpha_Row3_3), xMaskDissolve); - + isDiscardedFromDissolve *= any(float4(dissolveUdim.y >= 0, dissolveUdim.y < 4, dissolveUdim.x >= 0, dissolveUdim.x < 4)); // never discard outside 4x4 grid in pos coords - + // Use a threshold so that there's some room for animations to be close to 1, but not exactly 1 const float threshold = 0.999; if (isDiscardedFromDissolve > threshold) // Early Return skips rest of vertex shader - + { return (VertexOut)POI_NAN; } } #endif //endex - + //ifex _EnableMirrorOptions==0 #ifdef POI_MIRROR float notVisible = 0; - + if (_VisibilityMode == 1) // VRC - + { float mirrorMode = VRCMirrorMode(); float cameraMode = VRCCameraMode(); - + notVisible += (!_VisibilityVRCRegular && ((mirrorMode == 0) && (cameraMode == 0))); notVisible += (!_VisibilityVRCMirrorVR && (mirrorMode == 1)); notVisible += (!_VisibilityVRCMirrorDesktop && (mirrorMode == 2)); @@ -7586,50 +7692,50 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" notVisible += (!_VisibilityVRCCameraScreenshot && (cameraMode == 3)); } else if (_Mirror != 0) // Generic (CVR, etc) - + { notVisible += (_Mirror == 1) ^ IsInMirror(); } - + if (notVisible) // Early Return skips rest of vertex shader - + { return (VertexOut)POI_NAN; } #endif //endex - + o.normal = UnityObjectToWorldNormal(v.normal); o.tangent.xyz = UnityObjectToWorldDir(v.tangent); o.tangent.w = v.tangent.w; o.vertexColor = v.color; - + o.uv[0] = float4(v.uv0.xy, v.uv1.xy); o.uv[1] = float4(v.uv2.xy, v.uv3.xy); - + #if defined(LIGHTMAP_ON) o.lightmapUV.xy = v.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw; #endif #ifdef DYNAMICLIGHTMAP_ON o.lightmapUV.zw = v.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; #endif - + o.localPos = v.vertex; o.worldPos = mul(unity_ObjectToWorld, o.localPos); - + float3 localOffset = float3(0, 0, 0); float3 worldOffset = float3(0, 0, 0); - + //ifex _EnableOutlines!=1 #ifdef POI_PASS_OUTLINE float outlineMask = tex2Dlod(_OutlineMask, float4(poiUV(vertexUV(v, _OutlineMaskUV), _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0))[_OutlineMaskChannel]; - + //UNITY_BRANCH if (_OutlineVertexColorMask > 0) { outlineMask *= lerp(1, v.color[_OutlineVertexColorMask - 1], _OutlineVertexColorMaskStrength); } - + float3 outlineNormal = _OutlineSpace ? o.normal : v.normal; //UNITY_BRANCH if (_OutlineUseVertexColorNormals) @@ -7637,7 +7743,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 outlineTangent; float3 outlineBinormal; if (_OutlineSpace) // 0 Local, 1 World - + { outlineTangent = o.tangent; outlineBinormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w); @@ -7650,7 +7756,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 outlineVectorTS = v.color.rgb * 2.0 - 1.0; outlineNormal = outlineVectorTS.x * outlineTangent + outlineVectorTS.y * outlineBinormal + outlineVectorTS.z * outlineNormal; } - + float offsetMultiplier = 1; float distanceOffset = 1; //UNITY_BRANCH @@ -7658,7 +7764,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { distanceOffset *= lerp(1.0, clamp((distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz)), 0.0f, _OutlinesMaxDistance), _OutlineFixWidth); } - + float lineWidth = _LineWidth; #ifdef POI_AUDIOLINK // Due to PoiMods.audioLink being frag only I'll just @@ -7672,9 +7778,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } #endif - + float3 offset = outlineNormal * (lineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset; - + //UNITY_BRANCH if (_OutlineExpansionMode == 2) { @@ -7687,7 +7793,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { float3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal); offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy))); - + offset *= offsetMultiplier; offset *= distanceOffset; } @@ -7708,10 +7814,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _VertexGlitchingEnabled==0 #if defined(POI_VERTEX_GLITCHING) - + bool canGlitch = true; if (_VertexGlitchMirrorEnable && _VertexGlitchMirror > 0) { @@ -7725,26 +7831,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" forward.y = 0; forward = normalize(forward); float3 glitchDirection = normalize(cross(float3(0, 1, 0), forward)); - + float glitchAmount = 0; - + #if defined(POI_VERTEX_GLITCHING_TEXTURE) // if(_VertexGlitchingUseTexture) // { float uvl = o.worldPos.y * _VertexGlitchDensity + _Time.x * _VertexGlitchMapPanSpeed; float uvr = o.worldPos.y * _VertexGlitchDensity - _Time.x * _VertexGlitchMapPanSpeed; - + float3 glitchTextureL = 1; float3 glitchTextureR = 1; - + #if defined(POI_VERTEX_GLITCHING_TEXTURE) || !defined(OPTIMIZER_ENABLED) glitchTextureL = tex2Dlod(_VertexGlitchMap, float4(uvl, uvl, 0, 0)).rgb; glitchTextureR = tex2Dlod(_VertexGlitchMap, float4(uvr, uvr, 0, 0)).rgb; #endif - + glitchAmount += (glitchTextureL.r - 0.5) * 2; glitchAmount += - (glitchTextureR.r - 0.5) * 2; - + glitchAmount += (glitchTextureL.g - 0.5) * 2; glitchAmount += - (glitchTextureR.b - 0.5) * 2; // } else { @@ -7752,24 +7858,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" glitchAmount += frac(sin(dot(_Time.xy + o.worldPos.y, float2(12.9898, 78.233))) * 43758.5453123) * 2 - 1; // } #endif - + float time = _Time.y * _VertexGlitchFrequency; - + float randomGlitch = (sin(time) + sin(2.2 * time + 5.52) + sin(2.9 * time + 0.93) + sin(4.6 * time + 8.94)) / 4; float3 glitchOffset = 0; - + #ifdef POI_AUDIOLINK if (AudioLinkIsAvailable() && _VertexGlitchingAudioLinkEnabled) { // float4 audioLinkData = AudioLinkData(ALPASS_AUDIOBASS); - + float audioIntensity = AudioLinkData(ALPASS_AUDIOBASS).r * (_VertexGlitchingAudioLinkBand == 0) + AudioLinkData(ALPASS_AUDIOLOWMIDS).r * (_VertexGlitchingAudioLinkBand == 1) + AudioLinkData(ALPASS_AUDIOHIGHMIDS).r * (_VertexGlitchingAudioLinkBand == 2) + AudioLinkData(ALPASS_AUDIOTREBLE).r * (_VertexGlitchingAudioLinkBand == 3) + AudioLinkData(ALPASS_FILTEREDVU_INTENSITY).r * (_VertexGlitchingAudioLinkBand == 4); - + if(_VertexGlitchingAudiolinkOverride) { glitchOffset = glitchAmount * glitchDirection * (_VertexGlitchStrength * .01) * audioIntensity; @@ -7784,22 +7890,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else glitchOffset = glitchAmount * glitchDirection * (_VertexGlitchStrength * .01) * step(_VertexGlitchThreshold, randomGlitch); #endif - + localOffset += glitchOffset; worldOffset += mul(unity_ObjectToWorld, glitchOffset); } #endif //endex - + o.localPos.rgb += localOffset; o.worldPos.rgb += worldOffset; - + //ifex _EnableDepthBulge==0 #if defined(POI_DEPTHBULGE) && (defined(POI_PASS_BASE) || defined(POI_PASS_ADD)) applyDepthBulgeFX(o); #endif //endex - + //ifex _BSSEnabled!=1 #ifdef POIBS_ENABLE //ifex _BSSBloomfog!=1 @@ -7810,9 +7916,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex #endif //endex - + o.pos = UnityObjectToClipPos(o.localPos); - + #ifdef POI_PASS_OUTLINE #if defined(UNITY_REVERSED_Z) //DX @@ -7823,7 +7929,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //o.grabPos = ComputeGrabScreenPos(o.pos); - + #ifndef FORWARD_META_PASS #if !defined(UNITY_PASS_SHADOWCASTER) UNITY_TRANSFER_SHADOW(o, o.uv[0].xy); @@ -7832,9 +7938,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" TRANSFER_SHADOW_CASTER_NOPOS(o, o.pos); #endif #endif - + UNITY_TRANSFER_FOG(o, o.pos); - + if (_RenderingReduceClipDistance) { if (o.pos.w < _ProjectionParams.y * 1.01 && o.pos.w > 0) @@ -7846,14 +7952,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif } } - + #ifdef POI_PASS_META o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST); #endif - + return o; } - + //ifex _GlobalMaskTexturesEnable==0 #ifdef POI_GLOBALMASK_TEXTURES void ApplyGlobalMaskTextures(in PoiMesh poiMesh, inout PoiMods poiMods) @@ -7875,7 +7981,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[3] = gmcol0[3]; } #endif - + #if defined(PROP_GLOBALMASKTEXTURE1) || !defined(OPTIMIZER_ENABLED) float4 gmcol1 = POI2D_SAMPLER_PAN(_GlobalMaskTexture1, _MainTex, poiUV(poiMesh.uv[_GlobalMaskTexture1UV], _GlobalMaskTexture1_ST), _GlobalMaskTexture1Pan); if (_GlobalMaskTexture1Split) @@ -7893,7 +7999,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[7] = gmcol1[3]; } #endif - + #if defined(PROP_GLOBALMASKTEXTURE2) || !defined(OPTIMIZER_ENABLED) float4 gmcol2 = POI2D_SAMPLER_PAN(_GlobalMaskTexture2, _MainTex, poiUV(poiMesh.uv[_GlobalMaskTexture2UV], _GlobalMaskTexture2_ST), _GlobalMaskTexture2Pan); if (_GlobalMaskTexture2Split) @@ -7911,7 +8017,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[11] = gmcol2[3]; } #endif - + #if defined(PROP_GLOBALMASKTEXTURE3) || !defined(OPTIMIZER_ENABLED) float4 gmcol3 = POI2D_SAMPLER_PAN(_GlobalMaskTexture3, _MainTex, poiUV(poiMesh.uv[_GlobalMaskTexture3UV], _GlobalMaskTexture3_ST), _GlobalMaskTexture3Pan); if (_GlobalMaskTexture3Split) @@ -7996,7 +8102,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (_GlobalMaskToggleOn_13) poiMods.globalMask[13] = 1; if (_GlobalMaskToggleOn_14) poiMods.globalMask[14] = 1; if (_GlobalMaskToggleOn_15) poiMods.globalMask[15] = 1; - + poiMods.globalMask[0] *= (1 - _GlobalMaskToggleOff_0); poiMods.globalMask[1] *= (1 - _GlobalMaskToggleOff_1); poiMods.globalMask[2] *= (1 - _GlobalMaskToggleOff_2); @@ -8015,10 +8121,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[15] *= (1 - _GlobalMaskToggleOff_15); } //endex - + } //endex - + float customDistanceBlend(float base, float blend, float blendType) { switch(blendType) @@ -8028,7 +8134,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" default: return 0; break; } } - + void handleGlobalMaskDistance(int index, bool enable, bool type, float minAlpha, float maxAlpha, float min, float max, int blendType, in PoiMesh poiMesh, inout PoiMods poiMods) { if (enable) @@ -8038,7 +8144,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[index] = saturate(customDistanceBlend(poiMods.globalMask[index], val, blendType)); } } - + void ApplyGlobalMaskModifiers(in PoiMesh poiMesh, inout PoiMods poiMods, in PoiCam poiCam) { //ifex _GlobalMaskModifiersBackfaceEnable==0 @@ -8064,7 +8170,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[15] *= _GlobalMaskBackface_15 == 0 ? 1 : (facingMode == (_GlobalMaskBackface_15)); } //endex - + //ifex _GlobalMaskModifiersMirrorEnable==0 if (_GlobalMaskModifiersMirrorEnable) { @@ -8073,7 +8179,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" mirrorMode = VRCMirrorMode() > 0; else // Generic (CVR, etc) mirrorMode = IsInMirror(); - + mirrorMode += 1; // _GlobalMaskMirror is 0 for ignore, 1 for outside mirror only, 2 for in mirror only poiMods.globalMask[0] *= _GlobalMaskMirror_0 == 0 ? 1 : (mirrorMode == (_GlobalMaskMirror_0)); @@ -8094,7 +8200,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[15] *= _GlobalMaskMirror_15 == 0 ? 1 : (mirrorMode == (_GlobalMaskMirror_15)); } //endex - + //ifex _GlobalMaskModifiersCameraEnable==0 if (_GlobalMaskModifiersCameraEnable) { @@ -8170,12 +8276,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _GlobalMaskDistanceEnable_15==0 handleGlobalMaskDistance(15, _GlobalMaskDistanceEnable_15, _GlobalMaskDistanceType_15, _GlobalMaskDistanceMinAlpha_15, _GlobalMaskDistanceMaxAlpha_15, _GlobalMaskDistanceMin_15, _GlobalMaskDistanceMax_15, _GlobalMaskDistanceBlendType_15, poiMesh, poiMods); //endex - + } //endex - + } - + //ifex _GlobalMaskVertexColorRed==0 && _GlobalMaskVertexColorGreen==0 && _GlobalMaskVertexColorBlue==0 && _GlobalMaskVertexColorAlpha==0 void ApplyGlobalMaskVertexColors(in PoiMesh poiMesh, inout PoiMods poiMods) { @@ -8202,7 +8308,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } //endex - + //ifex _EnableUDIMDiscardOptions==0 #ifdef POI_UDIMDISCARD void applyUDIMDiscard(in VertexOut i) @@ -8210,29 +8316,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if(_UDIMDiscardMode == 1) // Don't run if in vertex mode { float2 udim = floor(vertexUV(i, _UDIMDiscardUV)); - + float isDiscarded = 0; float4 xMask = float4( (udim.x >= 0 && udim.x < 1), (udim.x >= 1 && udim.x < 2), (udim.x >= 2 && udim.x < 3), (udim.x >= 3 && udim.x < 4)); - + isDiscarded += (udim.y >= 0 && udim.y < 1) * dot(float4(_UDIMDiscardRow0_0, _UDIMDiscardRow0_1, _UDIMDiscardRow0_2, _UDIMDiscardRow0_3), xMask); isDiscarded += (udim.y >= 1 && udim.y < 2) * dot(float4(_UDIMDiscardRow1_0, _UDIMDiscardRow1_1, _UDIMDiscardRow1_2, _UDIMDiscardRow1_3), xMask); isDiscarded += (udim.y >= 2 && udim.y < 3) * dot(float4(_UDIMDiscardRow2_0, _UDIMDiscardRow2_1, _UDIMDiscardRow2_2, _UDIMDiscardRow2_3), xMask); isDiscarded += (udim.y >= 3 && udim.y < 4) * dot(float4(_UDIMDiscardRow3_0, _UDIMDiscardRow3_1, _UDIMDiscardRow3_2, _UDIMDiscardRow3_3), xMask); - + isDiscarded *= any(float4(udim.y >= 0, udim.y < 4, udim.x >= 0, udim.x < 4)); // never discard outside 4x4 grid in pos coords - + const float threshold = 0.001; clip(threshold - isDiscarded); // Clip if discarded } - + return; } #endif //endex - + //ifex _EnableMirrorOptions==0 #ifdef POI_MIRROR void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) @@ -8248,7 +8354,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { inMirror = IsInMirror(); } - + #if (defined(POI_PASS_BASE) || defined(POI_PASS_ADD)) #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED) float4 mirrorTexture = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiUV(poiMesh.uv[_MirrorTextureUV], _MirrorTexture_ST), _MirrorTexturePan); @@ -8267,7 +8373,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + float4 frag(VertexOut i, uint facing : SV_IsFrontFace) : SV_Target /* #ifdef @@ -8280,16 +8386,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); return float4(1, 1, 1, 1); } - + ENDCG } //endex - + Pass { Name "Base" Tags { "LightMode" = "ForwardBase" } - + Stencil { Ref [_StencilRef] @@ -8301,31 +8407,31 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Fail [_StencilFailOp] ZFail [_StencilZFailOp] //endex - + //ifex _StencilType==0 CompBack [_StencilBackCompareFunction] PassBack [_StencilBackPassOp] FailBack [_StencilBackFailOp] ZFailBack [_StencilBackZFailOp] - + CompFront [_StencilFrontCompareFunction] PassFront [_StencilFrontPassOp] FailFront [_StencilFrontFailOp] ZFailFront [_StencilFrontZFailOp] //endex } - + ZWrite [_ZWrite] Cull [_Cull] - + AlphaToMask [_AlphaToCoverage] ZTest [_ZTest] ColorMask [_ColorMask] Offset [_OffsetFactor], [_OffsetUnits] - + BlendOp [_BlendOp], [_BlendOpAlpha] Blend [_SrcBlend] [_DstBlend], [_SrcBlendAlpha] [_DstBlendAlpha] - + CGPROGRAM /* // Disable warnings we aren't interested in @@ -8340,80 +8446,80 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex 0==0 #pragma skip_optimizations d3d11 //endex - + #pragma shader_feature_local _STOCHASTICMODE_DELIOT_HEITZ _STOCHASTICMODE_HEXTILE _STOCHASTICMODE_NONE - + //ifex _MainColorAdjustToggle==0 #pragma shader_feature COLOR_GRADING_HDR //endex - + //#pragma shader_feature KEYWORD - + #pragma skip_variants LIGHTMAP_ON DYNAMICLIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK DIRLIGHTMAP_COMBINED _MIXED_LIGHTING_SUBTRACTIVE #pragma skip_variants DECALS_OFF DECALS_3RT DECALS_4RT DECAL_SURFACE_GRADIENT _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 #pragma skip_variants _ADDITIONAL_LIGHT_SHADOWS #pragma skip_variants PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 #pragma skip_variants _SCREEN_SPACE_OCCLUSION - + //ifex _GlobalMaskTexturesEnable==0 #pragma shader_feature_local POI_GLOBALMASK_TEXTURES //endex - + //ifex _EnableUDIMDiscardOptions==0 #pragma shader_feature_local POI_UDIMDISCARD //endex - + //ifex _EnableDistortion==0 #pragma shader_feature USER_LUT //endex - + //ifex _PoiParallax==0 #pragma shader_feature_local POI_PARALLAX //endex - + //ifex _EnableAudioLink==0 #pragma shader_feature_local POI_AUDIOLINK //endex - + //ifex _BlackLightMaskingEnabled==0 #pragma shader_feature_local POI_BLACKLIGHTMASKING //endex - + //ifex _DetailEnabled==0 #pragma shader_feature FINALPASS //endex - + //ifex _VertexManipulationsEnabled==0 #pragma shader_feature AUTO_EXPOSURE //endex - + //ifex _VertexGlitchingEnabled==0 #pragma shader_feature_local POI_VERTEX_GLITCHING #pragma shader_feature_local POI_VERTEX_GLITCHING_TEXTURE //endex - + //ifex _EnableDepthBulge==0 #pragma shader_feature_local POI_DEPTHBULGE //endex - + //ifex _BackFaceEnabled!=1 #pragma shader_feature_local POI_BACKFACE //endex - + //ifex _RGBMaskEnabled==0 #pragma shader_feature VIGNETTE #pragma shader_feature GEOM_TYPE_MESH //endex - + //ifex _LTCGIEnabled!=1 #pragma shader_feature_local POI_LTCGI //endex - + //ifex _ShadingEnabled==0 #pragma shader_feature_local VIGNETTE_MASKED #pragma shader_feature_local _LIGHTINGMODE_TEXTURERAMP _LIGHTINGMODE_MULTILAYER_MATH _LIGHTINGMODE_SHADEMAP _LIGHTINGMODE_REALISTIC _LIGHTINGMODE_WRAPPED _LIGHTINGMODE_SKIN _LIGHTINGMODE_FLAT _LIGHTINGMODE_CLOTH _LIGHTINGMODE_SDF //endex - + //ifex _DecalEnabled==0 #pragma shader_feature GEOM_TYPE_BRANCH //endex @@ -8426,15 +8532,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _DecalEnabled3==0 #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW //endex - + //ifex _EnableDissolve==0 #pragma shader_feature DISTORT //endex - + //ifex _EnableAniso==0 #pragma shader_feature_local POI_ANISOTROPICS //endex - + //ifex _MatcapEnable==0 #pragma shader_feature_local POI_MATCAP0 #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL @@ -8451,23 +8557,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #pragma shader_feature_local POI_MATCAP3 #pragma shader_feature_local POI_MATCAP3_CUSTOM_NORMAL //endex - + //ifex _CubeMapEnabled==0 #pragma shader_feature_local _CUBEMAP //endex - + //ifex _EnableALDecal==0 #pragma shader_feature_local POI_AL_DECAL //endex - + //ifex _EnableVolumeColor==0 #pragma shader_feature_local POI_AL_VOLUMECOLOR //endex - + //ifex _EnableFlipbook==0 #pragma shader_feature _SUNDISK_HIGH_QUALITY //endex - + //ifex _EnableEmission==0 #pragma shader_feature _EMISSION //endex @@ -8480,7 +8586,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _EnableEmission3==0 #pragma shader_feature_local POI_EMISSION_3 //endex - + //ifex _EnableRimLighting==0 #pragma shader_feature_local _GLOSSYREFLECTIONS_OFF #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2 _RIMSTYLE_LILTOON @@ -8489,70 +8595,70 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #pragma shader_feature_local POI_RIM2 #pragma shader_feature_local _RIM2STYLE_POIYOMI _RIM2STYLE_UTS2 _RIM2STYLE_LILTOON //endex - + //ifex _EnableDepthRimLighting==0 #pragma shader_feature_local _POI_DEPTH_RIMLIGHT //endex - + //ifex _GlitterEnable==0 #pragma shader_feature _SUNDISK_SIMPLE //endex - + //ifex _SubsurfaceScattering==0 #pragma shader_feature_local POI_SUBSURFACESCATTERING //endex - + //ifex _MochieBRDF==0 #pragma shader_feature_local MOCHIE_PBR //endex //ifex _ClearCoatBRDF==0 #pragma shader_feature_local POI_CLEARCOAT //endex - + //ifex _EnableEnvironmentalRim==0 #pragma shader_feature_local POI_ENVIRORIM //endex - + //ifex _StylizedSpecular==0 #pragma shader_feature_local POI_STYLIZED_StylizedSpecular //endex - + //ifex _EnablePathing==0 #pragma shader_feature_local POI_PATHING //endex - + //ifex _EnableMirrorOptions==0 #pragma shader_feature_local POI_MIRROR //endex - + //ifex _EnableTouchGlow==0 #pragma shader_feature GRAIN //endex - + //ifex _TextEnabled==0 #pragma shader_feature EFFECT_BUMP //endex - + //ifex _PostProcess==0 #pragma shader_feature_local POSTPROCESS //endex - + //ifex _PoiInternalParallax==0 #pragma shader_feature_local POI_INTERNALPARALLAX //endex - + //ifex _NormalCorrect==0 #pragma shader_feature_local POI_NORMALCORRECT //endex - + //ifex _VideoEffectsEnable==0 #pragma shader_feature_local POI_VIDEO_EFFECTS //endex - + //ifex _BacklightEnabled!=1 #pragma shader_feature_local POI_BACKLIGHT //endex - + //ifex _BSSEnabled!=1 #pragma shader_feature_local POIBS_ENABLE //ifex _BSSBloomfog!=1 @@ -8560,17 +8666,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #pragma shader_feature_local BSSBLOOMFOGTYPE_HEIGHT //endex //endex - + //ifex _VoronoiEnabled!=1 #pragma shader_feature_local POI_VORONOI //endex - + #pragma multi_compile_fwdbase #pragma multi_compile_instancing #pragma multi_compile_fog - #pragma multi_compile _ VERTEXLIGHT_ON + #pragma multi_compile_fragment _ VERTEXLIGHT_ON #define POI_PASS_BASE - + // UNITY Includes #include "UnityCG.cginc" #include "UnityStandardUtils.cginc" @@ -8581,16 +8687,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #include "UnityMetaPass.cginc" #endif #pragma vertex vert - + #pragma fragment frag - + #define DielectricSpec float4(0.04, 0.04, 0.04, 1.0 - 0.04) #define PI float(3.14159265359) #define Epsilon float(1e-10) - + #define POI2D_SAMPLE_TEX2D_SAMPLERGRAD(tex, samplertex, coord, dx, dy) tex.SampleGrad(sampler##samplertex, coord, dx, dy) #define POI2D_SAMPLE_TEX2D_SAMPLERGRADD(tex, samp, uv, pan, dx, dy) tex.SampleGrad(samp, POI_PAN_UV(uv, pan), dx, dy) - + #define POI_PAN_UV(uv, pan) (uv + _Time.x * pan) #define POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, POI_PAN_UV(uv, pan))) #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, dx, dy) (POI2D_SAMPLE_TEX2D_SAMPLERGRAD(tex, texSampler, POI_PAN_UV(uv, pan), dx, dy)) @@ -8603,29 +8709,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv)) #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, POI_PAN_UV(uv, pan))) #define POI_SAMPLE_CUBE_LOD(tex, samp, uv, lod) texCUBElod(tex, float4(uv, 0, lod)) - + #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED) #define POI_SAMPLE_SCREEN(tex, samp, uv) tex.Sample(samp, float3(uv, unity_StereoEyeIndex)) #else #define POI_SAMPLE_SCREEN(tex, samp, uv) tex.Sample(samp, uv) #endif - + // When using, properties won't properly lock at optimize time; needs macro evaluation implemented // #define POI2D_MAINTEX_SAMPLER_PAN_INLINED(tex, poiMesh) (POI2D_SAMPLER_PAN(tex, _MainTex, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Pan)) - + #define POI_SAFE_RGB0 float4(mainTexture.rgb * .0001, 0) #define POI_SAFE_RGB1 float4(mainTexture.rgb * .0001, 1) #define POI_SAFE_RGBA mainTexture - + #if defined(UNITY_COMPILER_HLSL) #define PoiInitStruct(type, name) name = (type)0; #else #define PoiInitStruct(type, name) #endif - + #define POI_ERROR(poiMesh, gridSize) lerp(float3(1, 0, 1), float3(0, 0, 0), fmod(floor((poiMesh.worldPos.x) * gridSize) + floor((poiMesh.worldPos.y) * gridSize) + floor((poiMesh.worldPos.z) * gridSize), 2) == 0) #define POI_NAN (asfloat(-1)) - + #define POI_MODE_OPAQUE 0 #define POI_MODE_CUTOUT 1 #define POI_MODE_FADE 2 @@ -8635,17 +8741,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define POI_MODE_MULTIPLICATIVE 6 #define POI_MODE_2XMULTIPLICATIVE 7 #define POI_MODE_TRANSCLIPPING 9 - + /* Texture2D ; float4 _ST; float2 Pan; float UV; float Stochastic; - + [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )] */ - + //ifex _EnableAudioLink==0 #ifdef POI_AUDIOLINK // Map of where features in AudioLink are. @@ -8678,7 +8784,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define ALPASS_FILTEREDVU uint2(24, 28) //Size: 4, 4 #define ALPASS_FILTEREDVU_INTENSITY uint2(24, 28) //Size: 4, 1 #define ALPASS_FILTEREDVU_MARKER uint2(24, 29) //Size: 4, 1 - + // Some basic constants to use (Note, these should be compatible with // future version of AudioLink, but may change. #define AUDIOLINK_SAMPHIST 3069 // Internal use for algos, do not change. @@ -8697,7 +8803,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define AUDIOLINK_DELAY_COEFFICIENT_MAX 0.9 #define AUDIOLINK_DFT_Q 4.0 #define AUDIOLINK_TREBLE_CORRECTION 5.0 - + // ColorChord constants #define COLORCHORD_EMAXBIN 192 #define COLORCHORD_IIR_DECAY_1 0.90 @@ -8707,13 +8813,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define COLORCHORD_NOTE_CLOSEST 3.0 #define COLORCHORD_NEW_NOTE_GAIN 8.0 #define COLORCHORD_MAX_NOTES 10 - + uniform float4 _AudioTexture_TexelSize; - + #ifdef SHADER_TARGET_SURFACE_ANALYSIS #define AUDIOLINK_STANDARD_INDEXING #endif - + // Mechanism to index into texture. #ifdef AUDIOLINK_STANDARD_INDEXING sampler2D _AudioTexture; @@ -8727,16 +8833,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" uniform float4 _Stored_TexelSize; #endif //endex - + float _GrabMode; float _Mode; - + float _StochasticDeliotHeitzDensity; float _StochasticHexGridDensity; float _StochasticHexRotationStrength; float _StochasticHexFallOffContrast; float _StochasticHexFallOffPower; - + #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED) Texture2D _LightingAOMaps; #endif @@ -8749,7 +8855,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _LightDataAOStrengthA; float _LightDataAOGlobalMaskR; float _LightDataAOGlobalMaskBlendTypeR; - + #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED) Texture2D _LightingDetailShadowMaps; #endif @@ -8766,7 +8872,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _LightingAddDetailShadowStrengthA; float _LightDataDetailShadowGlobalMaskR; float _LightDataDetailShadowGlobalMaskBlendTypeR; - + #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED) Texture2D _LightingShadowMasks; #endif @@ -8779,7 +8885,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _LightingShadowMaskStrengthA; float _LightDataShadowMaskGlobalMaskR; float _LightDataShadowMaskGlobalMaskBlendTypeR; - + // Lighting Data float _Unlit_Intensity; float _LightingColorMode; @@ -8810,13 +8916,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // Lighting Data Debug float _LightDataDebugEnabled; float _LightingDebugVisualize; - + float _IgnoreFog; float _RenderingReduceClipDistance; int _FlipBackfaceNormals; float _AddBlendOp; float _Cull; - + float4 _Color; float _ColorThemeIndex; UNITY_DECLARE_TEX2D(_MainTex); @@ -8842,7 +8948,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaMaskUV; float _AlphaMaskInvert; float _MainAlphaMaskMode; - float _AlphaMaskScale; + float _AlphaMaskBlendStrength; float _AlphaMaskValue; #endif float _Cutoff; @@ -8855,25 +8961,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _MainColorAdjustTexture_ST; float2 _MainColorAdjustTexturePan; float _MainColorAdjustTextureUV; + float _MainHueShiftColorSpace; float _MainHueShiftToggle; float _MainHueShiftReplace; float _MainHueShift; float _MainHueShiftSpeed; float _Saturation; float _MainBrightness; - + float _MainHueALCTEnabled; float _MainALHueShiftBand; float _MainALHueShiftCTIndex; float _MainHueALMotionSpeed; - + float _MainHueGlobalMask; float _MainHueGlobalMaskBlendType; float _MainSaturationGlobalMask; float _MainSaturationGlobalMaskBlendType; float _MainBrightnessGlobalMask; float _MainBrightnessGlobalMaskBlendType; - + #if defined(PROP_MAINGRADATIONTEX) || !defined(OPTIMIZER_ENABLED) Texture2D _MainGradationTex; #endif @@ -8881,11 +8988,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _MainGradationStrength; #endif //endex - + SamplerState sampler_linear_clamp; SamplerState sampler_linear_repeat; SamplerState sampler_trilinear_repeat; - + float _AlphaForceOpaque; float _AlphaMod; float _AlphaPremultiply; @@ -8895,13 +9002,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaSharpenedA2C; float _AlphaMipScale; //endex - + //ifex _AlphaDithering==0 && isNotAnimated(_AlphaDithering) float _AlphaDithering; float _AlphaDitherGradient; float _AlphaDitherBias; //endex - + //ifex _AlphaDistanceFade==0 && isNotAnimated(_AlphaDistanceFade) float _AlphaDistanceFade; float _AlphaDistanceFadeType; @@ -8912,7 +9019,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaDistanceFadeGlobalMask; float _AlphaDistanceFadeGlobalMaskBlendType; //endex - + //ifex _AlphaFresnel==0 && isNotAnimated(_AlphaFresnel) float _AlphaFresnel; float _AlphaFresnelAlpha; @@ -8922,7 +9029,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaFresnelGlobalMask; float _AlphaFresnelGlobalMaskBlendType; //endex - + //ifex _AlphaAngular==0 && isNotAnimated(_AlphaAngular) float _AlphaAngular; float _AngleType; @@ -8936,16 +9043,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaAngularGlobalMask; float _AlphaAngularGlobalMaskBlendType; //endex - + //ifex _AlphaAudioLinkEnabled==0 && isNotAnimated(_AlphaAudioLinkEnabled) float _AlphaAudioLinkEnabled; float2 _AlphaAudioLinkAddRange; float _AlphaAudioLinkAddBand; //endex - + float _AlphaGlobalMask; float _AlphaGlobalMaskBlendType; - + float4 _GlobalThemeColor0; float4 _GlobalThemeColor1; float4 _GlobalThemeColor2; @@ -8966,7 +9073,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalThemeValue1; float _GlobalThemeValue2; float _GlobalThemeValue3; - + //ifex _GlobalMaskTexturesEnable==0 #ifdef POI_GLOBALMASK_TEXTURES #if defined(PROP_GLOBALMASKTEXTURE0) || !defined(OPTIMIZER_ENABLED) @@ -8982,7 +9089,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _GlobalMaskTexture0SplitPan_B; float4 _GlobalMaskTexture0SplitTilingOffset_A; float4 _GlobalMaskTexture0SplitPan_A; - + #if defined(PROP_GLOBALMASKTEXTURE1) || !defined(OPTIMIZER_ENABLED) Texture2D _GlobalMaskTexture1; #endif @@ -8996,7 +9103,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _GlobalMaskTexture1SplitPan_B; float4 _GlobalMaskTexture1SplitTilingOffset_A; float4 _GlobalMaskTexture1SplitPan_A; - + #if defined(PROP_GLOBALMASKTEXTURE2) || !defined(OPTIMIZER_ENABLED) Texture2D _GlobalMaskTexture2; #endif @@ -9010,7 +9117,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _GlobalMaskTexture2SplitPan_B; float4 _GlobalMaskTexture2SplitTilingOffset_A; float4 _GlobalMaskTexture2SplitPan_A; - + #if defined(PROP_GLOBALMASKTEXTURE3) || !defined(OPTIMIZER_ENABLED) Texture2D _GlobalMaskTexture3; #endif @@ -9029,7 +9136,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _GlobalMaskOptionsEnable==0 float _GlobalMaskOptionsEnable; int _GlobalMaskOptionsType; - + //ifex _GlobalMaskOptionsType!=0 float _GlobalMaskSlider_0; float _GlobalMaskSlider_1; @@ -9048,7 +9155,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskSlider_14; float _GlobalMaskSlider_15; //endex - + //ifex _GlobalMaskOptionsType!=1 float2 _GlobalMaskMinMaxSlider_0; float2 _GlobalMaskMinMaxSlider_1; @@ -9067,7 +9174,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _GlobalMaskMinMaxSlider_14; float2 _GlobalMaskMinMaxSlider_15; //endex - + //ifex _GlobalMaskOptionsType!=2 int _GlobalMaskToggleOn_0; int _GlobalMaskToggleOff_0; @@ -9122,7 +9229,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskBackface_14; float _GlobalMaskBackface_15; //endex - + //ifex _GlobalMaskModifiersMirrorEnable==0 float _GlobalMaskModifiersMirrorEnable; float _GlobalMaskMirrorVisibilityMode; @@ -9143,7 +9250,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskMirror_14; float _GlobalMaskMirror_15; //endex - + //ifex _GlobalMaskModifiersCameraEnable==0 float _GlobalMaskModifiersCameraEnable; float _GlobalMaskCamera_0; @@ -9163,10 +9270,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskCamera_14; float _GlobalMaskCamera_15; //endex - + //ifex _GlobalMaskModifiersDistanceEnable==0 int _GlobalMaskModifiersDistanceEnable; - + //ifex _GlobalMaskDistanceEnable_0==0 int _GlobalMaskDistanceEnable_0; int _GlobalMaskDistanceType_0; @@ -9176,7 +9283,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_0; int _GlobalMaskDistanceBlendType_0; //endex - + //ifex _GlobalMaskDistanceEnable_1==0 int _GlobalMaskDistanceEnable_1; int _GlobalMaskDistanceType_1; @@ -9186,7 +9293,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_1; int _GlobalMaskDistanceBlendType_1; //endex - + //ifex _GlobalMaskDistanceEnable_2==0 int _GlobalMaskDistanceEnable_2; int _GlobalMaskDistanceType_2; @@ -9196,7 +9303,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_2; int _GlobalMaskDistanceBlendType_2; //endex - + //ifex _GlobalMaskDistanceEnable_3==0 int _GlobalMaskDistanceEnable_3; int _GlobalMaskDistanceType_3; @@ -9206,7 +9313,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_3; int _GlobalMaskDistanceBlendType_3; //endex - + //ifex _GlobalMaskDistanceEnable_4==0 int _GlobalMaskDistanceEnable_4; int _GlobalMaskDistanceType_4; @@ -9216,7 +9323,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_4; int _GlobalMaskDistanceBlendType_4; //endex - + //ifex _GlobalMaskDistanceEnable_5==0 int _GlobalMaskDistanceEnable_5; int _GlobalMaskDistanceType_5; @@ -9226,7 +9333,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_5; int _GlobalMaskDistanceBlendType_5; //endex - + //ifex _GlobalMaskDistanceEnable_6==0 int _GlobalMaskDistanceEnable_6; int _GlobalMaskDistanceType_6; @@ -9236,7 +9343,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_6; int _GlobalMaskDistanceBlendType_6; //endex - + //ifex _GlobalMaskDistanceEnable_7==0 int _GlobalMaskDistanceEnable_7; int _GlobalMaskDistanceType_7; @@ -9246,7 +9353,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_7; int _GlobalMaskDistanceBlendType_7; //endex - + //ifex _GlobalMaskDistanceEnable_8==0 int _GlobalMaskDistanceEnable_8; int _GlobalMaskDistanceType_8; @@ -9256,7 +9363,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_8; int _GlobalMaskDistanceBlendType_8; //endex - + //ifex _GlobalMaskDistanceEnable_9==0 int _GlobalMaskDistanceEnable_9; int _GlobalMaskDistanceType_9; @@ -9266,7 +9373,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_9; int _GlobalMaskDistanceBlendType_9; //endex - + //ifex _GlobalMaskDistanceEnable_10==0 int _GlobalMaskDistanceEnable_10; int _GlobalMaskDistanceType_10; @@ -9276,7 +9383,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_10; int _GlobalMaskDistanceBlendType_10; //endex - + //ifex _GlobalMaskDistanceEnable_11==0 int _GlobalMaskDistanceEnable_11; int _GlobalMaskDistanceType_11; @@ -9286,7 +9393,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_11; int _GlobalMaskDistanceBlendType_11; //endex - + //ifex _GlobalMaskDistanceEnable_12==0 int _GlobalMaskDistanceEnable_12; int _GlobalMaskDistanceType_12; @@ -9296,7 +9403,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_12; int _GlobalMaskDistanceBlendType_12; //endex - + //ifex _GlobalMaskDistanceEnable_13==0 int _GlobalMaskDistanceEnable_13; int _GlobalMaskDistanceType_13; @@ -9306,7 +9413,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_13; int _GlobalMaskDistanceBlendType_13; //endex - + //ifex _GlobalMaskDistanceEnable_14==0 int _GlobalMaskDistanceEnable_14; int _GlobalMaskDistanceType_14; @@ -9316,7 +9423,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_14; int _GlobalMaskDistanceBlendType_14; //endex - + //ifex _GlobalMaskDistanceEnable_15==0 int _GlobalMaskDistanceEnable_15; int _GlobalMaskDistanceType_15; @@ -9327,7 +9434,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _GlobalMaskDistanceBlendType_15; //endex //endex - + int _GlobalMaskVertexColorLinearSpace; //ifex _GlobalMaskVertexColorRed==0 int _GlobalMaskVertexColorRed; @@ -9345,7 +9452,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _GlobalMaskVertexColorAlpha; int _GlobalMaskVertexColorAlphaBlendType; //endex - + //ifex _EnableUDIMDiscardOptions==0 #ifdef POI_UDIMDISCARD float _UDIMDiscardMode; @@ -9368,7 +9475,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _UDIMDiscardRow0_3; #endif //endex - + //ifex _EnableDistortion==0 #ifdef USER_LUT #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED) @@ -9377,14 +9484,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _DistortionFlowTexturePan; float _DistortionFlowTextureUV; #endif - + #if defined(PROP_DISTORTIONFLOWTEXTURE1) || !defined(OPTIMIZER_ENABLED) Texture2D _DistortionFlowTexture1; float4 _DistortionFlowTexture1_ST; float2 _DistortionFlowTexture1Pan; float _DistortionFlowTexture1UV; #endif - + #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _DistortionMask; float4 _DistortionMask_ST; @@ -9392,11 +9499,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DistortionMaskUV; float _DistortionMaskChannel; #endif - + float _DistortionUvToDistort; float _DistortionStrength; float _DistortionStrength1; - + #ifdef POI_AUDIOLINK half _EnableDistortionAudioLink; half2 _DistortionStrengthAudioLink; @@ -9413,20 +9520,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _PolarLengthScale; float _PolarSpiralPower; float _PanoUseBothEyes; - + float _UVModWorldPos0; float _UVModWorldPos1; float _UVModLocalPos0; float _UVModLocalPos1; - + //ifex _PoiParallax==0 #ifdef POI_PARALLAX - + sampler2D _HeightMap; float4 _HeightMap_ST; float2 _HeightMapPan; float _HeightMapUV; - + #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _Heightmask; float4 _Heightmask_ST; @@ -9436,29 +9543,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _HeightmaskInvert; SamplerState _linear_repeat; #endif - + float _ParallaxUV; float _HeightStrength; float _HeightOffset; float _HeightStepsMin; float _HeightStepsMax; - + float _CurvatureU; float _CurvatureV; float _CurvFix; #endif //endex - + //ifex _EnableAudioLink==0 #ifdef POI_AUDIOLINK float _AudioLinkDelay; float _AudioLinkAnimToggle; - + float _AudioLinkSmoothingBass; float _AudioLinkSmoothingLowMid; float _AudioLinkSmoothingHighMid; float _AudioLinkSmoothingTreble; - + float _DebugWaveform; float _DebugDFT; float _DebugBass; @@ -9471,36 +9578,36 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DebugAutocorrelator; float _DebugChronotensity; float _AudioLinkCCStripY; - + float _AudioLinkBandOverridesEnabled; float4 _AudioLinkBandOverrideSliders; #endif //endex - + //ifex _BlackLightMaskingEnabled==0 #ifdef POI_BLACKLIGHTMASKING float _BlackLightMasking0Key; float2 _BlackLightMasking0Range; float _BlackLightMasking0GlobalMaskIndex; float _BlackLightMasking0GlobalMaskBlendType; - + float _BlackLightMasking1Key; float2 _BlackLightMasking1Range; float _BlackLightMasking1GlobalMaskIndex; float _BlackLightMasking1GlobalMaskBlendType; - + float _BlackLightMasking2Key; float2 _BlackLightMasking2Range; float _BlackLightMasking2GlobalMaskIndex; float _BlackLightMasking2GlobalMaskBlendType; - + float _BlackLightMasking3Key; float2 _BlackLightMasking3Range; float _BlackLightMasking3GlobalMaskIndex; float _BlackLightMasking3GlobalMaskBlendType; #endif //endex - + //ifex _DetailEnabled==0 #ifdef FINALPASS #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED) @@ -9510,7 +9617,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _DetailMaskPan; float _DetailMaskUV; float _DetailMaskStochastic; - + #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED) Texture2D _DetailNormalMap; #endif @@ -9521,7 +9628,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DetailNormalMapStochastic; float _DetailNormalGlobalMask; float _DetailNormalGlobalMaskBlendType; - + #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED) Texture2D _DetailTex; #endif @@ -9529,7 +9636,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _DetailTexPan; float _DetailTexUV; float _DetailTexStochastic; - + float3 _DetailTint; float _DetailTintThemeIndex; float _DetailTexIntensity; @@ -9538,7 +9645,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DetailTexGlobalMaskBlendType; #endif //endex - + //ifex _VertexManipulationsEnabled==0 #ifdef AUTO_EXPOSURE float4 _VertexManipulationLocalTranslation; @@ -9556,16 +9663,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VertexRoundingEnabled; int _VertexRoundingSpace; float _VertexRoundingDivision; - + //AL float _VertexAudioLinkEnabled; float3 _VertexLocalTranslationALMin; float3 _VertexLocalTranslationALMax; float _VertexLocalTranslationALBand; - + float3 _VertexLocalRotationAL; float _VertexLocalRotationALBand; - + float3 _VertexLocalRotationCTALSpeed; float _VertexLocalRotationCTALBandX; float _VertexLocalRotationCTALBandY; @@ -9573,39 +9680,39 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VertexLocalRotationCTALTypeX; float _VertexLocalRotationCTALTypeY; float _VertexLocalRotationCTALTypeZ; - + float4 _VertexLocalScaleALMin; float4 _VertexLocalScaleALMax; float _VertexLocalScaleALBand; - + float3 _VertexWorldTranslationALMin; float3 _VertexWorldTranslationALMax; float _VertexWorldTranslationALBand; - + float2 _VertexManipulationHeightAL; float _VertexManipulationHeightBand; - + float2 _VertexRoundingRangeAL; float _VertexRoundingRangeBand; - + float _VertexBarrelMode; float _VertexBarrelWidth; float _VertexBarrelAlpha; float _VertexBarrelHeight; - + float _VertexSphereMode; float _VertexSphereRadius; float _VertexSphereHeight; float _VertexSphereAlpha; float4 _VertexSphereCenter; - + float _VertexTornadoMode; float _VertexTornadoRadius; float _VertexTornadoSpeed; float _VertexTornadoIntensity; float _VertexTornadoBaseHeight; float _VertexTornadoTopHeight; - + float _VertexSpectrumMotion; float3 _VertexSpectrumOffsetMin; float3 _VertexSpectrumOffsetMax; @@ -9613,7 +9720,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VertexSpectrumUVDirection; #endif //endex - + //ifex _VertexGlitchingEnabled==0 #ifdef POI_VERTEX_GLITCHING //Vertex Glitching @@ -9626,22 +9733,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VertexGlitchFrequency; float _VertexGlitchStrength; float _VertexGlitchDensity; - + float _VertexGlitchMirrorEnable; float _VertexGlitchMirror; - + float _VertexGlitchMapPanSpeed; float _VertexGlitchingAudioLinkEnabled; float _VertexGlitchingAudioLinkBand; float _VertexGlitchingAudiolinkOverride; #endif //endex - + //ifex _EnableDepthBulge==0 #ifdef POI_DEPTHBULGE float _DepthBulgeFadeLength; float _DepthBulgeHeight; - + #if defined(PROP_DEPTHBULGEMASK) || !defined(OPTIMIZER_ENABLED) sampler2D _DepthBulgeMask; #endif @@ -9650,14 +9757,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DepthBulgeMaskChannel; #endif //endex - + //ifex _MainVertexColoringEnabled==0 float _MainVertexColoringEnabled; float _MainVertexColoringLinearSpace; float _MainVertexColoring; float _MainUseVertexColorAlpha; //endex - + //ifex _BackFaceEnabled!=1 #ifdef POI_BACKFACE float _BackFaceEnabled; @@ -9667,14 +9774,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _BackFaceColor; float _BackFaceColorThemeIndex; float _BackFaceReplaceAlpha; - + #if defined(PROP_BACKFACETEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _BackFaceTexture; #endif float4 _BackFaceTexture_ST; float2 _BackFaceTexturePan; float _BackFaceTextureUV; - + #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _BackFaceMask; #endif @@ -9682,16 +9789,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _BackFaceMaskPan; float _BackFaceMaskUV; float _BackFaceMaskChannel; - + float _BackFaceHueShiftEnabled; float _BackFaceHueShift; + float _BackFaceShiftColorSpace; float _BackFaceHueShiftSpeed; float _BackFaceEmissionLimiter; #endif - + //TODO detail strength stuff //endex - + //ifex _RGBMaskEnabled==0 #ifdef VIGNETTE #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED) @@ -9700,7 +9808,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _RGBMask_ST; float2 _RGBMaskPan; float _RGBMaskUV; - + #if defined(PROP_RGBAMETALLICMAPS) || !defined(OPTIMIZER_ENABLED) Texture2D _RGBAMetallicMaps; float4 _RGBAMetallicMaps_ST; @@ -9716,36 +9824,36 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _RGBAMetallicGreenEnabled; float _RGBAMetallicBlueEnabled; float _RGBAMetallicAlphaEnabled; - + float _RGBARedPBRSplitMaskSample; float4 _RGBARedPBRMaskScaleTiling; float2 _RGBARedPBRMasksPan; float _RGBARedPBRUV; float _RGBARedPBRSplitMaskStochastic; - + float _RGBAGreenPBRSplitMaskSample; float4 _RGBAGreenPBRMaskScaleTiling; float2 _RGBAGreenPBRMasksPan; float _RGBAGreenPBRUV; float _RGBAGreenPBRSplitMaskStochastic; - + float _RGBABluePBRSplitMaskSample; float4 _RGBABluePBRMaskScaleTiling; float2 _RGBABluePBRMasksPan; float _RGBABluePBRUV; float _RGBABluePBRSplitMaskStochastic; - + float _RGBAAlphaPBRSplitMaskSample; float4 _RGBAAlphaPBRMaskScaleTiling; float2 _RGBAAlphaPBRMasksPan; float _RGBAAlphaPBRUV; float _RGBAAlphaPBRSplitMaskStochastic; - + float _RGBAPBRRedEnabled; float _RGBAPBRGreenEnabled; float _RGBAPBRBlueEnabled; float _RGBAPBRAlphaEnabled; - + #if defined(PROP_RGBASMOOTHNESSMAPS) || !defined(OPTIMIZER_ENABLED) Texture2D _RGBASmoothnessMaps; float4 _RGBASmoothnessMaps_ST; @@ -9757,7 +9865,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _RGBAGreenSmoothnessInvert; float _RGBABlueSmoothnessInvert; float _RGBAAlphaSmoothnessInvert; - + float _RGBARedEnable; #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _RedTexture; @@ -9774,7 +9882,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _RedColor; float _RedColorThemeIndex; float _RGBARedEmissionStrength; - + #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED) Texture2D _RgbNormalR; #endif @@ -9787,7 +9895,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _RgbNormalRGlobalMaskChannel; float _RgbNormalRGlobalMaskBlendType; float _RgbNormalRedBlendMode; - + float _RGBAGreenEnable; #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _GreenTexture; @@ -9804,7 +9912,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _GreenColor; float _GreenColorThemeIndex; float _RGBAGreenEmissionStrength; - + #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED) Texture2D _RgbNormalG; #endif @@ -9817,7 +9925,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _RgbNormalGGlobalMaskChannel; float _RgbNormalGGlobalMaskBlendType; float _RgbNormalGreenBlendMode; - + float _RGBABlueEnable; #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _BlueTexture; @@ -9834,7 +9942,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _BlueColor; float _BlueColorThemeIndex; float _RGBABlueEmissionStrength; - + #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED) Texture2D _RgbNormalB; #endif @@ -9847,7 +9955,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _RgbNormalBGlobalMaskChannel; float _RgbNormalBGlobalMaskBlendType; float _RgbNormalBlueBlendMode; - + float _RGBAAlphaEnable; #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _AlphaTexture; @@ -9864,7 +9972,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _AlphaColor; float _AlphaColorThemeIndex; float _RGBAAlphaEmissionStrength; - + #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED) Texture2D _RgbNormalA; #endif @@ -9877,12 +9985,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _RgbNormalAGlobalMaskChannel; float _RgbNormalAGlobalMaskBlendType; float _RgbNormalAlphaBlendMode; - + float _RGBMaskType; - + #endif //endex - + //ifex _LTCGIEnabled!=1 #ifdef POI_LTCGI float4 _LTCGI_DiffuseColor; @@ -9895,18 +10003,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _LTCGI_AnimToggle; #endif //endex - + //ifex _ShadingEnabled==0 float _ShadowStrength; float _LightingIgnoreAmbientColor; float3 _LightingShadowColor; - + float _ShadingRampedLightMapApplyGlobalMaskIndex; float _ShadingRampedLightMapApplyGlobalMaskBlendType; - + float _ShadingRampedLightMapInverseApplyGlobalMaskIndex; float _ShadingRampedLightMapInverseApplyGlobalMaskBlendType; - + // Toon Lighting #ifdef _LIGHTINGMODE_TEXTURERAMP UNITY_DECLARE_TEX2D(_ToonRamp); @@ -9914,7 +10022,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _ToonRampCount; int _ToonRampUVSelector; #endif - + #ifdef _LIGHTINGMODE_WRAPPED float4 _LightingWrappedColor; float _LightingWrappedWrap; @@ -9922,7 +10030,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _LightingGradientStart; float _LightingGradientEnd; #endif - + #ifdef _LIGHTINGMODE_SHADEMAP float3 _1st_ShadeColor; #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED) @@ -9950,7 +10058,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _1st2nd_Shades_Feather; float _ShadingShadeMapBlendType; #endif - + #ifdef _LIGHTINGMODE_SKIN sampler2D _SkinLUT; float _SssScale; @@ -9966,7 +10074,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 _SssTransmissionAbsorption; float3 _SssColorBleedAoWeights; #endif - + #ifdef _LIGHTINGMODE_MULTILAYER_MATH float _ShadowBorderMapToggle; #if defined(PROP_SHADOWBORDERMASK) || !defined(OPTIMIZER_ENABLED) @@ -9979,7 +10087,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _ShadowBorderMaskLOD; float4 _ShadowAOShift; float4 _ShadowAOShift2; - + float4 _ShadowColor; float _LightingMulitlayerNonLinear; #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED) @@ -10021,26 +10129,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _ShadowBorderRange; float _ShadowMainStrength; #endif - + + #ifdef _LIGHTINGMODE_FLAT + float _ForceFlatRampedLightmap; + #endif + #ifdef _LIGHTINGMODE_CLOTH Texture2D_float _ClothDFG; SamplerState sampler_ClothDFG; - + #if defined(PROP_CLOTHMETALLICSMOOTHNESSMAP) || !defined(OPTIMIZER_ENABLED) Texture2D _ClothMetallicSmoothnessMap; #endif - + float4 _ClothMetallicSmoothnessMap_ST; float2 _ClothMetallicSmoothnessMapPan; float _ClothMetallicSmoothnessMapUV; float _ClothMetallicSmoothnessMapInvert; - + float _ClothLerp; float _ClothMetallic; float _ClothReflectance; float _ClothSmoothness; #endif - + #ifdef _LIGHTINGMODE_SDF #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _SDFShadingTexture; @@ -10052,15 +10164,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _SDFLeft; #endif #endif - + // Additive float _LightingAdditiveType; float _LightingAdditiveGradientStart; float _LightingAdditiveGradientEnd; float _LightingAdditiveDetailStrength; //endex - + //ifex _DecalEnabled==0 && _DecalEnabled1==0 && _DecalEnabled2==0 && _DecalEnabled3==0 + #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _DecalMask; float4 _DecalMask_ST; @@ -10072,6 +10185,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Decal1TPSMaskStrength; float _Decal2TPSMaskStrength; float _Decal3TPSMaskStrength; + + sampler2D _Udon_VideoTex; + float4 _Udon_VideoTex_TexelSize; + #ifdef POI_AUDIOLINK //ifex _DecalEnabled==0 #ifdef GEOM_TYPE_BRANCH @@ -10162,6 +10279,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //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; @@ -10175,6 +10298,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _DecalColor; float _DecalColorThemeIndex; float _DecalTiled; + float _DecalMirroredUVMode; + float _DecalSymmetryMode; float _DecalBlendType; half _DecalRotation; half3 _DecalScale; @@ -10184,6 +10309,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DecalEmissionStrength; float _DecalBlendAlpha; float _DecalOverrideAlpha; + float _DecalHueShiftColorSpace; float _DecalHueShiftEnabled; float _DecalHueShift; float _DecalHueShiftSpeed; @@ -10198,9 +10324,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; @@ -10223,6 +10356,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DecalEmissionStrength1; float _DecalBlendAlpha1; float _DecalOverrideAlpha1; + float _DecalHueShiftColorSpace1; float _DecalHueShiftEnabled1; float _DecalHueShift1; float _DecalHueShiftSpeed1; @@ -10235,11 +10369,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; @@ -10262,6 +10405,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DecalEmissionStrength2; float _DecalBlendAlpha2; float _DecalOverrideAlpha2; + float _DecalHueShiftColorSpace2; float _DecalHueShiftEnabled2; float _DecalHueShift2; float _DecalHueShiftSpeed2; @@ -10274,11 +10418,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; @@ -10301,6 +10454,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DecalEmissionStrength3; float _DecalBlendAlpha3; float _DecalOverrideAlpha3; + float _DecalHueShiftColorSpace3; float _DecalHueShiftEnabled3; float _DecalHueShift3; float _DecalHueShiftSpeed3; @@ -10313,9 +10467,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Decal3ChannelSeparationVertical; float _Decal3ChannelSeparationAngleStrength; float _Decal3OverrideAlphaMode; + float _DecalMirroredUVMode3; + float _DecalSymmetryMode3; #endif //endex - + //ifex _EnableDissolve==0 #ifdef DISTORT float _DissolveType; @@ -10329,35 +10485,35 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _DissolveTextureColor; float _DissolveEdgeColorThemeIndex; float _DissolveTextureColorThemeIndex; - + #if defined(PROP_DISSOLVETOTEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _DissolveToTexture; #endif float4 _DissolveToTexture_ST; float2 _DissolveToTexturePan; float _DissolveToTextureUV; - + #if defined(PROP_DISSOLVENOISETEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _DissolveNoiseTexture; #endif float4 _DissolveNoiseTexture_ST; float2 _DissolveNoiseTexturePan; float _DissolveNoiseTextureUV; - + #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED) Texture2D _DissolveDetailNoise; #endif float4 _DissolveDetailNoise_ST; float2 _DissolveDetailNoisePan; float _DissolveDetailNoiseUV; - + #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _DissolveMask; #endif float4 _DissolveMask_ST; float2 _DissolveMaskPan; float _DissolveMaskUV; - + float _DissolveMaskGlobalMask; float _DissolveMaskGlobalMaskBlendType; float _DissolveApplyGlobalMaskIndex; @@ -10373,27 +10529,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DissolveInvertNoise; float _DissolveInvertDetailNoise; float _DissolveToEmissionStrength; - + // Point to Point float _DissolveP2PWorldLocal; float _DissolveP2PEdgeLength; float _DissolveP2PClamp; float4 _DissolveStartPoint; float4 _DissolveEndPoint; - + // Spherical float3 _SphericalDissolveCenter; float _SphericalDissolveRadius; float _SphericalDissolveInvert; float _SphericalDissolveClamp; - + // CenterOut float _CenterOutDissolveMode; float3 _CenterOutDissolveDirection; float _CenterOutDissolveInvert; float _CenterOutDissolveNormals; float _CenterOutDissolvePower; - + // World Dissolve float _DissolveWorldShape; float4 _DissolveShapePosition; @@ -10401,12 +10557,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DissolveShapeScale; float _DissolveInvertShape; float _DissolveShapeEdgeLength; - + // UV Tile Dissolve float _UVTileDissolveEnabled; float _UVTileDissolveDiscardAtMax; float _UVTileDissolveUV; - + float _UVTileDissolveAlpha_Row3_0; float _UVTileDissolveAlpha_Row3_1; float _UVTileDissolveAlpha_Row3_2; @@ -10423,7 +10579,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _UVTileDissolveAlpha_Row0_1; float _UVTileDissolveAlpha_Row0_2; float _UVTileDissolveAlpha_Row0_3; - + float _DissolveAlpha0; float _DissolveAlpha1; float _DissolveAlpha2; @@ -10438,19 +10594,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DissolveEmissionSide; float _DissolveEmission1Side; float _DissolveUseVertexColors; - + float4 edgeColor; float edgeAlpha; float dissolveAlpha; float4 dissolveToTexture; - + + float _DissolveHueShiftColorSpace; + float _DissolveEdgeHueShiftColorSpace; float _DissolveHueShiftEnabled; float _DissolveHueShiftSpeed; float _DissolveHueShift; float _DissolveEdgeHueShiftEnabled; float _DissolveEdgeHueShiftSpeed; float _DissolveEdgeHueShift; - + // Audio Link #ifdef POI_AUDIOLINK fixed _EnableDissolveAudioLink; @@ -10461,10 +10619,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableAniso==0 #ifdef POI_ANISOTROPICS - + #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED) Texture2D _AnisoColorMap; float4 _AnisoColorMap_ST; @@ -10484,10 +10642,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AnisoAdd; float _AnisoUseBaseColor; float _AnisoUseLightColor; - + float _AnisoGlobalMask; float _AnisoGlobalMaskBlendType; - + float _Aniso0Strength; float _Aniso0Power; float _Aniso0Offset; @@ -10498,7 +10656,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Aniso0ToonMode; float _Aniso0Edge; float _Aniso0Blur; - + float _Aniso1Strength; float _Aniso1Power; float _Aniso1Offset; @@ -10511,7 +10669,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Aniso1Blur; #endif //endex - + //ifex _MatcapEnable==0 #ifdef POI_MATCAP0 #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED) @@ -10565,6 +10723,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _MatcapEmissionStrength; float _MatcapNormal; float _MatcapHueShiftEnabled; + float _MatcapHueShiftColorSpace; float _MatcapHueShiftSpeed; float _MatcapHueShift; int _MatcapApplyToAlphaEnabled; @@ -10573,7 +10732,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _MatcapApplyToAlphaBlending; float _MatcapTPSDepthEnabled; float _MatcapTPSMaskStrength; - + float _Matcap0ALEnabled; float _Matcap0ALAlphaAddBand; float4 _Matcap0ALAlphaAdd; @@ -10639,6 +10798,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Matcap2EmissionStrength; float _Matcap2Normal; float _Matcap2HueShiftEnabled; + float _Matcap2HueShiftColorSpace; float _Matcap2HueShiftSpeed; float _Matcap2HueShift; int _Matcap2ApplyToAlphaEnabled; @@ -10647,7 +10807,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Matcap2ApplyToAlphaBlending; float _Matcap2TPSDepthEnabled; float _Matcap2TPSMaskStrength; - + float _Matcap1ALEnabled; float _Matcap1ALAlphaAddBand; float4 _Matcap1ALAlphaAdd; @@ -10660,7 +10820,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Matcap1ALChronoPanSpeed; #endif //endex - + //ifex _Matcap3Enable==0 #ifdef POI_MATCAP2 #if defined(PROP_MATCAP3) || !defined(OPTIMIZER_ENABLED) @@ -10714,6 +10874,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Matcap3EmissionStrength; float _Matcap3Normal; float _Matcap3HueShiftEnabled; + float _Matcap3HueShiftColorSpace; float _Matcap3HueShiftSpeed; float _Matcap3HueShift; int _Matcap3ApplyToAlphaEnabled; @@ -10722,7 +10883,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Matcap3ApplyToAlphaBlending; float _Matcap3TPSDepthEnabled; float _Matcap3TPSMaskStrength; - + float _Matcap2ALEnabled; float _Matcap2ALAlphaAddBand; float4 _Matcap2ALAlphaAdd; @@ -10735,7 +10896,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Matcap2ALChronoPanSpeed; #endif //endex - + //ifex _Matcap4Enable==0 #ifdef POI_MATCAP3 #if defined(PROP_MATCAP4) || !defined(OPTIMIZER_ENABLED) @@ -10789,6 +10950,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Matcap4EmissionStrength; float _Matcap4Normal; float _Matcap4HueShiftEnabled; + float _Matcap4HueShiftColorSpace; float _Matcap4HueShiftSpeed; float _Matcap4HueShift; int _Matcap4ApplyToAlphaEnabled; @@ -10797,7 +10959,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Matcap4ApplyToAlphaBlending; float _Matcap4TPSDepthEnabled; float _Matcap4TPSMaskStrength; - + float _Matcap3ALEnabled; float _Matcap3ALAlphaAddBand; float4 _Matcap3ALAlphaAdd; @@ -10823,7 +10985,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float matcapALChronoPanBand; float matcapALChronoPanSpeed; }; - + //ifex _CubeMapEnabled==0 #ifdef _CUBEMAP #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED) @@ -10861,7 +11023,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _CubeMapSmoothness; #endif //endex - + //ifex _EnableALDecal==0 #ifdef POI_AUDIOLINK #ifdef POI_AL_DECAL @@ -10871,28 +11033,28 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _ALUVRotation; float _ALUVRotationSpeed; float4 _ALDecaldCircleDimensions; - + float _ALDecalUVMode; - + float _ALDecalVolumeStep; float _ALDecalVolumeClipMin; float _ALDecalVolumeClipMax; - + float _ALDecalBandStep; float _ALDecalBandClipMin; float _ALDecalBandClipMax; - + float _ALDecalShapeClip; float _ALDecalShapeClipVolumeWidth; float _ALDecalShapeClipBandWidth; - + #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _ALDecalColorMask; float4 _ALDecalColorMask_ST; float2 _ALDecalColorMaskPan; float _ALDecalColorMaskUV; #endif - + float _ALDecalVolume; float _ALDecalBaseBoost; float _ALDecalTrebleBoost; @@ -10915,7 +11077,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableVolumeColor==0 #ifdef POI_AUDIOLINK #ifdef POI_AL_VOLUMECOLOR @@ -10935,13 +11097,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableFlipbook==0 #ifdef _SUNDISK_HIGH_QUALITY - + UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray); float4 _FlipbookTexArray_ST; - + float4 _FlipbookColor; float _FlipbookColorThemeIndex; float _FlipbookFPS; @@ -10969,7 +11131,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _FlipbookMultiply; float _FlipbookAdd; float _FlipbookBlendType; - + #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED) Texture2D _FlipbookMask; #endif @@ -10979,21 +11141,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _FlipbookMaskChannel; float _FlipbookMaskGlobalMask; float _FlipbookMaskGlobalMaskBlendType; - + // anim float _FlipbookMovementType; float4 _FlipbookStartEndOffset; float _FlipbookMovementSpeed; - + // Crossfade float _FlipbookCrossfadeEnabled; float2 _FlipbookCrossfadeRange; - + // Hueshift float _FlipbookHueShiftEnabled; + float _FlipbookHueShiftColorSpace; float _FlipbookHueShiftSpeed; float _FlipbookHueShift; - + #ifdef POI_AUDIOLINK float _FlipbookChronotensityEnabled; float _FlipbookChronotensityBand; @@ -11010,7 +11173,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableEmission==0 #ifdef _EMISSION #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED) @@ -11033,11 +11196,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Texture2D _EmissionScrollingCurve; #endif float4 _EmissionScrollingCurve_ST; - + float4 _EmissionColor; float _EmissionBaseColorAsMap; float _EmissionStrength; float _EmissionHueShiftEnabled; + float _EmissionHueShiftColorSpace; float _EmissionSaturation; float _EmissionHueShift; float _EmissionHueShiftSpeed; @@ -11060,17 +11224,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _EmissiveScroll_Velocity; float _EmissiveScroll_Interval; float _EmissionScrollingOffset; - + float _EmissionReplace0; float _EmissionScrollingVertexColor; float _EmissionScrollingUseCurve; float _EmissionColorThemeIndex; - + // Audio Link float _EmissionAL0Enabled; float2 _EmissionAL0StrengthMod; float _EmissionAL0StrengthBand; - float _EmissionAL0StrengthBandSmoothing; float2 _AudioLinkEmission0CenterOut; float _AudioLinkEmission0CenterOutSize; float _AudioLinkEmission0CenterOutBand; @@ -11081,7 +11244,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex //ifex _EnableEmission1==0 #ifdef POI_EMISSION_1 - + #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED) Texture2D _EmissionMap1; #endif @@ -11102,11 +11265,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Texture2D _EmissionScrollingCurve1; #endif float4 _EmissionScrollingCurve1_ST; - + float4 _EmissionColor1; float _EmissionBaseColorAsMap1; float _EmissionStrength1; float _EnableEmission1; + float _EmissionHueShiftColorSpace1; float _EmissionHueShift1; float _EmissionHueShiftSpeed1; float4 _EmissiveScroll_Direction1; @@ -11134,7 +11298,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _EmissionScrollingUseCurve1; float _EmissionReplace1; float _EmissionColor1ThemeIndex; - + // Audio Link float _EmissionAL1Enabled; float2 _EmissionAL1StrengthMod; @@ -11149,7 +11313,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex //ifex _EnableEmission2==0 #ifdef POI_EMISSION_2 - + #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED) Texture2D _EmissionMap2; #endif @@ -11170,12 +11334,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Texture2D _EmissionScrollingCurve2; #endif float4 _EmissionScrollingCurve2_ST; - + float4 _EmissionColor2; float _EmissionBaseColorAsMap2; float _EmissionStrength2; float _EnableEmission2; float _EmissionHueShift2; + float _EmissionHueShiftColorSpace2; float _EmissionHueShiftSpeed2; float4 _EmissiveScroll_Direction2; float _EmissiveScroll_Width2; @@ -11202,7 +11367,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _EmissionScrollingUseCurve2; float _EmissionReplace2; float _EmissionColor2ThemeIndex; - + // Audio Link float _EmissionAL2Enabled; float2 _EmissionAL2StrengthMod; @@ -11237,12 +11402,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Texture2D _EmissionScrollingCurve3; #endif float4 _EmissionScrollingCurve3_ST; - + float4 _EmissionColor3; float _EmissionBaseColorAsMap3; float _EmissionStrength3; float _EnableEmission3; float _EmissionHueShift3; + float _EmissionHueShiftColorSpace3; float _EmissionHueShiftSpeed3; float4 _EmissiveScroll_Direction3; float _EmissiveScroll_Width3; @@ -11269,7 +11435,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _EmissionScrollingUseCurve3; float _EmissionReplace3; float _EmissionColor3ThemeIndex; - + // Audio Link float _EmissionAL3Enabled; float2 _EmissionAL3StrengthMod; @@ -11282,7 +11448,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _EmissionAL3MultipliersBand; #endif //endex - + //ifex _EnableRimLighting==0 #ifdef _GLOSSYREFLECTIONS_OFF float _Is_NormalMapToRimLight; @@ -11332,7 +11498,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _AudioLinkRimBrightnessAdd; #endif #endif - + #ifdef _RIMSTYLE_UTS2 float _RimLight; float _Is_LightColor_RimLight; @@ -11356,7 +11522,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif float _Tweak_RimLightMaskLevel; #endif - + #ifdef _RIMSTYLE_LILTOON float4 _RimColor; #if defined(PROP_RIMCOLORTEX) || !defined(OPTIMIZER_ENABLED) @@ -11382,13 +11548,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _RimIndirBlur; int _RimBlendMode; #endif - + float _RimGlobalMask; float _RimGlobalMaskBlendType; float _RimApplyGlobalMaskIndex; float _RimApplyGlobalMaskBlendType; - + float _RimHueShiftEnabled; + float _RimHueShiftColorSpace; float _RimHueShiftSpeed; float _RimHueShift; #endif @@ -11398,7 +11565,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Is_NormalMapToRim2Light; float4 _Rim2LightColor; float _Rim2LightColorThemeIndex; - + #ifdef _RIM2STYLE_POIYOMI float _Rim2LightingInvert; float _Rim2Width; @@ -11446,7 +11613,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _AudioLinkRim2BrightnessAdd; #endif #endif - + #ifdef _RIM2STYLE_UTS2 float _Rim2Light; float _Is_LightColor_Rim2Light; @@ -11470,7 +11637,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif float _Tweak_Rim2LightMaskLevel; #endif - + #ifdef _RIM2STYLE_LILTOON float4 _Rim2Color; #if defined(PROP_RIM2COLORTEX) || !defined(OPTIMIZER_ENABLED) @@ -11497,18 +11664,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Rim2IndirBlur; int _Rim2BlendMode; #endif - + float _Rim2GlobalMask; float _Rim2GlobalMaskBlendType; float _Rim2ApplyGlobalMaskIndex; float _Rim2ApplyGlobalMaskBlendType; - + float _Rim2HueShiftEnabled; + float _Rim2HueShiftColorSpace; float _Rim2HueShiftSpeed; float _Rim2HueShift; #endif //endex - + //ifex _EnableDepthRimLighting==0 #ifdef _POI_DEPTH_RIMLIGHT float _DepthRimNormalToUse; @@ -11526,13 +11694,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DepthRimMixLightColor; float _DepthRimType; float _DepthRimBrightness; - + static float2 sobelSamplePoints[9] = { float2(-1, 1), float2(0, 1), float2(1, 1), float2(-1, 0), float2(0, 0), float2(1, 01), float2(-1, -1), float2(0, -1), float2(1, -1) }; - + static float sobelXMatrix[9] = { 1, 0, -1, 2, 0, -2, @@ -11545,7 +11713,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" }; #endif //endex - + //ifex _GlitterEnable==0 #ifdef _SUNDISK_SIMPLE float4 _GlitterRandomRotationSpeed; @@ -11572,20 +11740,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlitterJaggyFix; float _GlitterTextureRotation; float2 _GlitterUVPanning; - + float _GlitterHueShiftEnabled; + float _GlitteHueShiftColorSpace; float _GlitterHueShiftSpeed; float _GlitterHueShift; float _GlitterHideInShadow; float _GlitterScaleWithLighting; - + float _GlitterRandomColors; float2 _GlitterMinMaxSaturation; float2 _GlitterMinMaxBrightness; float _GlitterRandomSize; float4 _GlitterMinMaxSize; float _GlitterRandomRotation; - + #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _GlitterMask; #endif @@ -11608,7 +11777,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _GlitterTexture_ST; float2 _GlitterTexturePan; float _GlitterTextureUV; - + float _GlitterALEnabled; float _GlitterALAlphaAddBand; float4 _GlitterALAlphaAdd; @@ -11626,7 +11795,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlitterALChronoRotationSpeed; #endif //endex - + //ifex _SubsurfaceScattering==0 #ifdef POI_SUBSURFACESCATTERING float4 _SSSColor; @@ -11637,7 +11806,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _SSSThicknessMapPan; float _SSSThicknessMapUV; float _SSSThicknessMapChannel; - + float _SSSThicknessMod; float _SSSStrength; float _SSSSpread; @@ -11645,7 +11814,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _SSSBaseColorMix; #endif //endex - + //ifex _MochieBRDF==0 #ifdef MOCHIE_PBR #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED) @@ -11665,10 +11834,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _MochieMetallicMapsReflectionMaskChannel; float _MochieMetallicMapsSpecularMaskChannel; float _PBRNormalSelect; - + float _MochieReflectionTintThemeIndex; float _MochieSpecularTintThemeIndex; - + float _MochieRoughnessMultiplier; float _MochieMetallicMultiplier; float _MochieReflectionStrength; @@ -11682,7 +11851,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _PBRMaskScaleTiling; float _MochieMetallicMasksUV; float4 _MochieMetallicMasksPan; - + float _Specular2ndLayer; float _MochieSpecularStrength2; float _MochieRoughnessMultiplier2; @@ -11697,7 +11866,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _BRDFTPSReflectionMaskStrength; float _BRDFTPSSpecularMaskStrength; float _BRDFTPSDepthEnabled; - + float _MochieMetallicGlobalMask; float _MochieMetallicGlobalMaskBlendType; float _MochieSmoothnessGlobalMask; @@ -11708,7 +11877,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _MochieSpecularStrengthGlobalMaskBlendType; #endif //endex - + //ifex _ClearCoatBRDF==0 #ifdef POI_CLEARCOAT #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED) @@ -11738,7 +11907,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _ClearCoatTPSMaskStrength; float _ClearCoatTPSDepthMaskEnabled; float _ClearCoatNormalSelect; - + samplerCUBE _ClearCoatFallback; float4 _ClearCoatFallback_HDR; float _ClearCoatForceFallback; @@ -11748,7 +11917,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _ClearCoatGSAAVariance; float _ClearCoatGSAAThreshold; float _ClearcoatFresnel; - + float _ClearCoatGlobalMask; float _ClearCoatGlobalMaskBlendType; float _ClearCoatSmoothnessGlobalMask; @@ -11759,7 +11928,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _ClearCoatSpecularStrengthGlobalMaskBlendType; #endif //endex - + //ifex _EnableEnvironmentalRim==0 #ifdef POI_ENVIRORIM #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED) @@ -11769,7 +11938,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _RimEnviroMaskPan; float _RimEnviroMaskUV; float _RimEnviroChannel; - + float _RimEnviroBlur; float _RimEnviroMinBrightness; float _RimEnviroWidth; @@ -11777,7 +11946,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _RimEnviroIntensity; #endif //endex - + //ifex _StylizedSpecular==0 #ifdef POI_STYLIZED_StylizedSpecular #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED) @@ -11786,7 +11955,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _HighColor_Tex_ST; float2 _HighColor_TexPan; float _HighColor_TexUV; - + #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _Set_HighColorMask; #endif @@ -11795,7 +11964,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Set_HighColorMaskUV; float _Set_HighColorMaskChannel; float _Tweak_HighColorMaskLevel; - + float _StylizedSpecularInvertMask; + /* #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED) Texture2D _StylizedSpecularOptMap1; @@ -11803,7 +11973,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _StylizedSpecularOptMap1_ST; float2 _StylizedSpecularOptMap1Pan; float _StylizedSpecularOptMap1UV; - + #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED) Texture2D _StylizedSpecularOptMap2; #endif @@ -11811,17 +11981,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _StylizedSpecularOptMap2Pan; float _StylizedSpecularOptMap2UV; */ - + float4 _HighColor; float _UseLightColor; - + float _HighColor_Power; float _StylizedSpecularFeather; float _Layer1Strength; - + float _StylizedSpecularIgnoreNormal; float _StylizedSpecularIgnoreShadow; - + float _Layer2Size; float _StylizedSpecular2Feather; float _Layer2Strength; @@ -11833,10 +12003,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Is_SpecularToHighColor; #endif //endex - + //ifex _EnablePathing==0 #ifdef POI_PATHING - + #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED) Texture2D _PathingMap; SamplerState SmpRepeatPoint; @@ -11844,7 +12014,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _PathingMap_ST; float2 _PathingMapPan; float _PathingMapUV; - + #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED) Texture2D _PathingColorMap; #endif @@ -11869,12 +12039,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _PathEmissionStrength; float4 _PathSoftness; float4 _PathSegments; - + float _PathColorRThemeIndex; float _PathColorGThemeIndex; float _PathColorBThemeIndex; float _PathColorAThemeIndex; - + #ifdef POI_AUDIOLINK float _PathALAutoCorrelator; float _PathALAutoCorrelatorMode; @@ -11886,7 +12056,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _PathALAutoCorrelatorRangeB; float _PathALAutoCorrelatorA; float2 _PathALAutoCorrelatorRangeA; - + float _PathALHistory; float _PathALHistoryMode; float _PathALHistoryBandR; @@ -11901,13 +12071,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _PathALHistoryBandA; float2 _PathALHistoryRangeA; float _PathALHistoryA; - + float _PathALColorChord; float _PathALCCR; float _PathALCCG; float _PathALCCB; float _PathALCCA; - + // Time Offset float _PathALTimeOffset; half _AudioLinkPathTimeOffsetBandR; @@ -11918,7 +12088,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" half2 _AudioLinkPathTimeOffsetB; half _AudioLinkPathTimeOffsetBandA; half2 _AudioLinkPathTimeOffsetA; - + // Emission Offset float _PathALEmissionOffset; half _AudioLinkPathEmissionAddBandR; @@ -11929,7 +12099,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" half2 _AudioLinkPathEmissionAddB; half _AudioLinkPathEmissionAddBandA; half2 _AudioLinkPathEmissionAddA; - + // Length Offset float _PathALWidthOffset; half _AudioLinkPathWidthOffsetBandR; @@ -11940,7 +12110,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" half2 _AudioLinkPathWidthOffsetB; half _AudioLinkPathWidthOffsetBandA; half2 _AudioLinkPathWidthOffsetA; - + // Chrono Time float _PathALChrono; float _PathChronoBandR; @@ -11958,7 +12128,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableMirrorOptions==0 #ifdef POI_MIRROR float _VisibilityMode; @@ -11982,7 +12152,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VisibilityVRCCameraScreenshot; #endif //endex - + //ifex _EnableTouchGlow==0 #ifdef GRAIN #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED) @@ -11994,7 +12164,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DepthMaskChannel; float _DepthMaskGlobalMask; float _DepthMaskGlobalMaskBlendType; - + // Color float _DepthColorToggle; float _DepthColorBlendMode; @@ -12004,7 +12174,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _DepthTexture_ST; float2 _DepthTexturePan; float _DepthTextureUV; - + float3 _DepthColor; float _DepthColorThemeIndex; float _DepthColorMinDepth; @@ -12012,9 +12182,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DepthColorMinValue; float _DepthColorMaxValue; float _DepthEmissionStrength; - + // Emission - + // Alpha float _DepthAlphaToggle; float _DepthAlphaMinValue; @@ -12023,12 +12193,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DepthAlphaMaxDepth; #endif //endex - + float _PPLightingMultiplier; float _PPLightingAddition; float _PPEmissionMultiplier; float _PPFinalColorMultiplier; - + //ifex _TextEnabled==0 #ifdef EFFECT_BUMP sampler2D _TextGlyphs; @@ -12039,12 +12209,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _TextPositionUV; float _TextNumericUV; float _TextPixelRange; - + float _TextFPSEnabled; float _TextPositionEnabled; float _TextTimeEnabled; float _TextNumericEnabled; - + float4 _TextFPSColor; float _TextFPSEmissionStrength; fixed4 _TextFPSPadding; @@ -12052,7 +12222,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _TextFPSScale; float _TextFPSRotation; float _TextFPSOutlineColor; - + fixed _TextPositionVertical; float4 _TextPositionColor; float _TextPositionEmissionStrength; @@ -12060,14 +12230,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _TextPositionOffset; float2 _TextPositionScale; float _TextPositionRotation; - + float4 _TextTimeColor; float _TextTimeEmissionStrength; fixed4 _TextTimePadding; float2 _TextTimeOffset; float2 _TextTimeScale; float _TextTimeRotation; - + float4 _TextNumericColor; float _TextNumericEmissionStrength; fixed4 _TextNumericPadding; @@ -12078,14 +12248,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _TextNumericWholeDigits; float _TextNumericDecimalDigits; float _TextNumericTrimZeroes; - + float _TextFPSColorThemeIndex; float _TextPositionColorThemeIndex; float _TextTimeColorThemeIndex; float _TextNumericColorThemeIndex; - + float3 globalTextEmission; - + #define ASCII_SPACE 32 #define ASCII_LEFT_PARENTHESIS 40 #define ASCII_RIGHT_PARENTHESIS 41 @@ -12104,10 +12274,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define ASCII_T 84 #define ASCII_SEMICOLON 58 #define glyphWidth 0.0625 - + #endif //endex - + //ifex _FXProximityColor==0 float _FXProximityColor; float _FXProximityColorType; @@ -12119,7 +12289,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _FXProximityColorMaxDistance; float _FXProximityColorBackFace; //endex - + //ifex _PostProcess==0 #ifdef POSTPROCESS #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED) @@ -12130,7 +12300,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _PPMaskUV; float _PPMaskChannel; float _PPMaskInvert; - + float3 _PPTint; float3 _PPRGB; float _PPHue; @@ -12139,14 +12309,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _PPBrightness; float _PPLightness; float _PPHDR; - + float _PPHueShiftColorSpace; float _PPPosterization; float _PPPosterizationAmount; const static float COLORS = 32; - + #endif //endex - + //ifex _PoiInternalParallax==0 #ifdef POI_INTERNALPARALLAX #if defined(PROP_PARALLAXINTERNALMAP) || !defined(OPTIMIZER_ENABLED) @@ -12154,7 +12324,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif float4 _ParallaxInternalMap_ST; float2 _ParallaxInternalMapPan; - + #if defined(PROP_PARALLAXINTERNALMAPMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _ParallaxInternalMapMask; #endif @@ -12162,7 +12332,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _ParallaxInternalMapMaskPan; float _ParallaxInternalMapMaskUV; float _ParallaxInternalMapMaskChannel; - + float _ParallaxInternalIterations; float _ParallaxInternalMinDepth; float _ParallaxInternalMaxDepth; @@ -12176,7 +12346,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _ParallaxInternalPanDepthSpeed; float _ParallaxInternalHeightmapMode; float _ParallaxInternalHeightFromAlpha; - + float _ParallaxInternalHueShiftEnabled; float _ParallaxInternalHueShift; float _ParallaxInternalHueShiftSpeed; @@ -12186,14 +12356,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // float _ParallaxInternalHueShiftPerLevelSpeed; #endif //endex - + //ifex _NormalCorrect==0 #ifdef POI_NORMALCORRECT float _NormalCorrectAmount; float3 _NormalCorrectOrigin; #endif //endex - + //ifex _VideoEffectsEnable==0 #ifdef POI_VIDEO_EFFECTS float _VideoEffectsEnable; @@ -12209,7 +12379,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VideoMaskTextureUV; float _VideoMaskTextureChannel; #endif - + float _VideoType; float2 _VideoResolution; sampler2D _VideoGameboyRamp; @@ -12219,13 +12389,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VideoRepeatVideoTexture; float _VideoPixelateToResolution; float2 _VideoMaskPanning; - + float _VideoSaturation; float _VideoContrast; float _VideoEmissionEnabled; #endif //endex - + //ifex _BacklightEnabled!=1 #ifdef POI_BACKLIGHT float4 _BacklightColor; @@ -12245,7 +12415,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _BacklightBackfaceMask; #endif //endex - + //ifex _BSSEnabled!=1 #ifdef POIBS_ENABLE float _CustomColors; @@ -12255,10 +12425,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _FogScale; float _FogHeightOffset; float _FogHeightScale; - + uniform float2 _CustomFogTextureToScreenRatio; uniform float _StereoCameraEyeOffset; - + uniform float _CustomFogOffset; uniform float _CustomFogAttenuation; uniform float _CustomFogHeightFogStartY; @@ -12268,7 +12438,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex #endif //endex - + //ifex _VoronoiEnabled!=1 #ifdef POI_VORONOI #if defined(PROP_VORONOIMASK) || !defined(OPTIMIZER_ENABLED) @@ -12303,18 +12473,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _VoronoiAffectsMaterialAlpha; float _VoronoiGlobalMask; float _VoronoiGlobalMaskBlendType; - + // AudioLink int _AudioLinkVoronoiInnerEmissionBand; float2 _AudioLinkVoronoiInnerEmission; int _AudioLinkVoronoiOuterEmissionBand; float2 _AudioLinkVoronoiOuterEmission; - + int _AudioLinkVoronoiGradientMinAddBand; float _AudioLinkVoronoiGradientMinAdd; int _AudioLinkVoronoiGradientMaxAddBand; float _AudioLinkVoronoiGradientMaxAdd; - + int _AudioLinkVoronoiChronoSpeedXType; int _AudioLinkVoronoiChronoSpeedXBand; float _AudioLinkVoronoiChronoSpeedXSpeed; @@ -12326,7 +12496,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AudioLinkVoronoiChronoSpeedZSpeed; #endif //endex - + struct appdata { float4 vertex : POSITION; @@ -12339,9 +12509,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 uv3 : TEXCOORD3; uint vertexId : SV_VertexID; UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO }; - + struct VertexOut { float4 pos : SV_POSITION; @@ -12354,14 +12523,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 lightmapUV : TEXCOORD7; float2 fogCoord: TEXCOORD10; UNITY_SHADOW_COORDS(11) - + UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; - + struct PoiMesh { - + // 0 Vertex normal // 1 Fragment normal float3 normals[2]; @@ -12384,8 +12553,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 parallaxUV; float2 dx; float2 dy; + uint isRightHand; }; - + struct PoiCam { float3 viewDir; @@ -12402,9 +12572,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 screenUV; float vDotN; float4 worldDirection; - + }; - + struct PoiMods { float4 Mask; @@ -12419,10 +12589,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float globalMask[16]; float ALTime[8]; }; - + struct PoiLight { - + float3 direction; float attenuation; float attenuationStrength; @@ -12455,7 +12625,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float directLuminance; float indirectLuminance; float finalLuminance; - + #if defined(VERTEXLIGHT_ON) // Non Important Lights float4 vDotNL; @@ -12472,17 +12642,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" half4 vertexVDotNH; half4 vDotLH; #endif - + }; - + struct PoiVertexLights { - + float3 direction; float3 color; float attenuation; }; - + struct PoiFragData { float smoothness; @@ -12490,34 +12660,34 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float metallic; float specularMask; float reflectionMask; - + float3 baseColor; float3 finalColor; float alpha; float3 emission; float toggleVertexLights; }; - + float4 poiTransformClipSpacetoScreenSpaceFrag(float4 clipPos) { float4 positionSS = float4(clipPos.xyz * clipPos.w, clipPos.w); positionSS.xy = positionSS.xy / _ScreenParams.xy; return positionSS; } - + // glsl_mod behaves better on negative numbers, and // in some situations actually outperforms HLSL's fmod() #ifndef glsl_mod #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y)))) #endif - + uniform float random_uniform_float_only_used_to_stop_compiler_warnings = 0.0f; - + float2 poiUV(float2 uv, float4 tex_st) { return uv * tex_st.xy + tex_st.zw; } - + float2 vertexUV(in VertexOut o, int index) { switch(index) @@ -12534,7 +12704,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return o.uv[0].xy; } } - + float2 vertexUV(in appdata v, int index) { switch(index) @@ -12551,67 +12721,67 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return v.uv0.xy; } } - + //Lighting Helpers float calculateluminance(float3 color) { return color.r * 0.299 + color.g * 0.587 + color.b * 0.114; } - + // Set by VRChat (as of open beta 1245) // _VRChatCameraMode: 0 => Normal, 1 => VR HandCam, 2 => Desktop Handcam, 3 => Screenshot/Photo // _VRChatMirrorMode: 0 => Normal, 1 => Mirror (VR), 2 => Mirror (Deskie) float _VRChatCameraMode; float _VRChatMirrorMode; - + float VRCCameraMode() { return _VRChatCameraMode; } - + float VRCMirrorMode() { return _VRChatMirrorMode; } - + bool IsInMirror() { return unity_CameraProjection[2][0] != 0.f || unity_CameraProjection[2][1] != 0.f; } - + bool IsOrthographicCamera() { return unity_OrthoParams.w == 1 || UNITY_MATRIX_P[3][3] == 1; } - + float shEvaluateDiffuseL1Geomerics_local(float L0, float3 L1, float3 n) { // average energy float R0 = max(0, L0); - + // avg direction of incoming light float3 R1 = 0.5f * L1; - + // directional brightness float lenR1 = length(R1); - + // linear angle between normal and direction 0-1 //float q = 0.5f * (1.0f + dot(R1 / lenR1, n)); //float q = dot(R1 / lenR1, n) * 0.5 + 0.5; float q = dot(normalize(R1), n) * 0.5 + 0.5; q = saturate(q); // Thanks to ScruffyRuffles for the bug identity. - + // power for q // lerps from 1 (linear) to 3 (cubic) based on directionality float p = 1.0f + 2.0f * lenR1 / R0; - + // dynamic range constant // should vary between 4 (highly directional) and 0 (ambient) float a = (1.0f - lenR1 / R0) / (1.0f + lenR1 / R0); - + return R0 * (a + (1.0f - a) * (p + 1.0f) * pow(q, p)); } - + half3 BetterSH9(half4 normal) { float3 indirect; @@ -12623,9 +12793,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirect += SHEvalLinearL2(normal); return indirect; } - + // Silent's code ends here - + float3 getCameraForward() { #if UNITY_SINGLE_PASS_STEREO @@ -12637,7 +12807,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif return normalize(p2 - p1); } - + half3 GetSHLength() { half3 x, x1; @@ -12649,7 +12819,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" x1.b = length(unity_SHBb); return x + x1; } - + float3 BoxProjection(float3 direction, float3 position, float4 cubemapPosition, float3 boxMin, float3 boxMax) { #if UNITY_SPECCUBE_BOX_PROJECTION @@ -12663,22 +12833,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif return direction; } - + float poiMax(float2 i) { return max(i.x, i.y); } - + float poiMax(float3 i) { return max(max(i.x, i.y), i.z); } - + float poiMax(float4 i) { return max(max(max(i.x, i.y), i.z), i.w); } - + float3 calculateNormal(in float3 baseNormal, in PoiMesh poiMesh, in Texture2D normalTexture, in float4 normal_ST, in float2 normalPan, in float normalUV, in float normalIntensity) { float3 normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(normalTexture, _MainTex, poiUV(poiMesh.uv[normalUV], normal_ST), normalPan), normalIntensity); @@ -12688,42 +12858,42 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" normal.z * baseNormal ); } - + float remap(float x, float minOld, float maxOld, float minNew = 0, float maxNew = 1) { return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); } - + float2 remap(float2 x, float2 minOld, float2 maxOld, float2 minNew = 0, float2 maxNew = 1) { return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); } - + float3 remap(float3 x, float3 minOld, float3 maxOld, float3 minNew = 0, float3 maxNew = 1) { return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); } - + float4 remap(float4 x, float4 minOld, float4 maxOld, float4 minNew = 0, float4 maxNew = 1) { return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); } - + float remapClamped(float minOld, float maxOld, float x, float minNew = 0, float maxNew = 1) { return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); } - + float2 remapClamped(float2 minOld, float2 maxOld, float2 x, float2 minNew, float2 maxNew) { return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); } - + float3 remapClamped(float3 minOld, float3 maxOld, float3 x, float3 minNew, float3 maxNew) { return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); } - + float4 remapClamped(float4 minOld, float4 maxOld, float4 x, float4 minNew, float4 maxNew) { return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); @@ -12732,7 +12902,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return ((height * - 1) + 1) * (poiCam.tangentViewDir.xy / poiCam.tangentViewDir.z); } - + /* 0: Zero float4(0.0, 0.0, 0.0, 0.0), 1: One float4(1.0, 1.0, 1.0, 1.0), @@ -12746,7 +12916,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 9: SrcAlphaSaturate saturate(sourceColor.aaaa), 10: OneMinusSrcAlpha float4(1.0, 1.0, 1.0, 1.0) - sourceColor.aaaa, */ - + float4 poiBlend(const float sourceFactor, const float4 sourceColor, const float destinationFactor, const float4 destinationColor, const float4 blendFactor) { float4 sA = 1 - blendFactor; @@ -12763,10 +12933,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" saturate(sourceColor.aaaa), 1 - sA, }; - + return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA); } - + // Average float blendAverage(float base, float blend) { @@ -12776,40 +12946,40 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return (base + blend) / 2.0; } - + // Color burn float blendColorBurn(float base, float blend) { return (blend == 0.0) ? blend : max((1.0 - ((1.0 - base) * rcp(random_uniform_float_only_used_to_stop_compiler_warnings + blend))), 0.0); } - + float3 blendColorBurn(float3 base, float3 blend) { return float3(blendColorBurn(base.r, blend.r), blendColorBurn(base.g, blend.g), blendColorBurn(base.b, blend.b)); } - + // Color Dodge float blendColorDodge(float base, float blend) { return (blend == 1.0) ? blend : min(base / (1.0 - blend), 1.0); } - + float3 blendColorDodge(float3 base, float3 blend) { return float3(blendColorDodge(base.r, blend.r), blendColorDodge(base.g, blend.g), blendColorDodge(base.b, blend.b)); } - + // Darken float blendDarken(float base, float blend) { return min(blend, base); } - + float3 blendDarken(float3 base, float3 blend) { return float3(blendDarken(base.r, blend.r), blendDarken(base.g, blend.g), blendDarken(base.b, blend.b)); } - + // Exclusion float blendExclusion(float base, float blend) { @@ -12819,18 +12989,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return base + blend - 2.0 * base * blend; } - + // Reflect float blendReflect(float base, float blend) { return (blend == 1.0) ? blend : min(base * base / (1.0 - blend), 1.0); } - + float3 blendReflect(float3 base, float3 blend) { return float3(blendReflect(base.r, blend.r), blendReflect(base.g, blend.g), blendReflect(base.b, blend.b)); } - + // Glow float blendGlow(float base, float blend) { @@ -12840,18 +13010,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return blendReflect(blend, base); } - + // Overlay float blendOverlay(float base, float blend) { return base < 0.5 ? (2.0 * base * blend) : (1.0 - 2.0 * (1.0 - base) * (1.0 - blend)); } - + float3 blendOverlay(float3 base, float3 blend) { return float3(blendOverlay(base.r, blend.r), blendOverlay(base.g, blend.g), blendOverlay(base.b, blend.b)); } - + // Hard Light float blendHardLight(float base, float blend) { @@ -12861,77 +13031,77 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return blendOverlay(blend, base); } - + // Vivid light float blendVividLight(float base, float blend) { return (blend < 0.5) ? blendColorBurn(base, (2.0 * blend)) : blendColorDodge(base, (2.0 * (blend - 0.5))); } - + float3 blendVividLight(float3 base, float3 blend) { return float3(blendVividLight(base.r, blend.r), blendVividLight(base.g, blend.g), blendVividLight(base.b, blend.b)); } - + // Hard mix float blendHardMix(float base, float blend) { return (blendVividLight(base, blend) < 0.5) ? 0.0 : 1.0; } - + float3 blendHardMix(float3 base, float3 blend) { return float3(blendHardMix(base.r, blend.r), blendHardMix(base.g, blend.g), blendHardMix(base.b, blend.b)); } - + // Lighten float blendLighten(float base, float blend) { return max(blend, base); } - + float3 blendLighten(float3 base, float3 blend) { return float3(blendLighten(base.r, blend.r), blendLighten(base.g, blend.g), blendLighten(base.b, blend.b)); } - + // Linear Burn float blendLinearBurn(float base, float blend) { // Note : Same implementation as BlendSubtractf return max(base + blend - 1.0, 0.0); } - + float3 blendLinearBurn(float3 base, float3 blend) { // Note : Same implementation as BlendSubtract return max(base + blend - float3(1.0, 1.0, 1.0), float3(0.0, 0.0, 0.0)); } - + // Linear Dodge float blendLinearDodge(float base, float blend) { // Note : Same implementation as BlendAddf return min(base + blend, 1.0); } - + float3 blendLinearDodge(float3 base, float3 blend) { // Note : Same implementation as BlendAdd return base + blend; } - + // Linear light float blendLinearLight(float base, float blend) { return blend < 0.5 ? blendLinearBurn(base, (2.0 * blend)) : blendLinearDodge(base, (2.0 * (blend - 0.5))); } - + float3 blendLinearLight(float3 base, float3 blend) { return float3(blendLinearLight(base.r, blend.r), blendLinearLight(base.g, blend.g), blendLinearLight(base.b, blend.b)); } - + // Multiply float blendMultiply(float base, float blend) { @@ -12941,7 +13111,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return base * blend; } - + // Negation float blendNegation(float base, float blend) { @@ -12951,7 +13121,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend); } - + // Normal float blendNormal(float base, float blend) { @@ -12961,7 +13131,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return blend; } - + // Phoenix float blendPhoenix(float base, float blend) { @@ -12971,83 +13141,83 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return min(base, blend) - max(base, blend) + float3(1.0, 1.0, 1.0); } - + // Pin light float blendPinLight(float base, float blend) { return (blend < 0.5) ? blendDarken(base, (2.0 * blend)) : blendLighten(base, (2.0 * (blend - 0.5))); } - + float3 blendPinLight(float3 base, float3 blend) { return float3(blendPinLight(base.r, blend.r), blendPinLight(base.g, blend.g), blendPinLight(base.b, blend.b)); } - + // Screen float blendScreen(float base, float blend) { return 1.0 - ((1.0 - base) * (1.0 - blend)); } - + float3 blendScreen(float3 base, float3 blend) { return float3(blendScreen(base.r, blend.r), blendScreen(base.g, blend.g), blendScreen(base.b, blend.b)); } - + // Soft Light float blendSoftLight(float base, float blend) { return (blend < 0.5) ? (2.0 * base * blend + base * base * (1.0 - 2.0 * blend)) : (sqrt(base) * (2.0 * blend - 1.0) + 2.0 * base * (1.0 - blend)); } - + float3 blendSoftLight(float3 base, float3 blend) { return float3(blendSoftLight(base.r, blend.r), blendSoftLight(base.g, blend.g), blendSoftLight(base.b, blend.b)); } - + // Subtract float blendSubtract(float base, float blend) { return max(base - blend, 0.0); } - + float3 blendSubtract(float3 base, float3 blend) { return max(base - blend, 0.0); } - + // Difference float blendDifference(float base, float blend) { return abs(base - blend); } - + float3 blendDifference(float3 base, float3 blend) { return abs(base - blend); } - + // Divide float blendDivide(float base, float blend) { return base / max(blend, 0.0001); } - + float3 blendDivide(float3 base, float3 blend) { return base / max(blend, 0.0001); } - + float blendMixed(float base, float blend) { return base + base * blend; } - + float3 blendMixed(float3 base, float3 blend) { return base + base * blend; } - + float3 customBlend(float3 base, float3 blend, float blendType, float alpha = 1) { float3 output = base; @@ -13066,7 +13236,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return output; } - + float3 customBlend(float base, float blend, float blendType, float alpha = 1) { float3 output = base; @@ -13084,7 +13254,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return output; } - + #define REPLACE 0 #define SUBSTRACT 1 #define MULTIPLY 2 @@ -13093,7 +13263,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define MAX 5 #define AVERAGE 6 #define ADD 7 - + float maskBlend(float baseMask, float blendMask, float blendType) { float output = 0; @@ -13110,7 +13280,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return saturate(output); } - + float globalMaskBlend(float baseMask, float globalMaskIndex, float blendType, PoiMods poiMods) { if (globalMaskIndex == 0) @@ -13122,27 +13292,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return maskBlend(baseMask, poiMods.globalMask[globalMaskIndex - 1], blendType); } } - + float random(float2 p) { return frac(sin(dot(p, float2(12.9898, 78.2383))) * 43758.5453123); } - + float2 random2(float2 p) { return frac(sin(float2(dot(p, float2(127.1, 311.7)), dot(p, float2(269.5, 183.3)))) * 43758.5453); } - + float3 random3(float2 p) { return frac(sin(float3(dot(p, float2(127.1, 311.7)), dot(p, float2(269.5, 183.3)), dot(p, float2(248.3, 315.9)))) * 43758.5453); } - + float3 random3(float3 p) { return frac(sin(float3(dot(p, float3(127.1, 311.7, 248.6)), dot(p, float3(269.5, 183.3, 423.3)), dot(p, float3(248.3, 315.9, 184.2)))) * 43758.5453); } - + float3 randomFloat3(float2 Seed, float maximum) { return (.5 + float3( @@ -13151,7 +13321,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453) ) * .5) * (maximum); } - + float3 randomFloat3Range(float2 Seed, float Range) { return (float3( @@ -13160,7 +13330,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453) ) * 2 - 1) * Range; } - + float3 randomFloat3WiggleRange(float2 Seed, float Range, float wiggleSpeed, float timeOffset) { float3 rando = (float3( @@ -13171,7 +13341,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float speed = 1 + wiggleSpeed; return float3(sin(((_Time.x + timeOffset) + rando.x * PI) * speed), sin(((_Time.x + timeOffset) + rando.y * PI) * speed), sin(((_Time.x + timeOffset) + rando.z * PI) * speed)) * Range; } - + void poiDither(float4 In, float4 ScreenPosition, out float4 Out) { float2 uv = ScreenPosition.xy * _ScreenParams.xy; @@ -13192,7 +13362,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" static const float HCLmaxL = 0.530454533953517; // == exp(HCLgamma / HCLy0) - 0.5 static const float3 wref = float3(1.0, 1.0, 1.0); #define TAU 6.28318531 - + float3 HUEtoRGB(in float H) { float R = abs(H * 6 - 3) - 1; @@ -13200,7 +13370,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float B = 2 - abs(H * 6 - 4); return saturate(float3(R, G, B)); } - + float3 RGBtoHCV(in float3 RGB) { // Based on work by Sam Hocevar and Emil Persson @@ -13210,27 +13380,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float H = abs((Q.w - Q.y) / (6 * C + Epsilon) + Q.z); return float3(H, C, Q.x); } - - float3 HSVtoRGB(in float3 HSV) - { - float3 RGB = HUEtoRGB(HSV.x); - return ((RGB - 1) * HSV.y + 1) * HSV.z; + + float3 RGBtoHSV(float3 c){ + float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); + float4 p = lerp(float4(c.bg, K.wz), float4(c.gb, K.xy), step(c.b, c.g)); + float4 q = lerp(float4(p.xyw, c.r), float4(c.r, p.yzx), step(p.x, c.r)); + + float d = q.x - min(q.w, q.y); + float e = 1.0e-10; + return float3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); } - - float3 RGBtoHSV(in float3 RGB) - { - float3 HCV = RGBtoHCV(RGB); - float S = HCV.y / (HCV.z + Epsilon); - return float3(HCV.x, S, HCV.z); + + float3 HSVtoRGB(float3 c){ + float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); + float3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www); + return c.z * lerp(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); } - + float3 HSLtoRGB(in float3 HSL) { float3 RGB = HUEtoRGB(HSL.x); float C = (1 - abs(2 * HSL.z - 1)) * HSL.y; return (RGB - 0.5) * C + HSL.z; } - + float3 RGBtoHSL(in float3 RGB) { float3 HCV = RGBtoHCV(RGB); @@ -13238,24 +13411,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon); return float3(HCV.x, S, L); } - + void DecomposeHDRColor(in float3 linearColorHDR, out float3 baseLinearColor, out float exposure) { // Optimization/adaptation of https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/GUI/ColorMutator.cs#L23 but skips weird photoshop stuff float maxColorComponent = max(linearColorHDR.r, max(linearColorHDR.g, linearColorHDR.b)); bool isSDR = maxColorComponent <= 1.0; - + float scaleFactor = isSDR ? 1.0 : (1.0 / maxColorComponent); exposure = isSDR ? 0.0 : log(maxColorComponent) * 1.44269504089; // ln(2) - + baseLinearColor = scaleFactor * linearColorHDR; } - + float3 ApplyHDRExposure(float3 linearColor, float exposure) { return linearColor * pow(2, exposure); } - + // Transforms an RGB color using a matrix. Note that S and V are absolute values here float3 ModifyViaHSV(float3 color, float h, float s, float v) { @@ -13265,12 +13438,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" colorHSV.z = saturate(colorHSV.z + v); return HSVtoRGB(colorHSV); } - + float3 ModifyViaHSV(float3 color, float3 HSVMod) { return ModifyViaHSV(color, HSVMod.x, HSVMod.y, HSVMod.z); } - + float4x4 brightnessMatrix(float brightness) { return float4x4( @@ -13280,11 +13453,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" brightness, brightness, brightness, 1 ); } - + float4x4 contrastMatrix(float contrast) { float t = (1.0 - contrast) / 2.0; - + return float4x4( contrast, 0, 0, 0, 0, contrast, 0, 0, @@ -13292,22 +13465,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" t, t, t, 1 ); } - + float4x4 saturationMatrix(float saturation) { float3 luminance = float3(0.3086, 0.6094, 0.0820); - + float oneMinusSat = 1.0 - saturation; - + float3 red = luminance.x * oneMinusSat; red += float3(saturation, 0, 0); - + float3 green = luminance.y * oneMinusSat; green += float3(0, saturation, 0); - + float3 blue = luminance.z * oneMinusSat; blue += float3(0, 0, saturation); - + return float4x4( red, 0, green, 0, @@ -13315,7 +13488,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, 0, 0, 1 ); } - + float4 PoiColorBCS(float4 color, float brightness, float contrast, float saturation) { return mul(color, mul(brightnessMatrix(brightness), mul(contrastMatrix(contrast), saturationMatrix(saturation)))); @@ -13324,68 +13497,87 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return mul(float4(color, 1), mul(brightnessMatrix(brightness), mul(contrastMatrix(contrast), saturationMatrix(saturation)))).rgb; } - + float3 linear_srgb_to_oklab(float3 c) { float l = 0.4122214708 * c.x + 0.5363325363 * c.y + 0.0514459929 * c.z; float m = 0.2119034982 * c.x + 0.6806995451 * c.y + 0.1073969566 * c.z; float s = 0.0883024619 * c.x + 0.2817188376 * c.y + 0.6299787005 * c.z; - + float l_ = pow(l, 1.0 / 3.0); float m_ = pow(m, 1.0 / 3.0); float s_ = pow(s, 1.0 / 3.0); - + return float3( 0.2104542553 * l_ + 0.7936177850 * m_ - 0.0040720468 * s_, 1.9779984951 * l_ - 2.4285922050 * m_ + 0.4505937099 * s_, 0.0259040371 * l_ + 0.7827717662 * m_ - 0.8086757660 * s_ ); } - + float3 oklab_to_linear_srgb(float3 c) { float l_ = c.x + 0.3963377774 * c.y + 0.2158037573 * c.z; float m_ = c.x - 0.1055613458 * c.y - 0.0638541728 * c.z; float s_ = c.x - 0.0894841775 * c.y - 1.2914855480 * c.z; - + float l = l_ * l_ * l_; float m = m_ * m_ * m_; float s = s_ * s_ * s_; - + return float3( + 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s, - 1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s, - 0.0041960863 * l - 0.7034186147 * m + 1.7076147010 * s ); } - + float3 hueShift(float3 color, float shift) { - float3 oklab = linear_srgb_to_oklab(max(color, 0.0000000001)); + float3 oklab = linear_srgb_to_oklab(color); + float chroma = length(oklab.yz); + + if (chroma < 1e-5) { + // No hue to shift for achromatic colors + return color; + } + float hue = atan2(oklab.z, oklab.y); hue += shift * PI * 2; // Add the hue shift - - float chroma = length(oklab.yz); + oklab.y = cos(hue) * chroma; oklab.z = sin(hue) * chroma; - + return oklab_to_linear_srgb(oklab); } - - float3 hueShift(float4 color, float shift) + + float3 hueShiftHSV(float3 color, float hueOffset) { - return hueShift(color.rgb, shift); + float3 hsv = float3(hueOffset, 0, 0); + float3 hsvCol = RGBtoHSV(color); + return HSVtoRGB(hsvCol + hsv); } - - /* - float3 hueShift(float3 color, float hueOffset) + + float3 hueShift(float3 color, float shift, float ColorSpace) { - color = RGBtoHSV(color); - color.x = frac(hueOffset +color.x); - return HSVtoRGB(color); + switch(ColorSpace) + { + // OkLab Hue Shift + case 0.0: + return hueShift(color, shift); + // HSV Hue Shift + case 1.0: + return hueShiftHSV(color, shift); + default: + return float3(1.0, 0.0, 0.0); + } } - */ - + + float3 hueShift(float4 color, float shift, float ColorSpace) + { + return hueShift(color.rgb, shift, ColorSpace); + } + // LCH float xyzF(float t) { @@ -13395,7 +13587,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655)); } - + float4x4 poiRotationMatrixFromAngles(float x, float y, float z) { float angleX = radians(x); @@ -13405,7 +13597,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1); - + float angleY = radians(y); c = cos(angleY); s = sin(angleY); @@ -13413,7 +13605,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, 1, 0, 0, - s, 0, c, 0, 0, 0, 0, 1); - + float angleZ = radians(z); c = cos(angleZ); s = sin(angleZ); @@ -13421,10 +13613,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); - + return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix); } - + float4x4 poiRotationMatrixFromAngles(float3 angles) { float angleX = radians(angles.x); @@ -13434,7 +13626,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1); - + float angleY = radians(angles.y); c = cos(angleY); s = sin(angleY); @@ -13442,7 +13634,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, 1, 0, 0, - s, 0, c, 0, 0, 0, 0, 1); - + float angleZ = radians(angles.z); c = cos(angleZ); s = sin(angleZ); @@ -13450,10 +13642,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); - + return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix); } - + float3 getCameraPosition() { #ifdef USING_STEREO_MATRICES @@ -13461,7 +13653,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif return _WorldSpaceCameraPos; } - + float2 calcPixelScreenUVs(half4 grabPos) { half2 uv = grabPos.xy / (grabPos.w + 0.0000000001); @@ -13470,60 +13662,60 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else uv.xy *= _ScreenParams.xy; #endif - + return uv; } - + float CalcMipLevel(float2 texture_coord) { float2 dx = ddx(texture_coord); float2 dy = ddy(texture_coord); float delta_max_sqr = max(dot(dx, dx), dot(dy, dy)); - + return 0.5 * log2(delta_max_sqr); } - + float inverseLerp(float A, float B, float T) { return (T - A) / (B - A); } - + float inverseLerp2(float2 a, float2 b, float2 value) { float2 AB = b - a; float2 AV = value - a; return dot(AV, AB) / dot(AB, AB); } - + float inverseLerp3(float3 a, float3 b, float3 value) { float3 AB = b - a; float3 AV = value - a; return dot(AV, AB) / dot(AB, AB); } - + float inverseLerp4(float4 a, float4 b, float4 value) { float4 AB = b - a; float4 AV = value - a; return dot(AV, AB) / dot(AB, AB); } - + /* MIT License - + Copyright (c) 2019 wraikny - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -13531,29 +13723,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + VertexTransformShader is dependent on: */ - + float4 quaternion_conjugate(float4 v) { return float4( v.x, -v.yzw ); } - + float4 quaternion_mul(float4 v1, float4 v2) { float4 result1 = (v1.x * v2 + v1 * v2.x); - + float4 result2 = float4( - dot(v1.yzw, v2.yzw), cross(v1.yzw, v2.yzw) ); - + return float4(result1 + result2); } - + // angle : radians float4 get_quaternion_from_angle(float3 axis, float angle) { @@ -13561,45 +13753,45 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float cs = cos(angle * 0.5); return float4(axis * sn, cs); } - + float4 quaternion_from_vector(float3 inVec) { return float4(0.0, inVec); } - + float degree_to_radius(float degree) { return ( degree / 180.0 * PI ); } - + float3 rotate_with_quaternion(float3 inVec, float3 rotation) { float4 qx = get_quaternion_from_angle(float3(1, 0, 0), radians(rotation.x)); float4 qy = get_quaternion_from_angle(float3(0, 1, 0), radians(rotation.y)); float4 qz = get_quaternion_from_angle(float3(0, 0, 1), radians(rotation.z)); - + #define MUL3(A, B, C) quaternion_mul(quaternion_mul((A), (B)), (C)) float4 quaternion = normalize(MUL3(qx, qy, qz)); float4 conjugate = quaternion_conjugate(quaternion); - + float4 inVecQ = quaternion_from_vector(inVec); - + float3 rotated = ( MUL3(quaternion, inVecQ, conjugate) ).yzw; - + return rotated; } - + float4 transform(float4 input, float4 pos, float4 rotation, float4 scale) { input.rgb *= (scale.xyz * scale.w); input = float4(rotate_with_quaternion(input.xyz, rotation.xyz * rotation.w) + (pos.xyz * pos.w), input.w); return input; } - + float2 RotateUV(float2 _uv, float _radian, float2 _piv, float _time) { float RotateUV_ang = _radian; @@ -13607,17 +13799,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float RotateUV_sin = sin(_time * RotateUV_ang); return (mul(_uv - _piv, float2x2(RotateUV_cos, -RotateUV_sin, RotateUV_sin, RotateUV_cos)) + _piv); } - + /* MIT END */ - + float3 RotateAroundAxis(float3 original, float3 axis, float radian) { float s = sin(radian); float c = cos(radian); float one_minus_c = 1.0 - c; - + axis = normalize(axis); float3x3 rot_mat = { one_minus_c * axis.x * axis.x + c, one_minus_c * axis.x * axis.y - axis.z * s, one_minus_c * axis.z * axis.x + axis.y * s, @@ -13626,14 +13818,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" }; return mul(rot_mat, original); } - + float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex) { float3 outputColor = srcColor; if (themeIndex != 0) { themeIndex = max(themeIndex - 1, 0); - + if (themeIndex <= 3) { outputColor = poiMods.globalColorTheme[themeIndex]; @@ -13650,7 +13842,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return outputColor; } - + float3 lilToneCorrection(float3 c, float4 hsvg) { // gamma @@ -13666,7 +13858,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // hsv - > rgb return hsv.z - hsv.z * hsv.y + hsv.z * hsv.y * saturate(abs(frac(hsv.x + float3(1.0, 2.0 / 3.0, 1.0 / 3.0)) * 6.0 - 3.0) - 1.0); } - + float3 lilBlendColor(float3 dstCol, float3 srcCol, float3 srcA, int blendMode) { float3 ad = dstCol + srcCol; @@ -13678,24 +13870,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (blendMode == 3) outCol = mu; // Multiply return lerp(dstCol, outCol, srcA); } - + float lilIsIn0to1(float f) { float value = 0.5 - abs(f - 0.5); return saturate(value / clamp(fwidth(value), 0.0001, 1.0)); } - + float lilIsIn0to1(float f, float nv) { float value = 0.5 - abs(f - 0.5); return saturate(value / clamp(fwidth(value), 0.0001, nv)); } - + float poiEdgeLinearNoSaturate(float value, float border) { return (value - border) / clamp(fwidth(value), 0.0001, 1.0); } - + float3 poiEdgeLinearNoSaturate(float value, float3 border) { return float3( @@ -13704,29 +13896,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" (value - border.z) / clamp(fwidth(value), 0.0001, 1.0) ); } - + float poiEdgeLinearNoSaturate(float value, float border, float blur) { float borderMin = saturate(border - blur * 0.5); float borderMax = saturate(border + blur * 0.5); return (value - borderMin) / saturate(borderMax - borderMin + fwidth(value)); } - + float poiEdgeLinearNoSaturate(float value, float border, float blur, float borderRange) { float borderMin = saturate(border - blur * 0.5 - borderRange); float borderMax = saturate(border + blur * 0.5); return (value - borderMin) / saturate(borderMax - borderMin + fwidth(value)); } - + float poiEdgeNonLinearNoSaturate(float value, float border) { // return (value - border) / clamp(fwidth(value), 0.0001, 1.0); - + float fwidthValue = fwidth(value); return smoothstep(border - fwidthValue, border + fwidthValue, value); } - + float poiEdgeNonLinearNoSaturate(float value, float border, float blur) { float fwidthValue = fwidth(value); @@ -13734,7 +13926,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float borderMax = saturate(border + blur * 0.5); return smoothstep(borderMin - fwidthValue, borderMax + fwidthValue, value); } - + float poiEdgeNonLinearNoSaturate(float value, float border, float blur, float borderRange) { float fwidthValue = fwidth(value); @@ -13742,32 +13934,32 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float borderMax = saturate(border + blur * 0.5); return smoothstep(borderMin - fwidthValue, borderMax + fwidthValue, value); } - + float poiEdgeNonLinear(float value, float border) { return saturate(poiEdgeNonLinearNoSaturate(value, border)); } - + float poiEdgeNonLinear(float value, float border, float blur) { return saturate(poiEdgeNonLinearNoSaturate(value, border, blur)); } - + float poiEdgeNonLinear(float value, float border, float blur, float borderRange) { return saturate(poiEdgeNonLinearNoSaturate(value, border, blur, borderRange)); } - + float poiEdgeLinear(float value, float border) { return saturate(poiEdgeLinearNoSaturate(value, border)); } - + float poiEdgeLinear(float value, float border, float blur) { return saturate(poiEdgeLinearNoSaturate(value, border, blur)); } - + float poiEdgeLinear(float value, float border, float blur, float borderRange) { return saturate(poiEdgeLinearNoSaturate(value, border, blur, borderRange)); @@ -13777,12 +13969,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return LinearToGammaSpace(col); } - + float3 OpenLitSRGBToLinear(float3 col) { return GammaToLinearSpace(col); } - + float OpenLitLuminance(float3 rgb) { #if defined(UNITY_COLORSPACE_GAMMA) @@ -13791,7 +13983,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return dot(rgb, float3(0.0396819152, 0.458021790, 0.00609653955)); #endif } - + float3 AdjustLitLuminance(float3 rgb, float targetLuminance) { float currentLuminance; @@ -13800,11 +13992,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else currentLuminance = dot(rgb, float3(0.0396819152, 0.458021790, 0.00609653955)); #endif - + float luminanceRatio = targetLuminance / currentLuminance; return rgb * luminanceRatio; } - + float3 ClampLuminance(float3 rgb, float minLuminance, float maxLuminance) { float currentLuminance = dot(rgb, float3(0.299, 0.587, 0.114)); @@ -13813,19 +14005,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float luminanceRatio = clamp(min(maxRatio, max(minRatio, 1.0)), 0.0, 1.0); return lerp(rgb, rgb * luminanceRatio, luminanceRatio < 1.0); } - + float3 MaxLuminance(float3 rgb, float maxLuminance) { float currentLuminance = dot(rgb, float3(0.299, 0.587, 0.114)); float luminanceRatio = (currentLuminance != 0) ? maxLuminance / max(currentLuminance, 0.00001) : 1.0; return lerp(rgb, rgb * luminanceRatio, currentLuminance > maxLuminance); } - + float OpenLitGray(float3 rgb) { return dot(rgb, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); } - + void OpenLitShadeSH9ToonDouble(float3 lightDirection, out float3 shMax, out float3 shMin) { #if !defined(LIGHTMAP_ON) @@ -13853,13 +14045,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" shMin = 0.0; #endif } - + float3 OpenLitComputeCustomLightDirection(float4 lightDirectionOverride) { float3 customDir = length(lightDirectionOverride.xyz) * normalize(mul((float3x3)unity_ObjectToWorld, lightDirectionOverride.xyz)); return lightDirectionOverride.w ? customDir : lightDirectionOverride.xyz; // .w isn't doc'd anywhere and is always 0 unless end user changes it + } - + float3 OpenLitLightingDirectionForSH9() { float3 mainDir = _WorldSpaceLightPos0.xyz * OpenLitLuminance(_LightColor0.rgb); @@ -13870,12 +14063,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 sh9Dir = 0; float3 sh9DirAbs = 0; #endif - + float3 lightDirectionForSH9 = sh9Dir + mainDir; lightDirectionForSH9 = dot(lightDirectionForSH9, lightDirectionForSH9) < 0.000001 ? 0 : normalize(lightDirectionForSH9); return lightDirectionForSH9; } - + float3 OpenLitLightingDirection(float4 lightDirectionOverride) { float3 mainDir = _WorldSpaceLightPos0.xyz * OpenLitLuminance(_LightColor0.rgb); @@ -13887,28 +14080,28 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 sh9DirAbs = 0; #endif float3 customDir = OpenLitComputeCustomLightDirection(lightDirectionOverride); - + return normalize(sh9DirAbs + mainDir + customDir); } - + float3 OpenLitLightingDirection() { float4 customDir = float4(0.001, 0.002, 0.001, 0.0); return OpenLitLightingDirection(customDir); } - + inline float4 CalculateFrustumCorrection() { float x1 = -UNITY_MATRIX_P._31 / (UNITY_MATRIX_P._11 * UNITY_MATRIX_P._34); float x2 = -UNITY_MATRIX_P._32 / (UNITY_MATRIX_P._22 * UNITY_MATRIX_P._34); return float4(x1, x2, 0, UNITY_MATRIX_P._33 / UNITY_MATRIX_P._34 + x1 * UNITY_MATRIX_P._13 + x2 * UNITY_MATRIX_P._23); } - + inline float CorrectedLinearEyeDepth(float z, float B) { return 1.0 / (z / UNITY_MATRIX_P._34 + B); } - + // Silent's code float2 sharpSample(float4 texelSize, float2 p) { @@ -13918,7 +14111,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" p = (p - 0.5) * texelSize.xy; return p; } - + void applyToGlobalMask(inout PoiMods poiMods, int index, int blendType, float val) { float valBlended = saturate(maskBlend(poiMods.globalMask[index], val, blendType)); @@ -13942,7 +14135,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" case 15: poiMods.globalMask[15] = valBlended; break; } } - + void assignValueToVectorFromIndex(inout float4 vec, int index, float value) { switch(index) @@ -13953,7 +14146,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" case 3: vec[3] = value; break; } } - + // SNose float3 mod289(float3 x) { @@ -13967,7 +14160,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return mod289(((x * 34.0) + 1.0) * x); } - + float snoise(float2 v) { const float4 C = float4(0.211324865405187, // (3.0 - sqrt(3.0)) / 6.0 @@ -13983,7 +14176,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" i = mod289(i); // Avoid truncation effects in permutation float3 p = permute(permute(i.y + float3(0.0, i1.y, 1.0)) + i.x + float3(0.0, i1.x, 1.0)); - + float3 m = max(0.5 - float3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0); m = m * m ; m = m * m ; @@ -13997,35 +14190,35 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" g.yz = a0.yz * x12.xz + h.yz * x12.yw; return 130.0 * dot(m, g); } - + float nsqDistance(float2 a, float2 b) { return dot(a - b, a - b); } - + float poiInvertToggle(in float value, in float toggle) { return (toggle == 0 ? value : 1 - value); } - + float3 PoiBlendNormal(float3 dstNormal, float3 srcNormal) { return float3(dstNormal.xy + srcNormal.xy, dstNormal.z * srcNormal.z); } - + float3 lilTransformDirOStoWS(float3 directionOS, bool doNormalize) { if (doNormalize) return normalize(mul((float3x3)unity_ObjectToWorld, directionOS)); else return mul((float3x3)unity_ObjectToWorld, directionOS); } - + float2 poiGetWidthAndHeight(Texture2D tex) { uint width, height; tex.GetDimensions(width, height); return float2(width, height); } - + float2 poiGetWidthAndHeight(Texture2DArray tex) { uint width, height, element; @@ -14034,25 +14227,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } //ifex _EnableAudioLink==0 #ifdef POI_AUDIOLINK - + // Convenient mechanism to read from the AudioLink texture that handles reading off the end of one line and onto the next above it. float4 AudioLinkDataMultiline(uint2 xycoord) { return AudioLinkData(uint2(xycoord.x % AUDIOLINK_WIDTH, xycoord.y + xycoord.x / AUDIOLINK_WIDTH)); } - + // Mechanism to sample between two adjacent pixels and lerp between them, like "linear" supesampling float4 AudioLinkLerp(float2 xy) { return lerp(AudioLinkData(xy), AudioLinkData(xy + int2(1, 0)), frac(xy.x)); } - + // Same as AudioLinkLerp but properly handles multiline reading. float4 AudioLinkLerpMultiline(float2 xy) { return lerp(AudioLinkDataMultiline(xy), AudioLinkDataMultiline(xy + float2(1, 0)), frac(xy.x)); } - + //Tests to see if Audio Link texture is available bool AudioLinkIsAvailable() { @@ -14064,7 +14257,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return _AudioTexture_TexelSize.z > 16; #endif } - + //Get version of audiolink present in the world, 0 if no audiolink is present float AudioLinkGetVersion() { @@ -14074,7 +14267,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else dims = _AudioTexture_TexelSize.zw; #endif - + if (dims.x >= 128) return AudioLinkData(ALPASS_GENERALVU).x; else if (dims.x > 16) @@ -14082,17 +14275,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" else return 0; } - + // This pulls data from this texture. #define AudioLinkGetSelfPixelData(xy) _SelfTexture2D[xy] - + // Extra utility functions for time. uint AudioLinkDecodeDataAsUInt(uint2 indexloc) { uint4 rpx = AudioLinkData(indexloc); return rpx.r + rpx.g * 1024 + rpx.b * 1048576 + rpx.a * 1073741824; } - + //Note: This will truncate time to every 134,217.728 seconds (~1.5 days of an instance being up) to prevent floating point aliasing. // if your code will alias sooner, you will need to use a different function. It should be safe to use this on all times. float AudioLinkDecodeDataAsSeconds(uint2 indexloc) @@ -14101,15 +14294,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //Can't just divide by float. Bug in Unity's HLSL compiler. return float(time / 1000) + float(time % 1000) / 1000.; } - + #define ALDecodeDataAsSeconds(x) AudioLinkDecodeDataAsSeconds(x) #define ALDecodeDataAsUInt(x) AudioLinkDecodeDataAsUInt(x) - + float AudioLinkRemap(float t, float a, float b, float u, float v) { return ((t - a) / (b - a)) * (v - u) + u; } - + float3 AudioLinkHSVtoRGB(float3 HSV) { float3 RGB = 0; @@ -14147,11 +14340,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float M = HSV.z - C; return RGB + M; } - + float3 AudioLinkCCtoRGB(float bin, float intensity, int rootNote) { float note = bin / AUDIOLINK_EXPBINS; - + float hue = 0.0; note *= 12.0; note = glsl_mod(4. - note + rootNote, 12.0); @@ -14177,48 +14370,48 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float val = intensity - 0.1; return AudioLinkHSVtoRGB(float3(fmod(hue, 1.0), 1.0, clamp(val, 0.0, 1.0))); } - + // Sample the amplitude of a given frequency in the DFT, supports frequencies in [13.75; 14080]. float4 AudioLinkGetAmplitudeAtFrequency(float hertz) { float note = AUDIOLINK_EXPBINS * log2(hertz / AUDIOLINK_BOTTOM_FREQUENCY); return AudioLinkLerpMultiline(ALPASS_DFT + float2(note, 0)); } - + // Sample the amplitude of a given semitone in an octave. Octave is in [0; 9] while note is [0; 11]. float AudioLinkGetAmplitudeAtNote(float octave, float note) { float quarter = note * 2.0; return AudioLinkLerpMultiline(ALPASS_DFT + float2(octave * AUDIOLINK_EXPBINS + quarter, 0)); } - + // Get a reasonable drop-in replacement time value for _Time.y with the // given chronotensity index [0; 7] and AudioLink band [0; 3]. float AudioLinkGetChronoTime(uint index, uint band) { return (AudioLinkDecodeDataAsUInt(ALPASS_CHRONOTENSITY + uint2(index, band))) / 100000.0; } - + // Get a chronotensity value in the interval [0; 1], modulated by the speed input, // with the given chronotensity index [0; 7] and AudioLink band [0; 3]. float AudioLinkGetChronoTimeNormalized(uint index, uint band, float speed) { return frac(AudioLinkGetChronoTime(index, band) * speed); } - + // Get a chronotensity value in the interval [0; interval], modulated by the speed input, // with the given chronotensity index [0; 7] and AudioLink band [0; 3]. float AudioLinkGetChronoTimeInterval(uint index, uint band, float speed, float interval) { return AudioLinkGetChronoTimeNormalized(index, band, speed) * interval; } - + float getBandAtTime(float band, float time, float size = 1.0f) { //return remap(UNITY_SAMPLE_TEX2D(_AudioTexture, float2(time * width, band/128.0)).r, min(size,.9999), 1); return remapClamped(min(size, .9999), 1, AudioLinkData(ALPASS_AUDIOBASS + uint2(time * AUDIOLINK_WIDTH, band)).r); } - + fixed3 maximize(fixed3 c) { if (c.x == 0 && c.y == 0 && c.z == 0) @@ -14226,11 +14419,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" else return c / max(c.r, max(c.g, c.b)); } - + void initPoiAudioLink(inout PoiMods poiMods) { if (!_AudioLinkAnimToggle) return; - + if (AudioLinkIsAvailable()) { poiMods.audioLinkAvailable = true; @@ -14245,25 +14438,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalColorTheme[5] = AudioLinkData( ALPASS_CCCOLORS + uint2( 1, 0 ) ); poiMods.globalColorTheme[6] = AudioLinkData( ALPASS_CCCOLORS + uint2( 2, 0 ) ); poiMods.globalColorTheme[7] = AudioLinkData( ALPASS_CCCOLORS + uint2( 3, 0 ) ); - + poiMods.globalColorTheme[4] = float4(maximize(AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) )),1.0); poiMods.globalColorTheme[5] = float4(maximize(AudioLinkData( ALPASS_CCCOLORS + uint2( 1, 0 ) )),1.0); poiMods.globalColorTheme[6] = float4(maximize(AudioLinkData( ALPASS_CCCOLORS + uint2( 2, 0 ) )),1.0); poiMods.globalColorTheme[7] = float4(maximize(AudioLinkData( ALPASS_CCCOLORS + uint2( 3, 0 ) )),1.0); */ - + poiMods.globalColorTheme[4] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(2, 0))[0], AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0); poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0))[0], AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0); poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0))[0], AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0); poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0))[0], AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0); - + poiMods.globalColorTheme[8] = AudioLinkData(ALPASS_THEME_COLOR0); poiMods.globalColorTheme[9] = AudioLinkData(ALPASS_THEME_COLOR1); poiMods.globalColorTheme[10] = AudioLinkData(ALPASS_THEME_COLOR2); poiMods.globalColorTheme[11] = AudioLinkData(ALPASS_THEME_COLOR3); return; } - + if (_AudioLinkBandOverridesEnabled) { poiMods.audioLinkAvailable = true; @@ -14273,7 +14466,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.audioLink[3] = _AudioLinkBandOverrideSliders.w; } } - + void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) { if (_DebugWaveform) @@ -14322,21 +14515,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.emission += (AudioLinkDecodeDataAsUInt(ALPASS_CHRONOTENSITY + uint2(1, 0)) % 1000000) / 1000000.0; } } - + void SetupAudioLink(inout PoiFragData poiFragData, inout PoiMods poiMods, in PoiMesh poiMesh) { initPoiAudioLink(poiMods); DebugVisualizer(poiFragData, poiMesh, poiMods); - + if (_AudioLinkCCStripY) { poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].y * AUDIOLINK_WIDTH, 0)).rgb * .5; } } - + #endif //endex - + //ifex _BSSEnabled!=1 #ifdef POIBS_ENABLE //ifex _BSSBloomfog!=1 @@ -14351,7 +14544,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" (screenPosNormalized.y + - 0.5) * _CustomFogTextureToScreenRatio.y + 0.5 ,clipPos.z,clipPos.w); } - + inline float GetHeightFogIntensity(float3 worldPos, float fogHeightOffset, float fogHeightScale) { float heightFogIntensity = _CustomFogHeightFogHeight + _CustomFogHeightFogStartY; @@ -14360,7 +14553,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" heightFogIntensity = clamp(heightFogIntensity, 0, 1); return ((-heightFogIntensity * 2) + 3) * (heightFogIntensity * heightFogIntensity); } - + inline float GetFogIntensity(float3 distance, float fogStartOffset, float fogScale) { float fogIntensity = max(dot(distance, distance) + - fogStartOffset, 0); @@ -14372,7 +14565,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex #endif //endex - + //ifex _EnableDepthBulge==0 #if defined(POI_DEPTHBULGE) void applyDepthBulgeFX(inout VertexOut o) @@ -14380,15 +14573,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 pos = UnityObjectToClipPos(o.localPos); float4 grabPos = ComputeGrabScreenPos(pos); float depth = SAMPLE_DEPTH_TEXTURE_LOD(_CameraDepthTexture, float4(grabPos.xy / grabPos.w, 0, 0)); - + #if defined(PROP_DEPTHBULGEMASK) || !defined(OPTIMIZER_ENABLED) float depthBulgeMask = tex2Dlod(_DepthBulgeMask, float4(poiUV(vertexUV(o, _DepthBulgeMaskUV), _DepthBulgeMask_ST), 0, 0))[_DepthBulgeMaskChannel]; #else float depthBulgeMask = 1.0; #endif - + depth = Linear01Depth(depth); - + float intersect = 0; if (depth != 1) { @@ -14399,16 +14592,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } float4 offset = intersect * _DepthBulgeHeight * float4(o.normal, 0); - + offset = IsInMirror() ? 0 : offset; offset *= depthBulgeMask; - + o.worldPos.xyz += offset.xyz; o.localPos.xyz += mul(unity_WorldToObject, float4(offset.xyz, 0)).xyz; } #endif //endex - + VertexOut vert( #ifndef POI_TESSELLATED appdata v @@ -14425,7 +14618,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v); #endif UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - + //ifex _EnableUDIMDiscardOptions==0 #ifdef POI_UDIMDISCARD UNITY_BRANCH @@ -14438,20 +14631,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" udim += (v.uv1.xy * (_UDIMDiscardUV == 1)); udim += (v.uv2.xy * (_UDIMDiscardUV == 2)); udim += (v.uv3.xy * (_UDIMDiscardUV == 3)); - + float isDiscarded = 0; float4 xMask = float4( (udim.x >= 0 && udim.x < 1), (udim.x >= 1 && udim.x < 2), (udim.x >= 2 && udim.x < 3), (udim.x >= 3 && udim.x < 4)); - + isDiscarded += (udim.y >= 0 && udim.y < 1) * dot(float4(_UDIMDiscardRow0_0, _UDIMDiscardRow0_1, _UDIMDiscardRow0_2, _UDIMDiscardRow0_3), xMask); isDiscarded += (udim.y >= 1 && udim.y < 2) * dot(float4(_UDIMDiscardRow1_0, _UDIMDiscardRow1_1, _UDIMDiscardRow1_2, _UDIMDiscardRow1_3), xMask); isDiscarded += (udim.y >= 2 && udim.y < 3) * dot(float4(_UDIMDiscardRow2_0, _UDIMDiscardRow2_1, _UDIMDiscardRow2_2, _UDIMDiscardRow2_3), xMask); isDiscarded += (udim.y >= 3 && udim.y < 4) * dot(float4(_UDIMDiscardRow3_0, _UDIMDiscardRow3_1, _UDIMDiscardRow3_2, _UDIMDiscardRow3_3), xMask); - + isDiscarded *= any(float4(udim.y >= 0, udim.y < 4, udim.x >= 0, udim.x < 4)); // never discard outside 4x4 grid in pos coords - + // Use a threshold so that there's some room for animations to be close to 0, but not exactly 0 const float threshold = 0.001; if(isDiscarded > threshold) // Early Return skips rest of vertex shader @@ -14461,7 +14654,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _VertexManipulationsEnabled==0 #ifdef AUTO_EXPOSURE float4 audioLinkBands = 0; @@ -14480,7 +14673,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" audioLinkBands.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r; audioLinkBands.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r; audioLinkBands.w = AudioLinkData(ALPASS_AUDIOTREBLE).r; - + if (any(_VertexLocalTranslationALMin) || any(_VertexLocalTranslationALMax)) { ALLocalTranslation = lerp(_VertexLocalTranslationALMin, _VertexLocalTranslationALMax, audioLinkBands[_VertexLocalTranslationALBand]); @@ -14517,37 +14710,37 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } #endif - + // Local Transformation float4 rotation = float4(_VertexManipulationLocalRotation.xyz + float3(180, 0, 0) + _VertexManipulationLocalRotationSpeed * _Time.x + ALrotation + CTALRotation, _VertexManipulationLocalRotation.w); v.normal = rotate_with_quaternion(v.normal, rotation.xyz); v.tangent.xyz = rotate_with_quaternion(v.tangent.xyz, rotation.xyz); v.vertex = transform(v.vertex, _VertexManipulationLocalTranslation + float4(ALLocalTranslation, 0) + ALSpectrumLocalOffset, rotation, _VertexManipulationLocalScale + float4(ALScale, 0)); o.normal = UnityObjectToWorldNormal(v.normal); - + #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED) float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(vertexUV(v, _VertexManipulationHeightMaskUV), _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0))[_VertexManipulationHeightMaskChannel] - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal; #else float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal; #endif - + if (_VertexBarrelMode) { v.vertex.xz = lerp(v.vertex.xz, normalize(v.vertex.xz) * _VertexBarrelWidth + v.vertex.xz * _VertexBarrelHeight, _VertexBarrelAlpha); } - + if (_VertexSphereMode) { v.vertex.xyz = lerp(v.vertex.xyz, normalize(v.vertex.xyz + _VertexSphereCenter.xyz) * _VertexSphereRadius + v.vertex.xyz * _VertexSphereHeight, _VertexSphereAlpha); } - + if (_VertexTornadoMode) { v.vertex.xz = lerp(v.vertex.xz, float3(v.vertex.xz + float2(cos(_Time.y * _VertexTornadoSpeed + v.vertex.y * _VertexTornadoIntensity) * _VertexTornadoRadius, sin(_Time.y * _VertexTornadoSpeed + v.vertex.y * _VertexTornadoIntensity) * _VertexTornadoRadius), v.vertex.y), smoothstep(_VertexTornadoBaseHeight, _VertexTornadoTopHeight, v.vertex.y)); } - + v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz; - + // rounding UNITY_BRANCH if (_VertexRoundingEnabled) @@ -14566,7 +14759,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _EnableDissolve==0 #ifdef DISTORT UNITY_BRANCH @@ -14579,41 +14772,41 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" dissolveUdim += (v.uv1.xy * (_UVTileDissolveUV == 1)); dissolveUdim += (v.uv2.xy * (_UVTileDissolveUV == 2)); dissolveUdim += (v.uv3.xy * (_UVTileDissolveUV == 3)); - + float isDiscardedFromDissolve = 0; float4 xMaskDissolve = float4((dissolveUdim.x >= 0 && dissolveUdim.x < 1), (dissolveUdim.x >= 1 && dissolveUdim.x < 2), (dissolveUdim.x >= 2 && dissolveUdim.x < 3), (dissolveUdim.x >= 3 && dissolveUdim.x < 4)); - + isDiscardedFromDissolve += (dissolveUdim.y >= 0 && dissolveUdim.y < 1) * dot(float4(_UVTileDissolveAlpha_Row0_0, _UVTileDissolveAlpha_Row0_1, _UVTileDissolveAlpha_Row0_2, _UVTileDissolveAlpha_Row0_3), xMaskDissolve); isDiscardedFromDissolve += (dissolveUdim.y >= 1 && dissolveUdim.y < 2) * dot(float4(_UVTileDissolveAlpha_Row1_0, _UVTileDissolveAlpha_Row1_1, _UVTileDissolveAlpha_Row1_2, _UVTileDissolveAlpha_Row1_3), xMaskDissolve); isDiscardedFromDissolve += (dissolveUdim.y >= 2 && dissolveUdim.y < 3) * dot(float4(_UVTileDissolveAlpha_Row2_0, _UVTileDissolveAlpha_Row2_1, _UVTileDissolveAlpha_Row2_2, _UVTileDissolveAlpha_Row2_3), xMaskDissolve); isDiscardedFromDissolve += (dissolveUdim.y >= 3 && dissolveUdim.y < 4) * dot(float4(_UVTileDissolveAlpha_Row3_0, _UVTileDissolveAlpha_Row3_1, _UVTileDissolveAlpha_Row3_2, _UVTileDissolveAlpha_Row3_3), xMaskDissolve); - + isDiscardedFromDissolve *= any(float4(dissolveUdim.y >= 0, dissolveUdim.y < 4, dissolveUdim.x >= 0, dissolveUdim.x < 4)); // never discard outside 4x4 grid in pos coords - + // Use a threshold so that there's some room for animations to be close to 1, but not exactly 1 const float threshold = 0.999; if (isDiscardedFromDissolve > threshold) // Early Return skips rest of vertex shader - + { return (VertexOut)POI_NAN; } } #endif //endex - + //ifex _EnableMirrorOptions==0 #ifdef POI_MIRROR float notVisible = 0; - + if (_VisibilityMode == 1) // VRC - + { float mirrorMode = VRCMirrorMode(); float cameraMode = VRCCameraMode(); - + notVisible += (!_VisibilityVRCRegular && ((mirrorMode == 0) && (cameraMode == 0))); notVisible += (!_VisibilityVRCMirrorVR && (mirrorMode == 1)); notVisible += (!_VisibilityVRCMirrorDesktop && (mirrorMode == 2)); @@ -14622,50 +14815,50 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" notVisible += (!_VisibilityVRCCameraScreenshot && (cameraMode == 3)); } else if (_Mirror != 0) // Generic (CVR, etc) - + { notVisible += (_Mirror == 1) ^ IsInMirror(); } - + if (notVisible) // Early Return skips rest of vertex shader - + { return (VertexOut)POI_NAN; } #endif //endex - + o.normal = UnityObjectToWorldNormal(v.normal); o.tangent.xyz = UnityObjectToWorldDir(v.tangent); o.tangent.w = v.tangent.w; o.vertexColor = v.color; - + o.uv[0] = float4(v.uv0.xy, v.uv1.xy); o.uv[1] = float4(v.uv2.xy, v.uv3.xy); - + #if defined(LIGHTMAP_ON) o.lightmapUV.xy = v.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw; #endif #ifdef DYNAMICLIGHTMAP_ON o.lightmapUV.zw = v.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; #endif - + o.localPos = v.vertex; o.worldPos = mul(unity_ObjectToWorld, o.localPos); - + float3 localOffset = float3(0, 0, 0); float3 worldOffset = float3(0, 0, 0); - + //ifex _EnableOutlines!=1 #ifdef POI_PASS_OUTLINE float outlineMask = tex2Dlod(_OutlineMask, float4(poiUV(vertexUV(v, _OutlineMaskUV), _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0))[_OutlineMaskChannel]; - + //UNITY_BRANCH if (_OutlineVertexColorMask > 0) { outlineMask *= lerp(1, v.color[_OutlineVertexColorMask - 1], _OutlineVertexColorMaskStrength); } - + float3 outlineNormal = _OutlineSpace ? o.normal : v.normal; //UNITY_BRANCH if (_OutlineUseVertexColorNormals) @@ -14673,7 +14866,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 outlineTangent; float3 outlineBinormal; if (_OutlineSpace) // 0 Local, 1 World - + { outlineTangent = o.tangent; outlineBinormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w); @@ -14686,7 +14879,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 outlineVectorTS = v.color.rgb * 2.0 - 1.0; outlineNormal = outlineVectorTS.x * outlineTangent + outlineVectorTS.y * outlineBinormal + outlineVectorTS.z * outlineNormal; } - + float offsetMultiplier = 1; float distanceOffset = 1; //UNITY_BRANCH @@ -14694,7 +14887,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { distanceOffset *= lerp(1.0, clamp((distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz)), 0.0f, _OutlinesMaxDistance), _OutlineFixWidth); } - + float lineWidth = _LineWidth; #ifdef POI_AUDIOLINK // Due to PoiMods.audioLink being frag only I'll just @@ -14708,9 +14901,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } #endif - + float3 offset = outlineNormal * (lineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset; - + //UNITY_BRANCH if (_OutlineExpansionMode == 2) { @@ -14723,7 +14916,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { float3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal); offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy))); - + offset *= offsetMultiplier; offset *= distanceOffset; } @@ -14744,10 +14937,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _VertexGlitchingEnabled==0 #if defined(POI_VERTEX_GLITCHING) - + bool canGlitch = true; if (_VertexGlitchMirrorEnable && _VertexGlitchMirror > 0) { @@ -14761,26 +14954,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" forward.y = 0; forward = normalize(forward); float3 glitchDirection = normalize(cross(float3(0, 1, 0), forward)); - + float glitchAmount = 0; - + #if defined(POI_VERTEX_GLITCHING_TEXTURE) // if(_VertexGlitchingUseTexture) // { float uvl = o.worldPos.y * _VertexGlitchDensity + _Time.x * _VertexGlitchMapPanSpeed; float uvr = o.worldPos.y * _VertexGlitchDensity - _Time.x * _VertexGlitchMapPanSpeed; - + float3 glitchTextureL = 1; float3 glitchTextureR = 1; - + #if defined(POI_VERTEX_GLITCHING_TEXTURE) || !defined(OPTIMIZER_ENABLED) glitchTextureL = tex2Dlod(_VertexGlitchMap, float4(uvl, uvl, 0, 0)).rgb; glitchTextureR = tex2Dlod(_VertexGlitchMap, float4(uvr, uvr, 0, 0)).rgb; #endif - + glitchAmount += (glitchTextureL.r - 0.5) * 2; glitchAmount += - (glitchTextureR.r - 0.5) * 2; - + glitchAmount += (glitchTextureL.g - 0.5) * 2; glitchAmount += - (glitchTextureR.b - 0.5) * 2; // } else { @@ -14788,24 +14981,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" glitchAmount += frac(sin(dot(_Time.xy + o.worldPos.y, float2(12.9898, 78.233))) * 43758.5453123) * 2 - 1; // } #endif - + float time = _Time.y * _VertexGlitchFrequency; - + float randomGlitch = (sin(time) + sin(2.2 * time + 5.52) + sin(2.9 * time + 0.93) + sin(4.6 * time + 8.94)) / 4; float3 glitchOffset = 0; - + #ifdef POI_AUDIOLINK if (AudioLinkIsAvailable() && _VertexGlitchingAudioLinkEnabled) { // float4 audioLinkData = AudioLinkData(ALPASS_AUDIOBASS); - + float audioIntensity = AudioLinkData(ALPASS_AUDIOBASS).r * (_VertexGlitchingAudioLinkBand == 0) + AudioLinkData(ALPASS_AUDIOLOWMIDS).r * (_VertexGlitchingAudioLinkBand == 1) + AudioLinkData(ALPASS_AUDIOHIGHMIDS).r * (_VertexGlitchingAudioLinkBand == 2) + AudioLinkData(ALPASS_AUDIOTREBLE).r * (_VertexGlitchingAudioLinkBand == 3) + AudioLinkData(ALPASS_FILTEREDVU_INTENSITY).r * (_VertexGlitchingAudioLinkBand == 4); - + if(_VertexGlitchingAudiolinkOverride) { glitchOffset = glitchAmount * glitchDirection * (_VertexGlitchStrength * .01) * audioIntensity; @@ -14820,22 +15013,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else glitchOffset = glitchAmount * glitchDirection * (_VertexGlitchStrength * .01) * step(_VertexGlitchThreshold, randomGlitch); #endif - + localOffset += glitchOffset; worldOffset += mul(unity_ObjectToWorld, glitchOffset); } #endif //endex - + o.localPos.rgb += localOffset; o.worldPos.rgb += worldOffset; - + //ifex _EnableDepthBulge==0 #if defined(POI_DEPTHBULGE) && (defined(POI_PASS_BASE) || defined(POI_PASS_ADD)) applyDepthBulgeFX(o); #endif //endex - + //ifex _BSSEnabled!=1 #ifdef POIBS_ENABLE //ifex _BSSBloomfog!=1 @@ -14846,9 +15039,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex #endif //endex - + o.pos = UnityObjectToClipPos(o.localPos); - + #ifdef POI_PASS_OUTLINE #if defined(UNITY_REVERSED_Z) //DX @@ -14859,7 +15052,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //o.grabPos = ComputeGrabScreenPos(o.pos); - + #ifndef FORWARD_META_PASS #if !defined(UNITY_PASS_SHADOWCASTER) UNITY_TRANSFER_SHADOW(o, o.uv[0].xy); @@ -14868,9 +15061,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" TRANSFER_SHADOW_CASTER_NOPOS(o, o.pos); #endif #endif - + UNITY_TRANSFER_FOG(o, o.pos); - + if (_RenderingReduceClipDistance) { if (o.pos.w < _ProjectionParams.y * 1.01 && o.pos.w > 0) @@ -14882,14 +15075,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif } } - + #ifdef POI_PASS_META o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST); #endif - + return o; } - + #if defined(_STOCHASTICMODE_DELIOT_HEITZ) #define POI2D_SAMPLER_STOCHASTIC(tex, texSampler, uv, useStochastic) (useStochastic ? DeliotHeitzSampleTexture(tex, sampler##texSampler, uv) : POI2D_SAMPLER(tex, texSampler, uv)) #define POI2D_SAMPLER_PAN_STOCHASTIC(tex, texSampler, uv, pan, useStochastic) (useStochastic ? DeliotHeitzSampleTexture(tex, sampler##texSampler, POI_PAN_UV(uv, pan)) : POI2D_SAMPLER_PAN(tex, texSampler, uv, pan)) @@ -14900,7 +15093,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define POI2D_SAMPLER_PAN_STOCHASTIC(tex, texSampler, uv, pan, useStochastic) (useStochastic ? HextileSampleTexture(tex, sampler##texSampler, POI_PAN_UV(uv, pan), false) : POI2D_SAMPLER_PAN(tex, texSampler, uv, pan)) #define POI2D_SAMPLER_PANGRAD_STOCHASTIC(tex, texSampler, uv, pan, dx, dy, useStochastic) (useStochastic ? HextileSampleTexture(tex, sampler##texSampler, POI_PAN_UV(uv, pan), false, dx, dy) : POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, dx, dy)) #endif - + #ifndef POI2D_SAMPLER_STOCHASTIC #define POI2D_SAMPLER_STOCHASTIC(tex, texSampler, uv, useStochastic) (POI2D_SAMPLER(tex, texSampler, uv)) #endif @@ -14910,17 +15103,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #ifndef POI2D_SAMPLER_PANGRAD_STOCHASTIC #define POI2D_SAMPLER_PANGRAD_STOCHASTIC(tex, texSampler, uv, pan, dx, dy, useStochastic) (POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, dx, dy)) #endif - + // When using, properties won't properly lock at optimize time; needs macro evaluation implemented // #define POI2D_SAMPLER_STOCHASTIC_INLINED(tex, texSampler) (POI2D_SAMPLER_STOCHASTIC(tex, texSampler, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Stochastic)) // #define POI2D_SAMPLER_PAN_STOCHASTIC_INLINED(tex, texSampler) (POI2D_SAMPLER_PAN_STOCHASTIC(tex, texSampler, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Pan, tex##Stochastic)) - + // #define POI2D_MAINTEX_SAMPLER_STOCHASTIC_INLINED(tex) (POI2D_SAMPLER_STOCHASTIC(tex, _MainTex, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Stochastic)) // #define POI2D_MAINTEX_SAMPLER_PAN_STOCHASTIC_INLINED(tex) (POI2D_SAMPLER_PAN_STOCHASTIC(tex, _MainTex, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Pan, tex##Stochastic)) - + // Deliot, Heitz 2019 - Fast, but non-histogram-preserving (ends up looking a bit blurry and lower contrast) // https://eheitzresearch.wordpress.com/738-2/ - + // Classic Magic Numbers fracsin #if !defined(_STOCHASTICMODE_NONE) float2 StochasticHash2D2D (float2 s) @@ -14928,7 +15121,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return frac(sin(glsl_mod(float2(dot(s, float2(127.1,311.7)), dot(s, float2(269.5,183.3))), 3.14159)) * 43758.5453); } #endif - + #if defined(_STOCHASTICMODE_DELIOT_HEITZ) // UV Offsets and blend weights // UVBW[0...2].xy = UV Offsets @@ -14938,46 +15131,46 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // UV transformed into triangular grid space with UV scaled by approximation of 2*sqrt(3) const float2x2 stochasticSkewedGrid = float2x2(1.0, -0.57735027, 0.0, 1.15470054); float2 skewUV = mul(stochasticSkewedGrid, uv * 3.4641 * _StochasticDeliotHeitzDensity); - + // Vertex IDs and barycentric coords float2 vxID = floor(skewUV); float3 bary = float3(frac(skewUV), 0); bary.z = 1.0 - bary.x - bary.y; - + float3x3 pos = float3x3( float3(vxID, bary.z), float3(vxID + float2(0, 1), bary.y), float3(vxID + float2(1, 0), bary.x) ); - + float3x3 neg = float3x3( float3(vxID + float2(1, 1), -bary.z), float3(vxID + float2(1, 0), 1.0 - bary.y), float3(vxID + float2(0, 1), 1.0 - bary.x) ); - + return (bary.z > 0) ? pos : neg; } - + float4 DeliotHeitzSampleTexture(Texture2D tex, SamplerState texSampler, float2 uv, float2 dx, float2 dy) { // UVBW[0...2].xy = UV Offsets // UVBW[0...2].z = Blend Weights float3x3 UVBW = DeliotHeitzStochasticUVBW(uv); - + //blend samples with calculated weights return mul(tex.SampleGrad(texSampler, uv + StochasticHash2D2D(UVBW[0].xy), dx, dy), UVBW[0].z) + mul(tex.SampleGrad(texSampler, uv + StochasticHash2D2D(UVBW[1].xy), dx, dy), UVBW[1].z) + mul(tex.SampleGrad(texSampler, uv + StochasticHash2D2D(UVBW[2].xy), dx, dy), UVBW[2].z) ; } - + float4 DeliotHeitzSampleTexture(Texture2D tex, SamplerState texSampler, float2 uv) { float2 dx = ddx(uv), dy = ddy(uv); return DeliotHeitzSampleTexture(tex, texSampler, uv, dx, dy); } #endif // defined(_STOCHASTICMODE_DELIOT_HEITZ) - + #if defined(_STOCHASTICMODE_HEXTILE) // HexTiling: Slower, but histogram-preserving // SPDX-License-Idenfitier: MIT @@ -14989,22 +15182,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" const float2x2 stochasticInverseSkewedGrid = float2x2(1.0, 0.5, 0.0, 1.0/1.15470054); return mul(stochasticInverseSkewedGrid, vertex) * 0.288675; } - + float2x2 HextileLoadRot2x2(float2 idx, float rotStrength) { float angle = abs(idx.x * idx.y) + abs(idx.x + idx.y) + PI; - + // remap to +/-pi angle = glsl_mod(angle, 2 * PI); if(angle < 0) angle += 2 * PI; if(angle > PI) angle -= 2 * PI; - + angle *= rotStrength; - + float cs = cos(angle), si = sin(angle); return float2x2(cs, -si, si, cs); } - + // UV Offsets and base blend weights // UVBWR[0...2].xy = UV Offsets // UVBWR[0...2].zw = rotation costh/sinth -> reconstruct rotation matrix with float2x2(UVBWR[n].z, -UVBWR[n].w, UVBWR[n].w, UVBWR[n].z) @@ -15015,30 +15208,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // Skew input space into simplex triangle grid (3.4641 ~= 2*sqrt(3)) const float2x2 stochasticSkewedGrid = float2x2(1.0, -0.57735027, 0.0, 1.15470054); float2 skewedCoord = mul(stochasticSkewedGrid, uv * 3.4641 * _StochasticHexGridDensity); - + float2 baseId = float2(floor(skewedCoord)); float3 temp = float3(frac(skewedCoord), 0); temp.z = 1 - temp.x - temp.y; - + float s = step(0.0, -temp.z); float s2 = 2 * s - 1; - + float3 weights = float3(-temp.z * s2, s - temp.y * s2, s - temp.x * s2); - + float2 vertex0 = baseId + float2(s, s); float2 vertex1 = baseId + float2(s, 1 - s); float2 vertex2 = baseId + float2(1 - s, s); - + float2 cen0 = HextileMakeCenUV(vertex0), cen1 = HextileMakeCenUV(vertex1), cen2 = HextileMakeCenUV(vertex2); float2x2 rot0 = float2x2(1, 0, 0, 1), rot1 = float2x2(1, 0, 0, 1), rot2 = float2x2(1, 0, 0, 1); - + if(_StochasticHexRotationStrength > 0) { rot0 = HextileLoadRot2x2(vertex0, _StochasticHexRotationStrength); rot1 = HextileLoadRot2x2(vertex1, _StochasticHexRotationStrength); rot2 = HextileLoadRot2x2(vertex2, _StochasticHexRotationStrength); } - + return float4x4( float4(mul(uv - cen0, rot0) + cen0 + StochasticHash2D2D(vertex0), rot0[0].x, -rot0[0].y), float4(mul(uv - cen1, rot1) + cen1 + StochasticHash2D2D(vertex1), rot1[0].x, -rot1[0].y), @@ -15046,68 +15239,68 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4(weights, 0) ); } - + float4 HextileSampleTexture(Texture2D tex, SamplerState texSampler, float2 uv, bool isNormalMap, float2 dUVdx, float2 dUVdy) { // For some reason doing this instead of just calculating it directly prevents it from \ // breaking after a certain number of textures use it. I don't understand why yet float4x4 UVBWR = HextileUVBWR(uv); - + // 2D Rotation Matrices for dUVdx/dy // Not sure if this constant folds during compiling when rot is locked at 0, so force it float2x2 rot0 = float2x2(1, 0, 0, 1), rot1 = float2x2(1, 0, 0, 1), rot2 = float2x2(1, 0, 0, 1); - + if(_StochasticHexRotationStrength > 0) { rot0 = float2x2(UVBWR[0].z, -UVBWR[0].w, UVBWR[0].w, UVBWR[0].z); rot1 = float2x2(UVBWR[1].z, -UVBWR[1].w, UVBWR[1].w, UVBWR[1].z); rot2 = float2x2(UVBWR[2].z, -UVBWR[2].w, UVBWR[2].w, UVBWR[2].z); } - + // Weights float3 W = UVBWR[3].xyz; - + // Sample texture // float3x4 c = float3x4( // tex.SampleGrad(texSampler, UVBWR[0].xy, mul(dUVdx, rot0), mul(dUVdy, rot0)), // tex.SampleGrad(texSampler, UVBWR[1].xy, mul(dUVdx, rot1), mul(dUVdy, rot1)), // tex.SampleGrad(texSampler, UVBWR[2].xy, mul(dUVdx, rot2), mul(dUVdy, rot2)) // ); - + float4 c0 = tex.SampleGrad(texSampler, UVBWR[0].xy, mul(dUVdx, rot0), mul(dUVdy, rot0)); float4 c1 = tex.SampleGrad(texSampler, UVBWR[1].xy, mul(dUVdx, rot1), mul(dUVdy, rot1)); float4 c2 = tex.SampleGrad(texSampler, UVBWR[2].xy, mul(dUVdx, rot2), mul(dUVdy, rot2)); - + // Blend samples using luminance // This is technically incorrect for normal maps, but produces very similar // results to blending using normal map gradients (steepness) const float3 Lw = float3(0.299, 0.587, 0.114); float3 Dw = float3(dot(c0.xyz, Lw), dot(c1.xyz, Lw), dot(c2.xyz, Lw)); - + Dw = lerp(1.0, Dw, _StochasticHexFallOffContrast); W = Dw * pow(W, _StochasticHexFallOffPower); // In the original hextiling there's a Gain3 step here, but it seems to slow things down \ // and cause the UVs to break, so I've omitted it. Looks fine without - + W /= (W.x + W.y + W.z); return W.x * c0 + W.y * c1 + W.z * c2; } - + float4 HextileSampleTexture(Texture2D tex, SamplerState texSampler, float2 uv, bool isNormalMap) { return HextileSampleTexture(tex, texSampler, uv, isNormalMap, ddx(uv), ddy(uv)); } #endif // defined(_STOCHASTICMODE_HEXTILE) - + void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods) { poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod); - + if (_AlphaGlobalMask > 0) { poiFragData.alpha = maskBlend(poiFragData.alpha, poiMods.globalMask[_AlphaGlobalMask - 1], _AlphaGlobalMaskBlendType); } - + //ifex _AlphaDistanceFade==0 && isNotAnimated(_AlphaDistanceFade) if (_AlphaDistanceFade) { @@ -15120,7 +15313,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.alpha *= distanceFadeMultiplier; } //endex - + //ifex _AlphaFresnel==0 && isNotAnimated(_AlphaFresnel) if (_AlphaFresnel) { @@ -15134,7 +15327,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.alpha *= holoRim; } //endex - + //ifex _AlphaAngular==0 && isNotAnimated(_AlphaAngular) if (_AlphaAngular) { @@ -15167,7 +15360,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.alpha *= angularAlphaMod; } //endex - + //ifex _AlphaAudioLinkEnabled==0 && isNotAnimated(_AlphaAudioLinkEnabled) #ifdef POI_AUDIOLINK if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled) @@ -15176,9 +15369,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + } - + //ifex _AlphaDithering==0 && isNotAnimated(_AlphaDithering) inline half Dither8x8Bayer(int x, int y) { @@ -15196,12 +15389,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int r = y * 8 + x; return dither[r]; } - + half calcDither(half2 grabPos) { return Dither8x8Bayer(glsl_mod(grabPos.x, 8), glsl_mod(grabPos.y, 8)); } - + void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam) { if (_AlphaDithering) @@ -15211,7 +15404,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } //endex - + //ifex _AlphaToCoverage==0 && isNotAnimated(_AlphaToCoverage) void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh) { @@ -15231,24 +15424,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } //endex - + void calculateGlobalThemes(inout PoiMods poiMods) { // Theme colors are defined as HDR; convert to SDR and do the HSV adjustment, then re-apply exposure float4 themeColorExposures = 0; float4 themeColor0, themeColor1, themeColor2, themeColor3 = 0; - + DecomposeHDRColor(_GlobalThemeColor0.rgb, themeColor0.rgb, themeColorExposures.x); DecomposeHDRColor(_GlobalThemeColor1.rgb, themeColor1.rgb, themeColorExposures.y); DecomposeHDRColor(_GlobalThemeColor2.rgb, themeColor2.rgb, themeColorExposures.z); DecomposeHDRColor(_GlobalThemeColor3.rgb, themeColor3.rgb, themeColorExposures.w); - + poiMods.globalColorTheme[0] = float4(ApplyHDRExposure(ModifyViaHSV(themeColor0.rgb, frac(_GlobalThemeHue0 + _GlobalThemeHueSpeed0 * _Time.x), _GlobalThemeSaturation0, _GlobalThemeValue0), themeColorExposures.x), _GlobalThemeColor0.a); poiMods.globalColorTheme[1] = float4(ApplyHDRExposure(ModifyViaHSV(themeColor1.rgb, frac(_GlobalThemeHue1 + _GlobalThemeHueSpeed1 * _Time.x), _GlobalThemeSaturation1, _GlobalThemeValue1), themeColorExposures.y), _GlobalThemeColor1.a); poiMods.globalColorTheme[2] = float4(ApplyHDRExposure(ModifyViaHSV(themeColor2.rgb, frac(_GlobalThemeHue2 + _GlobalThemeHueSpeed2 * _Time.x), _GlobalThemeSaturation2, _GlobalThemeValue2), themeColorExposures.z), _GlobalThemeColor2.a); poiMods.globalColorTheme[3] = float4(ApplyHDRExposure(ModifyViaHSV(themeColor3.rgb, frac(_GlobalThemeHue3 + _GlobalThemeHueSpeed3 * _Time.x), _GlobalThemeSaturation3, _GlobalThemeValue3), themeColorExposures.w), _GlobalThemeColor3.a); } - + //ifex _GlobalMaskTexturesEnable==0 #ifdef POI_GLOBALMASK_TEXTURES void ApplyGlobalMaskTextures(in PoiMesh poiMesh, inout PoiMods poiMods) @@ -15270,7 +15463,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[3] = gmcol0[3]; } #endif - + #if defined(PROP_GLOBALMASKTEXTURE1) || !defined(OPTIMIZER_ENABLED) float4 gmcol1 = POI2D_SAMPLER_PAN(_GlobalMaskTexture1, _MainTex, poiUV(poiMesh.uv[_GlobalMaskTexture1UV], _GlobalMaskTexture1_ST), _GlobalMaskTexture1Pan); if (_GlobalMaskTexture1Split) @@ -15288,7 +15481,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[7] = gmcol1[3]; } #endif - + #if defined(PROP_GLOBALMASKTEXTURE2) || !defined(OPTIMIZER_ENABLED) float4 gmcol2 = POI2D_SAMPLER_PAN(_GlobalMaskTexture2, _MainTex, poiUV(poiMesh.uv[_GlobalMaskTexture2UV], _GlobalMaskTexture2_ST), _GlobalMaskTexture2Pan); if (_GlobalMaskTexture2Split) @@ -15306,7 +15499,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[11] = gmcol2[3]; } #endif - + #if defined(PROP_GLOBALMASKTEXTURE3) || !defined(OPTIMIZER_ENABLED) float4 gmcol3 = POI2D_SAMPLER_PAN(_GlobalMaskTexture3, _MainTex, poiUV(poiMesh.uv[_GlobalMaskTexture3UV], _GlobalMaskTexture3_ST), _GlobalMaskTexture3Pan); if (_GlobalMaskTexture3Split) @@ -15391,7 +15584,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (_GlobalMaskToggleOn_13) poiMods.globalMask[13] = 1; if (_GlobalMaskToggleOn_14) poiMods.globalMask[14] = 1; if (_GlobalMaskToggleOn_15) poiMods.globalMask[15] = 1; - + poiMods.globalMask[0] *= (1 - _GlobalMaskToggleOff_0); poiMods.globalMask[1] *= (1 - _GlobalMaskToggleOff_1); poiMods.globalMask[2] *= (1 - _GlobalMaskToggleOff_2); @@ -15410,10 +15603,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[15] *= (1 - _GlobalMaskToggleOff_15); } //endex - + } //endex - + float customDistanceBlend(float base, float blend, float blendType) { switch(blendType) @@ -15423,7 +15616,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" default: return 0; break; } } - + void handleGlobalMaskDistance(int index, bool enable, bool type, float minAlpha, float maxAlpha, float min, float max, int blendType, in PoiMesh poiMesh, inout PoiMods poiMods) { if (enable) @@ -15433,7 +15626,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[index] = saturate(customDistanceBlend(poiMods.globalMask[index], val, blendType)); } } - + void ApplyGlobalMaskModifiers(in PoiMesh poiMesh, inout PoiMods poiMods, in PoiCam poiCam) { //ifex _GlobalMaskModifiersBackfaceEnable==0 @@ -15459,7 +15652,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[15] *= _GlobalMaskBackface_15 == 0 ? 1 : (facingMode == (_GlobalMaskBackface_15)); } //endex - + //ifex _GlobalMaskModifiersMirrorEnable==0 if (_GlobalMaskModifiersMirrorEnable) { @@ -15468,7 +15661,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" mirrorMode = VRCMirrorMode() > 0; else // Generic (CVR, etc) mirrorMode = IsInMirror(); - + mirrorMode += 1; // _GlobalMaskMirror is 0 for ignore, 1 for outside mirror only, 2 for in mirror only poiMods.globalMask[0] *= _GlobalMaskMirror_0 == 0 ? 1 : (mirrorMode == (_GlobalMaskMirror_0)); @@ -15489,7 +15682,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[15] *= _GlobalMaskMirror_15 == 0 ? 1 : (mirrorMode == (_GlobalMaskMirror_15)); } //endex - + //ifex _GlobalMaskModifiersCameraEnable==0 if (_GlobalMaskModifiersCameraEnable) { @@ -15565,12 +15758,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _GlobalMaskDistanceEnable_15==0 handleGlobalMaskDistance(15, _GlobalMaskDistanceEnable_15, _GlobalMaskDistanceType_15, _GlobalMaskDistanceMinAlpha_15, _GlobalMaskDistanceMaxAlpha_15, _GlobalMaskDistanceMin_15, _GlobalMaskDistanceMax_15, _GlobalMaskDistanceBlendType_15, poiMesh, poiMods); //endex - + } //endex - + } - + //ifex _GlobalMaskVertexColorRed==0 && _GlobalMaskVertexColorGreen==0 && _GlobalMaskVertexColorBlue==0 && _GlobalMaskVertexColorAlpha==0 void ApplyGlobalMaskVertexColors(in PoiMesh poiMesh, inout PoiMods poiMods) { @@ -15597,7 +15790,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } //endex - + //ifex _EnableUDIMDiscardOptions==0 #ifdef POI_UDIMDISCARD void applyUDIMDiscard(in VertexOut i) @@ -15605,29 +15798,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if(_UDIMDiscardMode == 1) // Don't run if in vertex mode { float2 udim = floor(vertexUV(i, _UDIMDiscardUV)); - + float isDiscarded = 0; float4 xMask = float4( (udim.x >= 0 && udim.x < 1), (udim.x >= 1 && udim.x < 2), (udim.x >= 2 && udim.x < 3), (udim.x >= 3 && udim.x < 4)); - + isDiscarded += (udim.y >= 0 && udim.y < 1) * dot(float4(_UDIMDiscardRow0_0, _UDIMDiscardRow0_1, _UDIMDiscardRow0_2, _UDIMDiscardRow0_3), xMask); isDiscarded += (udim.y >= 1 && udim.y < 2) * dot(float4(_UDIMDiscardRow1_0, _UDIMDiscardRow1_1, _UDIMDiscardRow1_2, _UDIMDiscardRow1_3), xMask); isDiscarded += (udim.y >= 2 && udim.y < 3) * dot(float4(_UDIMDiscardRow2_0, _UDIMDiscardRow2_1, _UDIMDiscardRow2_2, _UDIMDiscardRow2_3), xMask); isDiscarded += (udim.y >= 3 && udim.y < 4) * dot(float4(_UDIMDiscardRow3_0, _UDIMDiscardRow3_1, _UDIMDiscardRow3_2, _UDIMDiscardRow3_3), xMask); - + isDiscarded *= any(float4(udim.y >= 0, udim.y < 4, udim.x >= 0, udim.x < 4)); // never discard outside 4x4 grid in pos coords - + const float threshold = 0.001; clip(threshold - isDiscarded); // Clip if discarded } - + return; } #endif //endex - + float2 calculatePolarCoordinate(in PoiMesh poiMesh) { float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter; @@ -15637,10 +15830,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float phi_frac = frac(phi); angle = fwidth(phi) - 0.0001 < fwidth(phi_frac) ? phi : phi_frac; angle *= _PolarLengthScale; - + return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower); } - + float2 MonoPanoProjection(float3 coords) { float3 normalizedCoords = normalize(coords); @@ -15654,7 +15847,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" sphereCoords = float2(1.0, 1.0) - sphereCoords; return (sphereCoords + float4(0, 1 - unity_StereoEyeIndex, 1, 1.0).xy) * float4(0, 1 - unity_StereoEyeIndex, 1, 1.0).zw; } - + float2 StereoPanoProjection(float3 coords) { float3 normalizedCoords = normalize(coords); @@ -15668,12 +15861,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" sphereCoords = float2(0.5, 1.0) - sphereCoords; return (sphereCoords + float4(0, 1 - unity_StereoEyeIndex, 1, 0.5).xy) * float4(0, 1 - unity_StereoEyeIndex, 1, 0.5).zw; } - + float2 calculateWorldUV(in PoiMesh poiMesh) { return float2(_UVModWorldPos0 != 3 ? poiMesh.worldPos[ _UVModWorldPos0] : 0.0f, _UVModWorldPos1 != 3 ? poiMesh.worldPos[_UVModWorldPos1] : 0.0f); } - + float2 calculatelocalUV(in PoiMesh poiMesh) { float localUVs[8]; @@ -15685,10 +15878,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" localUVs[5] = poiMesh.vertexColor.g; localUVs[6] = poiMesh.vertexColor.b; localUVs[7] = poiMesh.vertexColor.a; - + return float2(localUVs[_UVModLocalPos0],localUVs[_UVModLocalPos1]); } - + float2 calculatePanosphereUV(in PoiMesh poiMesh) { float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1; @@ -15703,22 +15896,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float4 flowVector = -1; #endif - + #if defined(PROP_DISTORTIONFLOWTEXTURE1) || !defined(OPTIMIZER_ENABLED) float4 flowVector1 = POI2D_SAMPLER_PAN(_DistortionFlowTexture1, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTexture1UV], _DistortionFlowTexture1_ST), _DistortionFlowTexture1Pan) * 2 - 1; #else float4 flowVector1 = -1; #endif - + #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED) half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan)[_DistortionMaskChannel]; #else half distortionMask = 1; #endif - + half distortionStrength = _DistortionStrength; half distortionStrength1 = _DistortionStrength1; - + #ifdef POI_AUDIOLINK UNITY_BRANCH if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle) @@ -15727,14 +15920,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" distortionStrength1 += lerp(_DistortionStrength1AudioLink.x, _DistortionStrength1AudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrength1AudioLinkBand))).r); } #endif - + flowVector *= distortionStrength; flowVector1 *= distortionStrength1; return poiMesh.uv[_DistortionUvToDistort] + ((flowVector.xy + flowVector1.xy) / 2) * distortionMask; } #endif //endex - + //ifex _PoiParallax==0 #ifdef POI_PARALLAX inline float2 POM(in PoiLight poiLight, sampler2D heightMap, in PoiMesh poiMesh, float3 worldViewDir, float3 viewDirTan, int minSamples, int maxSamples, float parallax, float refPlane, float2 tilling, float2 curv) @@ -15748,7 +15941,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float heightMask = 1; #endif - + float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST); float2 dx = ddx(uvs); float2 dy = ddy(uvs); @@ -15822,7 +16015,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #ifdef UNITY_PASS_SHADOWCASTER } #endif - + return uvs + finalTexOffset; } /* @@ -15835,7 +16028,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 uvDelta = tangentViewDir.xy * (stepSize * strength); float prevStepHeight = stepHeight; float prevSurfaceHeight = surfaceHeight; - + [unroll(20)] for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++) { @@ -15846,13 +16039,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" stepHeight -= stepSize; surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset; } - + [unroll(3)] for (int k = 0; k < 3; k++) { uvDelta *= 0.5; stepSize *= 0.5; - + if (stepHeight < surfaceHeight) { uvOffset += uvDelta; @@ -15893,7 +16086,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (_ParallaxUV == 7) poiMesh.uv[7] += offset; #endif */ - + #if defined(OPTIMIZER_ENABLED) poiMesh.uv[_ParallaxUV] = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV)); #else @@ -15910,7 +16103,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _BlackLightMaskingEnabled==0 #ifdef POI_BLACKLIGHTMASKING void calculateBlackLightMasks(in PoiMesh poiMesh, inout PoiMods poiMods) @@ -15928,7 +16121,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" applyToGlobalMask(poiMods, _BlackLightMasking0GlobalMaskIndex - 1, _BlackLightMasking0GlobalMaskBlendType, smoothstep(_BlackLightMasking0Range.y, _BlackLightMasking0Range.x, distance(poiMesh.worldPos, lightPos))); } } - + if (_BlackLightMasking1GlobalMaskIndex > 0) { if (unity_LightColor[lightIndex].a == _BlackLightMasking1Key) @@ -15936,7 +16129,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" applyToGlobalMask(poiMods, _BlackLightMasking1GlobalMaskIndex - 1, _BlackLightMasking1GlobalMaskBlendType, smoothstep(_BlackLightMasking1Range.y, _BlackLightMasking1Range.x, distance(poiMesh.worldPos, lightPos))); } } - + if (_BlackLightMasking2GlobalMaskIndex > 0) { if (unity_LightColor[lightIndex].a == _BlackLightMasking2Key) @@ -15944,7 +16137,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" applyToGlobalMask(poiMods, _BlackLightMasking2GlobalMaskIndex - 1, _BlackLightMasking2GlobalMaskBlendType, smoothstep(_BlackLightMasking0Range.y, _BlackLightMasking0Range.x, distance(poiMesh.worldPos, lightPos))); } } - + if (_BlackLightMasking3GlobalMaskIndex > 0) { if (unity_LightColor[lightIndex].a == _BlackLightMasking3Key) @@ -15959,17 +16152,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { applyToGlobalMask(poiMods, _BlackLightMasking0GlobalMaskIndex - 1, _BlackLightMasking0GlobalMaskBlendType, 0); } - + if (_BlackLightMasking1GlobalMaskIndex > 0) { applyToGlobalMask(poiMods, _BlackLightMasking1GlobalMaskIndex - 1, _BlackLightMasking1GlobalMaskBlendType, 0); } - + if (_BlackLightMasking2GlobalMaskIndex > 0) { applyToGlobalMask(poiMods, _BlackLightMasking2GlobalMaskIndex - 1, _BlackLightMasking2GlobalMaskBlendType, 0); } - + if (_BlackLightMasking3GlobalMaskIndex > 0) { applyToGlobalMask(poiMods, _BlackLightMasking3GlobalMaskIndex - 1, _BlackLightMasking3GlobalMaskBlendType, 0); @@ -15978,7 +16171,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _DetailEnabled==0 #ifdef FINALPASS void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) @@ -15988,10 +16181,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else half3 detailTexture = 0.21763764082 * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex); #endif - + poiFragData.baseColor.rgb *= LerpWhiteTo(detailTexture * _DetailBrightness * unity_ColorSpaceDouble.rgb, poiMods.detailMask.r * _DetailTexIntensity); } - + void ApplyDetailNormal(inout PoiMods poiMods, inout PoiMesh poiMesh) { #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED) @@ -15999,14 +16192,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else poiMods.detailMask = 1; #endif - + #ifdef POI_BACKFACE if (!poiMesh.isFrontFace) { poiMods.detailMask.rg *= _BackFaceDetailIntensity; } #endif - + if (_DetailTexGlobalMask > 0) { poiMods.detailMask.r = maskBlend(poiMods.detailMask.r, poiMods.globalMask[_DetailTexGlobalMask-1], _DetailTexGlobalMaskBlendType); @@ -16015,7 +16208,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { poiMods.detailMask.g = maskBlend(poiMods.detailMask.g, poiMods.globalMask[_DetailNormalGlobalMask-1], _DetailNormalGlobalMaskBlendType); } - + #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED) half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN_STOCHASTIC(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan, _DetailNormalMapStochastic), _DetailNormalMapScale * poiMods.detailMask.g); poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal); @@ -16023,7 +16216,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _MainVertexColoringEnabled==0 void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh) { @@ -16037,7 +16230,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } //endex - + //ifex _BackFaceEnabled!=1 #ifdef POI_BACKFACE void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods) @@ -16049,8 +16242,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #if defined(PROP_BACKFACETEXTURE) || !defined(OPTIMIZER_ENABLED) backFaceColor *= POI2D_SAMPLER_PAN(_BackFaceTexture, _MainTex, poiUV(poiMesh.uv[_BackFaceTextureUV], _BackFaceTexture_ST), _BackFaceTexturePan); #endif - backFaceColor.rgb = hueShift(backFaceColor.rgb, frac(_BackFaceHueShift + _BackFaceHueShiftSpeed * _Time.x) * _BackFaceHueShiftEnabled); - + + if (_BackFaceHueShiftEnabled) + { + backFaceColor.rgb = hueShift(backFaceColor.rgb, frac(_BackFaceHueShift + _BackFaceHueShiftSpeed * _Time.x), _BackFaceShiftColorSpace); + } + float backFaceMask = 1; #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED) backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan)[_BackFaceMaskChannel]; @@ -16059,24 +16256,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { backFaceMask *= backFaceColor.a; } - + poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask); - + UNITY_BRANCH if (_BackFaceReplaceAlpha) { poiFragData.alpha = backFaceColor.a; } - + poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask; poiMods.globalEmission = poiMods.globalEmission * _BackFaceEmissionLimiter; } } #endif //endex - + //ifex _RGBMaskEnabled==0 - + void RGBABlendColor(inout PoiFragData poiFragData, in float mask, in float4 color, float emissionStrength, in float blendType, in float blendAdd, in float enabled) { if (!enabled) return; @@ -16084,7 +16281,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, color.rgb, blendType), alpha); poiFragData.emission += color.rgb * emissionStrength * alpha; } - + void RGBABlendNormals(inout float3 tangentSpaceNormal, float3 normalToBlendWith, float maskValue, int blendMode) { if (blendMode == 0) @@ -16096,7 +16293,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" tangentSpaceNormal = BlendNormals(tangentSpaceNormal, normalToBlendWith); } } - + #ifdef VIGNETTE #if !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE) void calculateRGBNormals(inout PoiMesh poiMesh, inout PoiMods poiMods) @@ -16104,30 +16301,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // Only define this if we actually have any normal map textures. Can't do the same in color textures because users can tint #if defined(PROP_RGBNORMALR) || defined(PROP_RGBNORMALG) || defined(PROP_RGBNORMALB) || defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED) float4 rgbMask = 1; - + #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED) if (_RGBMaskType == 0) { rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _trilinear_repeat, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan); } #endif - + if (_RGBMaskType == 1) { rgbMask = poiMesh.vertexColor; } - + float4 maskFinal = 1; maskFinal.r = rgbMask[_RgbNormalRMaskChannel]; maskFinal.g = rgbMask[_RgbNormalGMaskChannel]; maskFinal.b = rgbMask[_RgbNormalBMaskChannel]; maskFinal.a = rgbMask[_RgbNormalAMaskChannel]; - + if (_RgbNormalRGlobalMaskChannel > 0) maskFinal.r = customBlend(maskFinal.r, poiMods.globalMask[_RgbNormalRGlobalMaskChannel - 1], _RgbNormalRGlobalMaskBlendType); if (_RgbNormalGGlobalMaskChannel > 0) maskFinal.g = customBlend(maskFinal.g, poiMods.globalMask[_RgbNormalGGlobalMaskChannel - 1], _RgbNormalGGlobalMaskBlendType); if (_RgbNormalBGlobalMaskChannel > 0) maskFinal.b = customBlend(maskFinal.b, poiMods.globalMask[_RgbNormalBGlobalMaskChannel - 1], _RgbNormalBGlobalMaskBlendType); if (_RgbNormalAGlobalMaskChannel > 0) maskFinal.a = customBlend(maskFinal.a, poiMods.globalMask[_RgbNormalAGlobalMaskChannel - 1], _RgbNormalAGlobalMaskBlendType); - + #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED) if (_RgbNormalRScale > 0 && _RGBARedEnable) { @@ -16159,7 +16356,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif } #endif - + void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) { float4 rgbMask = float4(1, 1, 1, 1); @@ -16167,19 +16364,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 green = float4(poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), _GreenColor.a); float4 blue = float4(poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), _BlueColor.a); float4 alpha = float4(poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), _AlphaColor.a); - + #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED) if (_RGBMaskType == 0) { rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _trilinear_repeat, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan); } #endif - + if (_RGBMaskType == 1) { rgbMask = poiMesh.vertexColor; } - + #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED) red *= POI2D_SAMPLER_PAN_STOCHASTIC(_RedTexture, _trilinear_repeat, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan.xy, _RedTextureStochastic); #endif @@ -16192,12 +16389,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED) alpha *= POI2D_SAMPLER_PAN_STOCHASTIC(_AlphaTexture, _trilinear_repeat, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan.xy, _AlphaTextureStochastic); #endif - + RGBABlendColor(poiFragData, globalMaskBlend(rgbMask[_RgbRedMaskChannel], _RgbRedGlobalMaskChannel, _RgbRedGlobalMaskBlendType, poiMods), red, _RGBARedEmissionStrength, _RGBARedBlendType, _RedAlphaAdd, _RGBARedEnable); RGBABlendColor(poiFragData, globalMaskBlend(rgbMask[_RgbGreenMaskChannel], _RgbGreenGlobalMaskChannel, _RgbGreenGlobalMaskBlendType, poiMods), green, _RGBAGreenEmissionStrength, _RGBAGreenBlendType, _GreenAlphaAdd, _RGBAGreenEnable); RGBABlendColor(poiFragData, globalMaskBlend(rgbMask[_RgbBlueMaskChannel], _RgbBlueGlobalMaskChannel, _RgbBlueGlobalMaskBlendType, poiMods), blue, _RGBABlueEmissionStrength, _RGBABlueBlendType, _BlueAlphaAdd, _RGBABlueEnable); RGBABlendColor(poiFragData, globalMaskBlend(rgbMask[_RgbAlphaMaskChannel], _RgbAlphaGlobalMaskChannel, _RgbAlphaGlobalMaskBlendType, poiMods), alpha, _RGBAAlphaEmissionStrength, _RGBAAlphaBlendType, _AlphaAlphaAdd, _RGBAAlphaEnable); - + if (_RGBAPBRRedEnabled || _RGBAPBRGreenEnabled || _RGBAPBRBlueEnabled || _RGBAPBRAlphaEnabled) { #if defined(PROP_RGBASMOOTHNESSMAPS) || !defined(OPTIMIZER_ENABLED) @@ -16206,7 +16403,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { smoothnessMaps = POI2D_SAMPLER_PAN_STOCHASTIC(_RGBASmoothnessMaps, _trilinear_repeat, poiUV(poiMesh.uv[_RGBASmoothnessMapsUV], _RGBASmoothnessMaps_ST), _RGBASmoothnessMapsPan.xy, _RGBASmoothnessMapsStochastic); } - + if (_RGBARedPBRSplitMaskSample && _RGBAPBRRedEnabled && _RGBARedEnable) { smoothnessMaps.r = POI2D_SAMPLER_PAN_STOCHASTIC(_RGBASmoothnessMaps, _trilinear_repeat, poiUV(poiMesh.uv[_RGBARedPBRUV], _RGBARedPBRMaskScaleTiling), _RGBARedPBRMasksPan.xy, _RGBARedPBRSplitMaskStochastic).r; @@ -16223,20 +16420,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { smoothnessMaps.a = POI2D_SAMPLER_PAN_STOCHASTIC(_RGBASmoothnessMaps, _trilinear_repeat, poiUV(poiMesh.uv[_RGBAAlphaPBRUV], _RGBAAlphaPBRMaskScaleTiling), _RGBAAlphaPBRMasksPan.xy, _RGBAAlphaPBRSplitMaskStochastic).a; } - + poiFragData.smoothness = lerp(poiFragData.smoothness, poiInvertToggle(smoothnessMaps.r, _RGBARedSmoothnessInvert), rgbMask[_RgbRedMaskChannel] * (_RGBAPBRRedEnabled && _RGBARedEnable)); poiFragData.smoothness = lerp(poiFragData.smoothness, poiInvertToggle(smoothnessMaps.g, _RGBAGreenSmoothnessInvert), rgbMask[_RgbGreenMaskChannel] * (_RGBAPBRGreenEnabled && _RGBAGreenEnable)); poiFragData.smoothness = lerp(poiFragData.smoothness, poiInvertToggle(smoothnessMaps.b, _RGBABlueSmoothnessInvert), rgbMask[_RgbBlueMaskChannel] * (_RGBAPBRBlueEnabled && _RGBABlueEnable)); poiFragData.smoothness = lerp(poiFragData.smoothness, poiInvertToggle(smoothnessMaps.a, _RGBAAlphaSmoothnessInvert), rgbMask[_RgbAlphaMaskChannel] * (_RGBAPBRAlphaEnabled && _RGBAAlphaEnable)); #endif - + #if defined(PROP_RGBAMETALLICMAPS) || !defined(OPTIMIZER_ENABLED) float4 metallicMaps = 1; if (!_RGBARedPBRSplitMaskSample || !_RGBAGreenPBRSplitMaskSample || !_RGBABluePBRSplitMaskSample || !_RGBAAlphaPBRSplitMaskSample) { metallicMaps = POI2D_SAMPLER_PAN_STOCHASTIC(_RGBAMetallicMaps, _trilinear_repeat, poiUV(poiMesh.uv[_RGBAMetallicMapsUV], _RGBAMetallicMaps_ST), _RGBAMetallicMapsPan.xy, _RGBAMetallicMapsStochastic); } - + if (_RGBARedPBRSplitMaskSample && _RGBAPBRRedEnabled && _RGBARedEnable) { metallicMaps.r = POI2D_SAMPLER_PAN_STOCHASTIC(_RGBAMetallicMaps, _trilinear_repeat, poiUV(poiMesh.uv[_RGBARedPBRUV], _RGBARedPBRMaskScaleTiling), _RGBARedPBRMasksPan.xy, _RGBARedPBRSplitMaskStochastic).r; @@ -16253,7 +16450,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { metallicMaps.a = POI2D_SAMPLER_PAN_STOCHASTIC(_RGBAMetallicMaps, _trilinear_repeat, poiUV(poiMesh.uv[_RGBAAlphaPBRUV], _RGBAAlphaPBRMaskScaleTiling), _RGBAAlphaPBRMasksPan.xy, _RGBAAlphaPBRSplitMaskStochastic).a; } - + poiFragData.metallic = lerp(poiFragData.metallic, poiInvertToggle(metallicMaps.r, _RGBARedMetallicInvert), rgbMask[_RgbRedMaskChannel] * (_RGBAPBRRedEnabled && _RGBARedEnable)); poiFragData.metallic = lerp(poiFragData.metallic, poiInvertToggle(metallicMaps.g, _RGBAGreenMetallicInvert), rgbMask[_RgbGreenMaskChannel] * (_RGBAPBRGreenEnabled && _RGBAGreenEnable)); poiFragData.metallic = lerp(poiFragData.metallic, poiInvertToggle(metallicMaps.b, _RGBABlueMetallicInvert), rgbMask[_RgbBlueMaskChannel] * (_RGBAPBRBlueEnabled && _RGBABlueEnable)); @@ -16263,7 +16460,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _LTCGIEnabled!=1 #ifdef POI_LTCGI // #include "../../ThirdParty/LTCGI/LTCGI_structs.cginc" @@ -16272,7 +16469,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define LTCGI_COLORMODE_TEXTURE 1 #define LTCGI_COLORMODE_SINGLEUV 2 #define LTCGI_COLORMODE_AUDIOLINK 3 - + struct ltcgi_flags { bool doublesided; // if the light is doublesided or only illuminates the front face @@ -16285,9 +16482,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" bool cylinder; // is this light a cylinder uint alBand; // audiolink band if colormode == LTCGI_COLORMODE_AUDIOLINK bool lmdOnly; // if this light is lightmap-diffuse _only_, that is, no LTC will be run (Lw will be all 0 in that case) - this will never be true on avatars (with LTCGI_ALWAYS_LTC_DIFFUSE) - + }; - + struct ltcgi_input { uint i; // light number @@ -16298,93 +16495,93 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 rawColor; // the raw light color, unaffected by any colormode calculations (i.e. exactly what's given as "color" in editor) float3 screenNormal; // world space normal direction of area light ltcgi_flags flags; // flags, see above - + }; - + struct ltcgi_output { ltcgi_input input; // input data that resulted in this output - + float intensity; // intensity output by LTC calculation float3 color; // color output by LTCGI colormode calculation - + }; // LTCGI_structs.cginc END - + struct accumulator_struct { float3 diffuse; float3 specular; }; - + void callback_diffuse(inout accumulator_struct acc, in ltcgi_output output); void callback_specular(inout accumulator_struct acc, in ltcgi_output output); - + #define LTCGI_V2_CUSTOM_INPUT accumulator_struct #define LTCGI_V2_DIFFUSE_CALLBACK callback_diffuse #define LTCGI_V2_SPECULAR_CALLBACK callback_specular - + // #include "../../ThirdParty/LTCGI/LTCGI.cginc" // LTCGI.cginc // #include "LTCGI_config.cginc" // LTCGI_config.cginc - + // Feel free to enable or disable (//) the options here. // They will apply to all LTCGI materials in the project. // Most of these can be changed in the LTCGI_Controller editor as well. - + /// No specular at all. //#define LTCGI_SPECULAR_OFF /// No diffuse at all. //#define LTCGI_DIFFUSE_OFF /// Disable the ability to toggle specular/diffuse on or off per screen. //#define LTCGI_TOGGLEABLE_SPEC_DIFF_OFF - + /// Only use LTC diffuse mode, never lightmapped diffuse. /// This disables lightmaps entirely. //#define LTCGI_ALWAYS_LTC_DIFFUSE - + /// Use bicubic filtering for LTCGI lightmap. Recommended on. #define LTCGI_BICUBIC_LIGHTMAP - + /// Lightmap values below this will be treated as black for specular/LTC diffuse. #define LTCGI_LIGHTMAP_CUTOFF 0.1 /// Lightmap values above this (plus cutoff) will be treated as white. #define LTCGI_SPECULAR_LIGHTMAP_STEP 0.3 - + /// Distance multiplier for calculating blur amount. /// Increase to make reflections blurrier faster as distance increases. #define LTCGI_UV_BLUR_DISTANCE 333 - + /// Fall back to LTC diffuse (from LM diffuse) on objects that are not marked static. #define LTCGI_LTC_DIFFUSE_FALLBACK - + /// Approximation to ignore diffuse light for far away /// lights, increase MULT or disable if you notice artifacting #define LTCGI_DISTANCE_FADE_APPROX /// Distance at which diffuse from screens will be ignored. #define LTCGI_DISTANCE_FADE_APPROX_MULT 50 - + // disabled editor from here on out /// - + // Allow statically textured lights. // (deprecated: doesn't really cause any improvement when disabled...) #define LTCGI_STATIC_TEXTURES - + // keep in sync with LTCGI_Controller.cs #define MAX_SOURCES 16 - + // set according to the LUT specified on CONTROLLER #define LUT_SIZE 256 static float LUT_SCALE = (LUT_SIZE - 1.0) / LUT_SIZE; const float LUT_BIAS = 0.5 / LUT_SIZE; - + // will be set automatically if audiolink is available #ifdef POI_AUDIOLINK #define LTCGI_AUDIOLINK #endif - + // #ifdef LTCGI_AUDIOLINK // #ifndef AUDIOLINK_WIDTH // #ifndef AUDIOLINK_CGINC_INCLUDED @@ -16393,52 +16590,52 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // #endif // #endif // #endif - + // Bake screen data into texture for better performance. Disables moveable screens. #define LTCGI_STATIC_UNIFORMS - + // Enable support for cylindrical screens. #define LTCGI_CYLINDER - + // Activate avatar mode, which overrides certain configs from above. #define LTCGI_AVATAR_MODE - + // LTCGI_config.cginc END - + #ifdef LTCGI_AVATAR_MODE #undef LTCGI_STATIC_UNIFORMS #undef LTCGI_BICUBIC_LIGHTMAP #define LTCGI_ALWAYS_LTC_DIFFUSE #endif - + #ifdef LTCGI_TOGGLEABLE_SPEC_DIFF_OFF #undef LTCGI_DIFFUSE_OFF #undef LTCGI_SPECULAR_OFF #endif - + #if defined(LTCGI_V2_CUSTOM_INPUT) || defined(LTCGI_V2_DIFFUSE_CALLBACK) || defined(LTCGI_V2_SPECULAR_CALLBACK) #define LTCGI_API_V2 #endif - + // #include "LTCGI_uniform.cginc" // global sampler (trilinear) #ifndef LTCGI_SAMPLER SamplerState sampler_LTCGI_trilinear_clamp_sampler; #define LTCGI_SAMPLER sampler_LTCGI_trilinear_clamp_sampler #endif - + // LUTs #ifndef SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER uniform Texture2D _Udon_LTCGI_lut2; uniform Texture2D _Udon_LTCGI_lut1; #endif - + #ifndef SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER uniform Texture2D _Udon_LTCGI_static_uniforms; #endif - + #ifdef LTCGI_STATIC_UNIFORMS - + float4 _Udon_LTCGI_Vertices_0_get(uint i) { return _Udon_LTCGI_static_uniforms[uint2(0, i)]; @@ -16455,15 +16652,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return _Udon_LTCGI_static_uniforms[uint2(3, i)]; } - + #else - + // vertices in object space; w component is UV (legacy) uniform float4 _Udon_LTCGI_Vertices_0[MAX_SOURCES]; uniform float4 _Udon_LTCGI_Vertices_1[MAX_SOURCES]; uniform float4 _Udon_LTCGI_Vertices_2[MAX_SOURCES]; uniform float4 _Udon_LTCGI_Vertices_3[MAX_SOURCES]; - + float4 _Udon_LTCGI_Vertices_0_get(uint i) { return _Udon_LTCGI_Vertices_0[i]; @@ -16480,16 +16677,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return _Udon_LTCGI_Vertices_3[i]; } - + #endif - + // light source count, maximum is MAX_SOURCES uniform uint _Udon_LTCGI_ScreenCount; - + // per-renderer mask to select sources, // for max perf update _Udon_LTCGI_ScreenCount too uniform bool _Udon_LTCGI_Mask[MAX_SOURCES]; - + // extra data per light source, layout: // color.r color.g color.b flags* // * b0=double-sided, b1=diffuse-from-lightmap, b2=specular, b3=diffuse, @@ -16501,41 +16698,41 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // b15=lightmap diffuse only // (color black = fully disabled) uniform float4 _Udon_LTCGI_ExtraData[MAX_SOURCES]; - + ltcgi_flags ltcgi_parse_flags(uint val, bool noLmDiff) { ltcgi_flags ret = (ltcgi_flags)0; ret.doublesided = (val & 1) == 1; - + #ifdef LTCGI_ALWAYS_LTC_DIFFUSE ret.diffFromLm = false; #else ret.diffFromLm = !noLmDiff && (val & 2) == 2; #endif - + ret.diffuse = (val & 8) == 8; - + ret.specular = (val & 4) == 4; ret.texindex = (val & 0xf0) >> 4; ret.colormode = (val & 0x300) >> 8; - + #ifdef LTCGI_ALWAYS_LTC_DIFFUSE ret.lmch = 0; #else ret.lmch = (val & 0xC00) >> 10; #endif - + ret.cylinder = (val & (1 << 12)) == (1 << 12); - + #ifdef LTCGI_AUDIOLINK ret.alBand = (val & 0x6000) >> 13; #endif - + ret.lmdOnly = (val & (1 << 15)) == (1 << 15); - + return ret; } - + // video input #ifndef SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER uniform Texture2D _Udon_LTCGI_Texture_LOD0; @@ -16543,13 +16740,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" uniform Texture2D _Udon_LTCGI_Texture_LOD2; uniform Texture2D _Udon_LTCGI_Texture_LOD3; #endif - + // static textures UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(_Udon_LTCGI_Texture_LOD0_arr); UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(_Udon_LTCGI_Texture_LOD1_arr); UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(_Udon_LTCGI_Texture_LOD2_arr); UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(_Udon_LTCGI_Texture_LOD3_arr); - + // lightmap #ifndef SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER #ifndef LTCGI_ALWAYS_LTC_DIFFUSE @@ -16558,30 +16755,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif uniform float3 _Udon_LTCGI_LightmapMult; uniform float4 _Udon_LTCGI_LightmapST; - + // global toggle uniform float _Udon_LTCGI_GlobalEnable; - + // #include "LTCGI_uniform.cginc" END // #include "LTCGI_functions.cginc" - + /* LTC HELPERS */ - + float3 LTCGI_IntegrateEdge(float3 v1, float3 v2) { float x = dot(v1, v2); float y = abs(x); - + float a = 0.8543985 + (0.4965155 + 0.0145206 * y) * y; float b = 3.4175940 + (4.1616724 + y) * y; float v = a / b; float theta_sintheta = (x > 0.0) ? v : 0.5 * rsqrt(max(1.0 - x * x, 1e-7)) - v; - + return cross(v1, v2) * theta_sintheta; } - + void LTCGI_ClipQuadToHorizon(inout float3 L[5], out int n) { // detect clipping config @@ -16590,9 +16787,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (L[1].z > 0.0) config += 2; if (L[2].z > 0.0) config += 4; if (L[3].z > 0.0) config += 8; - + n = 0; - + // This [forcecase] only works when the cases are ordered in a specific manner. // It gives like 10%-20% performance boost, so *make sure to leave it on*! // If it breaks however, see if [branch] fixes it, and if it does, start @@ -16680,7 +16877,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" L[0] = -L[0].z * L[1] + L[1].z * L[0]; break; } - + // inlining these branches *unconditionally* breaks the [forcecase] above // ...yeah I know if (n == 3) @@ -16688,28 +16885,28 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (n == 4) L[4] = L[0]; } - + /* TEXTURE SAMPLING */ - + float2 LTCGI_inset_uv(float2 uv) { return uv * 0.75 + float2(0.125, 0.125); } - + half3 premul_alpha(half4 i) { return i.rgb * i.a; } - + void LTCGI_sample(float2 uv, uint lod, uint idx, float blend, out float3 result) { result = 0; #ifndef LTCGI_STATIC_TEXTURES idx = 0; // optimize away the branches below #endif - + [branch] if (lod == 0) { @@ -16747,9 +16944,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } } - + float2 ruv = LTCGI_inset_uv(uv); - + [branch] if (idx == 0) { @@ -16803,15 +17000,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } } - + void LTCGI_trilinear(float2 uv, float d, uint idx, out float3 result) { uint low = (uint)d; uint high = low + 1; - + // DEBUG: colorize d/lod //return float3(low == 0, low == 1, low == 2); - + if (low >= 3) { LTCGI_sample(uv, 3, idx, d - 3, result); @@ -16823,15 +17020,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" LTCGI_sample(uv, low, idx, amount, low_sample); float3 high_sample; LTCGI_sample(uv, high, idx, 0, high_sample); - + result = lerp(high_sample, low_sample, amount); } } - + /* GENERIC HELPERS */ - + bool LTCGI_tri_ray(float3 orig, float3 dir, float3 v0, float3 v1, float3 v2, out float2 bary) { float3 v0v1 = v1 - v0; @@ -16839,32 +17036,32 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 pvec = cross(dir, v0v2); float det = dot(v0v1, pvec); float invDet = 1 / det; - + float3 tvec = orig - v0; bary.x = dot(tvec, pvec) * invDet; - + float3 qvec = cross(tvec, v0v1); bary.y = dot(dir, qvec) * invDet; - + // return false when other triangle of quad should be sampled, // i.e. we went over the diagonal line return bary.x >= 0; } - + float2 LTCGI_rotateVector(float2 x, float angle) { float c = cos(angle); float s = sin(angle); return mul(float2x2(c, s, -s, c), x); } - + float2 LTCGI_calculateUV(uint i, ltcgi_flags flags, float3 L[5], bool isTri, float2 uvStart, float2 uvEnd, out float3 ray) { // calculate perpendicular vector to plane defined by area light float3 E1 = L[1] - L[0]; float3 E2 = L[3] - L[0]; ray = cross(E1, E2); - + // raycast it against the two triangles formed by the quad float2 bary; bool hit0 = LTCGI_tri_ray(0, ray, L[0], L[2], L[3], bary) || isTri; @@ -16872,7 +17069,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { LTCGI_tri_ray(0, ray, L[0], L[1], L[2], bary); } - + float2 uvs[4]; #ifdef LTCGI_CYLINDER if (flags.cylinder) @@ -16889,20 +17086,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" uvs[1] = _Udon_LTCGI_static_uniforms[uint2(4, i)].zw; uvs[2] = _Udon_LTCGI_static_uniforms[uint2(5, i)].xy; uvs[3] = uvEnd; // == _Udon_LTCGI_static_uniforms[uint2(5, i)].zw; - + } - + // map barycentric triangle coordinates to the according object UVs float3 bary3 = float3(bary, 1 - bary.x - bary.y); float2 uv = uvs[1 + hit0 * 2] * bary3.x + uvs[3 - hit0] * bary3.y + uvs[0] * bary3.z; - + return uv; } - + /* EXPERIMENTAL: CYLINDER HELPER */ - + void LTCGI_GetLw(uint i, ltcgi_flags flags, float3 worldPos, out float3 Lw[4], out float2 uvStart, out float2 uvEnd, out bool isTri) { bool cylinder = false; @@ -16910,24 +17107,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // statically optimize out branch below in case disabled cylinder = flags.cylinder; #endif - + float4 v0 = _Udon_LTCGI_Vertices_0_get(i); float4 v1 = _Udon_LTCGI_Vertices_1_get(i); float4 v2 = _Udon_LTCGI_Vertices_2_get(i); float4 v3 = _Udon_LTCGI_Vertices_3_get(i); - + [branch] if (cylinder) { // construct data according to worldPos to create aligned // rectangle tangent to the cylinder - + float3 in_base = v0.xyz; float in_height = v0.w; float in_radius = v1.w; float in_size = v2.w; float in_angle = v3.w; - + // get angle between 2D unit plane and vector pointing from cylinder to shade point float2 towardsCylinder = LTCGI_rotateVector((in_base - worldPos).xz, -in_angle); float angle = atan2(towardsCylinder.x, towardsCylinder.y); @@ -16938,21 +17135,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // tangent of rectangular screen on cylinder surface used for calculating lighting for shade point float2 tangent = float2(facing.y, -facing.x); float2 onCylinderFacing = facing * in_radius; - + // clip ends, approximately float rclip = saturate(lerp(1, 0, (angleClamped - in_angle) - (in_size - UNITY_HALF_PI * 0.5f))); float lclip = saturate(lerp(1, 0, - (angleClamped - in_angle) - (in_size - UNITY_HALF_PI * 0.5f))); - + float2 p1 = in_base.xz - onCylinderFacing + tangent * in_radius * lclip; float2 p2 = in_base.xz - onCylinderFacing - tangent * in_radius * rclip; - + Lw[0] = float3(p1.x, in_base.y, p1.y) - worldPos; Lw[1] = float3(p1.x, in_base.y + in_height, p1.y) - worldPos; Lw[2] = float3(p2.x, in_base.y, p2.y) - worldPos; Lw[3] = float3(p2.x, in_base.y + in_height, p2.y) - worldPos; - + isTri = false; - + // UV depends on "viewing" angle of the shade point towards the cylinder float2 viewDir = normalize((in_base - worldPos).xz); // forwardAngle == atan2(cos(in_angle), sin(in_angle)); but only negative @@ -16985,45 +17182,45 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" uvStart = float2(0, 0); uvEnd = float2(1, 1); #endif - + // we only detect triangles for "blender" import configuration, as those are the only // ones that can actually be triangles (I think?) isTri = /*distance(Lw[2], Lw[3]) < 0.001 || */distance(Lw[1], Lw[3]) < 0.001; } } - + /* - + Parts of the code in this file are adapted from the example code found here: - + https://github.com/selfshadow/ltc_code - + Modifications by _pi_ (@pimaker on GitHub), licensed under the terms of the MIT license as far as applicable. - + Original copyright notice: - + Copyright (c) 2017, Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + * If you use (or adapt) the source code in your own work, please include a reference to the paper: - + Real-Time Polygonal-Light Shading with Linearly Transformed Cosines. Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt. ACM Transactions on Graphics (Proceedings of ACM SIGGRAPH 2016) 35(4), 2016. Project page: https://eheitzresearch.wordpress.com/415-2/ - + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -17034,11 +17231,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + */ // #include "LTCGI_functions.cginc" END // #include "LTCGI_shadowmap.cginc" - + // Adapted from: https://gitlab.com/s-ilent/filamented // Licensed under the terms of the Apache License 2.0 // Full text: https://gitlab.com/s-ilent/filamented/-/blob/master/LICENSE @@ -17046,9 +17243,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // Conforming to the terms of the above license, this file is redistributed // under the terms of the MIT license as part of the LTCGI shader package, // provided this notice is kept. - + #ifndef SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER - + float4 LTCGI_cubic(float v) { float4 n = float4(1.0, 2.0, 3.0, 4.0) - v; @@ -17059,10 +17256,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float w = 6.0 - x - y - z; return float4(x, y, z, w); } - + // Unity's SampleTexture2DBicubic doesn't exist in 2018, which is our target here. // So this is a similar function with tweaks to have similar semantics. - + float4 LTCGI_SampleTexture2DBicubicFilter(Texture2D tex, SamplerState smp, float2 coord, float4 texSize) { coord = coord * texSize.xy - 0.5; @@ -17070,40 +17267,40 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float fy = frac(coord.y); coord.x -= fx; coord.y -= fy; - + float4 xcubic = LTCGI_cubic(fx); float4 ycubic = LTCGI_cubic(fy); - + float4 c = float4(coord.x - 0.5, coord.x + 1.5, coord.y - 0.5, coord.y + 1.5); float4 s = float4(xcubic.x + xcubic.y, xcubic.z + xcubic.w, ycubic.x + ycubic.y, ycubic.z + ycubic.w); float4 offset = c + float4(xcubic.y, xcubic.w, ycubic.y, ycubic.w) / s; - + float4 sample0 = tex.Sample(smp, float2(offset.x, offset.z) * texSize.zw); float4 sample1 = tex.Sample(smp, float2(offset.y, offset.z) * texSize.zw); float4 sample2 = tex.Sample(smp, float2(offset.x, offset.w) * texSize.zw); float4 sample3 = tex.Sample(smp, float2(offset.y, offset.w) * texSize.zw); - + float sx = s.x / (s.x + s.y); float sy = s.z / (s.z + s.w); - + return lerp( lerp(sample3, sample2, sx), lerp(sample1, sample0, sx), sy); } - + float4 LTCGI_SampleShadowmap(float2 lmuv) { #ifdef LTCGI_ALWAYS_LTC_DIFFUSE return 1; #else lmuv = lmuv * _Udon_LTCGI_LightmapST.xy + _Udon_LTCGI_LightmapST.zw; - + #ifdef LTCGI_BICUBIC_LIGHTMAP float width, height; _Udon_LTCGI_Lightmap.GetDimensions(width, height); - + float4 _Udon_LTCGI_Lightmap_TexelSize = float4(width, height, 1.0 / width, 1.0 / height); - + return LTCGI_SampleTexture2DBicubicFilter( _Udon_LTCGI_Lightmap, LTCGI_SAMPLER, lmuv, _Udon_LTCGI_Lightmap_TexelSize @@ -17113,7 +17310,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif } - + #else // surface shader analysis stub float4 LTCGI_SampleShadowmap(float2 lmuv) @@ -17121,24 +17318,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return 1; } #endif - + // #include "LTCGI_shadowmap.cginc" END - + #ifdef SHADER_TARGET_SURFACE_ANALYSIS #define const #endif - + // Main function - this calculates the approximated model for one pixel and one light void LTCGI_Evaluate(ltcgi_input input, float3 worldNorm, float3 viewDir, float3x3 Minv, float roughness, const bool diffuse, out ltcgi_output output) { output.input = input; output.color = input.rawColor; // copy for colormode static output.intensity = 0; - + // diffuse distance fade #ifdef LTCGI_DISTANCE_FADE_APPROX if (diffuse) // static branch, specular does not directly fade with distance - + { if (!input.flags.lmdOnly) { @@ -17152,12 +17349,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } #endif - + #define RET1_IF_LMDIFF [branch] if (/*const*/ diffuse && input.flags.diffFromLm) \ { \ output.intensity = 1.0f; return; \ } - + if (input.flags.colormode == LTCGI_COLORMODE_SINGLEUV) { float2 uv = input.uvStart; @@ -17170,20 +17367,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" LTCGI_sample(LTCGI_inset_uv(uv), 1, input.flags.texindex, 0, sampled); output.color *= sampled; #endif - + RET1_IF_LMDIFF } - + #ifdef LTCGI_AUDIOLINK if (input.flags.colormode == LTCGI_COLORMODE_AUDIOLINK) { float al = AudioLinkData(ALPASS_AUDIOLINK + uint2(0, input.flags.alBand)).r; output.color *= al; - + RET1_IF_LMDIFF } #endif - + // create LTC polygon array // note the order of source verts (keyword: winding order) float3 L[5]; @@ -17192,7 +17389,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" L[2] = input.isTri ? L[1] : mul(Minv, input.Lw[3]); L[3] = mul(Minv, input.Lw[2]); L[4] = 0; - + // get texture coords (before clipping!) [branch] if (input.flags.colormode == LTCGI_COLORMODE_TEXTURE) @@ -17201,7 +17398,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 uv = LTCGI_calculateUV(input.i, input.flags, L, input.isTri, input.uvStart, input.uvEnd, RN); float planeAreaSquared = dot(RN, RN); float planeDistxPlaneArea = dot(RN, L[0]); - + float3 sampled; [branch] if (diffuse) @@ -17220,36 +17417,36 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float d = abs(planeDistxPlaneArea) / planeAreaSquared; d *= LTCGI_UV_BLUR_DISTANCE; d = log(d) / log(3.0); - + // a rough material must never show a perfect reflection, // since our LOD0 texture is not prefiltered (and thus cannot // depict any blur correctly) - without this there is artifacting // on the border of LOD0 and LOD1 d = clamp(d, saturate(roughness * 5.75), 1000); - + LTCGI_trilinear(uv, d, input.flags.texindex, sampled); } - + // colorize output output.color *= sampled; } - + RET1_IF_LMDIFF #undef RET1_IF_LMDIFF - + int n; LTCGI_ClipQuadToHorizon(L, n); - + // early out if everything was clipped below horizon if (n == 0) return; - + L[0] = normalize(L[0]); L[1] = normalize(L[1]); L[2] = normalize(L[2]); L[3] = normalize(L[3]); L[4] = normalize(L[4]); - + // integrate (and pray that constant folding works well) float sum = 0; [unroll(5)] @@ -17259,12 +17456,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 b = L[(v + 1) % 5]; sum += LTCGI_IntegrateEdge(a, b).z; } - + // doublesided is accounted for with optimization at the start, so return abs output.intensity = abs(sum); return; } - + // Calculate light contribution for all lights, // call this from your shader and use the "diffuse" and "specular" outputs // lmuv is the raw lightmap UV coordinate (e.g. UV1) @@ -17285,19 +17482,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return; } - + // sample lookup tables float theta = acos(dot(worldNorm, viewDir)); float2 uv = float2(roughness, theta / (0.5 * UNITY_PI)); uv = uv * LUT_SCALE + LUT_BIAS; - + #ifndef UNITY_UV_STARTS_AT_TOP uv.y = 1 - uv.y; #endif - + // calculate LTCGI custom lightmap UV and sample float3 lms = LTCGI_SampleShadowmap(lmuv); - + #ifndef SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER // sample BDRF approximation from lookup texture float4 t = _Udon_LTCGI_lut1.SampleLevel(LTCGI_SAMPLER, uv, 0); @@ -17307,25 +17504,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3(0, t.z, 0), float3(t.y, 0, t.x) ); - + // construct orthonormal basis around N float3 T1, T2; T1 = normalize(viewDir - worldNorm * dot(viewDir, worldNorm)); T2 = cross(worldNorm, T1); - + // for diffuse lighting we assume the identity matrix as BDRF, so the // LTC approximation is directly equivalent to the orthonormal rotation matrix float3x3 identityBrdf = float3x3(float3(T1), float3(T2), float3(worldNorm)); // rotate area light in (T1, T2, N) basis for actual BRDF matrix as well Minv = mul(Minv, identityBrdf); - + // specular brightness #ifndef LTCGI_SPECULAR_OFF #ifndef SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER float spec_amp = _Udon_LTCGI_lut2.SampleLevel(LTCGI_SAMPLER, uv, 0).x; #endif #endif - + bool noLm = false; #ifdef LTCGI_LTC_DIFFUSE_FALLBACK #ifndef LTCGI_ALWAYS_LTC_DIFFUSE @@ -17339,7 +17536,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #ifdef LTCGI_ALWAYS_LTC_DIFFUSE noLm = true; #endif - + // loop through all lights and add them to the output uint count = min(_Udon_LTCGI_ScreenCount, MAX_SOURCES); [loop] @@ -17350,19 +17547,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 extra = _Udon_LTCGI_ExtraData[i]; float3 color = extra.rgb; if (!any(color)) continue; - + ltcgi_flags flags = ltcgi_parse_flags(asuint(extra.w), noLm); - + #ifdef LTCGI_ALWAYS_LTC_DIFFUSE // can't honor a lightmap-only light in this mode if (flags.lmdOnly) continue; #endif - + #ifdef LTCGI_TOGGLEABLE_SPEC_DIFF_OFF // compile branches below away statically flags.diffuse = flags.specular = true; #endif - + // calculate (shifted) world space positions float3 Lw[4]; float2 uvStart = (float2)0, uvEnd = (float2)0; @@ -17375,7 +17572,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { LTCGI_GetLw(i, flags, worldPos, Lw, uvStart, uvEnd, isTri); } - + // skip single-sided lights that face the other way float3 screenNorm = cross(Lw[1] - Lw[0], Lw[2] - Lw[0]); if (!flags.doublesided) @@ -17383,14 +17580,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (dot(screenNorm, Lw[0]) < 0) continue; } - + float lm = 1; if (flags.lmch) { lm = lms[flags.lmch - 1]; if (lm < 0.001) continue; } - + ltcgi_input input; input.i = i; input.Lw = Lw; @@ -17400,7 +17597,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" input.rawColor = color; input.flags = flags; input.screenNormal = screenNorm; - + // diffuse lighting #ifndef LTCGI_DIFFUSE_OFF [branch] @@ -17417,7 +17614,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" ltcgi_output diff; LTCGI_Evaluate(input, worldNorm, viewDir, identityBrdf, roughness, true, diff); diff.intensity *= lmd; - + #ifdef LTCGI_API_V2 LTCGI_V2_DIFFUSE_CALLBACK(data, diff); #else @@ -17427,7 +17624,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif } #endif - + // specular lighting #ifndef LTCGI_SPECULAR_OFF [branch] @@ -17436,7 +17633,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" ltcgi_output spec; LTCGI_Evaluate(input, worldNorm, viewDir, Minv, roughness, false, spec); spec.intensity *= spec_amp * smoothstep(0.0, LTCGI_SPECULAR_LIGHTMAP_STEP, saturate(lm - LTCGI_LIGHTMAP_CUTOFF)); - + #ifdef LTCGI_API_V2 LTCGI_V2_SPECULAR_CALLBACK(data, spec); #else @@ -17448,11 +17645,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif } } - + // COMPATIBILITY FALLBACKS - + #ifndef LTCGI_API_V2 - + void LTCGI_Contribution( float3 worldPos, float3 worldNorm, float3 viewDir, float roughness, float2 lmuv, inout half3 diffuse ) @@ -17461,7 +17658,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _u2, _u3; LTCGI_Contribution(worldPos, worldNorm, viewDir, roughness, lmuv, diffuse, _u1, _u2, _u3); } - + void LTCGI_Contribution( float3 worldPos, float3 worldNorm, float3 viewDir, float roughness, float2 lmuv, inout half3 diffuse, inout half3 specular ) @@ -17469,7 +17666,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _u1, _u2; LTCGI_Contribution(worldPos, worldNorm, viewDir, roughness, lmuv, diffuse, specular, _u1, _u2); } - + void LTCGI_Contribution( float3 worldPos, float3 worldNorm, float3 viewDir, float roughness, float2 lmuv, inout half3 diffuse, inout half3 specular, out float totalSpecularIntensity ) @@ -17477,41 +17674,41 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _u1; LTCGI_Contribution(worldPos, worldNorm, viewDir, roughness, lmuv, diffuse, specular, totalSpecularIntensity, _u1); } - + #endif - + /* - + Parts of the code in this file are adapted from the example code found here: - + https://github.com/selfshadow/ltc_code - + Modifications by _pi_ (@pimaker on GitHub), licensed under the terms of the MIT license as far as applicable. - + Original copyright notice: - + Copyright (c) 2017, Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + * If you use (or adapt) the source code in your own work, please include a reference to the paper: - + Real-Time Polygonal-Light Shading with Linearly Transformed Cosines. Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt. ACM Transactions on Graphics (Proceedings of ACM SIGGRAPH 2016) 35(4), 2016. Project page: https://eheitzresearch.wordpress.com/415-2/ - + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -17522,11 +17719,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + */ - + // LTCGI.cginc END - + void callback_diffuse(inout accumulator_struct acc, in ltcgi_output output) { // you can do whatever here! check out the ltcgi_output struct in @@ -17540,13 +17737,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // to emulate total{Specular,Diffuse}Intensity from APIv1 acc.specular += output.intensity * output.color; } - + #endif //endex - + //ifex _ShadingEnabled==0 #ifdef VIGNETTE_MASKED - + #ifdef _LIGHTINGMODE_CLOTH float V_SmithGGXCorrelated(float roughness, float NoV, float NoL) { @@ -17561,16 +17758,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // clamp to the maximum value representable in mediump return v; } - + float D_GGX(float roughness, float NoH) { // Walter et al. 2007, "Microfacet Models for Refraction through Rough Surfaces" - + // In mediump, there are two problems computing 1.0 - NoH^2 // 1) 1.0 - NoH^2 suffers floating point cancellation when NoH^2 is close to 1 (highlights) // 2) NoH doesn't have enough precision around 1.0 // Both problem can be fixed by computing 1-NoH^2 in highp and providing NoH in highp as well - + // However, we can do better using Lagrange's identity: // ||a x b||^2 = ||a||^2 ||b||^2 - (a . b)^2 // since N and H are unit vectors: ||N x H||^2 = 1.0 - NoH^2 @@ -17578,13 +17775,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // enough precision). // Overall this yields better performance, keeping all computations in mediump float oneMinusNoHSquared = 1.0 - NoH * NoH; - + float a = NoH * roughness; float k = roughness / (oneMinusNoHSquared + a * a); float d = k * k * (1.0 / UNITY_PI); return d; } - + // https://github.com/google/filament/blob/main/shaders/src/brdf.fs#L94-L100 float D_Charlie(float roughness, float NoH) { @@ -17594,14 +17791,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float sin2h = max(1.0 - cos2h, 0.0078125); // 0.0078125 = 2^(-14/2), so sin2h^2 > 0 in fp16 return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * UNITY_PI); } - + // https://github.com/google/filament/blob/main/shaders/src/brdf.fs#L136-L139 float V_Neubelt(float NoV, float NoL) { // Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886" return 1.0 / (4.0 * (NoL + NoV - NoL * NoV)); } - + float Distribution(float roughness, float NoH, float cloth) { //ifex _ClothLerp==0 @@ -17612,7 +17809,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH); } - + float Visibility(float roughness, float NoV, float NoL, float cloth) { //ifex _ClothLerp==0 @@ -17623,25 +17820,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL); } - + float F_Schlick(float3 f0, float f90, float VoH) { // Schlick 1994, "An Inexpensive BRDF Model for Physically-Based Rendering" return f0 + (f90 - f0) * pow(1.0 - VoH, 5); } - + float F_Schlick(float3 f0, float VoH) { float f = pow(1.0 - VoH, 5.0); return f + f0 * (1.0 - f); } - + float Fresnel(float3 f0, float LoH) { float f90 = saturate(dot(f0, float(50.0 * 0.33).xxx)); return F_Schlick(f0, f90, LoH); } - + float Fd_Burley(float roughness, float NoV, float NoL, float LoH) { // Burley 2012, "Physically-Based Shading at Disney" @@ -17650,23 +17847,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float viewScatter = F_Schlick(1.0, f90, NoV); return lightScatter * viewScatter; } - + // Energy conserving wrap diffuse term, does *not* include the divide by PI float Fd_Wrap(float NoL, float w) { return saturate((NoL + w) / pow(1.0 + w, 2)); } - + float4 SampleDFG(float NoV, float perceptualRoughness) { return _ClothDFG.Sample(sampler_ClothDFG, float3(NoV, perceptualRoughness, 0)); } - + float3 EnvBRDF(float2 dfg, float3 f0) { return f0 * dfg.x + dfg.y; } - + float3 EnvBRDFMultiscatter(float3 dfg, float3 f0, float cloth) { //ifex _ClothLerp==0 @@ -17677,7 +17874,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z; } - + float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth) { //ifex _ClothLerp==0 @@ -17688,7 +17885,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1; } - + // float ClothMetallic(float cloth) { @@ -17700,21 +17897,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex return cloth <= 0.5 ? 1 : 0; } - + float3 Specular(float roughness, PoiLight poiLight, float f0, float3 normal, float cloth) { float NoL = poiLight.nDotLSaturated; float NoH = poiLight.nDotH; float LoH = poiLight.lDotH; float NoV = poiLight.nDotV; - + float D = Distribution(roughness, NoH, cloth); float V = Visibility(roughness, NoV, NoL, cloth); float3 F = Fresnel(f0, LoH); - + return (D * V) * F; } - + float3 getBoxProjection(float3 direction, float3 position, float4 cubemapPosition, float3 boxMin, float3 boxMax) { #if UNITY_SPECCUBE_BOX_PROJECTION @@ -17725,29 +17922,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" direction = direction * scalar + (position - cubemapPosition.xyz); } #endif - + return direction; } - + float SpecularAO(float NoV, float ao, float roughness) { return clamp(pow(NoV + ao, exp2(-16.0 * roughness - 1.0)) - 1.0 + ao, 0.0, 1.0); } - + float3 IndirectSpecular(float3 dfg, float roughness, float occlusion, float energyCompensation, float cloth, float3 indirectDiffuse, float f0, PoiLight poiLight, PoiFragData poiFragData, PoiCam poiCam, PoiMesh poiMesh) { float3 normal = poiMesh.normals[1]; - + float3 reflDir = reflect(-poiCam.viewDir, normal); - + Unity_GlossyEnvironmentData envData; envData.roughness = roughness; envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin.xyz, unity_SpecCube0_BoxMax.xyz); - + float3 probe0 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE(unity_SpecCube0), unity_SpecCube0_HDR, envData); float3 indirectSpecular = probe0; - + #if UNITY_SPECCUBE_BLENDING UNITY_BRANCH if (unity_SpecCube0_BoxMin.w < 0.99999) @@ -17757,15 +17954,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirectSpecular = lerp(probe1, probe0, unity_SpecCube0_BoxMin.w); } #endif - + float horizon = min(1 + dot(reflDir, normal), 1); indirectSpecular = indirectSpecular * horizon * horizon * energyCompensation * EnvBRDFMultiscatter(dfg, f0, cloth); - + indirectSpecular *= SpecularAO(poiLight.nDotV, occlusion, roughness); return indirectSpecular; }; #endif - + #ifdef _LIGHTINGMODE_WRAPPED // Wrapped // Green’s model with adjustable energy @@ -17774,7 +17971,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float RTWrapFunc(in float dt, in float w, in float norm) { float cw = saturate(w); - + float o = (dt + cw) / ((1.0 + cw) * (1.0 + cw * norm)); float flt = 1.0 - 0.85 * norm; if (w > 1.0) @@ -17783,21 +17980,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return o; } - + float3 GreenWrapSH(float fA) // Greens unoptimized and non-normalized - + { float fAs = saturate(fA); float4 t = float4(fA + 1, fAs - 1, fA - 2, fAs + 1); // DJL edit: allow wrapping to L0-only at w=2 return float3(t.x, -t.z * t.x / 3, 0.25 * t.y * t.y * t.w); } float3 GreenWrapSHOpt(float fW) // optimised and normalized https://blog.selfshadow.com/2012/01/07/righting-wrap-part-2/ - + { const float4 t0 = float4(0.0, 1.0 / 4.0, -1.0 / 3.0, -1.0 / 2.0); const float4 t1 = float4(1.0, 2.0 / 3.0, 1.0 / 4.0, 0.0); float3 fWs = float3(fW, fW, saturate(fW)); // DJL edit: allow wrapping to L0-only at w=2 - + float3 r; r.xyz = t0.xxy * fWs + t0.xzw; r.xyz = r.xyz * fWs + t1.xyz; @@ -17808,33 +18005,33 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 x0, x1, x2; float3 conv = lerp(GreenWrapSH(wrap), GreenWrapSHOpt(wrap), _LightingWrappedNormalization); // Should try optimizing this... conv *= float3(1, 1.5, 4); // Undo pre-applied cosine convolution by using the inverse - + // Constant (L0) x0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w); // Remove pre-applied constant part from L(2,0) to apply correct convolution float3 L2_0 = float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / - 3.0; x0 -= L2_0; - + // Linear (L1) polynomial terms x1.r = dot(unity_SHAr.xyz, normal); x1.g = dot(unity_SHAg.xyz, normal); x1.b = dot(unity_SHAb.xyz, normal); - + // 4 of the quadratic (L2) polynomials float4 vB = normal.xyzz * normal.yzzx; x2.r = dot(unity_SHBr, vB); x2.g = dot(unity_SHBg, vB); x2.b = dot(unity_SHBb, vB); - + // Final (5th) quadratic (L2) polynomial float vC = normal.x * normal.x - normal.y * normal.y; x2 += unity_SHC.rgb * vC; // Move back the constant part of L(2,0) x2 += L2_0; - + return x0 * conv.x + x1 * conv.y + x2 * conv.z; } - + float3 GetSHDirectionL1() { // For efficiency, we only get the direction from L1. @@ -17849,7 +18046,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return ShadeSH9_wrapped(maxDirection, 0); } #endif - + #ifdef _LIGHTINGMODE_SHADEMAP void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight) { @@ -17859,37 +18056,37 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" shadowAttenuation = lerp(1, poiLight.additiveShadow, poiLight.attenuationStrength); //attenuation = poiLight.attenuation; #endif - + float MainColorFeatherStep = _BaseColor_Step - _BaseShade_Feather; float firstColorFeatherStep = _ShadeColor_Step - _1st2nd_Shades_Feather; - + #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED) float4 firstShadeMap = POI2D_SAMPLER_PAN(_1st_ShadeMap, _MainTex, poiUV(poiMesh.uv[_1st_ShadeMapUV], _1st_ShadeMap_ST), _1st_ShadeMapPan); #else float4 firstShadeMap = float4(1, 1, 1, 1); #endif firstShadeMap = lerp(firstShadeMap, float4(poiFragData.baseColor, 1), _Use_BaseAs1st); - + #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED) float4 secondShadeMap = POI2D_SAMPLER_PAN(_2nd_ShadeMap, _MainTex, poiUV(poiMesh.uv[_2nd_ShadeMapUV], _2nd_ShadeMap_ST), _2nd_ShadeMapPan); #else float4 secondShadeMap = float4(1, 1, 1, 1); #endif secondShadeMap = lerp(secondShadeMap, firstShadeMap, _Use_1stAs2nd); - + firstShadeMap.rgb *= _1st_ShadeColor.rgb; //* lighColor secondShadeMap.rgb *= _2nd_ShadeColor.rgb; //* LightColor; - + float shadowMask = 1; shadowMask *= _Use_1stShadeMapAlpha_As_ShadowMask ? (_1stShadeMapMask_Inverse ? (1.0 - firstShadeMap.a) : firstShadeMap.a) : 1; shadowMask *= _Use_2ndShadeMapAlpha_As_ShadowMask ? (_2ndShadeMapMask_Inverse ? (1.0 - secondShadeMap.a) : secondShadeMap.a) : 1; - + float mainShadowMask = saturate(1 - ((poiLight.lightMap) - MainColorFeatherStep) / (_BaseColor_Step - MainColorFeatherStep) * (shadowMask)); float firstSecondShadowMask = saturate(1 - ((poiLight.lightMap) - firstColorFeatherStep) / (_ShadeColor_Step - firstColorFeatherStep) * (shadowMask)); - + mainShadowMask *= poiLight.shadowMask * _ShadowStrength; firstSecondShadowMask *= poiLight.shadowMask * _ShadowStrength; - + // 0 lerp | 1 multiply if (_ShadingShadeMapBlendType == 0) { @@ -17902,7 +18099,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.rampedLightMap = 1 - mainShadowMask; } #endif - + #ifdef _LIGHTINGMODE_REALISTIC // For https://docs.unity3d.com/Manual/LightMode-Mixed-Subtractive.html #if defined(LIGHTMAP_ON) && defined(SHADOWS_SCREEN) @@ -17910,13 +18107,32 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define SUBTRACTIVE_LIGHTING 1 #endif #endif - - void ApplySubtractiveLighting(inout UnityIndirect indirectLight) + + float FadeShadows(float attenuation, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiCam poiCam) + { + #if HANDLE_SHADOWS_BLENDING_IN_GI || ADDITIONAL_MASKED_DIRECTIONAL_SHADOWS + // UNITY_LIGHT_ATTENUATION doesn't fade shadows for us. + + #if ADDITIONAL_MASKED_DIRECTIONAL_SHADOWS + attenuation = poiLight.attenuation; + #endif + + float viewZ = dot(_WorldSpaceCameraPos - poiMesh.worldPos, UNITY_MATRIX_V[2].xyz); + float shadowFadeDistance = UnityComputeShadowFadeDistance(poiMesh.worldPos, viewZ); + float shadowFade = UnityComputeShadowFade(shadowFadeDistance); + float bakedAttenuation = UnitySampleBakedOcclusion(poiMesh.lightmapUV.xy, poiMesh.worldPos); + attenuation = UnityMixRealtimeAndBakedShadows(attenuation, bakedAttenuation, shadowFade); + #endif + + return attenuation; + } + + void ApplySubtractiveLighting(inout UnityIndirect indirectLight, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiCam poiCam) { #if SUBTRACTIVE_LIGHTING - poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier)); - - float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz)); + poiLight.attenuation = FadeShadows(poiLight.attenuation, poiLight, poiMesh, poiCam); + + float ndotl = saturate(dot(poiMesh.normals[0], _WorldSpaceLightPos0.xyz)); float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb; float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate; subtractedLight = max(subtractedLight, unity_ShadowColor.rgb); @@ -17924,45 +18140,37 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirectLight.diffuse = min(subtractedLight, indirectLight.diffuse); #endif } - + UnityIndirect CreateIndirectLight(in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight) { UnityIndirect indirectLight; indirectLight.diffuse = 0; indirectLight.specular = 0; - + #if defined(LIGHTMAP_ON) indirectLight.diffuse = DecodeLightmap(UNITY_SAMPLE_TEX2D(unity_Lightmap, poiMesh.lightmapUV.xy)); - + #if defined(DIRLIGHTMAP_COMBINED) - float4 lightmapDirection = UNITY_SAMPLE_TEX2D_SAMPLER( - unity_LightmapInd, unity_Lightmap, poiMesh.lightmapUV.xy - ); - indirectLight.diffuse = DecodeDirectionalLightmap( - indirectLight.diffuse, lightmapDirection, poiMesh.normals[1] - ); + float4 lightmapDirection = UNITY_SAMPLE_TEX2D_SAMPLER(unity_LightmapInd, unity_Lightmap, poiMesh.lightmapUV.xy); + indirectLight.diffuse = DecodeDirectionalLightmap(indirectLight.diffuse, lightmapDirection, poiMesh.normals[1]); #endif - ApplySubtractiveLighting(indirectLight); + + ApplySubtractiveLighting(indirectLight, poiLight, poiMesh, poiCam); #endif - + #if defined(DYNAMICLIGHTMAP_ON) float3 dynamicLightDiffuse = DecodeRealtimeLightmap( UNITY_SAMPLE_TEX2D(unity_DynamicLightmap, poiMesh.lightmapUV.zw) ); - + #if defined(DIRLIGHTMAP_COMBINED) - float4 dynamicLightmapDirection = UNITY_SAMPLE_TEX2D_SAMPLER( - unity_DynamicDirectionality, unity_DynamicLightmap, - poiMesh.lightmapUV.zw - ); - indirectLight.diffuse += DecodeDirectionalLightmap( - dynamicLightDiffuse, dynamicLightmapDirection, poiMesh.normals[1] - ); + float4 dynamicLightmapDirection = UNITY_SAMPLE_TEX2D_SAMPLER(unity_DynamicDirectionality, unity_DynamicLightmap, poiMesh.lightmapUV.zw); + indirectLight.diffuse += DecodeDirectionalLightmap(dynamicLightDiffuse, dynamicLightmapDirection, poiMesh.normals[1]); #else indirectLight.diffuse += dynamicLightDiffuse; #endif #endif - + #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON) #if UNITY_LIGHT_PROBE_PROXY_VOLUME if (unity_ProbeVolumeParams.x == 1) @@ -17983,24 +18191,45 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1))); #endif #endif - + indirectLight.diffuse *= poiLight.occlusion; - + return indirectLight; } #endif - + float GetRemapMinValue(float scale, float offset) { return clamp(-offset / scale, -0.01f, 1.01f); // Remap min - + } float GetRemapMaxValue(float scale, float offset) { return clamp((1.0f - offset) / scale, -0.01f, 1.01f); // Remap Max - + } - + + half4 POI_BRDF_PBS(half3 diffColor, half3 specColor, half oneMinusReflectivity, half smoothness, float3 normal, float3 viewDir, UnityLight light, UnityIndirect gi) + { + float3 reflDir = reflect(viewDir, normal); + + half nl = saturate(dot(normal, light.dir)); + half nv = saturate(dot(normal, viewDir)); + + // Vectorize Pow4 to save instructions + half2 rlPow4AndFresnelTerm = Pow4(float2(dot(reflDir, light.dir), 1 - nv)); // use R.L instead of N.H to save couple of instructions + half rlPow4 = rlPow4AndFresnelTerm.x; // power exponent must match kHorizontalWarpExp in NHxRoughness() function in GeneratedTextures.cpp + half fresnelTerm = rlPow4AndFresnelTerm.y; + + half grazingTerm = saturate(smoothness + (1 - oneMinusReflectivity)); + + half3 color = BRDF3_Direct(diffColor, specColor, rlPow4, smoothness); + color *= light.color * nl; + color += BRDF3_Indirect(diffColor, specColor, gi, grazingTerm, fresnelTerm); + + return half4(color, 1); + } + void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam) { float shadowAttenuation = lerp(1, poiLight.attenuation, poiLight.attenuationStrength); @@ -18009,7 +18238,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" shadowAttenuation = lerp(1, poiLight.additiveShadow, poiLight.attenuationStrength); //attenuation = poiLight.attenuation; #endif - + #ifdef POI_PASS_ADD if (_LightingAdditiveType == 3) { @@ -18036,11 +18265,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float passthrough = _LightingAdditivePassthrough; #endif - + float2 ToonAddGradient = float2(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd); - + if (ToonAddGradient.x == ToonAddGradient.y) ToonAddGradient.y += 0.0001; - + poiLight.rampedLightMap = smoothstep(ToonAddGradient.y, ToonAddGradient.x, 1 - (.5 * poiLight.nDotL + .5)); #if defined(POINT) || defined(SPOT) poiLight.finalLighting = lerp(poiLight.directColor * max(min(poiLight.additiveShadow, poiLight.detailShadow), passthrough), poiLight.indirectColor, smoothstep(ToonAddGradient.x, ToonAddGradient.y, 1 - (.5 * poiLight.nDotL + .5))); @@ -18050,20 +18279,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return; } #endif - + float shadowStrength = _ShadowStrength * poiLight.shadowMask; - + #ifdef POI_PASS_OUTLINE shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength); #endif - + // These blocks shouldn't need ifex, they should be removed on lock when their keywords aren't present - + #ifdef _LIGHTINGMODE_FLAT poiLight.finalLighting = poiLight.directColor * attenuation * shadowAttenuation; - poiLight.rampedLightMap = poiLight.nDotLSaturated; + if (_ForceFlatRampedLightmap) + { + poiLight.rampedLightMap = smoothstep(0.4, 0.6, poiLight.nDotLNormalized); + } + else + { + poiLight.rampedLightMap = 1; + } #endif - + #ifdef _LIGHTINGMODE_TEXTURERAMP float2 rampUVs = poiLight.lightMap + _ShadowOffset; if (_ToonRampCount > 1) @@ -18073,26 +18309,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D_SAMPLER(_ToonRamp, _linear_clamp, rampUVs).rgb, shadowStrength); poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap) * attenuation; #endif - + #ifdef _LIGHTINGMODE_MULTILAYER_MATH #if defined(PROP_MULTILAYERMATHBLURMAP) || !defined(OPTIMIZER_ENABLED) float4 blurMap = POI2D_SAMPLER_PAN(_MultilayerMathBlurMap, _MainTex, poiUV(poiMesh.uv[_MultilayerMathBlurMapUV], _MultilayerMathBlurMap_ST), _MultilayerMathBlurMapPan); #else float4 blurMap = 1; #endif - + float4 lns = float4(1, 1, 1, 1); - + float shadowAttenuationNoStrength = poiLight.attenuation; #if defined(POINT) || defined(SPOT) shadowAttenuationNoStrength = poiLight.additiveShadow; #endif - + float3 lightMap = poiLight.lightMapNoAttenuation.xxx; lightMap.x *= lerp(1.0, shadowAttenuationNoStrength, _ShadowReceive); lightMap.y *= lerp(1.0, shadowAttenuationNoStrength, _Shadow2ndReceive); lightMap.z *= lerp(1.0, shadowAttenuationNoStrength, _Shadow3rdReceive); - + float4 shadowBorderMask = 1; if (_ShadowBorderMapToggle) { @@ -18100,19 +18336,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 shadowShift0 = float2(_ShadowAOShift.x, _ShadowAOShift.y); float2 shadowShift1 = float2(_ShadowAOShift.z, _ShadowAOShift.w); float2 shadowShift2 = float2(_ShadowAOShift2.x, _ShadowAOShift2.y); - + //float2 shadowShift0 = float2(GetRemapMinValue(_ShadowAOShift.x, _ShadowAOShift.y), GetRemapMaxValue(_ShadowAOShift.x, _ShadowAOShift.y)); //float2 shadowShift1 = float2(GetRemapMinValue(_ShadowAOShift.z, _ShadowAOShift.w), GetRemapMaxValue(_ShadowAOShift.z, _ShadowAOShift.w)); //float2 shadowShift2 = float2(GetRemapMinValue(_ShadowAOShift2.x, _ShadowAOShift2.y), GetRemapMaxValue(_ShadowAOShift2.x, _ShadowAOShift2.y)); - + shadowShift0.y = (shadowShift0.x == shadowShift0.y) ? (shadowShift0.y + 0.001f) : shadowShift0.y; shadowShift1.y = (shadowShift1.x == shadowShift1.y) ? (shadowShift1.y + 0.001f) : shadowShift1.y; shadowShift2.y = (shadowShift2.x == shadowShift2.y) ? (shadowShift2.y + 0.001f) : shadowShift2.y; - + shadowShift0 = float2(1.0f / (shadowShift0.y - shadowShift0.x), shadowShift0.x / (shadowShift0.x - shadowShift0.y)); shadowShift1 = float2(1.0f / (shadowShift1.y - shadowShift1.x), shadowShift1.x / (shadowShift1.x - shadowShift1.y)); shadowShift2 = float2(1.0f / (shadowShift2.y - shadowShift2.x), shadowShift2.x / (shadowShift2.x - shadowShift2.y)); - + #if defined(PROP_SHADOWBORDERMASK) || !defined(OPTIMIZER_ENABLED) float2 shadowBorderMaskUV = poiUV(poiMesh.uv[_ShadowBorderMaskUV], _ShadowBorderMask_ST); if (_ShadowBorderMaskLOD) @@ -18124,14 +18360,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" shadowBorderMask = POI2D_SAMPLER_PAN(_ShadowBorderMask, _linear_repeat, shadowBorderMaskUV, _ShadowBorderMaskPan); } #endif - + shadowBorderMask.r = saturate(shadowBorderMask.r * shadowShift0.x + shadowShift0.y); shadowBorderMask.g = saturate(shadowBorderMask.g * shadowShift1.x + shadowShift1.y); shadowBorderMask.b = saturate(shadowBorderMask.b * shadowShift2.x + shadowShift2.y); - + lightMap.xyz = _ShadowPostAO ? lightMap.xyz : lightMap.xyz * shadowBorderMask.rgb; } - + if (_LightingMulitlayerNonLinear) { lns.x = poiEdgeNonLinearNoSaturate(lightMap.x, _ShadowBorder, _ShadowBlur * blurMap.r); @@ -18153,7 +18389,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //poiLight.finalLighting = lns.rgb; //return; float3 indirectColor = 1; - + if (_ShadowColor.a > 0) { #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED) @@ -18185,7 +18421,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a; indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z); } - + indirectColor = lerp(indirectColor, indirectColor * poiFragData.baseColor, _ShadowMainStrength); poiLight.rampedLightMap = lns.x; indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb * _ShadowBorderColor.a); @@ -18193,11 +18429,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirectColor = lerp(poiLight.directColor, indirectColor, shadowStrength * poiLight.shadowMask); poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x) * attenuation; #endif - + #ifdef _LIGHTINGMODE_SHADEMAP poiLight.finalLighting = poiLight.directColor * attenuation; #endif - + #ifdef _LIGHTINGMODE_REALISTIC UnityLight light; light.dir = poiLight.direction; @@ -18213,11 +18449,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirectLight.diffuse = max(indirectLight.diffuse * _PPLightingMultiplier, 0); indirectLight.diffuse = max(indirectLight.diffuse + _PPLightingAddition, 0); #endif - + poiLight.rampedLightMap = poiLight.nDotLSaturated; - poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, indirectLight).xyz, _LightingMinLightBrightness); + poiLight.finalLighting = max(POI_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, indirectLight).xyz, _LightingMinLightBrightness); #endif - + #ifdef _LIGHTINGMODE_CLOTH #if defined(PROP_CLOTHMETALLICSMOOTHNESSMAP) || !defined(OPTIMIZER_ENABLED) float4 clothmapsample = POI2D_SAMPLER_PAN(_ClothMetallicSmoothnessMap, _MainTex, poiUV(poiMesh.uv[_ClothMetallicSmoothnessMapUV], _ClothMetallicSmoothnessMap_ST), _ClothMetallicSmoothnessMapPan); @@ -18232,22 +18468,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float reflectance = _ClothReflectance; float clothmask = 1; #endif - + float perceptualRoughness = pow(roughness, 2); float clampedRoughness = max(0.002, perceptualRoughness); - + float f0 = 0.16 * reflectance * reflectance * (1 - metallic) + poiFragData.baseColor * metallic; float3 fresnel = Fresnel(f0, poiLight.nDotV); - + float3 dfg = SampleDFG(poiLight.nDotV, perceptualRoughness); - + float energyCompensation = EnvBRDFEnergyCompensation(dfg, f0, clothmask); - + poiLight.finalLighting = Fd_Burley(perceptualRoughness, poiLight.nDotV, poiLight.nDotLSaturated, poiLight.lDotH); - poiLight.finalLighting *= _LightColor0 * attenuation * shadowAttenuation * poiLight.nDotLSaturated; + poiLight.finalLighting *= poiLight.directColor * attenuation * shadowAttenuation * poiLight.nDotLSaturated; poiLight.rampedLightMap = poiLight.nDotLSaturated; + float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F - + #ifdef UNITY_PASS_FORWARDBASE float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w); float3 indirectDiffuse; @@ -18255,15 +18492,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirectDiffuse.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, poiMesh.normals[1]); indirectDiffuse.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, poiMesh.normals[1]); indirectDiffuse = max(0, indirectDiffuse); - + indirectDiffuse = lerp(indirectDiffuse, dot(indirectDiffuse, float3(0.299, 0.587, 0.114)), _LightingMonochromatic); + float3 indirectSpecular = IndirectSpecular(dfg, roughness, poiLight.occlusion, energyCompensation, clothmask, indirectDiffuse, f0, poiLight, poiFragData, poiCam, poiMesh); poiLight.finalLightAdd += max(0, specular + indirectSpecular); poiLight.finalLighting += indirectDiffuse * poiLight.occlusion; + #endif - + poiFragData.baseColor.xyz *= (1 - metallic); #endif - + #ifdef _LIGHTINGMODE_WRAPPED #define GREYSCALE_VECTOR float3(.33333, .33333, .33333) float3 directColor = _LightColor0.rgb * saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)); @@ -18273,19 +18512,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif directColor = lerp(directColor, dot(directColor, float3(0.299, 0.587, 0.114)), _LightingMonochromatic); // Duplicated from Lightdata due to recreating the light colour indirectColor = lerp(indirectColor, dot(indirectColor, float3(0.299, 0.587, 0.114)), _LightingMonochromatic); // Ditto^ - + float3 ShadeSH9Plus_2 = GetSHMaxL1(); float bw_topDirectLighting_2 = dot(_LightColor0.rgb, GREYSCALE_VECTOR); float bw_directLighting = dot(directColor, GREYSCALE_VECTOR); float bw_indirectLighting = dot(indirectColor, GREYSCALE_VECTOR); float bw_topIndirectLighting = dot(ShadeSH9Plus_2, GREYSCALE_VECTOR); - + poiLight.lightMap = smoothstep(0, bw_topIndirectLighting + bw_topDirectLighting_2, bw_indirectLighting + bw_directLighting) * min(poiLight.detailShadow, shadowAttenuation); poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap))); float3 mathRamp = lerp(float3(1, 1, 1), saturate(lerp((_LightingShadowColor * lerp(indirectColor, 1, _LightingIgnoreAmbientColor)), float3(1, 1, 1), saturate(poiLight.rampedLightMap))), _ShadowStrength); - + directColor *= saturate(poiLight.rampedLightMap + 1 - _ShadowStrength) * _LightingWrappedColor; - + float3 finalWrap = directColor + indirectColor; if (_LightingCapEnabled) { @@ -18298,11 +18537,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //finalWrap *= attenuation; poiLight.finalLighting = finalWrap * saturate(mathRamp + 1 - _ShadowStrength); #endif - + #ifdef _LIGHTINGMODE_SKIN float3 ambientNormalWorld = poiMesh.normals[1];//aTangentToWorld(s, s.blurredNormalTangent); poiLight.rampedLightMap = poiLight.nDotLSaturated; - + // Scattering mask. #if defined(PROP_SKINTHICKNESS) || !defined(OPTIMIZER_ENABLED) float subsurface = 1 - POI2D_SAMPLER_PAN(_SkinThicknessMap, _MainTex, poiUV(poiMesh.uv[_SkinThicknessMapUV], _SkinThicknessMap_ST), _SkinThicknessMapPan).r; @@ -18318,33 +18557,33 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" subsurface = pow(subsurface, _SkinThicknessPower); } float skinScattering = saturate(subsurface * _SssScale * 2); - + // Skin subsurface depth absorption tint. // cf http://www.crytek.com/download/2014_03_25_CRYENGINE_GDC_Schultz.pdf pg 35 // link dead, https://ia600902.us.archive.org/25/items/crytek_presentations/2014_03_25_CRYENGINE_GDC_Schultz.pdf half3 absorption = exp((1.0h - subsurface) * _SssTransmissionAbsorption.rgb); - + // Albedo scale for absorption assumes ~0.5 luminance for Caucasian skin. absorption *= saturate(poiFragData.baseColor * unity_ColorSpaceDouble.rgb); - + // Blurred normals for indirect diffuse and direct scattering. ambientNormalWorld = normalize(lerp(poiMesh.normals[1], ambientNormalWorld, _SssBumpBlur)); - + float ndlBlur = dot(poiMesh.normals[1], poiLight.direction) * 0.5h + 0.5h; float lumi = dot(poiLight.directColor, half3(0.2126h, 0.7152h, 0.0722h)); float4 sssLookupUv = float4(ndlBlur, skinScattering * lumi, 0.0f, 0.0f); half3 sss = poiLight.lightMap * tex2Dlod(_SkinLUT, sssLookupUv).rgb; poiLight.finalLighting = lerp(poiLight.directColor, min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) * poiLight.occlusion + (sss * poiLight.directColor), poiLight.directColor), _ShadowStrength * poiLight.shadowMask) * attenuation; #endif - + #ifdef _LIGHTINGMODE_SDF float3 forward = normalize(UnityObjectToWorldDir(float4(_SDFForward.xyz, 1))); float3 left = normalize(UnityObjectToWorldDir(float4(_SDFLeft.xyz, 1))); float3 lightDirHorizontal = normalize(float3(poiLight.direction.x, 0, poiLight.direction.z)); - + float lightAtten = 1 - (dot(lightDirHorizontal, forward) * 0.5 + 0.5); float filpU = sign(dot(lightDirHorizontal, left)); - + #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED) float shadowSDF = POI2D_SAMPLER_PAN(_SDFShadingTexture, _MainTex, poiUV(poiMesh.uv[_SDFShadingTextureUV], _SDFShadingTexture_ST) * float2(filpU, 1), _SDFShadingTexturePan).r; #else @@ -18352,14 +18591,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif float blur = _SDFBlur * 0.1; float faceShadow = smoothstep(lightAtten - blur, lightAtten + blur, shadowSDF) * poiLight.detailShadow; - + float3 indirectColor = _LightingShadowColor.rgb; indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor); indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask); - + poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, faceShadow) * attenuation; #endif - + if (poiFragData.toggleVertexLights) { #if defined(VERTEXLIGHT_ON) @@ -18380,7 +18619,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (lightingMode == 0) { vertexLighting = max(vertexLighting, poiLight.vColor[index] * poiLight.vSaturatedDotNL[index] * poiLight.detailShadow); // Realistic - + } //UNITY_BRANCH // Toon @@ -18398,13 +18637,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + #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 PoiMesh poiMesh, in PoiCam poiCam) + 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] + calcParallax(depth + 1, poiCam); + 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 = 1.0 - uv.x; + 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); @@ -18413,17 +18663,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) + inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed, float colorSpace) { //UNITY_BRANCH if (enabled) { - color = hueShift(color, shift + _Time.x * shiftSpeed); + color = hueShift(color, shift + _Time.x * shiftSpeed, colorSpace); } return color; } - + inline float applyTilingClipping(float enabled, float2 uv) { float ret = 1; @@ -18437,7 +18686,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return ret; } - + struct PoiDecal { float m_DecalFaceMask; @@ -18460,7 +18709,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" half m_DecalRotationSpeed; float m_DecalEmissionStrength; float m_DecalBlendAlpha; - float m_DecalOverrideAlpha; + float m_DecalAlphaBlendMode; + float m_DecalHueShiftColorSpace; float m_DecalHueShiftEnabled; float m_DecalHueShift; float m_DecalHueShiftSpeed; @@ -18473,7 +18723,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; @@ -18493,7 +18746,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 m_AudioLinkDecalChannelSeparation; float m_AudioLinkDecalChannelSeparationBand; #endif - + float4 decalColor; float2 decalScale; float decalRotation; @@ -18502,14 +18755,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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 @@ -18523,44 +18776,63 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #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, poiMesh, 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); + decalColor.rgb = decalHueShift(m_DecalHueShiftEnabled, decalColor.rgb, m_DecalHueShift + poiLight.nDotV * m_DecalHueAngleStrength, m_DecalHueShiftSpeed, m_DecalHueShiftColorSpace); 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) + + 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, m_DecalSideOffset +sideMod, m_DecalDepth, poiMesh, poiCam); + 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); + decalColor.rgb = decalHueShift(m_DecalHueShiftEnabled, decalColor.rgb, m_DecalHueShift + poiLight.nDotV * m_DecalHueAngleStrength, m_DecalHueShiftSpeed, m_DecalHueShiftColorSpace); 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); + 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 = 0; + 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, poiMesh, poiCam); - float2 uvSample1 = decalUV(m_DecalTextureUV, m_DecalPosition - positionOffset, m_DecalRotation + decalRotation, m_DecalRotationSpeed, decalScale, m_DecalSideOffset +sideMod, m_DecalDepth, poiMesh, poiCam); - + 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); - sample1.rgb = decalHueShift(m_DecalHueShiftEnabled, sample1.rgb, m_DecalHueShift + poiLight.nDotV * m_DecalHueAngleStrength, m_DecalHueShiftSpeed); - + + sample0.rgb = decalHueShift(m_DecalHueShiftEnabled, sample0.rgb, m_DecalHueShift + poiLight.nDotV * m_DecalHueAngleStrength, m_DecalHueShiftSpeed, m_DecalHueShiftColorSpace); + sample1.rgb = decalHueShift(m_DecalHueShiftEnabled, sample1.rgb, m_DecalHueShift + poiLight.nDotV * m_DecalHueAngleStrength, m_DecalHueShiftSpeed, m_DecalHueShiftColorSpace); + float3 channelSeparationColor = HUEtoRGB(frac(m_DecalChannelSeparationHue)); - + if (m_DecalChannelSeparationPremultiply) { decalColor.rgb = lerp(sample0 * sample0.a, sample1 * sample1.a, channelSeparationColor); @@ -18572,19 +18844,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -18598,49 +18874,112 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } 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) { - alphaOverride += 1; + 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]); + //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 { - decalAlpha = lerp(decalAlpha, 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); } } - - if (m_DecalFaceMask > 0) + + if (m_DecalApplyGlobalMaskIndex > 0) { - if (m_DecalFaceMask == 1 && !poiMesh.isFrontFace) + 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) { - decalColor.a *= 0; + videoDimensions.xy *= float2((decalScale.y / decalScale.x), 1); } - else if (m_DecalFaceMask == 2 && poiMesh.isFrontFace) + else { - decalColor.a *= 0; + videoDimensions.xy *= float2(1, (decalScale.x / decalScale.y)); } } - - float decalAlphaMixed = decalColor.a * saturate(m_DecalBlendAlpha + audioLinkDecalAlpha); - - if (m_DecalApplyGlobalMaskIndex > 0) + + if (CorrectionType != 2) { - applyToGlobalMask(poiMods, m_DecalApplyGlobalMaskIndex - 1, m_DecalApplyGlobalMaskBlendType, decalAlphaMixed); + 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)); + } + } } - - 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); + 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) @@ -18648,7 +18987,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float4 decalMask = 1; #endif - + #ifdef TPS_Penetrator if (_DecalTPSDepthMaskEnabled) { @@ -18658,11 +18997,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; @@ -18689,6 +19028,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Decal0.m_DecalBlendAlpha = _DecalBlendAlpha; Decal0.m_DecalOverrideAlpha = _DecalOverrideAlpha; Decal0.m_DecalHueShiftEnabled = _DecalHueShiftEnabled; + Decal0.m_DecalHueShiftColorSpace = _DecalHueShiftColorSpace; Decal0.m_DecalHueShift = _DecalHueShift; Decal0.m_DecalHueShiftSpeed = _DecalHueShiftSpeed; Decal0.m_DecalDepth = _Decal0Depth; @@ -18700,9 +19040,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; @@ -18721,30 +19063,73 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Decal0.m_AudioLinkDecalSideMax = _AudioLinkDecal0SideMax; Decal0.m_AudioLinkDecalChannelSeparation = _AudioLinkDecal0ChannelSeparation; Decal0.m_AudioLinkDecalChannelSeparationBand = _AudioLinkDecal0ChannelSeparationBand; - + Decal0.InitAudiolink(poiMods); #endif - - #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED) - //ifex _Decal0ChannelSeparationEnable==0 - if (_Decal0ChannelSeparationEnable) + + if (!_Decal0VideoEnabled) { - Decal0.SampleDecalChannelSeparation(_DecalTexture, poiMods, poiLight, poiMesh, poiCam); + + #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); } - //endex - //ifex _Decal0ChannelSeparationEnable==1 - if (!_Decal0ChannelSeparationEnable) + else { - Decal0.SampleDecal(_DecalTexture, poiMods, poiLight, poiMesh, poiCam); + 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); + } } - //endex - #else - Decal0.SampleDecalNoTexture(poiMods, poiLight, poiMesh, poiCam); - #endif - Decal0.Apply(alphaOverride, decalAlpha, poiFragData, poiMesh, poiCam, poiMods, poiLight); #endif //endex - + //ifex _DecalEnabled1==0 #ifdef GEOM_TYPE_BRANCH_DETAIL PoiDecal Decal1; @@ -18771,6 +19156,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Decal1.m_DecalBlendAlpha = _DecalBlendAlpha1; Decal1.m_DecalOverrideAlpha = _DecalOverrideAlpha1; Decal1.m_DecalHueShiftEnabled = _DecalHueShiftEnabled1; + Decal1.m_DecalHueShiftColorSpace = _DecalHueShiftColorSpace1; Decal1.m_DecalHueShift = _DecalHueShift1; Decal1.m_DecalHueShiftSpeed = _DecalHueShiftSpeed1; Decal1.m_DecalDepth = _Decal1Depth; @@ -18782,9 +19168,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; @@ -18803,30 +19191,71 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Decal1.m_AudioLinkDecalSideMax = _AudioLinkDecal1SideMax; Decal1.m_AudioLinkDecalChannelSeparation = _AudioLinkDecal1ChannelSeparation; Decal1.m_AudioLinkDecalChannelSeparationBand = _AudioLinkDecal1ChannelSeparationBand; - + Decal1.InitAudiolink(poiMods); #endif - - #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED) - //ifex _Decal1ChannelSeparationEnable==0 - if (_Decal1ChannelSeparationEnable) + + if (!_Decal1VideoEnabled) { - Decal1.SampleDecalChannelSeparation(_DecalTexture1, poiMods, poiLight, poiMesh, poiCam); + #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); } - //endex - //ifex _Decal1ChannelSeparationEnable==1 - if (!_Decal1ChannelSeparationEnable) + else { - Decal1.SampleDecal(_DecalTexture1, poiMods, poiLight, poiMesh, poiCam); + 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); + } } - //endex - #else - Decal1.SampleDecalNoTexture(poiMods, poiLight, poiMesh, poiCam); - #endif - Decal1.Apply(alphaOverride, decalAlpha, poiFragData, poiMesh, poiCam, poiMods, poiLight); #endif //endex - + //ifex _DecalEnabled2==0 #ifdef GEOM_TYPE_FROND PoiDecal Decal2; @@ -18852,6 +19281,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Decal2.m_DecalEmissionStrength = _DecalEmissionStrength2; Decal2.m_DecalBlendAlpha = _DecalBlendAlpha2; Decal2.m_DecalOverrideAlpha = _DecalOverrideAlpha2; + Decal2.m_DecalHueShiftColorSpace = _DecalHueShiftColorSpace2; Decal2.m_DecalHueShiftEnabled = _DecalHueShiftEnabled2; Decal2.m_DecalHueShift = _DecalHueShift2; Decal2.m_DecalHueShiftSpeed = _DecalHueShiftSpeed2; @@ -18864,9 +19294,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; @@ -18885,30 +19317,70 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Decal2.m_AudioLinkDecalSideMax = _AudioLinkDecal2SideMax; Decal2.m_AudioLinkDecalChannelSeparation = _AudioLinkDecal2ChannelSeparation; Decal2.m_AudioLinkDecalChannelSeparationBand = _AudioLinkDecal2ChannelSeparationBand; - + Decal2.InitAudiolink(poiMods); #endif - - #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED) - //ifex _Decal2ChannelSeparationEnable==0 - if (_Decal2ChannelSeparationEnable) + if (!_Decal2VideoEnabled) { - Decal2.SampleDecalChannelSeparation(_DecalTexture2, poiMods, poiLight, poiMesh, poiCam); + #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); } - //endex - //ifex _Decal2ChannelSeparationEnable==1 - if (!_Decal2ChannelSeparationEnable) + else { - Decal2.SampleDecal(_DecalTexture2, poiMods, poiLight, poiMesh, poiCam); + 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); + } } - //endex - #else - Decal2.SampleDecalNoTexture(poiMods, poiLight, poiMesh, poiCam); - #endif - Decal2.Apply(alphaOverride, decalAlpha, poiFragData, poiMesh, poiCam, poiMods, poiLight); #endif //endex - + //ifex _DecalEnabled3==0 #ifdef DEPTH_OF_FIELD_COC_VIEW PoiDecal Decal3; @@ -18934,6 +19406,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Decal3.m_DecalEmissionStrength = _DecalEmissionStrength3; Decal3.m_DecalBlendAlpha = _DecalBlendAlpha3; Decal3.m_DecalOverrideAlpha = _DecalOverrideAlpha3; + Decal3.m_DecalHueShiftColorSpace = _DecalHueShiftColorSpace3; Decal3.m_DecalHueShiftEnabled = _DecalHueShiftEnabled3; Decal3.m_DecalHueShift = _DecalHueShift3; Decal3.m_DecalHueShiftSpeed = _DecalHueShiftSpeed3; @@ -18946,9 +19419,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; @@ -18967,40 +19442,81 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Decal3.m_AudioLinkDecalSideMax = _AudioLinkDecal3SideMax; Decal3.m_AudioLinkDecalChannelSeparation = _AudioLinkDecal3ChannelSeparation; Decal3.m_AudioLinkDecalChannelSeparationBand = _AudioLinkDecal3ChannelSeparationBand; - + Decal3.InitAudiolink(poiMods); #endif - - #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED) - //ifex _Decal3ChannelSeparationEnable==0 - if (_Decal3ChannelSeparationEnable) + if (!_Decal3VideoEnabled) { - Decal3.SampleDecalChannelSeparation(_DecalTexture3, poiMods, poiLight, poiMesh, poiCam); + #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); } - //endex - //ifex _Decal3ChannelSeparationEnable==1 - if (!_Decal3ChannelSeparationEnable) + else { - Decal3.SampleDecal(_DecalTexture3, poiMods, poiLight, poiMesh, poiCam); + 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); + } } - //endex - #else - Decal3.SampleDecalNoTexture(poiMods, poiLight, poiMesh, poiCam); - #endif - Decal3.Apply(alphaOverride, decalAlpha, poiFragData, poiMesh, poiCam, poiMods, poiLight); #endif //endex - if (alphaOverride) - { - - //poiFragData.baseColor = decalAlpha; - poiFragData.alpha *= decalAlpha; - } + //if (alphaOverride) + //{ + + //poiFragData.baseColor = decalAlpha; + //poiFragData.alpha *= decalAlpha; + + //} //poiFragData.baseColor = saturate(poiFragData.baseColor); - + } #endif - + //ifex _EnableDissolve==0 #ifdef DISTORT void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods, in PoiCam poiCam, in PoiLight poiLight) @@ -19020,19 +19536,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { dissolveMask = maskBlend(dissolveMask, poiMods.globalMask[_DissolveMaskGlobalMask - 1], _DissolveMaskGlobalMaskBlendType); } - + #if defined(PROP_DISSOLVETOTEXTURE) || !defined(OPTIMIZER_ENABLED) dissolveToTexture = POI2D_SAMPLER_PAN(_DissolveToTexture, _MainTex, poiUV(poiMesh.uv[_DissolveToTextureUV], _DissolveToTexture_ST), _DissolveToTexturePan) * float4(poiThemeColor(poiMods, _DissolveTextureColor.rgb, _DissolveTextureColorThemeIndex), _DissolveTextureColor.a); #else - dissolveToTexture = _DissolveTextureColor; + dissolveToTexture = float4(poiThemeColor(poiMods, _DissolveTextureColor.rgb, _DissolveTextureColorThemeIndex), _DissolveTextureColor.a); #endif - + #if defined(PROP_DISSOLVENOISETEXTURE) || !defined(OPTIMIZER_ENABLED) float dissolveNoiseTexture = POI2D_SAMPLER_PAN(_DissolveNoiseTexture, _MainTex, poiUV(poiMesh.uv[_DissolveNoiseTextureUV], _DissolveNoiseTexture_ST), _DissolveNoiseTexturePan).r; #else float dissolveNoiseTexture = 1; #endif - + float da = _DissolveAlpha + _DissolveAlpha0 + _DissolveAlpha1 @@ -19045,22 +19561,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" + _DissolveAlpha8 + _DissolveAlpha9; float dds = _DissolveDetailStrength; - + if (_UVTileDissolveEnabled) { float2 udim = floor(poiMesh.uv[(int)_UVTileDissolveUV]); - + float4 xMask = float4((udim.x >= 0 && udim.x < 1), (udim.x >= 1 && udim.x < 2), (udim.x >= 2 && udim.x < 3), (udim.x >= 3 && udim.x < 4)); - + da += (udim.y >= 0 && udim.y < 1) * dot(float4(_UVTileDissolveAlpha_Row0_0, _UVTileDissolveAlpha_Row0_1, _UVTileDissolveAlpha_Row0_2, _UVTileDissolveAlpha_Row0_3), xMask); da += (udim.y >= 1 && udim.y < 2) * dot(float4(_UVTileDissolveAlpha_Row1_0, _UVTileDissolveAlpha_Row1_1, _UVTileDissolveAlpha_Row1_2, _UVTileDissolveAlpha_Row1_3), xMask); da += (udim.y >= 2 && udim.y < 3) * dot(float4(_UVTileDissolveAlpha_Row2_0, _UVTileDissolveAlpha_Row2_1, _UVTileDissolveAlpha_Row2_2, _UVTileDissolveAlpha_Row2_3), xMask); da += (udim.y >= 3 && udim.y < 4) * dot(float4(_UVTileDissolveAlpha_Row3_0, _UVTileDissolveAlpha_Row3_1, _UVTileDissolveAlpha_Row3_2, _UVTileDissolveAlpha_Row3_3), xMask); } - + #ifdef POI_AUDIOLINK UNITY_BRANCH if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable) @@ -19069,10 +19585,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]); } #endif - + da = saturate(da); dds = saturate(dds); - + if (_DissolveMaskInvert) { dissolveMask = 1 - dissolveMask; @@ -19097,33 +19613,33 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" da *= dissolveMask; dissolveAlpha = da; edgeAlpha = 0; - + [flatten] switch(_DissolveType) { default: // Basic (case 1) - + { da = remap(da, 0, 1, -_DissolveEdgeWidth, 1); dissolveAlpha = da; //Adjust detail strength to avoid artifacts dds *= smoothstep(1, 0.99, da) * lerp(1, smoothstep(0, lerp(0.01, 0.1, dds), da), _DissolveDetailEdgeSmoothing); float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds); - + noise = saturate(noise * 0.998 + 0.001); dissolveAlpha = dissolveAlpha >= noise; edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha); break; } case 2: // Point to Point - + { float3 direction; float3 currentPos; float distanceTo = 0; direction = normalize(_DissolveEndPoint - _DissolveStartPoint); currentPos = lerp(_DissolveStartPoint, _DissolveEndPoint, dissolveAlpha); - + UNITY_BRANCH if (_DissolveP2PWorldLocal != 1) { @@ -19140,17 +19656,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" dissolveAlpha = (distanceTo < 0) ? 1 : 0; edgeAlpha *= 1 - dissolveAlpha; } - + if (_DissolveP2PClamp) { dissolveAlpha = saturate(dissolveAlpha * smoothstep(0, 0.01, da) + smoothstep(0.99, 1, da)); edgeAlpha *= smoothstep(0, 0.01, da); } - + break; } case 3: // Spherical - + { if (_SphericalDissolveInvert) { @@ -19160,14 +19676,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { da = remap(da, 0, 1, -_DissolveEdgeWidth, 1); } - + dissolveAlpha = da; dds *= smoothstep(0, 0.2 * dds + 0.01, dissolveAlpha) * lerp(1, smoothstep(1, 1 - 0.2 * dds - 0.01, dissolveAlpha), _DissolveDetailEdgeSmoothing); float currentDistance = lerp(0, _SphericalDissolveRadius, dissolveAlpha); float fragDistance = distance(_SphericalDissolveCenter, poiMesh.localPos.xyz); float normalizedDistance; normalizedDistance = (fragDistance - currentDistance) / (_SphericalDissolveRadius + 0.0001) - dissolveDetailNoise * dds; - + if (_SphericalDissolveInvert) { dissolveAlpha = (normalizedDistance > 0) ? 1 : 0; @@ -19178,62 +19694,62 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" dissolveAlpha = (normalizedDistance < 0) ? 1 : 0; edgeAlpha = smoothstep(_DissolveEdgeWidth + .00001, 0, normalizedDistance); } - + if (_SphericalDissolveClamp) { da = lerp(da, 1 - da, _SphericalDissolveInvert); dissolveAlpha = saturate(dissolveAlpha * smoothstep(0, 0.01, da) + smoothstep(0.99, 1, da)); edgeAlpha *= smoothstep(0, 0.01, da); } - + break; } case 4: // CenterOut - + { float ramp = 0.5; float noise; - + [flatten] switch(_CenterOutDissolveMode) { case 1: // View Direction - + { ramp = saturate(lerp(poiLight.vertexNDotV, poiLight.nDotV, _CenterOutDissolveNormals)); break; } case 2: // Custom Direction - + { ramp = dot(normalize(_CenterOutDissolveDirection), lerp(poiMesh.normals[0], poiMesh.normals[1], _CenterOutDissolveNormals)); ramp = saturate(ramp * .5 + 0.5); break; } case 3: // Light Direction - + { ramp = lerp(poiLight.vertexNDotL, poiLight.nDotL, _CenterOutDissolveNormals); ramp = saturate(ramp * .5 + 0.5); break; } } - + if (_CenterOutDissolvePower != 1) { ramp = pow(ramp, _CenterOutDissolvePower); } - + if (!_CenterOutDissolveInvert) { ramp = 1 - ramp; } - + da = remap(da, 0, 1, -_DissolveEdgeWidth, 1); dissolveAlpha = da; //Adjust detail strength to avoid artifacts dds *= smoothstep(1, 0.99, da) * lerp(1, smoothstep(0, lerp(0.01, 0.1, dds), da), _DissolveDetailEdgeSmoothing); - + noise = saturate(ramp - dissolveDetailNoise * dds); noise = saturate(noise * 0.998 + 0.001); dissolveAlpha = dissolveAlpha >= noise; @@ -19241,27 +19757,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" break; } } - + #ifndef POI_SHADOW UNITY_BRANCH if (_DissolveHueShiftEnabled) { - dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed); + dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed, _DissolveHueShiftColorSpace); } #endif - + poiFragData.alpha = lerp(poiFragData.alpha, dissolveToTexture.a, dissolveAlpha * .999999); - + #if !defined(POI_PASS_OUTLINE) && !defined(UNITY_PASS_SHADOWCASTER) poiFragData.baseColor = lerp(poiFragData.baseColor, dissolveToTexture.rgb, dissolveAlpha * .999999); - + if (_DissolveApplyGlobalMaskIndex > 0) { applyToGlobalMask(poiMods, _DissolveApplyGlobalMaskIndex - 1, _DissolveApplyGlobalMaskBlendType, dissolveAlpha * .999999); } if (_DissolveInverseApplyGlobalMaskIndex > 0) { - applyToGlobalMask(poiMods, _DissolveInverseApplyGlobalMaskIndex - 1, _DissolveInverseApplyGlobalMaskBlendType, 1-(dissolveAlpha * .999999)); + applyToGlobalMask(poiMods, _DissolveInverseApplyGlobalMaskIndex - 1, _DissolveInverseApplyGlobalMaskBlendType, 1 - (dissolveAlpha * .999999)); } UNITY_BRANCH if (_DissolveEdgeWidth || (_DissolveType == 2 && _DissolveP2PEdgeLength != 0)) @@ -19271,25 +19787,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" UNITY_BRANCH if (_DissolveEdgeHueShiftEnabled) { - edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed); + edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed, _DissolveEdgeHueShiftColorSpace); } #endif poiFragData.baseColor = lerp(poiFragData.baseColor, edgeColor.rgb, smoothstep(0, 1 - _DissolveEdgeHardness * .99999999999, edgeAlpha)); } - + poiFragData.emission += lerp(0, dissolveToTexture * _DissolveToEmissionStrength, dissolveAlpha) + lerp(0, edgeColor.rgb * _DissolveEdgeEmission, smoothstep(0, 1 - _DissolveEdgeHardness * .99999999999, edgeAlpha)); #endif } #endif //endex - + //ifex _EnableAniso==0 #ifdef POI_ANISOTROPICS /* float D_GGX_Anisotropic(float at, float ab, float TdotH, float BdotH, float NdotH) { // Burley 2012, "Physically-Based Shading at Disney" - + // The values at and ab are perceptualRoughness^2, a2 is therefore perceptualRoughness^4 // The dot product below computes perceptualRoughness^8. We cannot fit in fp16 without clamping // the roughness to too high values so we perform the dot product and the division in fp32 @@ -19299,7 +19815,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float b2 = a2 / d2; return a2 * b2 * b2 * (1.0 / UNITY_PI); } - + //-------------------------------------GGX Anisotropic visibility function float V_SmithGGXCorrelated_Anisotropic(float at, float ab, float TdotV, float BdotV, float TdotL, float BdotL, float NdotV, float NdotL) { @@ -19309,7 +19825,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return 0.5 / (lambdaV + lambdaL); } */ - + float calculateAnisotropics(float3 binormal, float offset, float3 normal, float3 viewDir, float3 LightDirection, float exponent, float strength, float shadowMask) { float3 ShiftedTangent = normalize(binormal + offset * normal); @@ -19319,14 +19835,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float dirAtten = smoothstep(-1.0, 0.0, dotTH); return saturate(dirAtten * pow(sinTH, exponent) * strength) * shadowMask; } - + float aaEdgeFeather(float value, float edge, float feather) { float edgeMin = saturate(edge - feather * 0.5); float edgeMax = saturate(edge + feather * 0.5); return saturate((value - edgeMin) / saturate(edgeMax - edgeMin + fwidth(value))); } - + void applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods) { #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED) @@ -19334,33 +19850,33 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float4 specMap = float4(1, 1, 1, 0); #endif - + float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow); #ifdef POI_PASS_ADD shadowMask *= poiLight.additiveShadow; #endif - + if (_AnisoGlobalMask > 0) { - shadowMask = customBlend(shadowMask, poiMods.globalMask[_AnisoGlobalMask-1], _AnisoGlobalMaskBlendType); + shadowMask = customBlend(shadowMask, poiMods.globalMask[_AnisoGlobalMask - 1], _AnisoGlobalMaskBlendType); } - + float spec0 = calculateAnisotropics(lerp(poiMesh.binormal[1], poiMesh.tangent[1], _Aniso0SwitchDirection), _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask); float spec1 = calculateAnisotropics(lerp(poiMesh.binormal[1], poiMesh.tangent[1], _Aniso1SwitchDirection), _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso1Power * 1000, _Aniso1Strength, shadowMask); - + spec0 = lerp(spec0, aaEdgeFeather(spec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode); spec1 = lerp(spec1, aaEdgeFeather(spec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode); - + float3 spec0Color = specMap.rgb * poiThemeColor(poiMods, _Aniso0Tint.rgb, _Aniso0TintIndex); float3 spec1Color = specMap.rgb * poiThemeColor(poiMods, _Aniso1Tint.rgb, _Aniso1TintIndex); - + float3 finalSpec = saturate(saturate(spec0 * spec0Color) + saturate(spec1 * spec1Color)) * lerp(1, poiFragData.baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.directColor, float3(0.299, 0.587, 0.114)), poiLight.directColor, _AnisoUseLightColor); float3 baseColor = poiFragData.baseColor; - + poiFragData.baseColor = lerp(poiFragData.baseColor, spec1Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.directColor, float3(0.299, 0.587, 0.114)), poiLight.directColor, _AnisoUseLightColor), _AnisoReplace * spec1); poiFragData.baseColor = lerp(poiFragData.baseColor, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.directColor, float3(0.299, 0.587, 0.114)), poiLight.directColor, _AnisoUseLightColor), _AnisoReplace * spec0); poiLight.finalLightAdd += max(0, finalSpec * _AnisoAdd); - + if (poiFragData.toggleVertexLights) { #if defined(VERTEXLIGHT_ON) @@ -19368,15 +19884,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { float vSpec0 = calculateAnisotropics(lerp(poiMesh.binormal[1], poiMesh.tangent[1], _Aniso0SwitchDirection), _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vSaturatedDotNL[index]); float vSpec1 = calculateAnisotropics(lerp(poiMesh.binormal[1], poiMesh.tangent[1], _Aniso1SwitchDirection), _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vSaturatedDotNL[index]); - + vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode); vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode); - + float3 vSpec0Color = spec0Color; float3 vSpec1Color = spec1Color; - + poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * vSpec0Color) + saturate(vSpec1 * vSpec1Color)) * lerp(1, poiFragData.baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor) * _AnisoAdd); - + poiFragData.baseColor = lerp(poiFragData.baseColor, vSpec1Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec1); poiFragData.baseColor = lerp(poiFragData.baseColor, vSpec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0); } @@ -19385,7 +19901,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //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) { @@ -19397,7 +19913,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { matcapMask = maskBlend(matcapMask, poiMods.globalMask[globalMaskIndex - 1], globalMaskBlendType); } - + #ifdef POI_AUDIOLINK if (matcapALD.matcapALEnabled > 0) { @@ -19405,7 +19921,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; @@ -19416,7 +19932,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -19428,7 +19944,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; } @@ -19464,13 +19980,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -19488,7 +20004,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float matcapIntensity; struct MatcapAudioLinkData matcapALD; //endex - + //ifex _MatcapEnable==0 // Matcap 1 #ifdef POI_MATCAP0 @@ -19502,14 +20018,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -19524,9 +20040,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -19543,7 +20059,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a); #endif - + matcapIntensity = _MatcapIntensity; #ifdef POI_AUDIOLINK if (matcapALD.matcapALEnabled > 0) @@ -19554,54 +20070,54 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif matcap.rgb *= matcapIntensity; matcap.rgb = lerp(matcap.rgb, matcap.rgb * poiFragData.baseColor.rgb, _MatcapBaseColorMix); - + #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); - + //UNITY_BRANCH if (_MatcapHueShiftEnabled) { - matcap.rgb = hueShift(matcap.rgb, _MatcapHueShift + _Time.x * _MatcapHueShiftSpeed); + matcap.rgb = hueShift(matcap.rgb, _MatcapHueShift + _Time.x * _MatcapHueShiftSpeed, _MatcapHueShiftColorSpace); } - + 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 @@ -19618,14 +20134,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -19640,9 +20156,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -19659,7 +20175,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a); #endif - + matcapIntensity = _Matcap2Intensity; #ifdef POI_AUDIOLINK if (matcapALD.matcapALEnabled > 0) @@ -19670,7 +20186,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif matcap2.rgb *= matcapIntensity; matcap2.rgb = lerp(matcap2.rgb, matcap2.rgb * poiFragData.baseColor.rgb, _Matcap2BaseColorMix); - + #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED) matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan)[_Matcap2MaskChannel]; #else @@ -19680,50 +20196,50 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { 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); + matcap2.rgb = hueShift(matcap2.rgb, _Matcap2HueShift + _Time.x * _Matcap2HueShiftSpeed, _Matcap2HueShiftColorSpace); } - + 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; @@ -19734,14 +20250,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -19756,9 +20272,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -19775,7 +20291,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else matcap3 = float4(poiThemeColor(poiMods, _Matcap3Color.rgb, _Matcap3ColorThemeIndex), _Matcap3Color.a); #endif - + matcapIntensity = _Matcap3Intensity; #ifdef POI_AUDIOLINK if (matcapALD.matcapALEnabled > 0) @@ -19786,7 +20302,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif matcap3.rgb *= matcapIntensity; matcap3.rgb = lerp(matcap3.rgb, matcap3.rgb * poiFragData.baseColor.rgb, _Matcap3BaseColorMix); - + #if defined(PROP_MATCAP3MASK) || !defined(OPTIMIZER_ENABLED) matcap3Mask = POI2D_SAMPLER_PAN(_Matcap3Mask, _MainTex, poiUV(poiMesh.uv[_Matcap3MaskUV], _Matcap3Mask_ST), _Matcap3MaskPan)[_Matcap3MaskChannel]; #else @@ -19796,50 +20312,50 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { 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); + matcap3.rgb = hueShift(matcap3.rgb, _Matcap3HueShift + _Time.x * _Matcap3HueShiftSpeed, _Matcap3HueShiftColorSpace); } - + 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; @@ -19850,14 +20366,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -19872,9 +20388,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -19891,7 +20407,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else matcap4 = float4(poiThemeColor(poiMods, _Matcap4Color.rgb, _Matcap4ColorThemeIndex), _Matcap4Color.a); #endif - + matcapIntensity = _Matcap4Intensity; #ifdef POI_AUDIOLINK if (matcapALD.matcapALEnabled > 0) @@ -19902,7 +20418,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif matcap4.rgb *= matcapIntensity; matcap4.rgb = lerp(matcap4.rgb, matcap4.rgb * poiFragData.baseColor.rgb, _Matcap4BaseColorMix); - + #if defined(PROP_MATCAP4MASK) || !defined(OPTIMIZER_ENABLED) matcap4Mask = POI2D_SAMPLER_PAN(_Matcap4Mask, _MainTex, poiUV(poiMesh.uv[_Matcap4MaskUV], _Matcap4Mask_ST), _Matcap4MaskPan)[_Matcap4MaskChannel]; #else @@ -19912,52 +20428,52 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { 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); + matcap4.rgb = hueShift(matcap4.rgb, _Matcap4HueShift + _Time.x * _Matcap4HueShiftSpeed, _Matcap4HueShiftColorSpace); } - + 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 - + //ifex _CubeMapEnabled==0 #ifdef _CUBEMAP #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED) @@ -19974,7 +20490,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods) { float3 CubeMapUV = 0; - + switch(_CubeMapUVMode) { case 0: // Skybox @@ -19990,7 +20506,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" CubeMapUV = poiMesh.objNormal; break; } - + #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED) if (any(_CubeMapRotation.xyz) || any(_CubeMapRotationPan.xyz)) { @@ -20000,36 +20516,36 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" CubeMapUV = RotateAroundYInDegrees(CubeMapUV.xzy, _CubeMapRotation.z + (_CubeMapRotationPan.z * _Time.y)).xzy; } float4 cubeMap = texCUBElod(_CubeMap, float4(CubeMapUV, (1 - _CubeMapSmoothness) * (1 - _CubeMapSmoothness) * 8)); - + cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex); #else float4 cubeMap = float4(0.21763764082, 0.21763764082, 0.21763764082, .5) * float4(poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex), 1); #endif - + cubeMap.rgb *= _CubeMapIntensity; #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED) float CubeMapMask = POI2D_SAMPLER_PAN(_CubeMapMask, _MainTex, poiUV(poiMesh.uv[_CubeMapMaskUV], _CubeMapMask_ST), _CubeMapMaskPan)[_CubeMapMaskChannel]; #else float CubeMapMask = 1; #endif - + if (_CubeMapMaskGlobalMask > 0) { CubeMapMask = maskBlend(CubeMapMask, poiMods.globalMask[_CubeMapMaskGlobalMask - 1], _CubeMapMaskGlobalMaskBlendType); } - + if (_CubeMapMaskInvert) { CubeMapMask = 1 - CubeMapMask; } - + //UNITY_BRANCH if (_CubeMapHueShiftEnabled) { cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed); cubeMap = PoiColorBCS(cubeMap, _CubeMapBrightness, _CubeMapContrast, _CubeMapSaturation); //cubeMap.rgb = ModifyViaHSV(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed, _CubeMapSaturation, _CubeMapValue); - + } CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask)); float cubeMapAlpha = CubeMapMask * cubeMap.a * _CubeMapBlendAmount; @@ -20040,7 +20556,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _EnableALDecal==0 #ifdef POI_AUDIOLINK #ifdef POI_AL_DECAL @@ -20054,7 +20570,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { colorAndMask.a = customBlend(colorAndMask.a, poiMods.globalMask[_ALDecalGlobalMask-1], _ALDecalGlobalMaskBlendType); } - + float2 uv = poiMesh.uv[_ALDecalUV]; float2 decalCenter = _ALUVPosition; float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed); @@ -20062,10 +20578,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) - _ALUVScale.xz / 2 + _ALUVPosition, _ALUVScale.yw / 2 + _ALUVPosition, float2(0, 0), float2(1, 1)); - + // Mask float4 audioLinkMask = 1.0; - + // UV float2 aluv = uv; if (_ALDecalUVMode == 1) @@ -20074,7 +20590,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" aluv.x = frac(atan2(uvdir.y, uvdir.x) * UNITY_INV_TWO_PI); aluv.y = length(uvdir); } - + // Scale / Offset / Step float maskY = aluv.y; if (_ALDecalUVMode == 1) @@ -20086,29 +20602,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { maskX = remap(maskX, _ALDecaldCircleDimensions.z, _ALDecaldCircleDimensions.w, 0, 1); } - + float maskVolume = _ALDecalVolumeStep != 0.0 ? floor(maskY * _ALDecalVolumeStep) / _ALDecalVolumeStep : maskY; float maskBand = _ALDecalBandStep != 0.0 ? floor(maskX * _ALDecalBandStep) / _ALDecalBandStep : maskX; - + // Copy audioLinkMask.r = maskVolume; audioLinkMask.g = maskBand; - + // Clip audioLinkMask.b = maskVolume < _ALDecalVolumeClipMin || maskVolume > _ALDecalVolumeClipMax ? 0.0 : audioLinkMask.b; audioLinkMask.b = maskBand < _ALDecalBandClipMin || maskBand > _ALDecalBandClipMax ? 0.0 : audioLinkMask.b; - + // Shape Clip if (_ALDecalShapeClip) { float volumeth = _ALDecalShapeClipVolumeWidth; if (_ALDecalVolumeStep != 0.0) audioLinkMask.b = frac(maskY * _ALDecalVolumeStep) > volumeth ? 0.0 : audioLinkMask.b; - + float bandwidth = _ALDecalUVMode == 1 ? _ALDecalShapeClipBandWidth / aluv.y : _ALDecalShapeClipBandWidth; float bandth = 1.0 - bandwidth; if (_ALDecalBandStep != 0.0) audioLinkMask.b = frac(maskX * _ALDecalBandStep + bandth * 0.5) < bandth ? 0.0 : audioLinkMask.b; } - + // AudioLink float2 audioLinkUV = float2(frac(audioLinkMask.g * 2.0), 4.5 / 4.0 + floor(audioLinkMask.g * 2.0) / 4.0); audioLinkUV.y *= 0.0625; @@ -20118,27 +20634,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" audioLinkValue = saturate(audioLinkValue) * audioLinkMask.b; //clip(audioLinkValue - .5); audioLinkValue *= colorAndMask.a; - + if (!poiMods.audioLinkAvailable) { audioLinkValue = 0; } - + float3 alColorChord = _AudioTexture.Sample(sampler_linear_clamp, float2(maskX, 24.5 / 64.0)).rgb; float volumeColorSrc = audioLinkMask.g; if (_ALDecalVolumeColorSource == 1) volumeColorSrc = audioLinkMask.r; if (_ALDecalVolumeColorSource == 2) volumeColorSrc = audioVal; - + float3 lowColor = _ALDecalVolumeColorLow.rgb * poiThemeColor(poiMods, _ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorLowThemeIndex); float3 midColor = _ALDecalVolumeColorMid.rgb * poiThemeColor(poiMods, _ALDecalVolumeColorMid.rgb, _ALDecalVolumeColorMidThemeIndex); float3 highColor = _ALDecalVolumeColorHigh.rgb * poiThemeColor(poiMods, _ALDecalVolumeColorHigh.rgb, _ALDecalVolumeColorHighThemeIndex); - + float3 volumeColor = lerp(lowColor, midColor, saturate(volumeColorSrc * 2)); volumeColor = lerp(volumeColor, highColor, saturate(volumeColorSrc * 2 - 1)); - + float3 emissionColor = lerp(lowColor * _ALDecalLowEmission, midColor * _ALDecalMidEmission, saturate(volumeColorSrc * 2)); emissionColor = lerp(emissionColor, highColor * _ALDecalHighEmission, saturate(volumeColorSrc * 2 - 1)); - + //poiFragData.baseColor = lerp(poiFragData.baseColor, volumeColor, audioLinkValue); #if defined(POI_PASS_BASE) || defined(POI_PASS_ADD) poiFragData.emission += emissionColor * audioLinkValue; @@ -20149,24 +20665,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableVolumeColor==0 #ifdef POI_AUDIOLINK #ifdef POI_AL_VOLUMECOLOR void ApplyAudioLinkVolumeColor(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods) { float volume = AudioLinkLerpMultiline(ALPASS_DFT + float2(poiMesh.uv[_ALVolumeColorUV][_ALVolumeColorDirection] * AUDIOLINK_ETOTALBINS, 0.0)).b; - + float3 lowColor = _ALVolumeColorLow.rgb * poiThemeColor(poiMods, _ALVolumeColorLow.rgb, _ALVolumeColorLowThemeIndex); float3 midColor = _ALVolumeColorMid.rgb * poiThemeColor(poiMods, _ALVolumeColorMid.rgb, _ALVolumeColorMidThemeIndex); float3 highColor = _ALVolumeColorHigh.rgb * poiThemeColor(poiMods, _ALVolumeColorHigh.rgb, _ALVolumeColorHighThemeIndex); - + float3 volumeColor = lerp(lowColor, midColor, saturate(volume * 2)); volumeColor = lerp(volumeColor, highColor, saturate(volume * 2 - 1)); - + float3 emissionColor = lerp(lowColor * _ALLowEmission, midColor * _ALMidEmission, saturate(volume * 2)); emissionColor = lerp(emissionColor, highColor * _ALHighEmission, saturate(volume * 2 - 1)); - + #if defined(POI_PASS_BASE) || defined(POI_PASS_ADD) poiFragData.emission += emissionColor * poiMods.audioLinkAvailable; poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor, _ALVolumeColorBlendType), saturate(_ALVolumeColorBlendAlpha * poiMods.audioLinkAvailable)); @@ -20175,10 +20691,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableFlipbook==0 #ifdef _SUNDISK_HIGH_QUALITY - + void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) { #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED) @@ -20193,14 +20709,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" flipBookMask = maskBlend(flipBookMask, poiMods.globalMask[_FlipbookMaskGlobalMask-1], _FlipbookMaskGlobalMaskBlendType); } float4 flipbookScaleOffset = _FlipbookScaleOffset; - + #ifdef POI_AUDIOLINK if (poiMods.audioLinkAvailable) { flipbookScaleOffset.xy += lerp(_AudioLinkFlipbookScale.xy, _AudioLinkFlipbookScale.zw, poiMods.audioLink[_AudioLinkFlipbookScaleBand]); } #endif - + flipbookScaleOffset.xy = 1 - flipbookScaleOffset.xy; float2 uv = frac(poiMesh.uv[_FlipbookTexArrayUV]); float theta = radians(_FlipbookRotation + _Time.z * _FlipbookRotationSpeed); @@ -20211,7 +20727,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" uv = float2((uv.x - spriteCenter.x) * cs - (uv.y - spriteCenter.y) * sn + spriteCenter.x, (uv.x - spriteCenter.x) * sn + (uv.y - spriteCenter.y) * cs + spriteCenter.y); float4 sideOffset = float4(-(_FlipbookSideOffset.x), _FlipbookSideOffset.y, -(_FlipbookSideOffset.z), _FlipbookSideOffset.w); float2 newUV = remap(uv, float2(0, 0) + flipbookScaleOffset.xy / 2 + flipbookScaleOffset.zw + sideOffset.xz, float2(1, 1) - flipbookScaleOffset.xy / 2 + flipbookScaleOffset.zw + sideOffset.yw, float2(0, 0), float2(1, 1)); - + UNITY_BRANCH if (_FlipbookTiled == 0) { @@ -20225,7 +20741,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float height; float totalFrames; _FlipbookTexArray.GetDimensions(width, height, totalFrames); - + if (_FlipbookStartAndEnd) { totalFrames -= (totalFrames - min(max(_FlipbookStartFrame, _FlipbookEndFrame), totalFrames)); @@ -20263,6 +20779,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame))); + UNITY_BRANCH if (_FlipbookCrossfadeEnabled) { @@ -20274,7 +20791,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % totalFramesCF))); flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame))); } - + UNITY_BRANCH if (_FlipbookIntensityControlsAlpha) { @@ -20289,11 +20806,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex); } - + UNITY_BRANCH if (_FlipbookHueShiftEnabled) { - flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed); + flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed, _FlipbookHueShiftColorSpace); } half flipbookAlpha = 1; #ifdef POI_AUDIOLINK @@ -20302,11 +20819,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" flipbookAlpha += saturate(lerp(_AudioLinkFlipbookAlpha.x, _AudioLinkFlipbookAlpha.y, poiMods.audioLink[_AudioLinkFlipbookAlphaBand])); } #endif - + #if !defined(POI_PASS_OUTLINE) && !defined(UNITY_PASS_SHADOWCASTER) - + poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, flipBookPixel.rgb, _FlipbookBlendType), flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha); - + float flipbookEmissionStrength = _FlipbookEmissionStrength; #ifdef POI_AUDIOLINK if (poiMods.audioLinkAvailable) @@ -20314,11 +20831,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" flipbookEmissionStrength += max(lerp(_AudioLinkFlipbookEmission.x, _AudioLinkFlipbookEmission.y, poiMods.audioLink[_AudioLinkFlipbookEmissionBand]), 0); } #endif - + poiFragData.emission += lerp(0, flipBookPixel.rgb * flipbookEmissionStrength, flipBookPixel.a * _FlipbookColor.a * flipBookMask * flipbookAlpha); - + #endif - + UNITY_BRANCH if (_FlipbookAlphaControlsFinalAlpha) { @@ -20326,10 +20843,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif } - + #endif //endex - + //ifex _EnableEmission==0 && _EnableEmission1==0 && _EnableEmission2==0 && _EnableEmission3==0 float calculateGlowInTheDark(in float minLight, in float maxLight, in float minEmissionMultiplier, in float maxEmissionMultiplier, in float enabled, in float worldOrMesh, in PoiLight poiLight) { @@ -20343,7 +20860,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return glowInTheDarkMultiplier; } - + float calculateScrollingEmission(in float3 direction, in float velocity, in float interval, in float scrollWidth, float offset, float3 position) { scrollWidth = max(scrollWidth, 0); @@ -20355,14 +20872,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" phase = saturate(phase); return (pow(phase, scrollWidth) + pow(1 - phase, scrollWidth * 4)) * 0.5; } - + float calculateBlinkingEmission(in float blinkMin, in float blinkMax, in float blinkVelocity, float offset) { float amplitude = (blinkMax - blinkMin) * 0.5f; float base = blinkMin + amplitude; return sin((_Time.y + offset) * blinkVelocity) * amplitude + base; } - + void applyALEmmissionStrength(in PoiMods poiMods, inout float emissionStrength, in float2 emissionStrengthMod, in float emissionStrengthBand, in float2 _EmissionALMultipliers, in float _EmissionALMultipliersBand, in float enabled) { #ifdef POI_AUDIOLINK @@ -20373,7 +20890,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif } - + void applyALCenterOutEmission(in PoiMods poiMods, in float nDotV, inout float emissionStrength, in float size, in float band, in float2 emissionToAdd, in float enabled, in float duration) { #ifdef POI_AUDIOLINK @@ -20395,21 +20912,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif } //endex - + //ifex _EnableEmission==0 #ifdef _EMISSION float3 applyEmission(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam, in PoiMods poiMods) { - + // First Emission float3 emission0 = 0; float emissionStrength0 = _EmissionStrength; float3 emissionColor0 = 0; applyALEmmissionStrength(poiMods, emissionStrength0, _EmissionAL0StrengthMod, _EmissionAL0StrengthBand, _EmissionAL0Multipliers, _EmissionAL0MultipliersBand, _EmissionAL0Enabled); applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength0, _AudioLinkEmission0CenterOutSize, _AudioLinkEmission0CenterOutBand, _AudioLinkEmission0CenterOut, _EmissionAL0Enabled, _AudioLinkEmission0CenterOutDuration); - + float glowInTheDarkMultiplier0 = calculateGlowInTheDark(_GITDEMinLight, _GITDEMaxLight, _GITDEMinEmissionMultiplier, _GITDEMaxEmissionMultiplier, _EnableGITDEmission, _GITDEWorldOrMesh, poiLight); - + #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED) //UNITY_BRANCH if (!_EmissionCenterOutEnabled) @@ -20423,7 +20940,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else emissionColor0 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex); #endif - + //UNITY_BRANCH if (_ScrollingEmission) { @@ -20433,7 +20950,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { pos = poiMesh.vertexColor.rgb; } - + //UNITY_BRANCH if (_EmissionScrollingUseCurve) { @@ -20446,34 +20963,34 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" emissionStrength0 *= calculateScrollingEmission(_EmissiveScroll_Direction.xyz, _EmissiveScroll_Velocity, _EmissiveScroll_Interval, _EmissiveScroll_Width, _EmissionScrollingOffset, pos); } } - + //UNITY_BRANCH if (_EmissionBlinkingEnabled) { emissionStrength0 *= calculateBlinkingEmission(_EmissiveBlink_Min, _EmissiveBlink_Max, _EmissiveBlink_Velocity, _EmissionBlinkingOffset); } - emissionColor0 = hueShift(emissionColor0, frac(_EmissionHueShift + _EmissionHueShiftSpeed * _Time.x) * _EmissionHueShiftEnabled); + emissionColor0 = hueShift(emissionColor0, frac(_EmissionHueShift + _EmissionHueShiftSpeed * _Time.x) * _EmissionHueShiftEnabled, _EmissionHueShiftColorSpace); emissionColor0 = lerp(emissionColor0, dot(emissionColor0, float3(0.3, 0.59, 0.11)), - (_EmissionSaturation) * _EmissionHueShiftEnabled); - + #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED) float emissionMask0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask, _MainTex, poiUV(poiMesh.uv[_EmissionMaskUV], _EmissionMask_ST) + _Time.x * _EmissionMaskPan)[_EmissionMaskChannel]; #else float emissionMask0 = 1; #endif - + if (_EmissionMaskInvert) { emissionMask0 = 1 - emissionMask0; } - + if (_EmissionMask0GlobalMask > 0) { emissionMask0 = maskBlend(emissionMask0, poiMods.globalMask[_EmissionMask0GlobalMask - 1], _EmissionMask0GlobalMaskBlendType); } - + emissionStrength0 *= glowInTheDarkMultiplier0 * emissionMask0; emission0 = max(emissionStrength0 * emissionColor0, 0); - + #ifdef POI_DISSOLVE //UNITY_BRANCH if (_DissolveEmissionSide != 2) @@ -20481,9 +20998,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" emission0 *= lerp(1 - dissolveAlpha, dissolveAlpha, _DissolveEmissionSide); } #endif - + // poiFragData.finalColor.rgb = lerp(poiFragData.finalColor.rgb, saturate(emission0 + emission1), _EmissionReplace * poiMax(emission0 + emission1)); - + poiFragData.emission += emission0; return emission0 * _EmissionReplace0; } @@ -20493,19 +21010,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #ifdef POI_EMISSION_1 float3 applyEmission1(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam, in PoiMods poiMods) { - + // Second Emission float3 emission1 = 0; float emissionStrength1 = 0; float3 emissionColor1 = 0; - + emissionStrength1 = _EmissionStrength1; applyALEmmissionStrength(poiMods, emissionStrength1, _EmissionAL1StrengthMod, _EmissionAL1StrengthBand, _EmissionAL1Multipliers, _EmissionAL1MultipliersBand, _EmissionAL1Enabled); applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength1, _AudioLinkEmission1CenterOutSize, _AudioLinkEmission1CenterOutBand, _AudioLinkEmission1CenterOut, _EmissionAL1Enabled, _AudioLinkEmission1CenterOutDuration); - + float glowInTheDarkMultiplier1 = calculateGlowInTheDark(_GITDEMinLight1, _GITDEMaxLight1, _GITDEMinEmissionMultiplier1, _GITDEMaxEmissionMultiplier1, _EnableGITDEmission1, _GITDEWorldOrMesh1, poiLight); #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED) - + //UNITY_BRANCH if (!_EmissionCenterOutEnabled1) { @@ -20527,7 +21044,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { pos1 = poiMesh.vertexColor.rgb; } - + //UNITY_BRANCH if (_EmissionScrollingUseCurve1) { @@ -20545,28 +21062,28 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { emissionStrength1 *= calculateBlinkingEmission(_EmissiveBlink_Min1, _EmissiveBlink_Max1, _EmissiveBlink_Velocity1, _EmissionBlinkingOffset1); } - emissionColor1 = hueShift(emissionColor1, frac(_EmissionHueShift1 + _EmissionHueShiftSpeed1 * _Time.x) * _EmissionHueShiftEnabled1); + emissionColor1 = hueShift(emissionColor1, frac(_EmissionHueShift1 + _EmissionHueShiftSpeed1 * _Time.x) * _EmissionHueShiftEnabled1, _EmissionHueShiftColorSpace1); emissionColor1 = lerp(emissionColor1, dot(emissionColor1, float3(0.3, 0.59, 0.11)), - (_EmissionSaturation1) * _EmissionHueShiftEnabled1); - + #if defined(PROP_EMISSIONMASK1) || !defined(OPTIMIZER_ENABLED) float emissionMask1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask1, _MainTex, poiUV(poiMesh.uv[_EmissionMask1UV], _EmissionMask1_ST) + _Time.x * _EmissionMask1Pan)[_EmissionMask1Channel]; #else float emissionMask1 = 1; #endif - + if (_EmissionMaskInvert1) { emissionMask1 = 1 - emissionMask1; } - + if (_EmissionMask1GlobalMask > 0) { emissionMask1 = maskBlend(emissionMask1, poiMods.globalMask[_EmissionMask1GlobalMask - 1], _EmissionMask1GlobalMaskBlendType); } - + emissionStrength1 *= glowInTheDarkMultiplier1 * emissionMask1; emission1 = max(emissionStrength1 * emissionColor1, 0); - + poiFragData.emission += emission1; return emission1 * _EmissionReplace1; } @@ -20576,19 +21093,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #ifdef POI_EMISSION_2 float3 applyEmission2(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam, in PoiMods poiMods) { - + // Second Emission float3 emission2 = 0; float emissionStrength2 = 0; float3 emissionColor2 = 0; - + emissionStrength2 = _EmissionStrength2; applyALEmmissionStrength(poiMods, emissionStrength2, _EmissionAL2StrengthMod, _EmissionAL2StrengthBand, _EmissionAL2Multipliers, _EmissionAL2MultipliersBand, _EmissionAL2Enabled); applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength2, _AudioLinkEmission2CenterOutSize, _AudioLinkEmission2CenterOutBand, _AudioLinkEmission2CenterOut, _EmissionAL2Enabled, _AudioLinkEmission2CenterOutDuration); - + float glowInTheDarkMultiplier2 = calculateGlowInTheDark(_GITDEMinLight2, _GITDEMaxLight2, _GITDEMinEmissionMultiplier2, _GITDEMaxEmissionMultiplier2, _EnableGITDEmission2, _GITDEWorldOrMesh2, poiLight); #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED) - + //UNITY_BRANCH if (!_EmissionCenterOutEnabled2) { @@ -20610,7 +21127,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { pos2 = poiMesh.vertexColor.rgb; } - + //UNITY_BRANCH if (_EmissionScrollingUseCurve2) { @@ -20628,9 +21145,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { emissionStrength2 *= calculateBlinkingEmission(_EmissiveBlink_Min2, _EmissiveBlink_Max2, _EmissiveBlink_Velocity2, _EmissionBlinkingOffset2); } - emissionColor2 = hueShift(emissionColor2, frac(_EmissionHueShift2 + _EmissionHueShiftSpeed2 * _Time.x) * _EmissionHueShiftEnabled2); + emissionColor2 = hueShift(emissionColor2, frac(_EmissionHueShift2 + _EmissionHueShiftSpeed2 * _Time.x) * _EmissionHueShiftEnabled2, _EmissionHueShiftColorSpace2); emissionColor2 = lerp(emissionColor2, dot(emissionColor2, float3(0.3, 0.59, 0.11)), - (_EmissionSaturation2) * _EmissionHueShiftEnabled2); - + #if defined(PROP_EMISSIONMASK2) || !defined(OPTIMIZER_ENABLED) float emissionMask2 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask2, _MainTex, poiUV(poiMesh.uv[_EmissionMask2UV], _EmissionMask2_ST) + _Time.x * _EmissionMask2Pan)[_EmissionMask2Channel]; #else @@ -20640,14 +21157,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { emissionMask2 = 1 - emissionMask2; } - + if (_EmissionMask2GlobalMask > 0) { emissionMask2 = maskBlend(emissionMask2, poiMods.globalMask[_EmissionMask2GlobalMask - 1], _EmissionMask2GlobalMaskBlendType); } emissionStrength2 *= glowInTheDarkMultiplier2 * emissionMask2; emission2 = max(emissionStrength2 * emissionColor2, 0); - + poiFragData.emission += emission2; return emission2 * _EmissionReplace2; } @@ -20657,19 +21174,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #ifdef POI_EMISSION_3 float3 applyEmission3(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam, in PoiMods poiMods) { - + // Second Emission float3 emission3 = 0; float emissionStrength3 = 0; float3 emissionColor3 = 0; - + emissionStrength3 = _EmissionStrength3; applyALEmmissionStrength(poiMods, emissionStrength3, _EmissionAL3StrengthMod, _EmissionAL3StrengthBand, _EmissionAL3Multipliers, _EmissionAL3MultipliersBand, _EmissionAL3Enabled); applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength3, _AudioLinkEmission3CenterOutSize, _AudioLinkEmission3CenterOutBand, _AudioLinkEmission3CenterOut, _EmissionAL3Enabled, _AudioLinkEmission3CenterOutDuration); - + float glowInTheDarkMultiplier3 = calculateGlowInTheDark(_GITDEMinLight3, _GITDEMaxLight3, _GITDEMinEmissionMultiplier3, _GITDEMaxEmissionMultiplier3, _EnableGITDEmission3, _GITDEWorldOrMesh3, poiLight); #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED) - + //UNITY_BRANCH if (!_EmissionCenterOutEnabled3) { @@ -20691,7 +21208,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { pos3 = poiMesh.vertexColor.rgb; } - + //UNITY_BRANCH if (_EmissionScrollingUseCurve3) { @@ -20709,59 +21226,59 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { emissionStrength3 *= calculateBlinkingEmission(_EmissiveBlink_Min3, _EmissiveBlink_Max3, _EmissiveBlink_Velocity3, _EmissionBlinkingOffset3); } - emissionColor3 = hueShift(emissionColor3, frac(_EmissionHueShift3 + _EmissionHueShiftSpeed3 * _Time.x) * _EmissionHueShiftEnabled3); + emissionColor3 = hueShift(emissionColor3, frac(_EmissionHueShift3 + _EmissionHueShiftSpeed3 * _Time.x) * _EmissionHueShiftEnabled3, _EmissionHueShiftColorSpace3); emissionColor3 = lerp(emissionColor3, dot(emissionColor3, float3(0.3, 0.59, 0.11)), - (_EmissionSaturation3) * _EmissionHueShiftEnabled3); - + #if defined(PROP_EMISSIONMASK3) || !defined(OPTIMIZER_ENABLED) float emissionMask3 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask3, _MainTex, poiUV(poiMesh.uv[_EmissionMask3UV], _EmissionMask3_ST) + _Time.x * _EmissionMask3Pan)[_EmissionMask3Channel]; #else float emissionMask3 = 1; #endif - + if (_EmissionMaskInvert3) { emissionMask3 = 1 - emissionMask3; } - + if (_EmissionMask3GlobalMask > 0) { emissionMask3 = maskBlend(emissionMask3, poiMods.globalMask[_EmissionMask3GlobalMask - 1], _EmissionMask3GlobalMaskBlendType); } emissionStrength3 *= glowInTheDarkMultiplier3 * emissionMask3; emission3 = max(emissionStrength3 * emissionColor3, 0); - + poiFragData.emission += emission3; return emission3 * _EmissionReplace3; } #endif //endex - + //ifex _EnableRimLighting==0 && _EnableRim2Lighting==0 #if defined(_GLOSSYREFLECTIONS_OFF) || defined(POI_RIM2) #if defined(_RIMSTYLE_POIYOMI) || defined(_RIM2STYLE_POIYOMI) - void ApplyPoiyomiRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, inout PoiMods poiMods, float Is_NormalMapToRimLight, float RimInvert, float RimPower, float RimStrength, float RimShadowWidth, float RimShadowToggle, float RimWidth, float RimBlendStrength, float RimMask, float RimGlobalMask, float RimGlobalMaskBlendType, float4 RimTex, float4 RimLightColor, float RimLightColorThemeIndex, float RimHueShiftEnabled, float RimHueShift, float RimHueShiftSpeed, float RimSharpness, float RimShadowMaskRampType, float RimShadowMaskInvert, float RimShadowMaskStrength, float2 RimShadowAlpha, float RimApplyGlobalMaskIndex, float RimApplyGlobalMaskBlendType, float RimBaseColorMix, float RimBrightness, float RimBlendMode, half AudioLinkRimWidthBand, float2 AudioLinkRimWidthAdd, half AudioLinkRimEmissionBand, float2 AudioLinkRimEmissionAdd, half AudioLinkRimBrightnessBand, float2 AudioLinkRimBrightnessAdd, float rimBias, float rimBiasIntensity, int RimApplyAlpha, float RimApplyAlphaBlend) + void ApplyPoiyomiRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, inout PoiMods poiMods, float Is_NormalMapToRimLight, float RimInvert, float RimPower, float RimStrength, float RimShadowWidth, float RimShadowToggle, float RimWidth, float RimBlendStrength, float RimMask, float RimGlobalMask, float RimGlobalMaskBlendType, float4 RimTex, float4 RimLightColor, float RimLightColorThemeIndex, float RimHueShiftEnabled, float RimHueShift, float RimHueShiftColorSpace, float RimHueShiftSpeed, float RimSharpness, float RimShadowMaskRampType, float RimShadowMaskInvert, float RimShadowMaskStrength, float2 RimShadowAlpha, float RimApplyGlobalMaskIndex, float RimApplyGlobalMaskBlendType, float RimBaseColorMix, float RimBrightness, float RimBlendMode, half AudioLinkRimWidthBand, float2 AudioLinkRimWidthAdd, half AudioLinkRimEmissionBand, float2 AudioLinkRimEmissionAdd, half AudioLinkRimBrightnessBand, float2 AudioLinkRimBrightnessAdd, float rimBias, float rimBiasIntensity, int RimApplyAlpha, float RimApplyAlphaBlend) { float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], Is_NormalMapToRimLight))); - + UNITY_BRANCH if (RimInvert) { viewDotNormal = 1 - viewDotNormal; } - + viewDotNormal = pow(viewDotNormal, RimPower); - + if (RimShadowWidth && RimShadowToggle) { viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, RimShadowWidth); } - + viewDotNormal *= lerp(1, rimBias, rimBiasIntensity); - + float rimStrength = RimStrength; - + float rimWidth = lerp( - .05, 1, RimWidth); - + float blendStrength = RimBlendStrength; #ifdef POI_AUDIOLINK UNITY_BRANCH @@ -20773,24 +21290,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif float rimMask = RimMask; - + if (RimGlobalMask > 0) { - rimMask = maskBlend(rimMask, poiMods.globalMask[RimGlobalMask-1], RimGlobalMaskBlendType); + rimMask = maskBlend(rimMask, poiMods.globalMask[RimGlobalMask - 1], RimGlobalMaskBlendType); } - + float4 rimColor = RimTex; rimColor *= float4(poiThemeColor(poiMods, RimLightColor.rgb, RimLightColorThemeIndex), RimLightColor.a); - + UNITY_BRANCH if (RimHueShiftEnabled) { - rimColor.rgb = hueShift(rimColor.rgb, RimHueShift + _Time.x * RimHueShiftSpeed); + rimColor.rgb = hueShift(rimColor.rgb, RimHueShift + _Time.x * RimHueShiftSpeed, RimHueShiftColorSpace); } - + float rim = 1 - smoothstep(min(RimSharpness, rimWidth), rimWidth, viewDotNormal); rim *= RimLightColor.a * rimColor.a * rimMask; - + if (RimShadowToggle) { switch(RimShadowMaskRampType) @@ -20807,22 +21324,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" break; } } - + if (RimApplyGlobalMaskIndex > 0) { - applyToGlobalMask(poiMods, RimApplyGlobalMaskIndex-1, RimApplyGlobalMaskBlendType, rim * blendStrength); + applyToGlobalMask(poiMods, RimApplyGlobalMaskIndex - 1, RimApplyGlobalMaskBlendType, rim * blendStrength); } - + if (RimApplyAlpha == 1) // Add + { poiFragData.alpha += lerp(0, saturate(rim), RimApplyAlphaBlend); poiFragData.alpha = saturate(poiFragData.alpha); } if (RimApplyAlpha == 2) // Multiply + { poiFragData.alpha *= lerp(1, saturate(rim), RimApplyAlphaBlend); } - + float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, RimBaseColorMix); finalRimColor *= RimBrightness; // Add 0, Replace 1, Multiply 2, Mixed 3 @@ -20838,13 +21357,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif #if defined(_RIMSTYLE_UTS2) || defined(_RIM2STYLE_UTS2) - void ApplyUTS2RimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods, float Set_RimLightMask_var, float RimGlobalMask, float RimGlobalMaskBlendType, float4 RimLightColor, float RimLightColorThemeIndex, float Is_LightColor_RimLight, float Is_NormalMapToRimLight, float RimLight_Power, float RimLight_InsideMask, float RimLight_FeatherOff, float LightDirection_MaskOn, float Tweak_LightDirection_MaskLevel, float Add_Antipodean_RimLight, float4 Ap_RimLightColor, float RimApColorThemeIndex, float Is_LightColor_Ap_RimLight, float Ap_RimLight_Power, float Ap_RimLight_FeatherOff, float Tweak_RimLightMaskLevel, float RimHueShiftEnabled, float RimHueShift, float RimHueShiftSpeed) + void ApplyUTS2RimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods, float Set_RimLightMask_var, float RimGlobalMask, float RimGlobalMaskBlendType, float4 RimLightColor, float RimLightColorThemeIndex, float Is_LightColor_RimLight, float Is_NormalMapToRimLight, float RimLight_Power, float RimLight_InsideMask, float RimLight_FeatherOff, float LightDirection_MaskOn, float Tweak_LightDirection_MaskLevel, float Add_Antipodean_RimLight, float4 Ap_RimLightColor, float RimApColorThemeIndex, float Is_LightColor_Ap_RimLight, float Ap_RimLight_Power, float Ap_RimLight_FeatherOff, float Tweak_RimLightMaskLevel, float RimHueShiftEnabled, float RimHueShift, float RimHueShiftColorSpace, float RimHueShiftSpeed) { if (RimGlobalMask > 0) { - Set_RimLightMask_var = maskBlend(Set_RimLightMask_var, poiMods.globalMask[RimGlobalMask-1], RimGlobalMaskBlendType); + Set_RimLightMask_var = maskBlend(Set_RimLightMask_var, poiMods.globalMask[RimGlobalMask - 1], RimGlobalMaskBlendType); } - + float3 rimColor = float3(poiThemeColor(poiMods, RimLightColor.rgb, RimLightColorThemeIndex)); float3 _Is_LightColor_RimLight_var = lerp(rimColor, (rimColor * poiLight.directColor), Is_LightColor_RimLight); float _RimArea_var = (1.0 - dot(lerp(poiMesh.normals[0], poiMesh.normals[1], Is_NormalMapToRimLight), poiCam.viewDir)); @@ -20858,87 +21377,96 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" UNITY_BRANCH if (RimHueShiftEnabled) { - _RimLight_var = hueShift(_RimLight_var, RimHueShift + _Time.x * RimHueShiftSpeed); + _RimLight_var = hueShift(_RimLight_var, RimHueShift + _Time.x * RimHueShiftSpeed, RimHueShiftColorSpace); } poiFragData.baseColor += _RimLight_var; } #endif #if defined(_RIMSTYLE_LILTOON) || defined(_RIM2STYLE_LILTOON) - void ApplyLiltoonRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods, float4 RimColor, float4 RimIndirColor, float4 RimColorTex, float RimMainStrength, float RimNormalStrength, float RimDirRange, float RimIndirRange, float RimFresnelPower, float RimBackfaceMask, float RimDirStrength, float RimBorder, float RimBlur, float RimIndirBorder, float RimIndirBlur, float RimShadowMask, float RimEnableLighting, float RimVRParallaxStrength, float RimGlobalMask, float RimGlobalMaskBlendType, float RimHueShiftEnabled, float RimHueShift, float RimHueShiftSpeed, int RimBlendMode) + void ApplyLiltoonRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods, float4 RimColor, float4 RimIndirColor, float4 RimColorTex, float RimMainStrength, float RimNormalStrength, float RimDirRange, float RimIndirRange, float RimFresnelPower, float RimBackfaceMask, float RimDirStrength, float RimBorder, float RimBlur, float RimIndirBorder, float RimIndirBlur, float RimShadowMask, float RimEnableLighting, float RimVRParallaxStrength, float RimGlobalMask, float RimGlobalMaskBlendType, float RimHueShiftEnabled, float RimHueShift, float RimHueShiftColorSpace, float RimHueShiftSpeed, int RimBlendMode) { if (RimGlobalMask > 0) { - RimColorTex.a = maskBlend(RimColorTex.a, poiMods.globalMask[RimGlobalMask-1], RimGlobalMaskBlendType); + RimColorTex.a = maskBlend(RimColorTex.a, poiMods.globalMask[RimGlobalMask - 1], RimGlobalMaskBlendType); } float4 rimColor = RimColor; float4 rimIndirColor = RimIndirColor; rimColor *= RimColorTex; rimIndirColor *= RimColorTex; - + if (RimHueShiftEnabled) { - rimColor.rgb = hueShift(rimColor.rgb, RimHueShift + _Time.x * RimHueShiftSpeed); - rimIndirColor.rgb = hueShift(rimIndirColor.rgb, RimHueShift + _Time.x * RimHueShiftSpeed); + rimColor.rgb = hueShift(rimColor.rgb, RimHueShift + _Time.x * RimHueShiftSpeed, RimHueShiftColorSpace); + rimIndirColor.rgb = hueShift(rimIndirColor.rgb, RimHueShift + _Time.x * RimHueShiftSpeed, RimHueShiftColorSpace); } - + rimColor.rgb = lerp(rimColor.rgb, rimColor.rgb * poiFragData.baseColor, RimMainStrength); - + // View direction float3 centerViewDir = !IsOrthographicCamera() ? normalize(getCameraPosition() - poiMesh.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22); float3 viewDir = lerp(centerViewDir, poiCam.viewDir, RimVRParallaxStrength); - + // Normal float3 normal = lerp(poiMesh.normals[0], poiMesh.normals[1], RimNormalStrength); float nvabs = abs(dot(normal, viewDir)); - + // Factor float lnRaw = dot(poiLight.direction, normal) * 0.5 + 0.5; float lnDir = saturate((lnRaw + RimDirRange) / (1.0 + RimDirRange)); - float lnIndir = saturate((1.0-lnRaw + RimIndirRange) / (1.0 + RimIndirRange)); + float lnIndir = saturate((1.0 - lnRaw + RimIndirRange) / (1.0 + RimIndirRange)); float rim = pow(saturate(1.0 - nvabs), RimFresnelPower); rim = !poiMesh.isFrontFace && RimBackfaceMask ? 0.0 : rim; float rimDir = lerp(rim, rim * lnDir, RimDirStrength); float rimIndir = rim * lnIndir * RimDirStrength; - + rimDir = poiEdgeLinear(rimDir, RimBorder, RimBlur); rimIndir = poiEdgeLinear(rimIndir, RimIndirBorder, RimIndirBlur); - + rimDir = lerp(rimDir, rimDir * poiLight.rampedLightMap, RimShadowMask); rimIndir = lerp(rimIndir, rimIndir * poiLight.rampedLightMap, RimShadowMask); - - float3 lightCol = poiLight.directColor + poiLight.indirectColor; + + float3 lightCol = poiLight.finalLighting; + /* #if !defined(POI_PASS_ADD) rimColor.rgb = lerp(rimColor.rgb, rimColor.rgb * lightCol, RimEnableLighting); #else - if(RimBlendMode < 3) rimColor.rgb *= lightCol * RimEnableLighting; + if (RimBlendMode < 3) rimColor.rgb *= lightCol * RimEnableLighting; #endif - poiFragData.baseColor = lilBlendColor(poiFragData.baseColor, rimColor.rgb, rimDir * rimColor.a, RimBlendMode); - poiFragData.baseColor = lilBlendColor(poiFragData.baseColor, rimIndirColor.rgb, rimIndir * rimIndirColor.a, RimBlendMode); + // Blend + */ + #if !defined(POI_PASS_ADD) + float3 rimLightMul = 1 - RimEnableLighting + lightCol * RimEnableLighting; + #else + float3 rimLightMul = RimBlendMode < 3 ? lightCol * RimEnableLighting : 1; + #endif + + poiFragData.finalColor = lilBlendColor(poiFragData.finalColor, rimColor.rgb * rimLightMul, rimDir * rimColor.a, RimBlendMode); + poiFragData.finalColor = lilBlendColor(poiFragData.finalColor, rimIndirColor.rgb * rimLightMul, rimIndir * rimIndirColor.a, RimBlendMode); } #endif #endif //endex - + //ifex _EnableDepthRimLighting==0 #ifdef _POI_DEPTH_RIMLIGHT - + float PositivePow(float base, float power) { return pow(max(abs(base), Epsilon), power); } - + float GetScaleWithHight() { return _ScreenParams.y / 1080; } - + float GetSSRimScale(float z) { float w = (1.0 / (PositivePow(z + saturate(UNITY_MATRIX_P._m00), 1.5) + 0.75)) * GetScaleWithHight(); w *= lerp(1, UNITY_MATRIX_P._m00, 0.60 * saturate(0.25 * z * z)); return w < 0.01 ? 0 : w; } - + void ApplyDepthRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, inout PoiLight poiLight, in PoiMods poiMods) { float rim = 0; @@ -20946,35 +21474,35 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 direction = poiCam.worldDirection * perspectiveDivide; float2 screenPos = poiCam.posScreenSpace.xy * perspectiveDivide; float z = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, screenPos); - + #if UNITY_REVERSED_Z if (z == 0) return; #else if (z == 1) return; #endif - + float depth = CorrectedLinearEyeDepth(z, direction.w); - + switch(_DepthRimType) { case 0: { float3 viewPos = UnityObjectToViewPos(poiMesh.localPos); float3 viewDir = normalize(viewPos); - + float3 viewNorm = mul((float3x3)UNITY_MATRIX_V, poiMesh.normals[_DepthRimNormalToUse]); float3 viewCrossNorm = cross(viewDir, viewNorm); float2 N_View = normalize(float2(-viewCrossNorm.y, viewCrossNorm.x)); - + float3 viewLight = mul((float3x3)UNITY_MATRIX_V, poiLight.direction); float3 viewCrossLight = cross(viewDir, viewLight); float2 L_View = normalize(float2(-viewCrossLight.y, viewCrossLight.x)); - + //float lDotN = saturate(poiLight.nDotL + _RimLightLength); float scale = _DepthRimWidth * GetSSRimScale(depth); float2 ssUV1 = clamp(screenPos + N_View * .1 * scale, 0, _ScreenParams.xy - 1); float depthDiff = z - SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, ssUV1) ; - + rim = smoothstep(0.24 * _DepthRimSharpness * z, 0.25 * z, depthDiff); rim *= lerp(1, (dot(L_View, N_View) > 0), _DepthRimHideInShadow); } @@ -20995,9 +21523,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } break; } - + float3 rimColor = poiThemeColor(poiMods, _DepthRimColor.rgb, _DepthRimColorThemeIndex).rgb * lerp(1, poiLight.directColor, _DepthRimMixLightColor) * lerp(1, poiFragData.baseColor, _DepthRimMixBaseColor) * _DepthRimBrightness; - + #ifdef POI_PASS_BASE poiLight.finalLightAdd += rim * rimColor * _DepthRimAdditiveLighting; #endif @@ -21008,10 +21536,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _GlitterEnable==0 #ifdef _SUNDISK_SIMPLE - + float3 RandomColorFromPoint(float2 rando, PoiMods poiMods) { fixed hue = random2(rando.x + rando.y).x; @@ -21020,7 +21548,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 hsv = float3(hue, saturation, value); return HSVtoRGB(hsv); } - + void applyGlitter(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods) { float glitterRotationTimeOffset = 0; @@ -21030,17 +21558,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" glitterRotationTimeOffset += AudioLinkGetChronoTime(_GlitterALChronoRotationSpeedType, _GlitterALChronoRotationSpeedBand) * _GlitterALChronoRotationSpeed; } #endif - + for (int glitterLayer = 0; glitterLayer < _GlitterLayers; glitterLayer++) { // Scale - + float2 st = (poiMesh.uv[_GlitterUV] + _GlitterUVPanning.xy * _Time.x) * _GlitterFrequency; - + // Tile the space float2 i_st = floor(st); float2 f_st = frac(st); - + float m_dist = 10.; // minimun distance float2 m_point = 0; // minimum point float2 randoPoint = 0; @@ -21055,7 +21583,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" pos = pos * _GlitterRandomLocation; float2 diff = neighbor + pos - f_st; float dist = length(diff); - + if (dist < m_dist) { dank = diff; @@ -21065,9 +21593,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } } - + float randomFromPoint = random(randoPoint); - + float size = _GlitterSize; UNITY_BRANCH if (_GlitterRandomSize) @@ -21080,16 +21608,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" size = saturate(size + lerp(_GlitterALSizeAdd.x, _GlitterALSizeAdd.y, poiMods.audioLink[_GlitterALSizeAddBand])); } #endif - + // Assign a color using the closest point position //color += dot(m_point, float2(.3, .6)); - + // Add distance field to closest point center // color.g = m_dist; - + // Show isolines //color -= abs(sin(40.0 * m_dist)) * 0.07; - + // Draw cell center half glitterAlpha = 1; switch(_GlitterShape) @@ -21127,11 +21655,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } break; } - + float3 finalGlitter = 0; - + half3 glitterColor = poiThemeColor(poiMods, _GlitterColor.rgb, _GlitterColorThemeIndex); - + float3 norm = lerp(poiMesh.normals[0], poiMesh.normals[1], _GlitterUseNormals); float3 randomRotation = 0; float glitterSpeedOffset = 0; @@ -21153,7 +21681,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange); } - + float3 glitterReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm)); finalGlitter = lerp(0, _GlitterMinBrightness * glitterAlpha, glitterAlpha) + max(pow(saturate(dot(lerp(glitterReflectionDirection, poiCam.viewDir, _GlitterBias), poiCam.viewDir)), _GlitterContrast), 0); finalGlitter *= glitterAlpha; @@ -21172,29 +21700,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange); } - + float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm)); - + glitterAlpha *= poiLight.nDotLSaturated; - + float3 halfDir = normalize(poiLight.direction + poiCam.viewDir); float specAngle = max(dot(halfDir, glitterLightReflectionDirection), 0.0); - + finalGlitter = lerp(0, _GlitterMinBrightness * glitterAlpha, glitterAlpha) + max(pow(specAngle, _GlitterContrast), 0); - + glitterColor *= poiLight.directColor; finalGlitter *= glitterAlpha; - + break; } - + glitterColor *= lerp(1, poiFragData.baseColor, _GlitterUseSurfaceColor); #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED) glitterColor *= POI2D_SAMPLER_PAN(_GlitterColorMap, _MainTex, poiUV(poiMesh.uv[_GlitterColorMapUV], _GlitterColorMap_ST), _GlitterColorMapPan).rgb; #endif float2 uv = remapClamped(-size, size, dank, 0, 1); UNITY_BRANCH - + if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0 || _GlitterRandomRotationSpeed.x != 0 || _GlitterRandomRotationSpeed.y && !_GlitterShape || glitterRotationTimeOffset != 0) { float2 fakeUVCenter = float2(.5, .5); @@ -21215,7 +21743,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float sn = sin(theta); uv = float2((uv.x - fakeUVCenter.x) * cs - (uv.y - fakeUVCenter.y) * sn + fakeUVCenter.x, (uv.x - fakeUVCenter.x) * sn + (uv.y - fakeUVCenter.y) * cs + fakeUVCenter.y); } - + #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED) float4 glitterTexture = POI2D_SAMPLER_PANGRAD(_GlitterTexture, _linear_clamp, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan, poiMesh.dx, poiMesh.dy); #else @@ -21228,37 +21756,37 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float glitterMask = 1; #endif - + #ifdef POI_AUDIOLINK if (_GlitterALEnabled) { glitterMask = clamp(glitterMask + lerp(_GlitterALAlphaAdd.x, _GlitterALAlphaAdd.y, poiMods.audioLink[_GlitterALAlphaAddBand]), 0, glitterMask); } #endif - + if (_GlitterMaskInvert) { glitterMask = 1 - glitterMask; } - + glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow); glitterMask *= lerp(1, poiLight.directLuminance, _GlitterScaleWithLighting); glitterMask *= _GlitterColor.a; - + if (_GlitterMaskGlobalMask > 0) { glitterMask = maskBlend(glitterMask, poiMods.globalMask[_GlitterMaskGlobalMask - 1], _GlitterMaskGlobalMaskBlendType); } - + if (_GlitterRandomColors) { glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y), poiMods); } - + UNITY_BRANCH if (_GlitterHueShiftEnabled) { - glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed); + glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed, _GlitteHueShiftColorSpace); } float GlitterbrightnessOffset = 0; #ifdef POI_AUDIOLINK @@ -21267,7 +21795,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" GlitterbrightnessOffset = max(GlitterbrightnessOffset +lerp(_GlitterALMaxBrightnessAdd.x, _GlitterALMaxBrightnessAdd.y, poiMods.audioLink[_GlitterALMaxBrightnessBand]), 0); } #endif - + UNITY_BRANCH if (_GlitterBlendType == 1) { @@ -21282,7 +21810,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _SubsurfaceScattering==0 #ifdef POI_SUBSURFACESCATTERING void applySubsurfaceScattering(in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiFragData poiFragData) @@ -21292,7 +21820,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" SSS = POI2D_SAMPLER_PAN(_SSSThicknessMap, _MainTex, poiUV(poiMesh.uv[_SSSThicknessMapUV], _SSSThicknessMap_ST), _SSSThicknessMapPan); SSS.a = 1 - SSS.a; #endif - + float3 vLTLight = poiLight.direction + poiMesh.normals[0] * _SSSDistortion; float flTDot = pow(saturate(dot(poiCam.viewDir, -vLTLight)), _SSSSpread) * _SSSStrength; #ifdef UNITY_PASS_FORWARDBASE @@ -21300,7 +21828,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float3 fLT = poiLight.additiveShadow * (flTDot) * saturate(SSS.a + - 1 * _SSSThicknessMod); #endif - + #if defined(POINT) || defined(SPOT) poiLight.finalLightAdd += fLT * poiLight.directColor * _SSSColor * SSS.rgb * lerp(1, poiFragData.baseColor, _SSSBaseColorMix); #endif @@ -21308,10 +21836,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _MochieBRDF==0 && _ClearCoatBRDF==0 #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT) - + /* * Copyright 2022 orels1 * @@ -21321,45 +21849,45 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - + // https://github.com/orels1/orels-Unity-Shaders - + float GSAA_Filament(float3 worldNormal, float perceptualRoughness, float gsaaVariance, float gsaaThreshold) { // Kaplanyan 2016, "Stable specular highlights" // Tokuyoshi 2017, "Error Reduction and Simplification for Shading Anti-Aliasing" // Tokuyoshi and Kaplanyan 2019, "Improved Geometric Specular Antialiasing" - + // This implementation is meant for deferred rendering in the original paper but // we use it in forward rendering as well (as discussed in Tokuyoshi and Kaplanyan // 2019). The main reason is that the forward version requires an expensive transform // of the float vector by the tangent frame for every light. This is therefore an // approximation but it works well enough for our needs and provides an improvement // over our original implementation based on Vlachos 2015, "Advanced VR Rendering". - + float3 du = ddx(worldNormal); float3 dv = ddy(worldNormal); - + float variance = gsaaVariance * (dot(du, du) + dot(dv, dv)); - + float roughness = perceptualRoughness * perceptualRoughness; float kernelRoughness = min(2.0 * variance, gsaaThreshold); float squareRoughness = saturate(roughness * roughness + kernelRoughness); - + return sqrt(sqrt(squareRoughness)); } - + /* MIT END */ - + bool SceneHasReflections() { float width, height; unity_SpecCube0.GetDimensions(width, height); return !(width * height < 2); } - + float3 GetWorldReflections(float3 reflDir, float3 worldPos, float roughness) { float3 baseReflDir = reflDir; @@ -21377,7 +21905,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return p0; } - + float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float4 hdrData, float3 reflectionDir) { float3 reflections = 0; @@ -21424,7 +21952,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" reflections *= pl.occlusion; return reflections; } - + float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness) { float visibilityTerm = 0; @@ -21432,26 +21960,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { float rough = roughness; float rough2 = roughness * roughness; - + float lambdaV = nDotL * (nDotV * (1 - rough) + rough); float lambdaL = nDotV * (nDotL * (1 - rough) + rough); - + visibilityTerm = 0.5f / (lambdaV + lambdaL + 1e-5f); float d = (nDotH * rough2 - nDotH) * nDotH + 1.0f; float dotTerm = UNITY_INV_PI * rough2 / (d * d + 1e-7f); - + visibilityTerm *= dotTerm * UNITY_PI; } return visibilityTerm; } - + void GetSpecFresTerm(float nDotL, float nDotV, float nDotH, float lDotH, inout float3 specularTerm, inout float3 fresnelTerm, float3 specCol, float roughness) { specularTerm = GetGGXTerm(nDotL, nDotV, nDotH, roughness); fresnelTerm = FresnelTerm(specCol, lDotH); specularTerm = max(0, specularTerm * max(0.00001, nDotL)); } - + float GetRoughness(float smoothness) { float rough = 1 - smoothness; @@ -21460,7 +21988,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _MochieBRDF==0 #ifdef MOCHIE_PBR void MetallicAndSpecularFragDataInit(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) @@ -21470,13 +21998,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float metallic = _MochieMetallicMultiplier; float specularMask = 1; float reflectionMask = 1; - + smoothness *= poiFragData.smoothness; smoothness2 *= poiFragData.smoothness2; metallic *= poiFragData.metallic; specularMask *= poiFragData.specularMask; reflectionMask *= poiFragData.reflectionMask; - + #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED) float4 PBRMaps = POI2D_SAMPLER_PAN_STOCHASTIC(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan, _MochieMetallicMapsStochastic); UNITY_BRANCH @@ -21486,7 +22014,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" assignValueToVectorFromIndex(PBRMaps, _MochieMetallicMapsReflectionMaskChannel, PBRSplitMask[_MochieMetallicMapsReflectionMaskChannel]); assignValueToVectorFromIndex(PBRMaps, _MochieMetallicMapsSpecularMaskChannel, PBRSplitMask[_MochieMetallicMapsSpecularMaskChannel]); } - + if (_MochieMetallicMapsMetallicChannel < 4) { metallic *= PBRMaps[_MochieMetallicMapsMetallicChannel]; @@ -21505,10 +22033,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" specularMask *= PBRMaps[_MochieMetallicMapsSpecularMaskChannel]; } #endif - + reflectionMask *= _MochieReflectionStrength; specularMask *= _MochieSpecularStrength; - + if (_MochieMetallicMapInvert) { metallic = 1 - metallic; @@ -21526,14 +22054,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { specularMask = 1 - specularMask; } - + poiFragData.smoothness *= smoothness; poiFragData.smoothness2 *= smoothness2; poiFragData.metallic *= metallic; poiFragData.specularMask *= specularMask; poiFragData.reflectionMask *= reflectionMask; } - + void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, inout PoiMods poiMods) { float smoothness = poiFragData.smoothness; @@ -21541,7 +22069,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float metallic = poiFragData.metallic; float specularMask = poiFragData.specularMask; float reflectionMask = poiFragData.reflectionMask; - + if (_MochieMetallicGlobalMask > 0) { metallic = customBlend(metallic, poiMods.globalMask[_MochieMetallicGlobalMask - 1], _MochieMetallicGlobalMaskBlendType); @@ -21559,7 +22087,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { specularMask = customBlend(specularMask, poiMods.globalMask[_MochieSpecularStrengthGlobalMask - 1], _MochieSpecularStrengthGlobalMaskBlendType); } - + #ifdef TPS_Penetrator if (_BRDFTPSDepthEnabled) { @@ -21567,7 +22095,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" specularMask = lerp(0, specularMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSSpecularMaskStrength); } #endif - + float roughness = GetRoughness(smoothness); float roughness2 = GetRoughness(smoothness2); float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic); @@ -21585,10 +22113,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } float brdfRoughness = percepRough * percepRough; brdfRoughness = max(brdfRoughness, 0.002); - + float brdfRoughness2 = percepRough2 * percepRough2; brdfRoughness2 = max(brdfRoughness2, 0.002); - + float3 diffuse = poiFragData.baseColor; float3 specular = 0; float3 specular2 = 0; @@ -21596,24 +22124,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 vSpecular2 = 0; float3 reflections = 0; float3 environment = 0; - + #if defined(POINT) || defined(SPOT) float attenuation = lerp(poiLight.additiveShadow, 1, _IgnoreCastedShadows); #else float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows)); #endif - + float3 fresnelTerm = 1; float3 specularTerm = 1; - + float pbrNDotL = lerp(poiLight.vertexNDotL, poiLight.nDotL, _PBRNormalSelect); float pbrNDotV = lerp(poiLight.vertexNDotV, poiLight.nDotV, _PBRNormalSelect); float pbrNDotH = lerp(poiLight.vertexNDotH, poiLight.nDotH, _PBRNormalSelect); float3 pbrReflectionDir = lerp(poiCam.vertexReflectionDir, poiCam.reflectionDir, _PBRNormalSelect); - + GetSpecFresTerm(pbrNDotL, pbrNDotV, pbrNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness); specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation; - + if (poiFragData.toggleVertexLights) { #if defined(VERTEXLIGHT_ON) @@ -21628,14 +22156,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif } - + if (_Specular2ndLayer == 1) { float3 fresnelTerm = 1; float3 specularTerm = 1; GetSpecFresTerm(pbrNDotL, pbrNDotV, pbrNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2); specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2; - + if (poiFragData.toggleVertexLights) { #if defined(VERTEXLIGHT_ON) @@ -21651,7 +22179,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif } } - + float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0)); float grazingTerm = saturate(smoothness + (1 - omr)); float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, _MochieReflCube_HDR, pbrReflectionDir); @@ -21663,11 +22191,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { reflections = surfaceReduction * reflCol * lerp(1, FresnelLerp(specCol, grazingTerm, pbrNDotV), _RefSpecFresnelBack); } - + reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex); reflections *= reflectionMask; diffuse = lerp(diffuse, diffuse * omr, reflectionMask); - + environment = max(specular + vSpecular, specular2 + vSpecular2); environment += reflections; diffuse *= poiLight.finalLighting; @@ -21684,10 +22212,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float smoothness = _ClearCoatSmoothness; float reflectionMask = _ClearCoatReflectionStrength; float specularMask = _ClearCoatSpecularStrength; - + #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED) float4 PBRMaps = POI2D_SAMPLER_PAN_STOCHASTIC(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan, _ClearCoatMapsStochastic); - + if (_ClearCoatMapsClearCoatMaskChannel < 4) { clearCoatMask *= PBRMaps[_ClearCoatMapsClearCoatMaskChannel]; @@ -21705,7 +22233,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" specularMask *= PBRMaps[_ClearCoatMapsSpecularMaskChannel]; } #endif - + if (_ClearCoatGlobalMask > 0) { clearCoatMask = customBlend(clearCoatMask, poiMods.globalMask[_ClearCoatGlobalMask - 1], _ClearCoatGlobalMaskBlendType); @@ -21722,7 +22250,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { specularMask = customBlend(specularMask, poiMods.globalMask[_ClearCoatSpecularStrengthGlobalMask - 1], _ClearCoatSpecularStrengthGlobalMaskBlendType); } - + if (_ClearCoatMaskInvert) { clearCoatMask = 1 - clearCoatMask; @@ -21745,7 +22273,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" clearCoatMask = lerp(0, clearCoatMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _ClearCoatTPSMaskStrength); } #endif - + float roughness = GetRoughness(smoothness); float3 specCol = 0.220916301; float omr = unity_ColorSpaceDielectricSpec.a; @@ -21757,22 +22285,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } float brdfRoughness = percepRough * percepRough; brdfRoughness = max(brdfRoughness, 0.002); - + float3 diffuse = 0; float3 specular = 0; float3 vSpecular = 0; float3 reflections = 0; float3 environment = 0; float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _CCIgnoreCastedShadows)); - + float3 fresnelTerm = 1; float3 specularTerm = 1; - + float clearcoatNDotL = lerp(poiLight.vertexNDotL, poiLight.nDotL, _ClearCoatNormalSelect); float clearcoatNDotV = lerp(poiLight.vertexNDotV, poiLight.nDotV, _ClearCoatNormalSelect); float clearcoatNDotH = lerp(poiLight.vertexNDotH, poiLight.nDotH, _ClearCoatNormalSelect); float3 clearcoatReflectionDir = lerp(poiCam.vertexReflectionDir, poiCam.reflectionDir, _ClearCoatNormalSelect); - + GetSpecFresTerm(clearcoatNDotL, clearcoatNDotV, clearcoatNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness); specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation; if (poiFragData.toggleVertexLights) @@ -21789,14 +22317,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif } - + float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0)); float grazingTerm = saturate(smoothness + (1 - omr)); float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, _ClearCoatFallback_HDR, clearcoatReflectionDir); reflections = surfaceReduction * reflCol * lerp(1, FresnelLerp(specCol, grazingTerm, clearcoatNDotV), _ClearcoatFresnel); reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflectionMask; diffuse = lerp(diffuse, diffuse * omr, reflectionMask); - + environment = specular + vSpecular; #ifdef UNITY_PASS_FORWARDBASE environment += reflections; @@ -21807,14 +22335,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _EnableEnvironmentalRim==0 #ifdef POI_ENVIRORIM void applyEnvironmentRim(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam) { float enviroRimAlpha = saturate(1 - smoothstep(min(_RimEnviroSharpness, _RimEnviroWidth), _RimEnviroWidth, poiCam.vDotN)); _RimEnviroBlur *= 1.7 - 0.7 * _RimEnviroBlur; - + float3 enviroRimColor = 0; float interpolator = unity_SpecCube0_BoxMin.w; UNITY_BRANCH @@ -21823,11 +22351,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //Probe 1 float4 reflectionData0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, poiMesh.normals[1], _RimEnviroBlur * UNITY_SPECCUBE_LOD_STEPS); float3 reflectionColor0 = DecodeHDR(reflectionData0, unity_SpecCube0_HDR); - + //Probe 2 float4 reflectionData1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, poiMesh.normals[1], _RimEnviroBlur * UNITY_SPECCUBE_LOD_STEPS); float3 reflectionColor1 = DecodeHDR(reflectionData1, unity_SpecCube1_HDR); - + enviroRimColor = lerp(reflectionColor1, reflectionColor0, interpolator); } else @@ -21835,7 +22363,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 reflectionData = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, poiMesh.normals[1], _RimEnviroBlur * UNITY_SPECCUBE_LOD_STEPS); enviroRimColor = DecodeHDR(reflectionData, unity_SpecCube0_HDR); } - + half enviroMask = 1; #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED) enviroMask = POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan)[_RimEnviroChannel]; @@ -21845,7 +22373,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _StylizedSpecular==0 #ifdef POI_STYLIZED_StylizedSpecular void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods) @@ -21856,7 +22384,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float3 specularMap = 1; #endif - + // Spec 1 float specMask1 = 0; float specMask2 = 0; @@ -21870,21 +22398,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" specMask1 += poiEdgeNonLinear(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength; specMask2 += poiEdgeNonLinear(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength; } - + #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED) float specularMask = POI2D_SAMPLER_PAN(_Set_HighColorMask, _MainTex, poiUV(poiMesh.uv[_Set_HighColorMaskUV], _Set_HighColorMask_ST), _Set_HighColorMaskPan)[_Set_HighColorMaskChannel]; #else float specularMask = 1; #endif - + if(_StylizedSpecularInvertMask) + { + specularMask = 1 - specularMask; + } specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel); - + float specMask = saturate(specMask1 + specMask2) * specularMask * lerp(poiLight.rampedLightMap, 1, _StylizedSpecularIgnoreShadow); float attenuation = min(lerp(poiLight.nDotLSaturated, 1, _StylizedSpecularIgnoreNormal), lerp(lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows), 1, _StylizedSpecularIgnoreShadow)); #ifdef POI_PASS_ADD attenuation *= lerp(poiLight.additiveShadow, 1, _SSIgnoreCastedShadows); #endif - + float finalSpecMask = min(min(specMask, poiLight.occlusion), attenuation) * _StylizedSpecularStrength; switch(_Is_BlendAddToHiColor) { @@ -21905,9 +22436,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), finalSpecMask); break; } - + //poiFragData.baseColor = _StylizedSpecularStrength; - + float3 vSpecMask = 0; if (poiFragData.toggleVertexLights) { @@ -21926,7 +22457,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" vSpecMask = poiEdgeNonLinear(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation[index]; vSpecMask = max(vSpecMask, poiEdgeNonLinear(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation[index]); } - + vSpecMask *= specularMask; float finalSpecMask = min(min(vSpecMask, poiLight.occlusion), attenuation) * _StylizedSpecularStrength; switch(_Is_BlendAddToHiColor) @@ -21954,7 +22485,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _EnablePathing==0 #ifdef POI_PATHING void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) @@ -21983,25 +22514,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" PathColor[1] = _PathColorG; PathColor[2] = _PathColorB; PathColor[3] = _PathColorA; - + // Combined data if (_PathGradientType == 1) { path = (path.r + path.g + path.b + path.a) * .25; } - + #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED) float4 pathColorMap = POI2D_SAMPLER_PAN(_PathingColorMap, _MainTex, poiUV(poiMesh.uv[_PathingColorMapUV], _PathingColorMap_ST), _PathingColorMapPan); #else float4 pathColorMap = float4(1, 1, 1, 1); #endif - + float4 pathAudioLinkEmission = 0; float4 pathTime = 0; float3 pathAlpha[4] = { float3(0.0, 0.0, 0.0), float3(0.0, 0.0, 0.0), float3(0.0, 0.0, 0.0), float3(0.0, 0.0, 0.0) }; - + #ifdef POI_AUDIOLINK float4 chronoType = float4(_PathChronoTypeR, _PathChronoTypeG, _PathChronoTypeB, _PathChronoTypeA); float4 chronoBand = float4(_PathChronoBandR, _PathChronoBandG, _PathChronoBandB, _PathChronoBandA); @@ -22014,7 +22545,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4(_PathALHistoryR, _PathALHistoryBandR, _PathALHistoryRangeR[0], _PathALHistoryRangeR[1]), float4(_PathALHistoryG, _PathALHistoryBandG, _PathALHistoryRangeG[0], _PathALHistoryRangeG[1]), float4(_PathALHistoryB, _PathALHistoryBandB, _PathALHistoryRangeB[0], _PathALHistoryRangeB[1]), float4(_PathALHistoryA, _PathALHistoryBandA, _PathALHistoryRangeA[0], _PathALHistoryRangeA[1]) }; - + if (poiMods.audioLinkAvailable) { if (_PathALTimeOffset) @@ -22028,7 +22559,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy; pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy; } - + if (_PathALWidthOffset) { pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR; @@ -22048,7 +22579,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]); pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]); } - + if(_PathALColorChord) { if (_PathALCCR) @@ -22070,7 +22601,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } #endif - + [unroll] for (int index = 0; index < 4; index++) { @@ -22083,7 +22614,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]); } - + if (_PathALChrono) { timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index]; @@ -22091,13 +22622,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif pathTime[index] = _PathTime[index] != -999.0f ? frac(_PathTime[index] + _PathOffset[index] + timeOffset) : frac(_Time.x * _PathSpeed[index] + _PathOffset[index] + timeOffset); - + if (_PathSegments[index]) { float pathSegments = abs(_PathSegments[index]); pathTime = (ceil(pathTime * pathSegments) - .5) / pathSegments; } - + if (path[index]) { // Cutting it in half because it goes out in both directions for now @@ -22112,7 +22643,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } #endif - + //fill pathAlpha[index].x = pathTime[index] > path[index]; //path @@ -22121,7 +22652,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" pathAlpha[index].z = saturate((1 - distance(pathTime[index], path[index])) - (1 - pathWidth)) * (1 / pathWidth); pathAlpha[index].z += saturate(distance(pathTime[index], path[index]) - (1 - pathWidth)) * (1 / pathWidth); pathAlpha[index] = smoothstep(0, _PathSoftness[index] + .00001, pathAlpha[index]); - + #ifdef POI_AUDIOLINK if (poiMods.audioLinkAvailable) { @@ -22129,23 +22660,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { // history[index]: [0]: on/off, [1]: band, [2]/[3] min/max float historyUV = lerp(history[index][2], history[index][3], path[index]); - + if (_PathSegments[index]) { float pathSegments = abs(_PathSegments[index]); historyUV = (ceil(historyUV * pathSegments) - .5) / pathSegments; } - + historyUV *= AUDIOLINK_WIDTH; - + float historyValue = AudioLinkLerp(ALPASS_AUDIOLINK + float2(historyUV, history[index][1]))[0]; - + if(_PathALHistoryMode == 0) // Mask pathAlpha[index] *= historyValue; else // Override pathAlpha[index] = historyValue; } - + if (_PathALAutoCorrelator && autoCorrelator[index][0] != 0) { // autoCorrelator[index]: [0]: on/off, [1]/[2]: min/max @@ -22155,33 +22686,33 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { autoCorrelatorUV = abs(1. - autoCorrelatorUV * 2.); } - + if (_PathSegments[index]) { float pathSegments = abs(_PathSegments[index]); autoCorrelatorUV = (ceil(autoCorrelatorUV * pathSegments) - .5) / pathSegments; } - + // Normalize Autocorrelator Value float autoCorrelatorValue = AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0))[0]; float autoCorrelatorMax = AudioLinkLerp(ALPASS_AUTOCORRELATOR); autoCorrelatorValue = saturate(abs(autoCorrelatorValue) * rcp(autoCorrelatorMax)); - + // Autocorrelator is normalized, so can look weird at lower volume levels. use Filtered VU intensity to make it smoothly fall off at low volume levels. float4 vu = AudioLinkData(ALPASS_FILTEREDVU_INTENSITY + uint2(0, 0)); autoCorrelatorValue *= smoothstep(0.01, 0.2, vu); - + if(_PathALAutoCorrelatorMode == 0) // Mask pathAlpha[index] *= autoCorrelatorValue; else // Override pathAlpha[index] = autoCorrelatorValue; - + } } #endif } } - + // Emission pathEmission = 0; pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r); @@ -22189,7 +22720,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" pathEmission += pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * (_PathEmissionStrength[2] + pathAudioLinkEmission.b); pathEmission += pathAlpha[3][_PathTypeA] * poiThemeColor(poiMods, PathColor[3].rgb, _PathColorAThemeIndex) * (_PathEmissionStrength[3] + pathAudioLinkEmission.a); pathEmission *= pathColorMap.rgb * pathColorMap.a; - + float3 colorReplace = 0; colorReplace = pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * pathColorMap.rgb; albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[0].a * pathAlpha[0][_PathTypeR]); @@ -22199,16 +22730,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[2].a * pathAlpha[2][_PathTypeB]); colorReplace = pathAlpha[3][_PathTypeA] * poiThemeColor(poiMods, PathColor[3].rgb, _PathColorAThemeIndex) * pathColorMap.rgb; albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[3].a * pathAlpha[3][_PathTypeA]); - + float alpha = max(max(max(pathAlpha[0][_PathTypeR], pathAlpha[1][_PathTypeG]), pathAlpha[2][_PathTypeB]), pathAlpha[3][_PathTypeA]); - + poiFragData.alpha *= lerp(1, alpha, _PathingOverrideAlpha); poiFragData.baseColor = albedo.rgb; poiFragData.emission += pathEmission; } #endif //endex - + //ifex _EnableMirrorOptions==0 #ifdef POI_MIRROR void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) @@ -22224,7 +22755,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { inMirror = IsInMirror(); } - + #if (defined(POI_PASS_BASE) || defined(POI_PASS_ADD)) #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED) float4 mirrorTexture = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiUV(poiMesh.uv[_MirrorTextureUV], _MirrorTexture_ST), _MirrorTexturePan); @@ -22243,50 +22774,50 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _EnableTouchGlow==0 #ifdef GRAIN void applyDepthFX(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods) { float3 touchEmission = 0; - + float perspectiveDivide = 1.0f / poiCam.clipPos.w; float4 direction = poiCam.worldDirection * perspectiveDivide; float2 screenPos = poiCam.posScreenSpace * perspectiveDivide; float z = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, screenPos); - + #if UNITY_REVERSED_Z if (z == 0) #else if (z == 1) #endif return; - + float depth = CorrectedLinearEyeDepth(z, direction.w); float3 worldpos = direction * depth + _WorldSpaceCameraPos.xyz; /* finalColor.rgb = frac(worldpos); return; */ - + float diff = distance(worldpos, poiMesh.worldPos); //poiFragData.finalColor = diff; - + #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED) float depthMask = POI2D_SAMPLER_PAN(_DepthMask, _MainTex, poiUV(poiMesh.uv[_DepthMaskUV], _DepthMask_ST), _DepthMaskPan)[_DepthMaskChannel]; #else float depthMask = 1; #endif - + if (_DepthMaskGlobalMask > 0) { depthMask = maskBlend(depthMask, poiMods.globalMask[_DepthMaskGlobalMask - 1], _DepthMaskGlobalMaskBlendType); } - + if (_DepthColorToggle) { float colorBlendAlpha = lerp(_DepthColorMinValue, _DepthColorMaxValue, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff)); - + #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED) float2 depthTextureUV = float2(0, 0); if (_DepthTextureUV == 8) @@ -22301,7 +22832,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex); #endif - + switch(_DepthColorBlendMode) { case 0: @@ -22322,7 +22853,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask; } - + if (_DepthAlphaToggle) { poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask); @@ -22330,10 +22861,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _TextEnabled==0 #ifdef EFFECT_BUMP - + float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv) { float theta = radians(rotation); @@ -22342,20 +22873,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float sn = sin(theta); float2 centerPoint = offset + .5; uv = float2((uv.x - centerPoint.x) * cs - (uv.y - centerPoint.y) * sn + centerPoint.x, (uv.x - centerPoint.x) * sn + (uv.y - centerPoint.y) * cs + centerPoint.y); - + return remap(uv, float2(0, 0) + offset + (scale * .5), float2(1, 1) + offset - (scale * .5), float2(0, 0), float2(1, 1)); } - + float2 getAsciiCoordinate(float index) { return float2((index - 1) / 16, 1 - ((floor(index / 16 - glyphWidth)) / 16)); } - + float median(float r, float g, float b) { return max(min(r, g), min(max(r, g), b)); } - + void ApplyPositionText(inout PoiFragData poiFragData, float2 uv, in PoiMods poiMods) { float3 cameraPos = clamp(getCameraPosition(), -999, 999); @@ -22382,30 +22913,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" positionArray[17] = floor(absCameraPos.z % 10) + 48; positionArray[18] = ASCII_PERIOD; positionArray[19] = floor((absCameraPos.z * 10) % 10) + 48; - + uv = TransformUV(_TextPositionOffset, _TextPositionRotation, _TextPositionScale, uv); - + if (uv.x > 1 || uv.x < 0 || uv.y > 1 || uv.y < 0) { return; } - + float currentCharacter = floor(uv.x * totalCharacters); float2 glyphPos = getAsciiCoordinate(positionArray[currentCharacter]); - + float2 startUV = float2(1 / totalCharacters * currentCharacter, 0); float2 endUV = float2(1 / totalCharacters * (currentCharacter + 1), 1); - + fixed4 textPositionPadding = _TextPositionPadding; textPositionPadding *= 1 / totalCharacters; - + uv = remapClamped(startUV, endUV, uv, float2(glyphPos.x + textPositionPadding.x, glyphPos.y - glyphWidth + textPositionPadding.y), float2(glyphPos.x + glyphWidth - textPositionPadding.z, glyphPos.y - textPositionPadding.w)); - + if (uv.x > glyphPos.x + glyphWidth - textPositionPadding.z - .001 || uv.x < glyphPos.x + textPositionPadding.x + .001 || uv.y > glyphPos.y - textPositionPadding.w - .001 || uv.y < glyphPos.y - glyphWidth + textPositionPadding.y + .001) { return; } - + float3 samp = tex2D(_TextGlyphs, TRANSFORM_TEX(uv, _TextGlyphs)).rgb; float2 msdfUnit = _TextPixelRange / _TextGlyphs_TexelSize.zw; float sigDist = median(samp.r, samp.g, samp.b) - 0.5; @@ -22414,7 +22945,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextPositionColor.rgb, _TextPositionColorThemeIndex), opacity * _TextPositionColor.a); globalTextEmission += poiThemeColor(poiMods, _TextPositionColor.rgb, _TextPositionColorThemeIndex) * opacity * _TextPositionEmissionStrength; } - + void ApplyTimeText(inout PoiFragData poiFragData, float2 uv, in PoiMods poiMods) { float instanceTime = _Time.y; @@ -22431,30 +22962,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" timeArray[5] = ASCII_SEMICOLON; timeArray[6] = floor((seconds * .1) % 10) + 48; timeArray[7] = floor(seconds % 10) + 48; - + uv = TransformUV(_TextTimeOffset, _TextTimeRotation, _TextTimeScale, uv); - + if (uv.x > 1 || uv.x < 0 || uv.y > 1 || uv.y < 0) { return; } - + float currentCharacter = floor(uv.x * totalCharacters); float2 glyphPos = getAsciiCoordinate(timeArray[currentCharacter]); // 0.1428571 = 1/7 = 1 / totalCharacters float startUV = 1 / totalCharacters * currentCharacter; float endUV = 1 / totalCharacters * (currentCharacter + 1); - + fixed4 textTimePadding = _TextTimePadding; textTimePadding *= 1 / totalCharacters; - + uv = remapClamped(float2(startUV, 0), float2(endUV, 1), uv, float2(glyphPos.x + textTimePadding.x, glyphPos.y - glyphWidth + textTimePadding.y), float2(glyphPos.x + glyphWidth - textTimePadding.z, glyphPos.y - textTimePadding.w)); - + if (uv.x > glyphPos.x + glyphWidth - textTimePadding.z - .001 || uv.x < glyphPos.x + textTimePadding.x + .001 || uv.y > glyphPos.y - textTimePadding.w - .001 || uv.y < glyphPos.y - glyphWidth + textTimePadding.y + .001) { return; } - + float3 samp = tex2D(_TextGlyphs, TRANSFORM_TEX(uv, _TextGlyphs)).rgb; float2 msdfUnit = _TextPixelRange / _TextGlyphs_TexelSize.zw; float sigDist = median(samp.r, samp.g, samp.b) - 0.5; @@ -22463,7 +22994,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextTimeColor.rgb, _TextTimeColorThemeIndex), opacity * _TextTimeColor.a); globalTextEmission += poiThemeColor(poiMods, _TextTimeColor.rgb, _TextTimeColorThemeIndex) * opacity * _TextTimeEmissionStrength; } - + void ApplyFPSText(inout PoiFragData poiFragData, float2 uv, in PoiMods poiMods) { float smoothDeltaTime = clamp(unity_DeltaTime.w, 0, 999); @@ -22476,30 +23007,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" fpsArray[4] = floor((smoothDeltaTime * .01) % 10) + 48; fpsArray[5] = floor((smoothDeltaTime * .1) % 10) + 48; fpsArray[6] = floor(smoothDeltaTime % 10) + 48; - + uv = TransformUV(_TextFPSOffset, _TextFPSRotation, _TextFPSScale, uv); - + if (uv.x > 1 || uv.x < 0 || uv.y > 1 || uv.y < 0) { return; } - + float currentCharacter = floor(uv.x * totalCharacters); float2 glyphPos = getAsciiCoordinate(fpsArray[currentCharacter]); // 0.1428571 = 1/7 = 1 / totalCharacters float startUV = 1 / totalCharacters * currentCharacter; float endUV = 1 / totalCharacters * (currentCharacter + 1); - + float4 textFPSPadding = _TextFPSPadding; textFPSPadding *= 1 / totalCharacters; - + uv = remapClamped(float2(startUV, 0), float2(endUV, 1), uv, float2(glyphPos.x + textFPSPadding.x, glyphPos.y - glyphWidth + textFPSPadding.y), float2(glyphPos.x + glyphWidth - textFPSPadding.z, glyphPos.y - textFPSPadding.w)); - + if (uv.x > glyphPos.x + glyphWidth - textFPSPadding.z - .001 || uv.x < glyphPos.x + textFPSPadding.x + .001 || uv.y > glyphPos.y - textFPSPadding.w - .001 || uv.y < glyphPos.y - glyphWidth + textFPSPadding.y + .001) { return; } - + float3 samp = tex2D(_TextGlyphs, TRANSFORM_TEX(uv, _TextGlyphs)).rgb; float2 msdfUnit = _TextPixelRange / _TextGlyphs_TexelSize.zw; float sigDist = median(samp.r, samp.g, samp.b) - 0.5; @@ -22508,7 +23039,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a); globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength; } - + void ApplyNumericText(inout PoiFragData poiFragData, float2 uv, in PoiMods poiMods) { // If both digits are set to zero: exit. @@ -22516,7 +23047,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return; } - + uint wholeNumber = 0; uint decimalNumber = 0; uint wholeDigits = _TextNumericWholeDigits; @@ -22524,18 +23055,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float NumericArray[10]; // 10 is the max amount of characters = 1 sign + 4 max whole digits + 1 decimal mark + 4 max decimal digits uint arrayIndex = 0; float totalCharacters = 1 + wholeDigits + decimalDigits; // Sign Character + Whole Digits + Decimal Digits - + //Determine Sign (_TextNumericValue is usually animated) float charSign = _TextNumericValue >= 0 ? ASCII_SPACE : ASCII_NEGATIVE; - + NumericArray[arrayIndex] = charSign; //First character is always the sign arrayIndex++; - + //Isolate whole number and fill array if (wholeDigits > 0) { wholeNumber = uint(glsl_mod(abs(_TextNumericValue), pow(10, wholeDigits))); - + int expIndex = -1 * (wholeDigits - 1); // Exponent Index bool leadingZero = true; // Pouplate the Array @@ -22545,7 +23076,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int digit = floor(glsl_mod(wholeNumber * pow(10, expIndex), 10)); // Take the resulting value and add 48 to get the corresponding location in the font array. NumericArray[arrayIndex] = digit + 48; - + //Trim Leading Zeroes, but leave at least one. if (_TextNumericTrimZeroes == true) { @@ -22564,7 +23095,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" arrayIndex++; } } - + // Isolate decimal number and fill array if (decimalDigits > 0) { @@ -22573,9 +23104,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int decimalPointer = arrayIndex; arrayIndex++; totalCharacters++; - + decimalNumber = uint(frac(abs(_TextNumericValue)) * pow(10.00001, decimalDigits)); // Isolate the decimal number - + int expIndex = -1 * (decimalDigits - 1); // Exponent Index //Populate the Array with the remaining digits while (arrayIndex < (uint)(totalCharacters)) @@ -22584,34 +23115,34 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int digit = floor(glsl_mod(decimalNumber * pow(10, expIndex), 10)); // Take the resulting value and add 48 to get the corresponding location in the font array. NumericArray[arrayIndex] = digit + 48; - + expIndex++; arrayIndex++; } } - + uv = TransformUV(_TextNumericOffset, _TextNumericRotation, _TextNumericScale, uv); - + if (uv.x > 1 || uv.x < 0 || uv.y > 1 || uv.y < 0) { return; } - + float currentCharacter = floor(uv.x * totalCharacters); float2 glyphPos = getAsciiCoordinate(NumericArray[currentCharacter]); float startUV = 1 / totalCharacters * currentCharacter; float endUV = 1 / totalCharacters * (currentCharacter + 1); - + float4 textNumericPadding = _TextNumericPadding; textNumericPadding *= 1 / totalCharacters; - + uv = remapClamped(float2(startUV, 0), float2(endUV, 1), uv, float2(glyphPos.x + textNumericPadding.x, glyphPos.y - glyphWidth + textNumericPadding.y), float2(glyphPos.x + glyphWidth - textNumericPadding.z, glyphPos.y - textNumericPadding.w)); - + if (uv.x > glyphPos.x + glyphWidth - textNumericPadding.z - .001 || uv.x < glyphPos.x + textNumericPadding.x + .001 || uv.y > glyphPos.y - textNumericPadding.w - .001 || uv.y < glyphPos.y - glyphWidth + textNumericPadding.y + .001) { return; } - + float3 samp = tex2D(_TextGlyphs, TRANSFORM_TEX(uv, _TextGlyphs)).rgb; float2 msdfUnit = _TextPixelRange / _TextGlyphs_TexelSize.zw; float sigDist = median(samp.r, samp.g, samp.b) - 0.5; @@ -22620,12 +23151,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextNumericColor.rgb, _TextNumericColorThemeIndex), opacity * _TextNumericColor.a); globalTextEmission += poiThemeColor(poiMods, _TextNumericColor.rgb, _TextNumericColorThemeIndex) * opacity * _TextNumericEmissionStrength; } - + void ApplyTextOverlayColor(inout PoiFragData poiFragData, PoiMesh poiMesh, in PoiMods poiMods) { globalTextEmission = 0; float positionalOpacity = 0; - + if (_TextFPSEnabled == 1) ApplyFPSText(poiFragData, poiMesh.uv[_TextFPSUV], poiMods); if (_TextPositionEnabled == 1) @@ -22634,12 +23165,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods); if (_TextNumericEnabled == 1) ApplyNumericText(poiFragData, poiMesh.uv[_TextNumericUV], poiMods); - + poiFragData.emission += globalTextEmission; } #endif //endex - + //ifex _PostProcess==0 #ifdef POSTPROCESS float3 poiPosterize(float3 color, float steps) @@ -22651,7 +23182,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" newColor.b = floor(newColor.b * steps) / steps; return HSVtoRGB(newColor); } - + float oetf_sRGB_scalar(float L) { float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055; @@ -22659,12 +23190,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" V = L * 12.92; return V; } - + float3 oetf_sRGB(float3 L) { return float3(oetf_sRGB_scalar(L.r), oetf_sRGB_scalar(L.g), oetf_sRGB_scalar(L.b)); } - + float eotf_sRGB_scalar(float V) { float L = pow((V + 0.055) / 1.055, 2.4); @@ -22672,26 +23203,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" L = V / 12.92; return L; } - + float3 GetHDR(float3 rgb) { return float3(eotf_sRGB_scalar(rgb.r), eotf_sRGB_scalar(rgb.g), eotf_sRGB_scalar(rgb.b)); } - + float3 GetContrast(float3 col, float contrast) { return lerp(float3(0.5, 0.5, 0.5), col, contrast); } - + float3 GetSaturation(float3 col, float interpolator) { return lerp(dot(col, float3(0.3, 0.59, 0.11)), col, interpolator); } - + void applyPostProcessing(inout PoiFragData poiFragData, in PoiMesh poiMesh) { float3 col = poiFragData.finalColor; - col = hueShift(col, _PPHue); + col = hueShift(col, _PPHue, _PPHueShiftColorSpace); col *= _PPTint; col *= _PPRGB; col = GetSaturation(col, _PPSaturation); @@ -22699,30 +23230,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" col = GetContrast(col, _PPContrast); col *= _PPBrightness; col += _PPLightness; - + float ppMask = 1; #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED) ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan)[_PPMaskChannel]; ppMask = lerp(ppMask, 1 - ppMask, _PPMaskInvert); col = lerp(poiFragData.finalColor, col, ppMask); #endif - + if (_PPPosterization) { col = lerp(col, poiPosterize(col, _PPPosterizationAmount), ppMask); } - + poiFragData.finalColor = col; } #endif //endex - + //ifex _PoiInternalParallax==0 #ifdef POI_INTERNALPARALLAX void applyInternalParallax(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods) { float3 parallax = 0; - + for (int j = _ParallaxInternalIterations - 1; j >= 0; j--) { float ratio = saturate((float)j / max(_ParallaxInternalIterations - 1, 1)); @@ -22771,7 +23302,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + // normal correct code from https://github.com/yoship1639/UniToon (MIT) //ifex _NormalCorrect==0 #ifdef POI_NORMALCORRECT @@ -22786,14 +23317,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _VideoEffectsEnable==0 #ifdef POI_VIDEO_EFFECTS float3 applyBacklight(float3 videoTexture, half backlightStrength) { return max(backlightStrength, videoTexture.rgb); } - + float3 applyViewAngleTN(float3 videoTexture, PoiCam poiCam, PoiMesh poiMesh) { float3 reflectionVector = normalize(reflect(poiCam.viewDir.rgb, poiMesh.normals[1].rgb)); @@ -22811,7 +23342,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" videoTexture = (lerp(videoTexture, videoTexture.gbr, sideShift)); return videoTexture; } - + float calculateCRTPixelBrightness(float2 uv) { float totalPixels = _VideoResolution.x * _VideoResolution.y; @@ -22820,7 +23351,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float currentPixelAlpha = currentPixelNumber / totalPixels; half electronBeamAlpha = frac(_Time.y * _VideoCRTRefreshRate); float electronBeamPixelNumber = totalPixels * electronBeamAlpha; - + float DistanceInPixelsFromCurrentElectronBeamPixel = 0; if (electronBeamPixelNumber >= currentPixelNumber) { @@ -22832,10 +23363,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } float CRTFrameTime = 1 / _VideoCRTRefreshRate; float timeSincecurrentPixelWasHitByElectronBeam = (DistanceInPixelsFromCurrentElectronBeamPixel / totalPixels); - + return saturate(_VideoCRTPixelEnergizedTime - timeSincecurrentPixelWasHitByElectronBeam); } - + void applyContrastSettings(inout float3 pixel) { #if !UNITY_COLORSPACE_GAMMA @@ -22846,18 +23377,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" pixel = GammaToLinearSpace(pixel); #endif } - + void applySaturationSettings(inout float3 pixel) { pixel = lerp(pixel.rgb, dot(pixel.rgb, float3(0.3, 0.59, 0.11)), - (_VideoSaturation)); } - + void applyVideoSettings(inout float3 pixel) { applySaturationSettings(pixel); applyContrastSettings(pixel); } - + void calculateLCD(inout float4 videoTexture, float3 pixels) { videoTexture.rgb = applyBacklight(videoTexture, _VideoBacklight * .01); @@ -22898,13 +23429,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" void calculateProjector(inout float4 videoTexture) { applyVideoSettings(videoTexture.rgb); - + float3 projectorColor = videoTexture * _VideoBacklight; videoTexture.r = clamp(projectorColor.r, videoTexture.r, 1000); videoTexture.g = clamp(projectorColor.g, videoTexture.g, 1000); videoTexture.b = clamp(projectorColor.b, videoTexture.b, 1000); } - + void applyVideoEffectsMainTex(inout float4 mainTexture, in PoiMesh poiMesh) { float2 uvs = poiMesh.uv[_MainTexUV]; @@ -22936,7 +23467,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 modifiedVideoTexture = 0; modifiedVideoTexture.rgb = poiFragData.baseColor; modifiedVideoTexture.a = poiFragData.alpha; - + // UNITY_BRANCH // if(_VideoRepeatVideoTexture == 1) // { @@ -22945,41 +23476,41 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // return; // } // } - + switch(_VideoType) { case 0: // LCD - + { calculateLCD(modifiedVideoTexture, pixels); break; } case 1: // TN - + { calculateTN(modifiedVideoTexture, pixels, poiCam, poiMesh); break; } case 2: // CRT - + { calculateCRT(modifiedVideoTexture, pixels, uvs); break; } case 3: // OLED - + { calculateOLED(modifiedVideoTexture, pixels); break; } case 4: // Gameboy - + { calculateGameboy(modifiedVideoTexture); break; } case 5: // Projector - + { calculateProjector(modifiedVideoTexture); break; @@ -22990,7 +23521,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float screenMask = 1; #endif - + poiFragData.baseColor = lerp(poiFragData.baseColor, modifiedVideoTexture, screenMask); // UNITY_BRANCH if (_VideoEmissionEnabled) @@ -23000,18 +23531,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _BacklightEnabled!=1 #ifdef POI_BACKLIGHT void ApplyBacklight(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiCam poiCam, inout PoiMods poiMods) { - + // Color float3 backlightColor = _BacklightColor.rgb; #if defined(PROP_BACKLIGHTCOLORTEX) || !defined(OPTIMIZER_ENABLED) backlightColor *= POI2D_SAMPLER_PAN(_BacklightColorTex, _MainTex, poiUV(poiMesh.uv[_BacklightColorTexUV], _BacklightColorTex_ST), _BacklightColorTexPan).rgb; #endif - + float3 normal = lerp(poiMesh.normals[0], poiMesh.normals[1], _BacklightNormalStrength); // Factor float3 headDir = normalize(getCameraPosition() - poiMesh.worldPos.xyz); @@ -23026,14 +23557,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" backlightLN = poiEdgeLinear(backlightLN, _BacklightBorder, _BacklightBlur); float backlight = saturate(backlightFactor * backlightLN); backlight = !poiMesh.isFrontFace && _BacklightBackfaceMask ? 0.0 : backlight; - + // Blend backlightColor = lerp(backlightColor, backlightColor * poiFragData.baseColor, _BacklightMainStrength); poiLight.finalLightAdd += backlight * backlightColor * poiLight.directColor; } #endif //endex - + //ifex _VoronoiEnabled!=1 #ifdef POI_VORONOI //1/7 @@ -23045,7 +23576,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return glsl_mod((34.0 * x + 1.0) * x, 289.0); } - + float3 inoise(float3 P, float jitter, out float3 randomPoint) { P *= 0.7f; // Scale adjustment @@ -23056,10 +23587,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 px = Permutation(Pi.x + oi); float3 py = Permutation(Pi.y + oi); float3 pz = Permutation(Pi.z + oi); - + float3 p, ox, oy, oz, dx, dy, dz; float3 F = 1e6; - + [unroll(3)] for (int i = 0; i < 3; i++) { @@ -23071,19 +23602,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { p = Permutation(px[i] + py[j] + pz[k] + oi); // pij1, pij2, pij3 float3 ogp = p; - + ox = frac(p * VoronoiK) - VoronoiKo; oy = glsl_mod(floor(p * VoronoiK), 7.0) * VoronoiK - VoronoiKo; - + p = Permutation(p); oz = frac(p * VoronoiK) - VoronoiKo; - + dx = Pf.x - of[i] + jitter * ox; dy = Pf.y - of[j] + jitter * oy; dz = Pf.z - of[k] + jitter * oz; - + float3 d = dx * dx + dy * dy + dz * dz; // dij1, dij2 and dij3, squared - + //Find lowest and second lowest distances for (int n = 0; n < 3; n++) { @@ -23101,17 +23632,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } } - + return F; } - + float voronoi2D(in float2 x, float scale, float2 speed, out float2 randomPoint) { x *= scale; x += speed * _Time.x; float2 n = floor(x); float2 f = frac(x); - + // first pass: regular voronoi float2 mg, mr; float md = 8.0; @@ -23122,10 +23653,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 g = float2(float(i), float(j)); float2 o = random2(n + g); float2 currentPoint = o; - + float2 r = g + o - f; float d = dot(r, r); - + if (d < md) { md = d; @@ -23135,7 +23666,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } } - + // second pass: distance to borders md = 8.0; for (int r = -2; r <= 2; r++) @@ -23144,9 +23675,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { float2 g = mg + float2(float(q), float(r)); float2 o = random2(n + g); - + float2 r = g + o - f; - + if (dot(mr - r, mr - r) > 0.00001) { md = min(md, dot(0.5 * (mr + r), normalize(r - mr))); @@ -23155,14 +23686,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return md; } - + float voronoi3D(in float3 x, float scale, float3 speed, out float3 randomPoint) { x *= scale; x += speed * _Time.x; float3 n = floor(x); float3 f = frac(x); - + // first pass: regular voronoi float3 mg, mr; float md = 8.0; @@ -23175,10 +23706,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 g = float3(float(h), float(i), float(j)); float3 o = random3(n + g); float3 currentPoint = o; - + float3 r = g + o - f; float d = dot(r, r); - + if (d < md) { md = d; @@ -23189,7 +23720,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } } - + // second pass: distance to borders md = 8.0; for (int r = -2; r <= 2; r++) @@ -23200,9 +23731,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { float3 g = mg + float3(float(p), float(q), float(r)); float3 o = random3(n + g); - + float3 r = g + o - f; - + if (dot(mr - r, mr - r) > 0.00001) { md = min(md, dot(0.5 * (mr + r), normalize(r - mr))); @@ -23212,7 +23743,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return md; } - + // fracal sum, range -1.0 - 1.0 float VoronoiNoise_Octaves(float3 p, float scale, float3 speed, int octaveNumber, float octaveScale, float octaveAttenuation, float jitter, float time, out float3 randomPoint) { @@ -23223,15 +23754,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // for (int i = 0; i < octaveNumber; i ++) // { float3 F = inoise(p * freq + time * speed, jitter, randomPoint) * weight; - + sum += sqrt(F[0]); - + // freq *= octaveScale; // weight *= 1.0f - octaveAttenuation; // } return sum; } - + float VoronoiNoiseDiff_Octaves(float3 p, float scale, float3 speed, int octaveNumber, float octaveScale, float octaveAttenuation, float jitter, float time, out float3 randomPoint) { float freq = scale; @@ -23241,26 +23772,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // for (int i = 0; i < octaveNumber; i ++) // { float3 F = inoise(p * freq + time * speed, jitter, randomPoint) * weight; - + sum += sqrt(F[1]) - sqrt(F[0]); - + // freq *= octaveScale; // weight *= 1.0f - octaveAttenuation; // } return sum; } - + void ApplyVoronoi(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) { float voronoiOctaveNumber = 1; float voronoiOctaveScale = 1; float voronoiOctaveAttenuation = 1; float3 randomPoint = 0; - + float voronoi = 0; - + float3 position = 0; - + UNITY_BRANCH if (_VoronoiSpace == 0) { @@ -23281,19 +23812,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float mask = 1; #endif - + if (_VoronoiGlobalMask > 0) { mask = maskBlend(mask, poiMods.globalMask[_VoronoiGlobalMask - 1], _VoronoiGlobalMaskBlendType); } - + #if defined(PROP_VORONOINOISE) || !defined(OPTIMIZER_ENABLED) float edgeNoise = POI2D_SAMPLER_PAN(_VoronoiNoise, _MainTex, poiUV(poiMesh.uv[_VoronoiNoiseUV], _VoronoiNoise_ST), _VoronoiNoisePan)[_VoronoiNoiseChannel]; #else float edgeNoise = 0; #endif edgeNoise *= _VoronoiNoiseIntensity; - + float3 voronoiSpeed = _VoronoiSpeed * 10; #ifdef POI_AUDIOLINK if (poiMods.audioLinkAvailable) @@ -23303,30 +23834,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" position.z += AudioLinkGetChronoTime(_AudioLinkVoronoiChronoSpeedZType, _AudioLinkVoronoiChronoSpeedZBand) * _AudioLinkVoronoiChronoSpeedZSpeed * 0.01; } #endif - + if (_VoronoiType == 0) // Basic - + { voronoi = voronoi2D(position.xy, _VoronoiScale, voronoiSpeed, randomPoint.xy); voronoi *= 1.55; // Range adjustment - + } if (_VoronoiType == 1) // Diff - + { voronoi = VoronoiNoiseDiff_Octaves(position, _VoronoiScale, voronoiSpeed, voronoiOctaveNumber, voronoiOctaveScale, voronoiOctaveAttenuation, 1, _Time.x, randomPoint); } if (_VoronoiType == 2) // Fixed Border - + { voronoi = voronoi3D(position, _VoronoiScale, voronoiSpeed, randomPoint); voronoi *= 1.8; // Range adjustment - + } - + float4 outerColor = _VoronoiOuterColor; float4 innerColor = _VoronoiInnerColor; - + if (_VoronoiEnableRandomCellColor == 1) { float3 rando = random3(randomPoint); @@ -23343,7 +23874,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" voronoiGradient.y -= _AudioLinkVoronoiGradientMaxAdd * poiMods.audioLink[_AudioLinkVoronoiGradientMaxAddBand]; #endif float ramp = smoothstep(voronoiGradient.x, voronoiGradient.y, voronoi); - + if (_VoronoiBlend == 0) { float4 voronoiColor = lerp(outerColor, innerColor, ramp); @@ -23365,7 +23896,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + float4 frag(VertexOut i, uint facing : SV_IsFrontFace) : SV_Target /* #ifdef @@ -23375,23 +23906,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { UNITY_SETUP_INSTANCE_ID(i); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); - + PoiMesh poiMesh; PoiInitStruct(PoiMesh, poiMesh); - + PoiLight poiLight; PoiInitStruct(PoiLight, poiLight); - + PoiVertexLights poiVertexLights; PoiInitStruct(PoiVertexLights, poiVertexLights); - + PoiCam poiCam; PoiInitStruct(PoiCam, poiCam); - + PoiMods poiMods; PoiInitStruct(PoiMods, poiMods); poiMods.globalEmission = 1; - + PoiFragData poiFragData; poiFragData.smoothness = 1; poiFragData.smoothness2 = 1; @@ -23403,17 +23934,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.finalColor = float3(0, 0, 0); poiFragData.alpha = 1; poiFragData.toggleVertexLights = 0; - + #ifdef POI_UDIMDISCARD applyUDIMDiscard(i); #endif - + //ifex _NormalCorrect==0 #ifdef POI_NORMALCORRECT applyNormalCorrect(i); #endif //endex - + // Mesh Data //poiMesh.objectPosition = mul(unity_ObjectToWorld, float3(0, 0, 0)).xyz; poiMesh.objectPosition = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz; @@ -23427,7 +23958,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMesh.isFrontFace = facing; poiMesh.dx = ddx(poiMesh.uv[0]); poiMesh.dy = ddy(poiMesh.uv[0]); - + poiMesh.isRightHand = i.tangent.w > 0.0; + #ifndef POI_PASS_OUTLINE if (!poiMesh.isFrontFace && _FlipBackfaceNormals) { @@ -23436,14 +23968,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMesh.binormal[0] *= -1; } #endif - + poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22); float3 tanToWorld0 = float3(poiMesh.tangent[0].x, poiMesh.binormal[0].x, poiMesh.normals[0].x); float3 tanToWorld1 = float3(poiMesh.tangent[0].y, poiMesh.binormal[0].y, poiMesh.normals[0].y); float3 tanToWorld2 = float3(poiMesh.tangent[0].z, poiMesh.binormal[0].z, poiMesh.normals[0].z); float3 ase_tanViewDir = tanToWorld0 * poiCam.viewDir.x + tanToWorld1 * poiCam.viewDir.y + tanToWorld2 * poiCam.viewDir.z; poiCam.tangentViewDir = normalize(ase_tanViewDir); - + // 0-3 UV0-UV3 // 4 Panosphere UV // 5 world pos xz @@ -23462,7 +23994,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMesh.uv[6] = poiMesh.uv[0]; poiMesh.uv[7] = poiMesh.uv[0]; poiMesh.uv[8] = poiMesh.uv[0]; - + poiMesh.uv[4] = calculatePanosphereUV(poiMesh); poiMesh.uv[5] = calculateWorldUV(poiMesh); poiMesh.uv[6] = calculatePolarCoordinate(poiMesh); @@ -23477,7 +24009,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp)); poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5; */ - + //ifex _PoiParallax==0 #ifdef POI_PARALLAX #ifndef POI_PASS_OUTLINE @@ -23487,7 +24019,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + poiMods.globalMask[0] = 1; poiMods.globalMask[1] = 1; poiMods.globalMask[2] = 1; @@ -23519,16 +24051,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" ApplyGlobalMaskOptions(poiMods); } //endex - + float2 mainUV = poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST); - + if (_MainPixelMode) { mainUV = sharpSample(_MainTex_TexelSize, mainUV); } - + float4 mainTexture = POI2D_SAMPLER_PAN_STOCHASTIC(_MainTex, _MainTex, mainUV, _MainTexPan, _MainTexStochastic); - + //ifex _VideoEffectsEnable==0 #ifdef POI_VIDEO_EFFECTS if (_VideoEffectsEnable) @@ -23537,48 +24069,48 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + #if defined(PROP_BUMPMAP) || !defined(OPTIMIZER_ENABLED) poiMesh.tangentSpaceNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN_STOCHASTIC(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV].xy, _BumpMap_ST), _BumpMapPan, _BumpMapStochastic), _BumpScale); #else poiMesh.tangentSpaceNormal = UnpackNormal(float4(0.5, 0.5, 1, 1)); #endif - + //ifex _DetailEnabled==0 #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE) ApplyDetailNormal(poiMods, poiMesh); #endif //endex - + //ifex _RGBMaskEnabled==0 #if defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE) calculateRGBNormals(poiMesh, poiMods); #endif - + //endex - + float3 tangentSpaceNormal = UnpackNormal(float4(0.5, 0.5, 1, 1)); poiMesh.normals[0] = normalize( tangentSpaceNormal.x * poiMesh.tangent[0] + tangentSpaceNormal.y * poiMesh.binormal[0] + tangentSpaceNormal.z * poiMesh.normals[0] ); - + poiMesh.normals[1] = normalize( poiMesh.tangentSpaceNormal.x * poiMesh.tangent[0] + poiMesh.tangentSpaceNormal.y * poiMesh.binormal[0] + poiMesh.tangentSpaceNormal.z * poiMesh.normals[0] ); - + poiMesh.tangent[1] = cross(poiMesh.binormal[0], -poiMesh.normals[1]); poiMesh.binormal[1] = cross(-poiMesh.normals[1], poiMesh.tangent[0]); - + //ifex _EnableOutlines!=1 #ifdef POI_PASS_OUTLINE poiMesh.normals[1] = poiMesh.normals[0]; #endif //endex - + // Camera data poiCam.forwardDir = getCameraForward(); poiCam.worldPos = _WorldSpaceCameraPos; @@ -23598,14 +24130,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif poiCam.posScreenPixels = calcPixelScreenUVs(poiCam.posScreenSpace); poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1])); - + poiCam.worldDirection.xyz = poiMesh.worldPos.xyz - poiCam.worldPos; poiCam.worldDirection.w = dot(poiCam.clipPos, CalculateFrustumCorrection()); - + calculateGlobalThemes(poiMods); - + poiLight.finalLightAdd = 0; - + // Ambient Occlusion #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED) float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan); @@ -23613,12 +24145,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else poiLight.occlusion = 1; #endif - + if (_LightDataAOGlobalMaskR > 0) { poiLight.occlusion = maskBlend(poiLight.occlusion, poiMods.globalMask[_LightDataAOGlobalMaskR - 1], _LightDataAOGlobalMaskBlendTypeR); } - + // Detail Shadows #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED) float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan); @@ -23630,12 +24162,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else poiLight.detailShadow = 1; #endif - + if (_LightDataDetailShadowGlobalMaskR > 0) { poiLight.detailShadow = maskBlend(poiLight.detailShadow, poiMods.globalMask[_LightDataDetailShadowGlobalMaskR - 1], _LightDataDetailShadowGlobalMaskBlendTypeR); } - + // Shadow Masks #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED) float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan); @@ -23647,15 +24179,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { poiLight.shadowMask = maskBlend(poiLight.shadowMask, poiMods.globalMask[_LightDataShadowMaskGlobalMaskR - 1], _LightDataShadowMaskGlobalMaskBlendTypeR); } - + #ifdef UNITY_PASS_FORWARDBASE - + bool lightExists = false; if (any(_LightColor0.rgb >= 0.002)) { lightExists = true; } - + if (_LightingVertexLightingEnabled) { poiFragData.toggleVertexLights = 1; @@ -23664,7 +24196,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { poiFragData.toggleVertexLights = 0; } - + if (_LightingVertexLightingEnabled) { #if defined(VERTEXLIGHT_ON) @@ -23675,34 +24207,34 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" lengthSq += toLightX * toLightX; lengthSq += toLightY * toLightY; lengthSq += toLightZ * toLightZ; - + float4 lightAttenSq = unity_4LightAtten0; float4 atten = 1.0 / (1.0 + lengthSq * lightAttenSq); float4 vLightWeight = saturate(1 - (lengthSq * lightAttenSq / 25)); poiLight.vAttenuation = min(atten, vLightWeight * vLightWeight); - + poiLight.vDotNL = 0; poiLight.vDotNL += toLightX * poiMesh.normals[1].x; poiLight.vDotNL += toLightY * poiMesh.normals[1].y; poiLight.vDotNL += toLightZ * poiMesh.normals[1].z; - + float4 corr = rsqrt(lengthSq); poiLight.vertexVDotNL = max(0, poiLight.vDotNL * corr); - + poiLight.vertexVDotNL = 0; poiLight.vertexVDotNL += toLightX * poiMesh.normals[0].x; poiLight.vertexVDotNL += toLightY * poiMesh.normals[0].y; poiLight.vertexVDotNL += toLightZ * poiMesh.normals[0].z; - + poiLight.vertexVDotNL = max(0, poiLight.vDotNL * corr); - + poiLight.vSaturatedDotNL = saturate(poiLight.vDotNL); - + [unroll] for (int index = 0; index < 4; index++) { poiLight.vPosition[index] = float3(unity_4LightPosX0[index], unity_4LightPosY0[index], unity_4LightPosZ0[index]); - + float3 vertexToLightSource = poiLight.vPosition[index] - poiMesh.worldPos; poiLight.vDirection[index] = normalize(vertexToLightSource); poiLight.vColor[index] = _LightingAdditiveLimited ? MaxLuminance(unity_LightColor[index].rgb * poiLight.vAttenuation[index], _LightingAdditiveLimit) : unity_LightColor[index].rgb * poiLight.vAttenuation[index]; @@ -23711,38 +24243,38 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.vDotNL[index] = dot(poiMesh.normals[1], poiLight.vDirection[index]); poiLight.vCorrectedDotNL[index] = .5 * (poiLight.vDotNL[index] + 1); poiLight.vDotLH[index] = saturate(dot(poiLight.vDirection[index], poiLight.vHalfDir[index])); - + poiLight.vDotNH[index] = dot(poiMesh.normals[1], poiLight.vHalfDir[index]); poiLight.vertexVDotNH[index] = saturate(dot(poiMesh.normals[0], poiLight.vHalfDir[index])); } #endif } - + //UNITY_BRANCH if (_LightingColorMode == 0) // Poi Custom Light Color - + { float3 magic = max(BetterSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)), 0); float3 normalLight = _LightColor0.rgb + BetterSH9(float4(0, 0, 0, 1)); - + float magiLumi = calculateluminance(magic); float normaLumi = calculateluminance(normalLight); float maginormalumi = magiLumi + normaLumi; - + float magiratio = magiLumi / maginormalumi; float normaRatio = normaLumi / maginormalumi; - + float target = calculateluminance(magic * magiratio + normalLight * normaRatio); float3 properLightColor = magic + normalLight; float properLuminance = calculateluminance(magic + normalLight); poiLight.directColor = properLightColor * max(0.0001, (target / properLuminance)); - + poiLight.indirectColor = BetterSH9(float4(lerp(0, poiMesh.normals[1], _LightingIndirectUsesNormals), 1)); } - + //UNITY_BRANCH if (_LightingColorMode == 1) // More standard approach to light color - + { float3 indirectColor = BetterSH9(float4(poiMesh.normals[1], 1)); if (lightExists) @@ -23756,24 +24288,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.indirectColor = indirectColor * 0.5; } } - + if (_LightingColorMode == 2) // UTS style - + { poiLight.indirectColor = saturate(max(half3(0.05, 0.05, 0.05) * _Unlit_Intensity, max(ShadeSH9(half4(0.0, 0.0, 0.0, 1.0)), ShadeSH9(half4(0.0, -1.0, 0.0, 1.0)).rgb) * _Unlit_Intensity)); poiLight.directColor = max(poiLight.indirectColor, _LightColor0.rgb); } - + if (_LightingColorMode == 3) // OpenLit - + { float3 lightDirectionForSH9 = OpenLitLightingDirectionForSH9(); OpenLitShadeSH9ToonDouble(lightDirectionForSH9, poiLight.directColor, poiLight.indirectColor); poiLight.directColor += _LightColor0.rgb; // OpenLit does a few other things by default like clamp direct colour // see https://github.com/lilxyzw/OpenLit/blob/main/Assets/OpenLit/core.hlsl#L174 + } - + float lightMapMode = _LightingMapMode; //UNITY_BRANCH if (_LightingDirectionMode == 0) @@ -23797,23 +24330,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" lightMapMode == 1; } } - + if (_LightingDirectionMode == 3) // UTS - + { float3 defaultLightDirection = normalize(UNITY_MATRIX_V[2].xyz + UNITY_MATRIX_V[1].xyz); float3 lightDirection = normalize(lerp(defaultLightDirection, _WorldSpaceLightPos0.xyz, any(_WorldSpaceLightPos0.xyz))); poiLight.direction = lightDirection; } if (_LightingDirectionMode == 4) // OpenLit - + { poiLight.direction = OpenLitLightingDirection(); // float4 customDir = 0; // Do we want to give users to alter this (OpenLit always does!)? - + } - + if (_LightingDirectionMode == 5) // View Direction - + { float3 upViewDir = normalize(UNITY_MATRIX_V[1].xyz); float3 rightViewDir = normalize(UNITY_MATRIX_V[0].xyz); @@ -23824,12 +24357,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 rotatedViewPitch = RotateAroundAxis(rotatedViewCameraMeshOffset, rotatedViewYaw, pitchOffset_Rads); poiLight.direction = normalize(rotatedViewPitch); } - + if (!any(poiLight.direction)) { poiLight.direction = float3(.4, 1, .4); } - + poiLight.direction = normalize(poiLight.direction); poiLight.attenuationStrength = _LightingCastedShadows; poiLight.attenuation = 1; @@ -23838,7 +24371,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos) poiLight.attenuation *= attenuation; } - + + #if defined(HANDLE_SHADOWS_BLENDING_IN_GI) + half bakedAtten = UnitySampleBakedOcclusion(poiMesh.lightmapUV.xy, poiMesh.worldPos); + float zDist = dot(_WorldSpaceCameraPos - poiMesh.worldPos, UNITY_MATRIX_V[2].xyz); + float fadeDist = UnityComputeShadowFadeDistance(poiMesh.worldPos, zDist); + poiLight.attenuation = UnityMixRealtimeAndBakedShadows(poiLight.attenuation, bakedAtten, UnityComputeShadowFade(fadeDist)); + #endif + if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0) { lightMapMode = 1; @@ -23847,7 +24387,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.direction = normalize(float3(.4, 1, .4)); } } - + poiLight.halfDir = normalize(poiLight.direction + poiCam.viewDir); poiLight.vertexNDotL = dot(poiMesh.normals[0], poiLight.direction); poiLight.nDotL = dot(poiMesh.normals[1], poiLight.direction); @@ -23859,13 +24399,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.vertexNDotH = max(0.00001, dot(poiMesh.normals[0], poiLight.halfDir)); poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir); poiLight.lDotH = max(0.00001, dot(poiLight.direction, poiLight.halfDir)); - + // Poi special light map if (lightMapMode == 0) { float3 ShadeSH9Plus = GetSHLength(); float3 ShadeSH9Minus = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0; - + float3 greyScaleVector = float3(.33333, .33333, .33333); float bw_lightColor = dot(poiLight.directColor, greyScaleVector); float bw_directLighting = (((poiLight.nDotL * 0.5 + 0.5) * bw_lightColor * lerp(1, poiLight.attenuation, poiLight.attenuationStrength)) + dot(ShadeSH9(float4(poiMesh.normals[1], 1)), greyScaleVector)); @@ -23873,7 +24413,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float bw_bottomIndirectLighting = dot(ShadeSH9Minus, greyScaleVector); float bw_topIndirectLighting = dot(ShadeSH9Plus, greyScaleVector); float lightDifference = ((bw_topIndirectLighting + bw_lightColor) - bw_bottomIndirectLighting); - + poiLight.lightMap = smoothstep(0, lightDifference, bw_directLighting - bw_bottomIndirectLighting); poiLight.lightMapNoAttenuation = smoothstep(0, lightDifference, bw_directLightingNoAtten - bw_bottomIndirectLighting); } @@ -23896,10 +24436,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } poiLight.lightMapNoAttenuation *= poiLight.detailShadow; poiLight.lightMap *= poiLight.detailShadow; - + poiLight.directColor = max(poiLight.directColor, 0.0001); poiLight.indirectColor = max(poiLight.indirectColor, 0.0001); - + if (_LightingColorMode == 3) { // OpenLit @@ -23910,50 +24450,50 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.directColor = max(poiLight.directColor, poiLight.directColor * min(10000, (_LightingMinLightBrightness * rcp(calculateluminance(poiLight.directColor))))); poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor * min(10000, (_LightingMinLightBrightness * rcp(calculateluminance(poiLight.indirectColor))))); } - + poiLight.directColor = lerp(poiLight.directColor, dot(poiLight.directColor, float3(0.299, 0.587, 0.114)), _LightingMonochromatic); poiLight.indirectColor = lerp(poiLight.indirectColor, dot(poiLight.indirectColor, float3(0.299, 0.587, 0.114)), _LightingMonochromatic); - + if (_LightingCapEnabled) { poiLight.directColor = min(poiLight.directColor, _LightingCap); poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap); } - + if (_LightingForceColorEnabled) { poiLight.directColor = poiThemeColor(poiMods, _LightingForcedColor, _LightingForcedColorThemeIndex); } - + #ifdef UNITY_PASS_FORWARDBASE poiLight.directColor = max(poiLight.directColor * _PPLightingMultiplier, 0); poiLight.directColor = max(poiLight.directColor + _PPLightingAddition, 0); poiLight.indirectColor = max(poiLight.indirectColor * _PPLightingMultiplier, 0); poiLight.indirectColor = max(poiLight.indirectColor + _PPLightingAddition, 0); #endif - + #endif - + #ifdef POI_PASS_ADD if (!_LightingAdditiveEnable) { return float4(mainTexture.rgb * .0001, 1); } - + #if defined(DIRECTIONAL) if (_DisableDirectionalInAdd) { return float4(mainTexture.rgb * .0001, 1); } #endif - + poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz * _WorldSpaceLightPos0.w); #if defined(POINT) || defined(SPOT) #ifdef POINT unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz; poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r; #endif - + #ifdef SPOT unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)); poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz); @@ -23964,18 +24504,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos); poiLight.attenuationStrength = _LightingAdditiveCastedShadows; - poiLight.directColor = _LightingAdditiveLimited ? MaxLuminance(_LightColor0.rgb * poiLight.attenuation, _LightingAdditiveLimit) : _LightColor0.rgb * poiLight.attenuation; - + poiLight.directColor = _LightingAdditiveLimited ? MaxLuminance(_LightColor0.rgb * poiLight.attenuation, _LightingAdditiveLimit) : _LightColor0.rgb * poiLight.attenuation; + #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE) poiLight.indirectColor = 0; #else poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough); poiLight.indirectColor = _LightingAdditiveLimited ? MaxLuminance(poiLight.indirectColor, _LightingAdditiveLimit) : poiLight.indirectColor; #endif - + poiLight.directColor = lerp(poiLight.directColor, dot(poiLight.directColor, float3(0.299, 0.587, 0.114)), _LightingAdditiveMonochromatic); poiLight.indirectColor = lerp(poiLight.indirectColor, dot(poiLight.indirectColor, float3(0.299, 0.587, 0.114)), _LightingAdditiveMonochromatic); - + poiLight.halfDir = normalize(poiLight.direction + poiCam.viewDir); poiLight.nDotL = dot(poiMesh.normals[1], poiLight.direction); poiLight.nDotLSaturated = saturate(poiLight.nDotL); @@ -23987,7 +24527,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.vertexNDotL = dot(poiMesh.normals[0], poiLight.direction); poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir)); poiLight.vertexNDotH = max(0.00001, dot(poiMesh.normals[0], poiLight.halfDir)); - + // Normalized nDotL if (_LightingMapMode == 0 || _LightingMapMode == 1 || _LightingMapMode == 2) { @@ -24001,7 +24541,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.lightMapNoAttenuation = poiLight.lightMap; poiLight.lightMap *= lerp(1, poiLight.additiveShadow, poiLight.attenuationStrength); #endif - + //ifex _LightDataDebugEnabled==0 if (_LightDataDebugEnabled) { @@ -24069,28 +24609,28 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif } //endex - + //ifex _EnableAudioLink==0 #ifdef POI_AUDIOLINK SetupAudioLink(poiFragData, poiMods, poiMesh); #endif //endex - + //ifex _MochieBRDF==0 #if defined(MOCHIE_PBR) MetallicAndSpecularFragDataInit(poiFragData, poiMesh, poiMods); #endif //endex - + //ifex _BlackLightMaskingEnabled==0 #ifdef POI_BLACKLIGHTMASKING calculateBlackLightMasks(poiMesh, poiMods); #endif //endex - + poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex); poiFragData.alpha = mainTexture.a * _Color.a; - + //ifex _MainColorAdjustToggle==0 #ifdef COLOR_GRADING_HDR #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED) @@ -24098,7 +24638,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float4 hueShiftAlpha = 1; #endif - + if (_MainHueGlobalMask > 0) { hueShiftAlpha.r = maskBlend(hueShiftAlpha.r, poiMods.globalMask[_MainHueGlobalMask - 1], _MainHueGlobalMaskBlendType); @@ -24111,8 +24651,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { hueShiftAlpha.g = maskBlend(hueShiftAlpha.g, poiMods.globalMask[_MainBrightnessGlobalMask - 1], _MainBrightnessGlobalMaskBlendType); } - - if (_MainHueShiftToggle) + + if (_MainHueShiftToggle == 1) { float shift = _MainHueShift; #ifdef POI_AUDIOLINK @@ -24124,18 +24664,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif if (_MainHueShiftReplace) { - poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r); + poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x, _MainHueShiftColorSpace), hueShiftAlpha.r); } else { - poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x))); + poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)), _MainHueShiftColorSpace); } } - + if (_MainGradationStrength && _ColorGradingToggle) { #if !defined(UNITY_COLORSPACE_GAMMA) float3 tempColor = OpenLitLinearToSRGB(poiFragData.baseColor); + #else + float3 tempColor = poiFragData.baseColor; #endif #if defined(PROP_MAINGRADATIONTEX) || !defined(OPTIMIZER_ENABLED) tempColor.r = POI_SAMPLE_1D_X(_MainGradationTex, sampler_linear_clamp, tempColor.r).r; @@ -24149,18 +24691,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif poiFragData.baseColor = lerp(poiFragData.baseColor, tempColor, _MainGradationStrength); } - + poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), - (_Saturation) * hueShiftAlpha.b); poiFragData.baseColor = saturate(lerp(poiFragData.baseColor, poiFragData.baseColor * (_MainBrightness + 1), hueShiftAlpha.g)); #endif //endex - + #if defined(PROP_ALPHAMASK) || !defined(OPTIMIZER_ENABLED) - + if (_MainAlphaMaskMode) { float alphaMask = POI2D_SAMPLER_PAN(_AlphaMask, _MainTex, poiUV(poiMesh.uv[_AlphaMaskUV], _AlphaMask_ST), _AlphaMaskPan.xy).r; - alphaMask = saturate(alphaMask * _AlphaMaskScale + _AlphaMaskValue); + alphaMask = saturate(alphaMask * _AlphaMaskBlendStrength + (_AlphaMaskInvert ?_AlphaMaskValue * -1 : _AlphaMaskValue)); if (_AlphaMaskInvert) alphaMask = 1 - alphaMask; if (_MainAlphaMaskMode == 1) poiFragData.alpha = alphaMask; if (_MainAlphaMaskMode == 2) poiFragData.alpha = poiFragData.alpha * alphaMask; @@ -24168,7 +24710,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (_MainAlphaMaskMode == 4) poiFragData.alpha = saturate(poiFragData.alpha - alphaMask); } #endif - + //ifex _VideoEffectsEnable==0 #ifdef POI_VIDEO_EFFECTS if (_VideoEffectsEnable) @@ -24177,43 +24719,43 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods); - + //ifex _EnableTouchGlow==0 #ifdef GRAIN applyDepthFX(poiFragData, poiCam, poiMesh, poiMods); #endif //endex - + //ifex _DetailEnabled==0 #ifdef FINALPASS ApplyDetailColor(poiFragData, poiMesh, poiMods); #endif //endex - + //ifex _MainVertexColoringEnabled==0 applyVertexColor(poiFragData, poiMesh); //endex - + //ifex _BackFaceEnabled!=1 #ifdef POI_BACKFACE ApplyBackFaceColor(poiFragData, poiMesh, poiMods); #endif //endex - + //ifex _RGBMaskEnabled==0 #ifdef VIGNETTE calculateRGBMask(poiFragData, poiMesh, poiMods); #endif //endex - + //ifex _EnableDissolve==0 #ifdef DISTORT applyDissolve(poiFragData, poiMesh, poiMods, poiCam, poiLight); #endif //endex - + //ifex _ShadingEnabled==0 #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED) #ifndef POI_PASS_OUTLINE @@ -24223,7 +24765,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _ShadingEnabled==0 #ifdef VIGNETTE_MASKED #ifdef POI_PASS_OUTLINE @@ -24253,34 +24795,34 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { applyToGlobalMask(poiMods, _ShadingRampedLightMapInverseApplyGlobalMaskIndex - 1, _ShadingRampedLightMapInverseApplyGlobalMaskBlendType, 1 - poiLight.rampedLightMap); } - + poiLight.directLuminance = dot(poiLight.directColor, float3(0.299, 0.587, 0.114)); poiLight.indirectLuminance = dot(poiLight.directColor, float3(0.299, 0.587, 0.114)); poiLight.finalLuminance = dot(poiLight.finalLighting, float3(0.299, 0.587, 0.114)); //endex - + #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 - + //ifex _EnableAniso==0 #ifdef POI_ANISOTROPICS applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods); #endif //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) applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods); #endif //endex - + //ifex _CubeMapEnabled==0 #ifdef _CUBEMAP applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods); #endif //endex - + //ifex _EnableALDecal==0 #ifdef POI_AUDIOLINK #ifdef POI_AL_DECAL @@ -24288,7 +24830,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableVolumeColor==0 #ifdef POI_AUDIOLINK #ifdef POI_AL_VOLUMECOLOR @@ -24296,13 +24838,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableFlipbook==0 #ifdef _SUNDISK_HIGH_QUALITY applyFlipbook(poiFragData, poiMesh, poiMods); #endif //endex - + //ifex _EnableRimLighting==0 #ifdef _GLOSSYREFLECTIONS_OFF #ifdef _RIMSTYLE_POIYOMI @@ -24314,12 +24856,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float rimMask = 1; float rimBias = 0; #endif - - if(_RimMaskInvert) + + if (_RimMaskInvert) { rimMask = 1 - rimMask; } - + #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED) float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan); #else @@ -24339,8 +24881,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" AudioLinkRimBrightnessBand = _AudioLinkRimBrightnessBand; AudioLinkRimBrightnessAdd = _AudioLinkRimBrightnessAdd; #endif - - ApplyPoiyomiRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, _Is_NormalMapToRimLight, _RimLightingInvert, _RimPower, _RimStrength, _RimShadowWidth, _RimShadowToggle, _RimWidth, _RimBlendStrength, rimMask, _RimGlobalMask, _RimGlobalMaskBlendType, rimColor, _RimLightColor, _RimLightColorThemeIndex, _RimHueShiftEnabled, _RimHueShift, _RimHueShiftSpeed, _RimSharpness, _RimShadowMaskRampType, _RimShadowMaskInvert, _RimShadowMaskStrength, _RimShadowAlpha, _RimApplyGlobalMaskIndex, _RimApplyGlobalMaskBlendType, _RimBaseColorMix, _RimBrightness, _RimPoiBlendMode, AudioLinkRimWidthBand, AudioLinkRimWidthAdd, AudioLinkRimEmissionBand, AudioLinkRimEmissionAdd, AudioLinkRimBrightnessBand, AudioLinkRimBrightnessAdd, rimBias, _RimBiasIntensity, _RimApplyAlpha, _RimApplyAlphaBlend); + + ApplyPoiyomiRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, _Is_NormalMapToRimLight, _RimLightingInvert, _RimPower, _RimStrength, _RimShadowWidth, _RimShadowToggle, _RimWidth, _RimBlendStrength, rimMask, _RimGlobalMask, _RimGlobalMaskBlendType, rimColor, _RimLightColor, _RimLightColorThemeIndex, _RimHueShiftEnabled, _RimHueShift, _RimHueShiftColorSpace, _RimHueShiftSpeed, _RimSharpness, _RimShadowMaskRampType, _RimShadowMaskInvert, _RimShadowMaskStrength, _RimShadowAlpha, _RimApplyGlobalMaskIndex, _RimApplyGlobalMaskBlendType, _RimBaseColorMix, _RimBrightness, _RimPoiBlendMode, AudioLinkRimWidthBand, AudioLinkRimWidthAdd, AudioLinkRimEmissionBand, AudioLinkRimEmissionAdd, AudioLinkRimBrightnessBand, AudioLinkRimBrightnessAdd, rimBias, _RimBiasIntensity, _RimApplyAlpha, _RimApplyAlphaBlend); #endif #ifdef _RIMSTYLE_UTS2 #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED) @@ -24348,16 +24890,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float Set_RimLightMask_var = 1; #endif - ApplyUTS2RimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, Set_RimLightMask_var, _RimGlobalMask, _RimGlobalMaskBlendType, _RimLightColor, _RimLightColorThemeIndex, _Is_LightColor_RimLight, _Is_NormalMapToRimLight, _RimLight_Power, _RimLight_InsideMask, _RimLight_FeatherOff, _LightDirection_MaskOn, _Tweak_LightDirection_MaskLevel, _Add_Antipodean_RimLight, _Ap_RimLightColor, _RimApColorThemeIndex, _Is_LightColor_Ap_RimLight, _Ap_RimLight_Power, _Ap_RimLight_FeatherOff, _Tweak_RimLightMaskLevel, _RimHueShiftEnabled, _RimHueShift, _RimHueShiftSpeed); - #endif - #ifdef _RIMSTYLE_LILTOON - #if defined(PROP_RIMCOLORTEX) || !defined(OPTIMIZER_ENABLED) - float4 rimColorTex = POI2D_SAMPLER_PAN(_RimColorTex, _MainTex, poiUV(poiMesh.uv[_RimColorTexUV], _RimColorTex_ST), _RimColorTexPan); - #else - float4 rimColorTex = 1; - #endif - ApplyLiltoonRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, _RimColor, _RimIndirColor, rimColorTex, _RimMainStrength, _RimNormalStrength, _RimDirRange, _RimIndirRange, _RimFresnelPower, _RimBackfaceMask, _RimDirStrength, _RimBorder, _RimBlur, _RimIndirBorder, _RimIndirBlur, _RimShadowMask, _RimEnableLighting, _RimVRParallaxStrength, _RimGlobalMask, _RimGlobalMaskBlendType, _RimHueShiftEnabled, _RimHueShift, _RimHueShiftSpeed, _RimBlendMode); + ApplyUTS2RimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, Set_RimLightMask_var, _RimGlobalMask, _RimGlobalMaskBlendType, _RimLightColor, _RimLightColorThemeIndex, _Is_LightColor_RimLight, _Is_NormalMapToRimLight, _RimLight_Power, _RimLight_InsideMask, _RimLight_FeatherOff, _LightDirection_MaskOn, _Tweak_LightDirection_MaskLevel, _Add_Antipodean_RimLight, _Ap_RimLightColor, _RimApColorThemeIndex, _Is_LightColor_Ap_RimLight, _Ap_RimLight_Power, _Ap_RimLight_FeatherOff, _Tweak_RimLightMaskLevel, _RimHueShiftEnabled, _RimHueShift, _RimHueShiftColorSpace, _RimHueShiftSpeed); #endif + #endif //endex //ifex _EnableRim2Lighting==0 @@ -24371,12 +24906,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float rim2Mask = 1; float rim2Bias = 0; #endif - - if(_Rim2MaskInvert) + + if (_Rim2MaskInvert) { rim2Mask = 1 - rim2Mask; } - + #if defined(PROP_RIM2TEX) || !defined(OPTIMIZER_ENABLED) float4 rim2Color = POI2D_SAMPLER_PAN(_Rim2Tex, _MainTex, poiUV(poiMesh.uv[_Rim2TexUV], _Rim2Tex_ST), _Rim2TexPan); #else @@ -24396,7 +24931,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" AudioLinkRim2BrightnessBand = _AudioLinkRim2BrightnessBand; AudioLinkRim2BrightnessAdd = _AudioLinkRim2BrightnessAdd; #endif - ApplyPoiyomiRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, _Is_NormalMapToRim2Light, _Rim2LightingInvert, _Rim2Power, _Rim2Strength, _Rim2ShadowWidth, _Rim2ShadowToggle, _Rim2Width, _Rim2BlendStrength, rim2Mask, _Rim2GlobalMask, _Rim2GlobalMaskBlendType, rim2Color, _Rim2LightColor, _Rim2LightColorThemeIndex, _Rim2HueShiftEnabled, _Rim2HueShift, _Rim2HueShiftSpeed, _Rim2Sharpness, _Rim2ShadowMaskRampType, _Rim2ShadowMaskInvert, _Rim2ShadowMaskStrength, _Rim2ShadowAlpha, _Rim2ApplyGlobalMaskIndex, _Rim2ApplyGlobalMaskBlendType, _Rim2BaseColorMix, _Rim2Brightness, _RimPoi2BlendMode, AudioLinkRim2WidthBand, AudioLinkRim2WidthAdd, AudioLinkRim2EmissionBand, AudioLinkRim2EmissionAdd, AudioLinkRim2BrightnessBand, AudioLinkRim2BrightnessAdd, rim2Bias, _Rim2BiasIntensity, _Rim2ApplyAlpha, _Rim2ApplyAlphaBlend); + ApplyPoiyomiRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, _Is_NormalMapToRim2Light, _Rim2LightingInvert, _Rim2Power, _Rim2Strength, _Rim2ShadowWidth, _Rim2ShadowToggle, _Rim2Width, _Rim2BlendStrength, rim2Mask, _Rim2GlobalMask, _Rim2GlobalMaskBlendType, rim2Color, _Rim2LightColor, _Rim2LightColorThemeIndex, _Rim2HueShiftEnabled, _Rim2HueShift, _Rim2HueShiftColorSpace, _Rim2HueShiftSpeed, _Rim2Sharpness, _Rim2ShadowMaskRampType, _Rim2ShadowMaskInvert, _Rim2ShadowMaskStrength, _Rim2ShadowAlpha, _Rim2ApplyGlobalMaskIndex, _Rim2ApplyGlobalMaskBlendType, _Rim2BaseColorMix, _Rim2Brightness, _RimPoi2BlendMode, AudioLinkRim2WidthBand, AudioLinkRim2WidthAdd, AudioLinkRim2EmissionBand, AudioLinkRim2EmissionAdd, AudioLinkRim2BrightnessBand, AudioLinkRim2BrightnessAdd, rim2Bias, _Rim2BiasIntensity, _Rim2ApplyAlpha, _Rim2ApplyAlphaBlend); #endif #ifdef _RIM2STYLE_UTS2 #if defined(PROP_SET_RIM2LIGHTMASK) || !defined(OPTIMIZER_ENABLED) @@ -24404,19 +24939,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float Set_Rim2LightMask_var = 1; #endif - ApplyUTS2RimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, Set_Rim2LightMask_var, _Rim2GlobalMask, _Rim2GlobalMaskBlendType, _Rim2LightColor, _Rim2LightColorThemeIndex, _Is_LightColor_Rim2Light, _Is_NormalMapToRim2Light, _Rim2Light_Power, _Rim2Light_InsideMask, _Rim2Light_FeatherOff, _LightDirection_MaskOn2, _Tweak_LightDirection_MaskLevel2, _Add_Antipodean_Rim2Light, _Ap_Rim2LightColor, _Rim2ApColorThemeIndex, _Is_LightColor_Ap_Rim2Light, _Ap_Rim2Light_Power, _Ap_Rim2Light_FeatherOff, _Tweak_Rim2LightMaskLevel, _Rim2HueShiftEnabled, _Rim2HueShift, _Rim2HueShiftSpeed); - #endif - #ifdef _RIM2STYLE_LILTOON - #if defined(PROP_RIM2COLORTEX) || !defined(OPTIMIZER_ENABLED) - float4 rim2ColorTex = POI2D_SAMPLER_PAN(_Rim2ColorTex, _MainTex, poiUV(poiMesh.uv[_Rim2ColorTexUV], _Rim2ColorTex_ST), _Rim2ColorTexPan); - #else - float4 rim2ColorTex = 1; - #endif - ApplyLiltoonRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, _Rim2Color, _Rim2IndirColor, rim2ColorTex, _Rim2MainStrength, _Rim2NormalStrength, _Rim2DirRange, _Rim2IndirRange, _Rim2FresnelPower, _Rim2BackfaceMask, _Rim2DirStrength, _Rim2Border, _Rim2Blur, _Rim2IndirBorder, _Rim2IndirBlur, _Rim2ShadowMask, _Rim2EnableLighting, _Rim2VRParallaxStrength, _Rim2GlobalMask, _Rim2GlobalMaskBlendType, _Rim2HueShiftEnabled, _Rim2HueShift, _Rim2HueShiftSpeed, _Rim2BlendMode); + ApplyUTS2RimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, Set_Rim2LightMask_var, _Rim2GlobalMask, _Rim2GlobalMaskBlendType, _Rim2LightColor, _Rim2LightColorThemeIndex, _Is_LightColor_Rim2Light, _Is_NormalMapToRim2Light, _Rim2Light_Power, _Rim2Light_InsideMask, _Rim2Light_FeatherOff, _LightDirection_MaskOn2, _Tweak_LightDirection_MaskLevel2, _Add_Antipodean_Rim2Light, _Ap_Rim2LightColor, _Rim2ApColorThemeIndex, _Is_LightColor_Ap_Rim2Light, _Ap_Rim2Light_Power, _Ap_Rim2Light_FeatherOff, _Tweak_Rim2LightMaskLevel, _Rim2HueShiftEnabled, _Rim2HueShift, _Rim2HueShiftColorSpace, _Rim2HueShiftSpeed); #endif + #endif //endex - + //ifex _EnableDepthRimLighting==0 #ifdef _POI_DEPTH_RIMLIGHT if (!IsInMirror()) @@ -24425,19 +24953,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _GlitterEnable==0 #ifdef _SUNDISK_SIMPLE applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods); #endif //endex - + //ifex _StylizedSpecular==0 #ifdef POI_STYLIZED_StylizedSpecular stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods); #endif //endex - + //ifex _EnablePathing==0 #ifdef POI_PATHING // Only run pathing if a map exists. @@ -24446,38 +24974,38 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableMirrorOptions==0 #ifdef POI_MIRROR applyMirror(poiFragData, poiMesh, poiMods); #endif //endex - + //ifex _TextEnabled==0 #ifdef EFFECT_BUMP ApplyTextOverlayColor(poiFragData, poiMesh, poiMods); #endif //endex - + //ifex _PoiInternalParallax==0 #ifdef POI_INTERNALPARALLAX applyInternalParallax(poiFragData, poiMesh, poiCam, poiMods); #endif //endex - + //ifex _VoronoiEnabled!=1 #ifdef POI_VORONOI ApplyVoronoi(poiFragData, poiMesh, poiMods); #endif //endex - + UNITY_BRANCH if (_AlphaPremultiply) { poiFragData.baseColor *= saturate(poiFragData.alpha); } poiFragData.finalColor = poiFragData.baseColor; - + //ifex _LTCGIEnabled!=1 #ifdef POI_LTCGI if (_LTCGI_AnimToggle) @@ -24485,7 +25013,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float LTCGIsmoothness = _LTCGI_Smoothness; float LTCGImetalness = _LTCGI_Metallic; float LTCGISpecMask = 1; - + if (_LTCGI_UsePBR) { #ifdef MOCHIE_PBR @@ -24493,7 +25021,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float metallic = _MochieMetallicMultiplier; float specularMask = 1; float reflectionMask = 1; - + #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED) float4 PBRMaps = POI2D_SAMPLER_PAN_STOCHASTIC(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan, _MochieMetallicMapsStochastic); UNITY_BRANCH @@ -24503,7 +25031,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" assignValueToVectorFromIndex(PBRMaps, _MochieMetallicMapsReflectionMaskChannel, PBRSplitMask[_MochieMetallicMapsReflectionMaskChannel]); assignValueToVectorFromIndex(PBRMaps, _MochieMetallicMapsSpecularMaskChannel, PBRSplitMask[_MochieMetallicMapsSpecularMaskChannel]); } - + if (_MochieMetallicMapsMetallicChannel < 4) { metallic *= PBRMaps[_MochieMetallicMapsMetallicChannel]; @@ -24526,7 +25054,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif } accumulator_struct acc = (accumulator_struct)0; - + // then we make the LTCGI_Contribution call as usual, but with slightly different params LTCGI_Contribution( acc, // our accumulator @@ -24538,9 +25066,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" ); acc.specular *= poiThemeColor(poiMods, _LTCGI_SpecularColor.rgb, _LTCGI_SpecularColorThemeIndex); acc.diffuse *= poiThemeColor(poiMods, _LTCGI_DiffuseColor.rgb, _LTCGI_DiffuseColorThemeIndex); - + poiLight.finalLightAdd += (acc.specular * lerp(unity_ColorSpaceDielectricSpec, poiFragData.baseColor, LTCGImetalness)) * LTCGISpecMask; - + poiLight.finalLighting += acc.diffuse; if (_LightingCapEnabled) { @@ -24549,15 +25077,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting; - + //ifex _SubsurfaceScattering==0 #ifdef POI_SUBSURFACESCATTERING applySubsurfaceScattering(poiCam, poiLight, poiMesh, poiFragData); #endif //endex - + //ifex _MochieBRDF==0 #ifdef MOCHIE_PBR MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods); @@ -24568,38 +25096,63 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods); #endif //endex - + //ifex _EnableEnvironmentalRim==0 #ifdef POI_ENVIRORIM applyEnvironmentRim(poiFragData, poiMesh, poiCam); #endif //endex - + //ifex _BacklightEnabled!=1 #ifdef POI_BACKLIGHT ApplyBacklight(poiFragData, poiMesh, poiLight, poiCam, poiMods); #endif //endex - + + //ifex _EnableRimLighting==0 + #ifdef _GLOSSYREFLECTIONS_OFF + #ifdef _RIMSTYLE_LILTOON + #if defined(PROP_RIMCOLORTEX) || !defined(OPTIMIZER_ENABLED) + float4 rimColorTex = POI2D_SAMPLER_PAN(_RimColorTex, _MainTex, poiUV(poiMesh.uv[_RimColorTexUV], _RimColorTex_ST), _RimColorTexPan); + #else + float4 rimColorTex = 1; + #endif + ApplyLiltoonRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, _RimColor, _RimIndirColor, rimColorTex, _RimMainStrength, _RimNormalStrength, _RimDirRange, _RimIndirRange, _RimFresnelPower, _RimBackfaceMask, _RimDirStrength, _RimBorder, _RimBlur, _RimIndirBorder, _RimIndirBlur, _RimShadowMask, _RimEnableLighting, _RimVRParallaxStrength, _RimGlobalMask, _RimGlobalMaskBlendType, _RimHueShiftEnabled, _RimHueShift, _RimHueShiftColorSpace, _RimHueShiftSpeed, _RimBlendMode); + #endif + #endif + //endex + //ifex _EnableRim2Lighting==0 + #ifdef POI_RIM2 + #ifdef _RIM2STYLE_LILTOON + #if defined(PROP_RIM2COLORTEX) || !defined(OPTIMIZER_ENABLED) + float4 rim2ColorTex = POI2D_SAMPLER_PAN(_Rim2ColorTex, _MainTex, poiUV(poiMesh.uv[_Rim2ColorTexUV], _Rim2ColorTex_ST), _Rim2ColorTexPan); + #else + float4 rim2ColorTex = 1; + #endif + ApplyLiltoonRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, _Rim2Color, _Rim2IndirColor, rim2ColorTex, _Rim2MainStrength, _Rim2NormalStrength, _Rim2DirRange, _Rim2IndirRange, _Rim2FresnelPower, _Rim2BackfaceMask, _Rim2DirStrength, _Rim2Border, _Rim2Blur, _Rim2IndirBorder, _Rim2IndirBlur, _Rim2ShadowMask, _Rim2EnableLighting, _Rim2VRParallaxStrength, _Rim2GlobalMask, _Rim2GlobalMaskBlendType, _Rim2HueShiftEnabled, _Rim2HueShift, _Rim2HueShiftColorSpace, _Rim2HueShiftSpeed, _Rim2BlendMode); + #endif + #endif + //endex + //ifex _FXProximityColor==0 if (_FXProximityColor) { float3 position = _FXProximityColorType ? poiMesh.worldPos : poiMesh.objectPosition; poiFragData.finalColor *= lerp(poiThemeColor(poiMods, _FXProximityColorMinColor.rgb, _FXProximityColorMinColorThemeIndex), poiThemeColor(poiMods, _FXProximityColorMaxColor.rgb, _FXProximityColorMaxColorThemeIndex), smoothstep(_FXProximityColorMinDistance, _FXProximityColorMaxDistance, distance(position, poiCam.worldPos))); - + if (_FXProximityColorBackFace) { poiFragData.finalColor = lerp(poiFragData.finalColor * _FXProximityColorMinColor.rgb, poiFragData.finalColor, saturate(poiMesh.isFrontFace)); } } //endex - + //ifex _EnableEmission==0 && _EnableEmission1==0 && _EnableEmission2==0 && _EnableEmission3==0 #if defined(_EMISSION) || defined(POI_EMISSION_1) || defined(POI_EMISSION_2) || defined(POI_EMISSION_3) float3 emissionBaseReplace = 0; #endif //endex - + //ifex _EnableEmission==0 #ifdef _EMISSION emissionBaseReplace += applyEmission(poiFragData, poiMesh, poiLight, poiCam, poiMods); @@ -24620,66 +25173,66 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" emissionBaseReplace += applyEmission3(poiFragData, poiMesh, poiLight, poiCam, poiMods); #endif //endex - + //ifex _EnableEmission==0 && _EnableEmission1==0 && _EnableEmission2==0 && _EnableEmission3==0 #if defined(_EMISSION) || defined(POI_EMISSION_1) || defined(POI_EMISSION_2) || defined(POI_EMISSION_3) poiFragData.finalColor.rgb = lerp(poiFragData.finalColor.rgb, saturate(emissionBaseReplace), poiMax(emissionBaseReplace)); #endif //endex - + //UNITY_BRANCH if (_IgnoreFog == 0) { UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor); } - + poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha; - + //ifex _AlphaToCoverage==0 && isNotAnimated(_AlphaToCoverage) ApplyAlphaToCoverage(poiFragData, poiMesh); //endex - + //ifex _AlphaDithering==0 && isNotAnimated(_AlphaDithering) applyDithering(poiFragData, poiCam); //endex - + poiFragData.finalColor += poiLight.finalLightAdd; - + #ifdef UNITY_PASS_FORWARDBASE poiFragData.emission = max(poiFragData.emission * _PPEmissionMultiplier, 0); poiFragData.finalColor = max(poiFragData.finalColor * _PPFinalColorMultiplier, 0); #endif - + //ifex _PostProcess==0 #ifdef POSTPROCESS applyPostProcessing(poiFragData, poiMesh); #endif //endex - + if (_Mode == POI_MODE_OPAQUE) { //poiFragData.alpha = 1; } - + clip(poiFragData.alpha - _Cutoff); - + if (_Mode == POI_MODE_CUTOUT && !_AlphaToCoverage) { poiFragData.alpha = 1; } - + //ifex _BSSEnabled!=1 #ifdef POIBS_ENABLE poiFragData.finalColor += poiFragData.emission * poiMods.globalEmission; poiFragData.alpha = poiFragData.alpha * poiFragData.emission.z; poiFragData.emission = 0; - + //ifex _BSSBloomfog!=1 #ifdef POIBS_BLOOMFOG float3 fogDistance = i.worldPos + - _WorldSpaceCameraPos; float4 fogCol = -float4(poiFragData.finalColor, 1) + tex2D(_BloomPrePassTexture, i.fogCoord.xy); fogCol.a = -poiFragData.alpha; - + #ifdef BSSBLOOMFOGTYPE_HEIGHT poiFragData.finalColor = poiFragData.finalColor + (((GetHeightFogIntensity(i.worldPos, _FogHeightOffset, _FogHeightScale) * GetFogIntensity(fogDistance, _FogStartOffset, _FogScale)) + 1) * fogCol.rgb); poiFragData.alpha = poiFragData.alpha + (((GetHeightFogIntensity(i.worldPos, _FogHeightOffset, _FogHeightScale) * GetFogIntensity(fogDistance, _FogStartOffset, _FogScale)) + 1) * fogCol.a); @@ -24691,18 +25244,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex #endif //endex - + return float4(poiFragData.finalColor + poiFragData.emission * poiMods.globalEmission, poiFragData.alpha) + POI_SAFE_RGB0; } - + ENDCG } - + Pass { Name "Add" Tags { "LightMode" = "ForwardAdd" } - + Stencil { Ref [_StencilRef] @@ -24714,31 +25267,31 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Fail [_StencilFailOp] ZFail [_StencilZFailOp] //endex - + //ifex _StencilType==0 CompBack [_StencilBackCompareFunction] PassBack [_StencilBackPassOp] FailBack [_StencilBackFailOp] ZFailBack [_StencilBackZFailOp] - + CompFront [_StencilFrontCompareFunction] PassFront [_StencilFrontPassOp] FailFront [_StencilFrontFailOp] ZFailFront [_StencilFrontZFailOp] //endex } - + ZWrite Off Cull [_Cull] - + AlphaToMask [_AlphaToCoverage] ZTest [_ZTest] ColorMask [_ColorMask] Offset [_OffsetFactor], [_OffsetUnits] - + BlendOp [_AddBlendOp], [_AddBlendOpAlpha] Blend [_AddSrcBlend] [_AddDstBlend], [_AddSrcBlendAlpha] [_AddDstBlendAlpha] - + CGPROGRAM /* // Disable warnings we aren't interested in @@ -24753,80 +25306,80 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex 0==0 #pragma skip_optimizations d3d11 //endex - + #pragma shader_feature_local _STOCHASTICMODE_DELIOT_HEITZ _STOCHASTICMODE_HEXTILE _STOCHASTICMODE_NONE - + //ifex _MainColorAdjustToggle==0 #pragma shader_feature COLOR_GRADING_HDR //endex - + //#pragma shader_feature KEYWORD - + #pragma skip_variants LIGHTMAP_ON DYNAMICLIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK DIRLIGHTMAP_COMBINED _MIXED_LIGHTING_SUBTRACTIVE #pragma skip_variants DECALS_OFF DECALS_3RT DECALS_4RT DECAL_SURFACE_GRADIENT _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 #pragma skip_variants _ADDITIONAL_LIGHT_SHADOWS #pragma skip_variants PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 #pragma skip_variants _SCREEN_SPACE_OCCLUSION - + //ifex _GlobalMaskTexturesEnable==0 #pragma shader_feature_local POI_GLOBALMASK_TEXTURES //endex - + //ifex _EnableUDIMDiscardOptions==0 #pragma shader_feature_local POI_UDIMDISCARD //endex - + //ifex _EnableDistortion==0 #pragma shader_feature USER_LUT //endex - + //ifex _PoiParallax==0 #pragma shader_feature_local POI_PARALLAX //endex - + //ifex _EnableAudioLink==0 #pragma shader_feature_local POI_AUDIOLINK //endex - + //ifex _BlackLightMaskingEnabled==0 #pragma shader_feature_local POI_BLACKLIGHTMASKING //endex - + //ifex _DetailEnabled==0 #pragma shader_feature FINALPASS //endex - + //ifex _VertexManipulationsEnabled==0 #pragma shader_feature AUTO_EXPOSURE //endex - + //ifex _VertexGlitchingEnabled==0 #pragma shader_feature_local POI_VERTEX_GLITCHING #pragma shader_feature_local POI_VERTEX_GLITCHING_TEXTURE //endex - + //ifex _EnableDepthBulge==0 #pragma shader_feature_local POI_DEPTHBULGE //endex - + //ifex _BackFaceEnabled!=1 #pragma shader_feature_local POI_BACKFACE //endex - + //ifex _RGBMaskEnabled==0 #pragma shader_feature VIGNETTE #pragma shader_feature GEOM_TYPE_MESH //endex - + //ifex _LTCGIEnabled!=1 #pragma shader_feature_local POI_LTCGI //endex - + //ifex _ShadingEnabled==0 #pragma shader_feature_local VIGNETTE_MASKED #pragma shader_feature_local _LIGHTINGMODE_TEXTURERAMP _LIGHTINGMODE_MULTILAYER_MATH _LIGHTINGMODE_SHADEMAP _LIGHTINGMODE_REALISTIC _LIGHTINGMODE_WRAPPED _LIGHTINGMODE_SKIN _LIGHTINGMODE_FLAT _LIGHTINGMODE_CLOTH _LIGHTINGMODE_SDF //endex - + //ifex _DecalEnabled==0 #pragma shader_feature GEOM_TYPE_BRANCH //endex @@ -24839,15 +25392,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _DecalEnabled3==0 #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW //endex - + //ifex _EnableDissolve==0 #pragma shader_feature DISTORT //endex - + //ifex _EnableAniso==0 #pragma shader_feature_local POI_ANISOTROPICS //endex - + //ifex _MatcapEnable==0 #pragma shader_feature_local POI_MATCAP0 #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL @@ -24864,23 +25417,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #pragma shader_feature_local POI_MATCAP3 #pragma shader_feature_local POI_MATCAP3_CUSTOM_NORMAL //endex - + //ifex _CubeMapEnabled==0 #pragma shader_feature_local _CUBEMAP //endex - + //ifex _EnableALDecal==0 #pragma shader_feature_local POI_AL_DECAL //endex - + //ifex _EnableVolumeColor==0 #pragma shader_feature_local POI_AL_VOLUMECOLOR //endex - + //ifex _EnableFlipbook==0 #pragma shader_feature _SUNDISK_HIGH_QUALITY //endex - + //ifex _EnableEmission==0 #pragma shader_feature _EMISSION //endex @@ -24893,7 +25446,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _EnableEmission3==0 #pragma shader_feature_local POI_EMISSION_3 //endex - + //ifex _EnableRimLighting==0 #pragma shader_feature_local _GLOSSYREFLECTIONS_OFF #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2 _RIMSTYLE_LILTOON @@ -24902,70 +25455,70 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #pragma shader_feature_local POI_RIM2 #pragma shader_feature_local _RIM2STYLE_POIYOMI _RIM2STYLE_UTS2 _RIM2STYLE_LILTOON //endex - + //ifex _EnableDepthRimLighting==0 #pragma shader_feature_local _POI_DEPTH_RIMLIGHT //endex - + //ifex _GlitterEnable==0 #pragma shader_feature _SUNDISK_SIMPLE //endex - + //ifex _SubsurfaceScattering==0 #pragma shader_feature_local POI_SUBSURFACESCATTERING //endex - + //ifex _MochieBRDF==0 #pragma shader_feature_local MOCHIE_PBR //endex //ifex _ClearCoatBRDF==0 #pragma shader_feature_local POI_CLEARCOAT //endex - + //ifex _EnableEnvironmentalRim==0 #pragma shader_feature_local POI_ENVIRORIM //endex - + //ifex _StylizedSpecular==0 #pragma shader_feature_local POI_STYLIZED_StylizedSpecular //endex - + //ifex _EnablePathing==0 #pragma shader_feature_local POI_PATHING //endex - + //ifex _EnableMirrorOptions==0 #pragma shader_feature_local POI_MIRROR //endex - + //ifex _EnableTouchGlow==0 #pragma shader_feature GRAIN //endex - + //ifex _TextEnabled==0 #pragma shader_feature EFFECT_BUMP //endex - + //ifex _PostProcess==0 #pragma shader_feature_local POSTPROCESS //endex - + //ifex _PoiInternalParallax==0 #pragma shader_feature_local POI_INTERNALPARALLAX //endex - + //ifex _NormalCorrect==0 #pragma shader_feature_local POI_NORMALCORRECT //endex - + //ifex _VideoEffectsEnable==0 #pragma shader_feature_local POI_VIDEO_EFFECTS //endex - + //ifex _BacklightEnabled!=1 #pragma shader_feature_local POI_BACKLIGHT //endex - + //ifex _BSSEnabled!=1 #pragma shader_feature_local POIBS_ENABLE //ifex _BSSBloomfog!=1 @@ -24973,16 +25526,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #pragma shader_feature_local BSSBLOOMFOGTYPE_HEIGHT //endex //endex - + //ifex _VoronoiEnabled!=1 #pragma shader_feature_local POI_VORONOI //endex - + #pragma multi_compile_fwdadd_fullshadows #pragma multi_compile_instancing #pragma multi_compile_fog #define POI_PASS_ADD - + // UNITY Includes #include "UnityCG.cginc" #include "UnityStandardUtils.cginc" @@ -24993,16 +25546,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #include "UnityMetaPass.cginc" #endif #pragma vertex vert - + #pragma fragment frag - + #define DielectricSpec float4(0.04, 0.04, 0.04, 1.0 - 0.04) #define PI float(3.14159265359) #define Epsilon float(1e-10) - + #define POI2D_SAMPLE_TEX2D_SAMPLERGRAD(tex, samplertex, coord, dx, dy) tex.SampleGrad(sampler##samplertex, coord, dx, dy) #define POI2D_SAMPLE_TEX2D_SAMPLERGRADD(tex, samp, uv, pan, dx, dy) tex.SampleGrad(samp, POI_PAN_UV(uv, pan), dx, dy) - + #define POI_PAN_UV(uv, pan) (uv + _Time.x * pan) #define POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, POI_PAN_UV(uv, pan))) #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, dx, dy) (POI2D_SAMPLE_TEX2D_SAMPLERGRAD(tex, texSampler, POI_PAN_UV(uv, pan), dx, dy)) @@ -25015,29 +25568,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv)) #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, POI_PAN_UV(uv, pan))) #define POI_SAMPLE_CUBE_LOD(tex, samp, uv, lod) texCUBElod(tex, float4(uv, 0, lod)) - + #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED) #define POI_SAMPLE_SCREEN(tex, samp, uv) tex.Sample(samp, float3(uv, unity_StereoEyeIndex)) #else #define POI_SAMPLE_SCREEN(tex, samp, uv) tex.Sample(samp, uv) #endif - + // When using, properties won't properly lock at optimize time; needs macro evaluation implemented // #define POI2D_MAINTEX_SAMPLER_PAN_INLINED(tex, poiMesh) (POI2D_SAMPLER_PAN(tex, _MainTex, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Pan)) - + #define POI_SAFE_RGB0 float4(mainTexture.rgb * .0001, 0) #define POI_SAFE_RGB1 float4(mainTexture.rgb * .0001, 1) #define POI_SAFE_RGBA mainTexture - + #if defined(UNITY_COMPILER_HLSL) #define PoiInitStruct(type, name) name = (type)0; #else #define PoiInitStruct(type, name) #endif - + #define POI_ERROR(poiMesh, gridSize) lerp(float3(1, 0, 1), float3(0, 0, 0), fmod(floor((poiMesh.worldPos.x) * gridSize) + floor((poiMesh.worldPos.y) * gridSize) + floor((poiMesh.worldPos.z) * gridSize), 2) == 0) #define POI_NAN (asfloat(-1)) - + #define POI_MODE_OPAQUE 0 #define POI_MODE_CUTOUT 1 #define POI_MODE_FADE 2 @@ -25047,17 +25600,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define POI_MODE_MULTIPLICATIVE 6 #define POI_MODE_2XMULTIPLICATIVE 7 #define POI_MODE_TRANSCLIPPING 9 - + /* Texture2D ; float4 _ST; float2 Pan; float UV; float Stochastic; - + [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )] */ - + //ifex _EnableAudioLink==0 #ifdef POI_AUDIOLINK // Map of where features in AudioLink are. @@ -25090,7 +25643,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define ALPASS_FILTEREDVU uint2(24, 28) //Size: 4, 4 #define ALPASS_FILTEREDVU_INTENSITY uint2(24, 28) //Size: 4, 1 #define ALPASS_FILTEREDVU_MARKER uint2(24, 29) //Size: 4, 1 - + // Some basic constants to use (Note, these should be compatible with // future version of AudioLink, but may change. #define AUDIOLINK_SAMPHIST 3069 // Internal use for algos, do not change. @@ -25109,7 +25662,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define AUDIOLINK_DELAY_COEFFICIENT_MAX 0.9 #define AUDIOLINK_DFT_Q 4.0 #define AUDIOLINK_TREBLE_CORRECTION 5.0 - + // ColorChord constants #define COLORCHORD_EMAXBIN 192 #define COLORCHORD_IIR_DECAY_1 0.90 @@ -25119,13 +25672,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define COLORCHORD_NOTE_CLOSEST 3.0 #define COLORCHORD_NEW_NOTE_GAIN 8.0 #define COLORCHORD_MAX_NOTES 10 - + uniform float4 _AudioTexture_TexelSize; - + #ifdef SHADER_TARGET_SURFACE_ANALYSIS #define AUDIOLINK_STANDARD_INDEXING #endif - + // Mechanism to index into texture. #ifdef AUDIOLINK_STANDARD_INDEXING sampler2D _AudioTexture; @@ -25139,16 +25692,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" uniform float4 _Stored_TexelSize; #endif //endex - + float _GrabMode; float _Mode; - + float _StochasticDeliotHeitzDensity; float _StochasticHexGridDensity; float _StochasticHexRotationStrength; float _StochasticHexFallOffContrast; float _StochasticHexFallOffPower; - + #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED) Texture2D _LightingAOMaps; #endif @@ -25161,7 +25714,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _LightDataAOStrengthA; float _LightDataAOGlobalMaskR; float _LightDataAOGlobalMaskBlendTypeR; - + #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED) Texture2D _LightingDetailShadowMaps; #endif @@ -25178,7 +25731,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _LightingAddDetailShadowStrengthA; float _LightDataDetailShadowGlobalMaskR; float _LightDataDetailShadowGlobalMaskBlendTypeR; - + #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED) Texture2D _LightingShadowMasks; #endif @@ -25191,7 +25744,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _LightingShadowMaskStrengthA; float _LightDataShadowMaskGlobalMaskR; float _LightDataShadowMaskGlobalMaskBlendTypeR; - + // Lighting Data float _Unlit_Intensity; float _LightingColorMode; @@ -25222,13 +25775,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // Lighting Data Debug float _LightDataDebugEnabled; float _LightingDebugVisualize; - + float _IgnoreFog; float _RenderingReduceClipDistance; int _FlipBackfaceNormals; float _AddBlendOp; float _Cull; - + float4 _Color; float _ColorThemeIndex; UNITY_DECLARE_TEX2D(_MainTex); @@ -25254,7 +25807,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaMaskUV; float _AlphaMaskInvert; float _MainAlphaMaskMode; - float _AlphaMaskScale; + float _AlphaMaskBlendStrength; float _AlphaMaskValue; #endif float _Cutoff; @@ -25267,25 +25820,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _MainColorAdjustTexture_ST; float2 _MainColorAdjustTexturePan; float _MainColorAdjustTextureUV; + float _MainHueShiftColorSpace; float _MainHueShiftToggle; float _MainHueShiftReplace; float _MainHueShift; float _MainHueShiftSpeed; float _Saturation; float _MainBrightness; - + float _MainHueALCTEnabled; float _MainALHueShiftBand; float _MainALHueShiftCTIndex; float _MainHueALMotionSpeed; - + float _MainHueGlobalMask; float _MainHueGlobalMaskBlendType; float _MainSaturationGlobalMask; float _MainSaturationGlobalMaskBlendType; float _MainBrightnessGlobalMask; float _MainBrightnessGlobalMaskBlendType; - + #if defined(PROP_MAINGRADATIONTEX) || !defined(OPTIMIZER_ENABLED) Texture2D _MainGradationTex; #endif @@ -25293,11 +25847,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _MainGradationStrength; #endif //endex - + SamplerState sampler_linear_clamp; SamplerState sampler_linear_repeat; SamplerState sampler_trilinear_repeat; - + float _AlphaForceOpaque; float _AlphaMod; float _AlphaPremultiply; @@ -25307,13 +25861,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaSharpenedA2C; float _AlphaMipScale; //endex - + //ifex _AlphaDithering==0 && isNotAnimated(_AlphaDithering) float _AlphaDithering; float _AlphaDitherGradient; float _AlphaDitherBias; //endex - + //ifex _AlphaDistanceFade==0 && isNotAnimated(_AlphaDistanceFade) float _AlphaDistanceFade; float _AlphaDistanceFadeType; @@ -25324,7 +25878,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaDistanceFadeGlobalMask; float _AlphaDistanceFadeGlobalMaskBlendType; //endex - + //ifex _AlphaFresnel==0 && isNotAnimated(_AlphaFresnel) float _AlphaFresnel; float _AlphaFresnelAlpha; @@ -25334,7 +25888,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaFresnelGlobalMask; float _AlphaFresnelGlobalMaskBlendType; //endex - + //ifex _AlphaAngular==0 && isNotAnimated(_AlphaAngular) float _AlphaAngular; float _AngleType; @@ -25348,16 +25902,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaAngularGlobalMask; float _AlphaAngularGlobalMaskBlendType; //endex - + //ifex _AlphaAudioLinkEnabled==0 && isNotAnimated(_AlphaAudioLinkEnabled) float _AlphaAudioLinkEnabled; float2 _AlphaAudioLinkAddRange; float _AlphaAudioLinkAddBand; //endex - + float _AlphaGlobalMask; float _AlphaGlobalMaskBlendType; - + float4 _GlobalThemeColor0; float4 _GlobalThemeColor1; float4 _GlobalThemeColor2; @@ -25378,7 +25932,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalThemeValue1; float _GlobalThemeValue2; float _GlobalThemeValue3; - + //ifex _GlobalMaskTexturesEnable==0 #ifdef POI_GLOBALMASK_TEXTURES #if defined(PROP_GLOBALMASKTEXTURE0) || !defined(OPTIMIZER_ENABLED) @@ -25394,7 +25948,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _GlobalMaskTexture0SplitPan_B; float4 _GlobalMaskTexture0SplitTilingOffset_A; float4 _GlobalMaskTexture0SplitPan_A; - + #if defined(PROP_GLOBALMASKTEXTURE1) || !defined(OPTIMIZER_ENABLED) Texture2D _GlobalMaskTexture1; #endif @@ -25408,7 +25962,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _GlobalMaskTexture1SplitPan_B; float4 _GlobalMaskTexture1SplitTilingOffset_A; float4 _GlobalMaskTexture1SplitPan_A; - + #if defined(PROP_GLOBALMASKTEXTURE2) || !defined(OPTIMIZER_ENABLED) Texture2D _GlobalMaskTexture2; #endif @@ -25422,7 +25976,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _GlobalMaskTexture2SplitPan_B; float4 _GlobalMaskTexture2SplitTilingOffset_A; float4 _GlobalMaskTexture2SplitPan_A; - + #if defined(PROP_GLOBALMASKTEXTURE3) || !defined(OPTIMIZER_ENABLED) Texture2D _GlobalMaskTexture3; #endif @@ -25441,7 +25995,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _GlobalMaskOptionsEnable==0 float _GlobalMaskOptionsEnable; int _GlobalMaskOptionsType; - + //ifex _GlobalMaskOptionsType!=0 float _GlobalMaskSlider_0; float _GlobalMaskSlider_1; @@ -25460,7 +26014,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskSlider_14; float _GlobalMaskSlider_15; //endex - + //ifex _GlobalMaskOptionsType!=1 float2 _GlobalMaskMinMaxSlider_0; float2 _GlobalMaskMinMaxSlider_1; @@ -25479,7 +26033,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _GlobalMaskMinMaxSlider_14; float2 _GlobalMaskMinMaxSlider_15; //endex - + //ifex _GlobalMaskOptionsType!=2 int _GlobalMaskToggleOn_0; int _GlobalMaskToggleOff_0; @@ -25534,7 +26088,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskBackface_14; float _GlobalMaskBackface_15; //endex - + //ifex _GlobalMaskModifiersMirrorEnable==0 float _GlobalMaskModifiersMirrorEnable; float _GlobalMaskMirrorVisibilityMode; @@ -25555,7 +26109,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskMirror_14; float _GlobalMaskMirror_15; //endex - + //ifex _GlobalMaskModifiersCameraEnable==0 float _GlobalMaskModifiersCameraEnable; float _GlobalMaskCamera_0; @@ -25575,10 +26129,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskCamera_14; float _GlobalMaskCamera_15; //endex - + //ifex _GlobalMaskModifiersDistanceEnable==0 int _GlobalMaskModifiersDistanceEnable; - + //ifex _GlobalMaskDistanceEnable_0==0 int _GlobalMaskDistanceEnable_0; int _GlobalMaskDistanceType_0; @@ -25588,7 +26142,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_0; int _GlobalMaskDistanceBlendType_0; //endex - + //ifex _GlobalMaskDistanceEnable_1==0 int _GlobalMaskDistanceEnable_1; int _GlobalMaskDistanceType_1; @@ -25598,7 +26152,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_1; int _GlobalMaskDistanceBlendType_1; //endex - + //ifex _GlobalMaskDistanceEnable_2==0 int _GlobalMaskDistanceEnable_2; int _GlobalMaskDistanceType_2; @@ -25608,7 +26162,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_2; int _GlobalMaskDistanceBlendType_2; //endex - + //ifex _GlobalMaskDistanceEnable_3==0 int _GlobalMaskDistanceEnable_3; int _GlobalMaskDistanceType_3; @@ -25618,7 +26172,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_3; int _GlobalMaskDistanceBlendType_3; //endex - + //ifex _GlobalMaskDistanceEnable_4==0 int _GlobalMaskDistanceEnable_4; int _GlobalMaskDistanceType_4; @@ -25628,7 +26182,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_4; int _GlobalMaskDistanceBlendType_4; //endex - + //ifex _GlobalMaskDistanceEnable_5==0 int _GlobalMaskDistanceEnable_5; int _GlobalMaskDistanceType_5; @@ -25638,7 +26192,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_5; int _GlobalMaskDistanceBlendType_5; //endex - + //ifex _GlobalMaskDistanceEnable_6==0 int _GlobalMaskDistanceEnable_6; int _GlobalMaskDistanceType_6; @@ -25648,7 +26202,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_6; int _GlobalMaskDistanceBlendType_6; //endex - + //ifex _GlobalMaskDistanceEnable_7==0 int _GlobalMaskDistanceEnable_7; int _GlobalMaskDistanceType_7; @@ -25658,7 +26212,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_7; int _GlobalMaskDistanceBlendType_7; //endex - + //ifex _GlobalMaskDistanceEnable_8==0 int _GlobalMaskDistanceEnable_8; int _GlobalMaskDistanceType_8; @@ -25668,7 +26222,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_8; int _GlobalMaskDistanceBlendType_8; //endex - + //ifex _GlobalMaskDistanceEnable_9==0 int _GlobalMaskDistanceEnable_9; int _GlobalMaskDistanceType_9; @@ -25678,7 +26232,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_9; int _GlobalMaskDistanceBlendType_9; //endex - + //ifex _GlobalMaskDistanceEnable_10==0 int _GlobalMaskDistanceEnable_10; int _GlobalMaskDistanceType_10; @@ -25688,7 +26242,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_10; int _GlobalMaskDistanceBlendType_10; //endex - + //ifex _GlobalMaskDistanceEnable_11==0 int _GlobalMaskDistanceEnable_11; int _GlobalMaskDistanceType_11; @@ -25698,7 +26252,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_11; int _GlobalMaskDistanceBlendType_11; //endex - + //ifex _GlobalMaskDistanceEnable_12==0 int _GlobalMaskDistanceEnable_12; int _GlobalMaskDistanceType_12; @@ -25708,7 +26262,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_12; int _GlobalMaskDistanceBlendType_12; //endex - + //ifex _GlobalMaskDistanceEnable_13==0 int _GlobalMaskDistanceEnable_13; int _GlobalMaskDistanceType_13; @@ -25718,7 +26272,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_13; int _GlobalMaskDistanceBlendType_13; //endex - + //ifex _GlobalMaskDistanceEnable_14==0 int _GlobalMaskDistanceEnable_14; int _GlobalMaskDistanceType_14; @@ -25728,7 +26282,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_14; int _GlobalMaskDistanceBlendType_14; //endex - + //ifex _GlobalMaskDistanceEnable_15==0 int _GlobalMaskDistanceEnable_15; int _GlobalMaskDistanceType_15; @@ -25739,7 +26293,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _GlobalMaskDistanceBlendType_15; //endex //endex - + int _GlobalMaskVertexColorLinearSpace; //ifex _GlobalMaskVertexColorRed==0 int _GlobalMaskVertexColorRed; @@ -25757,7 +26311,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _GlobalMaskVertexColorAlpha; int _GlobalMaskVertexColorAlphaBlendType; //endex - + //ifex _EnableUDIMDiscardOptions==0 #ifdef POI_UDIMDISCARD float _UDIMDiscardMode; @@ -25780,7 +26334,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _UDIMDiscardRow0_3; #endif //endex - + //ifex _EnableDistortion==0 #ifdef USER_LUT #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED) @@ -25789,14 +26343,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _DistortionFlowTexturePan; float _DistortionFlowTextureUV; #endif - + #if defined(PROP_DISTORTIONFLOWTEXTURE1) || !defined(OPTIMIZER_ENABLED) Texture2D _DistortionFlowTexture1; float4 _DistortionFlowTexture1_ST; float2 _DistortionFlowTexture1Pan; float _DistortionFlowTexture1UV; #endif - + #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _DistortionMask; float4 _DistortionMask_ST; @@ -25804,11 +26358,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DistortionMaskUV; float _DistortionMaskChannel; #endif - + float _DistortionUvToDistort; float _DistortionStrength; float _DistortionStrength1; - + #ifdef POI_AUDIOLINK half _EnableDistortionAudioLink; half2 _DistortionStrengthAudioLink; @@ -25825,20 +26379,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _PolarLengthScale; float _PolarSpiralPower; float _PanoUseBothEyes; - + float _UVModWorldPos0; float _UVModWorldPos1; float _UVModLocalPos0; float _UVModLocalPos1; - + //ifex _PoiParallax==0 #ifdef POI_PARALLAX - + sampler2D _HeightMap; float4 _HeightMap_ST; float2 _HeightMapPan; float _HeightMapUV; - + #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _Heightmask; float4 _Heightmask_ST; @@ -25848,29 +26402,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _HeightmaskInvert; SamplerState _linear_repeat; #endif - + float _ParallaxUV; float _HeightStrength; float _HeightOffset; float _HeightStepsMin; float _HeightStepsMax; - + float _CurvatureU; float _CurvatureV; float _CurvFix; #endif //endex - + //ifex _EnableAudioLink==0 #ifdef POI_AUDIOLINK float _AudioLinkDelay; float _AudioLinkAnimToggle; - + float _AudioLinkSmoothingBass; float _AudioLinkSmoothingLowMid; float _AudioLinkSmoothingHighMid; float _AudioLinkSmoothingTreble; - + float _DebugWaveform; float _DebugDFT; float _DebugBass; @@ -25883,36 +26437,36 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DebugAutocorrelator; float _DebugChronotensity; float _AudioLinkCCStripY; - + float _AudioLinkBandOverridesEnabled; float4 _AudioLinkBandOverrideSliders; #endif //endex - + //ifex _BlackLightMaskingEnabled==0 #ifdef POI_BLACKLIGHTMASKING float _BlackLightMasking0Key; float2 _BlackLightMasking0Range; float _BlackLightMasking0GlobalMaskIndex; float _BlackLightMasking0GlobalMaskBlendType; - + float _BlackLightMasking1Key; float2 _BlackLightMasking1Range; float _BlackLightMasking1GlobalMaskIndex; float _BlackLightMasking1GlobalMaskBlendType; - + float _BlackLightMasking2Key; float2 _BlackLightMasking2Range; float _BlackLightMasking2GlobalMaskIndex; float _BlackLightMasking2GlobalMaskBlendType; - + float _BlackLightMasking3Key; float2 _BlackLightMasking3Range; float _BlackLightMasking3GlobalMaskIndex; float _BlackLightMasking3GlobalMaskBlendType; #endif //endex - + //ifex _DetailEnabled==0 #ifdef FINALPASS #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED) @@ -25922,7 +26476,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _DetailMaskPan; float _DetailMaskUV; float _DetailMaskStochastic; - + #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED) Texture2D _DetailNormalMap; #endif @@ -25933,7 +26487,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DetailNormalMapStochastic; float _DetailNormalGlobalMask; float _DetailNormalGlobalMaskBlendType; - + #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED) Texture2D _DetailTex; #endif @@ -25941,7 +26495,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _DetailTexPan; float _DetailTexUV; float _DetailTexStochastic; - + float3 _DetailTint; float _DetailTintThemeIndex; float _DetailTexIntensity; @@ -25950,7 +26504,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DetailTexGlobalMaskBlendType; #endif //endex - + //ifex _VertexManipulationsEnabled==0 #ifdef AUTO_EXPOSURE float4 _VertexManipulationLocalTranslation; @@ -25968,16 +26522,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VertexRoundingEnabled; int _VertexRoundingSpace; float _VertexRoundingDivision; - + //AL float _VertexAudioLinkEnabled; float3 _VertexLocalTranslationALMin; float3 _VertexLocalTranslationALMax; float _VertexLocalTranslationALBand; - + float3 _VertexLocalRotationAL; float _VertexLocalRotationALBand; - + float3 _VertexLocalRotationCTALSpeed; float _VertexLocalRotationCTALBandX; float _VertexLocalRotationCTALBandY; @@ -25985,39 +26539,39 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VertexLocalRotationCTALTypeX; float _VertexLocalRotationCTALTypeY; float _VertexLocalRotationCTALTypeZ; - + float4 _VertexLocalScaleALMin; float4 _VertexLocalScaleALMax; float _VertexLocalScaleALBand; - + float3 _VertexWorldTranslationALMin; float3 _VertexWorldTranslationALMax; float _VertexWorldTranslationALBand; - + float2 _VertexManipulationHeightAL; float _VertexManipulationHeightBand; - + float2 _VertexRoundingRangeAL; float _VertexRoundingRangeBand; - + float _VertexBarrelMode; float _VertexBarrelWidth; float _VertexBarrelAlpha; float _VertexBarrelHeight; - + float _VertexSphereMode; float _VertexSphereRadius; float _VertexSphereHeight; float _VertexSphereAlpha; float4 _VertexSphereCenter; - + float _VertexTornadoMode; float _VertexTornadoRadius; float _VertexTornadoSpeed; float _VertexTornadoIntensity; float _VertexTornadoBaseHeight; float _VertexTornadoTopHeight; - + float _VertexSpectrumMotion; float3 _VertexSpectrumOffsetMin; float3 _VertexSpectrumOffsetMax; @@ -26025,7 +26579,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VertexSpectrumUVDirection; #endif //endex - + //ifex _VertexGlitchingEnabled==0 #ifdef POI_VERTEX_GLITCHING //Vertex Glitching @@ -26038,22 +26592,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VertexGlitchFrequency; float _VertexGlitchStrength; float _VertexGlitchDensity; - + float _VertexGlitchMirrorEnable; float _VertexGlitchMirror; - + float _VertexGlitchMapPanSpeed; float _VertexGlitchingAudioLinkEnabled; float _VertexGlitchingAudioLinkBand; float _VertexGlitchingAudiolinkOverride; #endif //endex - + //ifex _EnableDepthBulge==0 #ifdef POI_DEPTHBULGE float _DepthBulgeFadeLength; float _DepthBulgeHeight; - + #if defined(PROP_DEPTHBULGEMASK) || !defined(OPTIMIZER_ENABLED) sampler2D _DepthBulgeMask; #endif @@ -26062,14 +26616,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DepthBulgeMaskChannel; #endif //endex - + //ifex _MainVertexColoringEnabled==0 float _MainVertexColoringEnabled; float _MainVertexColoringLinearSpace; float _MainVertexColoring; float _MainUseVertexColorAlpha; //endex - + //ifex _BackFaceEnabled!=1 #ifdef POI_BACKFACE float _BackFaceEnabled; @@ -26079,14 +26633,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _BackFaceColor; float _BackFaceColorThemeIndex; float _BackFaceReplaceAlpha; - + #if defined(PROP_BACKFACETEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _BackFaceTexture; #endif float4 _BackFaceTexture_ST; float2 _BackFaceTexturePan; float _BackFaceTextureUV; - + #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _BackFaceMask; #endif @@ -26094,16 +26648,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _BackFaceMaskPan; float _BackFaceMaskUV; float _BackFaceMaskChannel; - + float _BackFaceHueShiftEnabled; float _BackFaceHueShift; + float _BackFaceShiftColorSpace; float _BackFaceHueShiftSpeed; float _BackFaceEmissionLimiter; #endif - + //TODO detail strength stuff //endex - + //ifex _RGBMaskEnabled==0 #ifdef VIGNETTE #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED) @@ -26112,7 +26667,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _RGBMask_ST; float2 _RGBMaskPan; float _RGBMaskUV; - + #if defined(PROP_RGBAMETALLICMAPS) || !defined(OPTIMIZER_ENABLED) Texture2D _RGBAMetallicMaps; float4 _RGBAMetallicMaps_ST; @@ -26128,36 +26683,36 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _RGBAMetallicGreenEnabled; float _RGBAMetallicBlueEnabled; float _RGBAMetallicAlphaEnabled; - + float _RGBARedPBRSplitMaskSample; float4 _RGBARedPBRMaskScaleTiling; float2 _RGBARedPBRMasksPan; float _RGBARedPBRUV; float _RGBARedPBRSplitMaskStochastic; - + float _RGBAGreenPBRSplitMaskSample; float4 _RGBAGreenPBRMaskScaleTiling; float2 _RGBAGreenPBRMasksPan; float _RGBAGreenPBRUV; float _RGBAGreenPBRSplitMaskStochastic; - + float _RGBABluePBRSplitMaskSample; float4 _RGBABluePBRMaskScaleTiling; float2 _RGBABluePBRMasksPan; float _RGBABluePBRUV; float _RGBABluePBRSplitMaskStochastic; - + float _RGBAAlphaPBRSplitMaskSample; float4 _RGBAAlphaPBRMaskScaleTiling; float2 _RGBAAlphaPBRMasksPan; float _RGBAAlphaPBRUV; float _RGBAAlphaPBRSplitMaskStochastic; - + float _RGBAPBRRedEnabled; float _RGBAPBRGreenEnabled; float _RGBAPBRBlueEnabled; float _RGBAPBRAlphaEnabled; - + #if defined(PROP_RGBASMOOTHNESSMAPS) || !defined(OPTIMIZER_ENABLED) Texture2D _RGBASmoothnessMaps; float4 _RGBASmoothnessMaps_ST; @@ -26169,7 +26724,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _RGBAGreenSmoothnessInvert; float _RGBABlueSmoothnessInvert; float _RGBAAlphaSmoothnessInvert; - + float _RGBARedEnable; #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _RedTexture; @@ -26186,7 +26741,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _RedColor; float _RedColorThemeIndex; float _RGBARedEmissionStrength; - + #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED) Texture2D _RgbNormalR; #endif @@ -26199,7 +26754,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _RgbNormalRGlobalMaskChannel; float _RgbNormalRGlobalMaskBlendType; float _RgbNormalRedBlendMode; - + float _RGBAGreenEnable; #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _GreenTexture; @@ -26216,7 +26771,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _GreenColor; float _GreenColorThemeIndex; float _RGBAGreenEmissionStrength; - + #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED) Texture2D _RgbNormalG; #endif @@ -26229,7 +26784,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _RgbNormalGGlobalMaskChannel; float _RgbNormalGGlobalMaskBlendType; float _RgbNormalGreenBlendMode; - + float _RGBABlueEnable; #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _BlueTexture; @@ -26246,7 +26801,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _BlueColor; float _BlueColorThemeIndex; float _RGBABlueEmissionStrength; - + #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED) Texture2D _RgbNormalB; #endif @@ -26259,7 +26814,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _RgbNormalBGlobalMaskChannel; float _RgbNormalBGlobalMaskBlendType; float _RgbNormalBlueBlendMode; - + float _RGBAAlphaEnable; #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _AlphaTexture; @@ -26276,7 +26831,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _AlphaColor; float _AlphaColorThemeIndex; float _RGBAAlphaEmissionStrength; - + #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED) Texture2D _RgbNormalA; #endif @@ -26289,23 +26844,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _RgbNormalAGlobalMaskChannel; float _RgbNormalAGlobalMaskBlendType; float _RgbNormalAlphaBlendMode; - + float _RGBMaskType; - + #endif //endex - + //ifex _ShadingEnabled==0 float _ShadowStrength; float _LightingIgnoreAmbientColor; float3 _LightingShadowColor; - + float _ShadingRampedLightMapApplyGlobalMaskIndex; float _ShadingRampedLightMapApplyGlobalMaskBlendType; - + float _ShadingRampedLightMapInverseApplyGlobalMaskIndex; float _ShadingRampedLightMapInverseApplyGlobalMaskBlendType; - + // Toon Lighting #ifdef _LIGHTINGMODE_TEXTURERAMP UNITY_DECLARE_TEX2D(_ToonRamp); @@ -26313,7 +26868,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _ToonRampCount; int _ToonRampUVSelector; #endif - + #ifdef _LIGHTINGMODE_WRAPPED float4 _LightingWrappedColor; float _LightingWrappedWrap; @@ -26321,7 +26876,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _LightingGradientStart; float _LightingGradientEnd; #endif - + #ifdef _LIGHTINGMODE_SHADEMAP float3 _1st_ShadeColor; #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED) @@ -26349,7 +26904,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _1st2nd_Shades_Feather; float _ShadingShadeMapBlendType; #endif - + #ifdef _LIGHTINGMODE_SKIN sampler2D _SkinLUT; float _SssScale; @@ -26365,7 +26920,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 _SssTransmissionAbsorption; float3 _SssColorBleedAoWeights; #endif - + #ifdef _LIGHTINGMODE_MULTILAYER_MATH float _ShadowBorderMapToggle; #if defined(PROP_SHADOWBORDERMASK) || !defined(OPTIMIZER_ENABLED) @@ -26378,7 +26933,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _ShadowBorderMaskLOD; float4 _ShadowAOShift; float4 _ShadowAOShift2; - + float4 _ShadowColor; float _LightingMulitlayerNonLinear; #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED) @@ -26420,26 +26975,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _ShadowBorderRange; float _ShadowMainStrength; #endif - + + #ifdef _LIGHTINGMODE_FLAT + float _ForceFlatRampedLightmap; + #endif + #ifdef _LIGHTINGMODE_CLOTH Texture2D_float _ClothDFG; SamplerState sampler_ClothDFG; - + #if defined(PROP_CLOTHMETALLICSMOOTHNESSMAP) || !defined(OPTIMIZER_ENABLED) Texture2D _ClothMetallicSmoothnessMap; #endif - + float4 _ClothMetallicSmoothnessMap_ST; float2 _ClothMetallicSmoothnessMapPan; float _ClothMetallicSmoothnessMapUV; float _ClothMetallicSmoothnessMapInvert; - + float _ClothLerp; float _ClothMetallic; float _ClothReflectance; float _ClothSmoothness; #endif - + #ifdef _LIGHTINGMODE_SDF #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _SDFShadingTexture; @@ -26451,15 +27010,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _SDFLeft; #endif #endif - + // Additive float _LightingAdditiveType; float _LightingAdditiveGradientStart; float _LightingAdditiveGradientEnd; float _LightingAdditiveDetailStrength; //endex - + //ifex _DecalEnabled==0 && _DecalEnabled1==0 && _DecalEnabled2==0 && _DecalEnabled3==0 + #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _DecalMask; float4 _DecalMask_ST; @@ -26471,6 +27031,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Decal1TPSMaskStrength; float _Decal2TPSMaskStrength; float _Decal3TPSMaskStrength; + + sampler2D _Udon_VideoTex; + float4 _Udon_VideoTex_TexelSize; + #ifdef POI_AUDIOLINK //ifex _DecalEnabled==0 #ifdef GEOM_TYPE_BRANCH @@ -26561,6 +27125,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //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; @@ -26574,6 +27144,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _DecalColor; float _DecalColorThemeIndex; float _DecalTiled; + float _DecalMirroredUVMode; + float _DecalSymmetryMode; float _DecalBlendType; half _DecalRotation; half3 _DecalScale; @@ -26583,6 +27155,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DecalEmissionStrength; float _DecalBlendAlpha; float _DecalOverrideAlpha; + float _DecalHueShiftColorSpace; float _DecalHueShiftEnabled; float _DecalHueShift; float _DecalHueShiftSpeed; @@ -26597,9 +27170,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; @@ -26622,6 +27202,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DecalEmissionStrength1; float _DecalBlendAlpha1; float _DecalOverrideAlpha1; + float _DecalHueShiftColorSpace1; float _DecalHueShiftEnabled1; float _DecalHueShift1; float _DecalHueShiftSpeed1; @@ -26634,11 +27215,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; @@ -26661,6 +27251,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DecalEmissionStrength2; float _DecalBlendAlpha2; float _DecalOverrideAlpha2; + float _DecalHueShiftColorSpace2; float _DecalHueShiftEnabled2; float _DecalHueShift2; float _DecalHueShiftSpeed2; @@ -26673,11 +27264,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; @@ -26700,6 +27300,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DecalEmissionStrength3; float _DecalBlendAlpha3; float _DecalOverrideAlpha3; + float _DecalHueShiftColorSpace3; float _DecalHueShiftEnabled3; float _DecalHueShift3; float _DecalHueShiftSpeed3; @@ -26712,9 +27313,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Decal3ChannelSeparationVertical; float _Decal3ChannelSeparationAngleStrength; float _Decal3OverrideAlphaMode; + float _DecalMirroredUVMode3; + float _DecalSymmetryMode3; #endif //endex - + //ifex _EnableDissolve==0 #ifdef DISTORT float _DissolveType; @@ -26728,35 +27331,35 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _DissolveTextureColor; float _DissolveEdgeColorThemeIndex; float _DissolveTextureColorThemeIndex; - + #if defined(PROP_DISSOLVETOTEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _DissolveToTexture; #endif float4 _DissolveToTexture_ST; float2 _DissolveToTexturePan; float _DissolveToTextureUV; - + #if defined(PROP_DISSOLVENOISETEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _DissolveNoiseTexture; #endif float4 _DissolveNoiseTexture_ST; float2 _DissolveNoiseTexturePan; float _DissolveNoiseTextureUV; - + #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED) Texture2D _DissolveDetailNoise; #endif float4 _DissolveDetailNoise_ST; float2 _DissolveDetailNoisePan; float _DissolveDetailNoiseUV; - + #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _DissolveMask; #endif float4 _DissolveMask_ST; float2 _DissolveMaskPan; float _DissolveMaskUV; - + float _DissolveMaskGlobalMask; float _DissolveMaskGlobalMaskBlendType; float _DissolveApplyGlobalMaskIndex; @@ -26772,27 +27375,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DissolveInvertNoise; float _DissolveInvertDetailNoise; float _DissolveToEmissionStrength; - + // Point to Point float _DissolveP2PWorldLocal; float _DissolveP2PEdgeLength; float _DissolveP2PClamp; float4 _DissolveStartPoint; float4 _DissolveEndPoint; - + // Spherical float3 _SphericalDissolveCenter; float _SphericalDissolveRadius; float _SphericalDissolveInvert; float _SphericalDissolveClamp; - + // CenterOut float _CenterOutDissolveMode; float3 _CenterOutDissolveDirection; float _CenterOutDissolveInvert; float _CenterOutDissolveNormals; float _CenterOutDissolvePower; - + // World Dissolve float _DissolveWorldShape; float4 _DissolveShapePosition; @@ -26800,12 +27403,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DissolveShapeScale; float _DissolveInvertShape; float _DissolveShapeEdgeLength; - + // UV Tile Dissolve float _UVTileDissolveEnabled; float _UVTileDissolveDiscardAtMax; float _UVTileDissolveUV; - + float _UVTileDissolveAlpha_Row3_0; float _UVTileDissolveAlpha_Row3_1; float _UVTileDissolveAlpha_Row3_2; @@ -26822,7 +27425,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _UVTileDissolveAlpha_Row0_1; float _UVTileDissolveAlpha_Row0_2; float _UVTileDissolveAlpha_Row0_3; - + float _DissolveAlpha0; float _DissolveAlpha1; float _DissolveAlpha2; @@ -26837,19 +27440,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DissolveEmissionSide; float _DissolveEmission1Side; float _DissolveUseVertexColors; - + float4 edgeColor; float edgeAlpha; float dissolveAlpha; float4 dissolveToTexture; - + + float _DissolveHueShiftColorSpace; + float _DissolveEdgeHueShiftColorSpace; float _DissolveHueShiftEnabled; float _DissolveHueShiftSpeed; float _DissolveHueShift; float _DissolveEdgeHueShiftEnabled; float _DissolveEdgeHueShiftSpeed; float _DissolveEdgeHueShift; - + // Audio Link #ifdef POI_AUDIOLINK fixed _EnableDissolveAudioLink; @@ -26860,10 +27465,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableAniso==0 #ifdef POI_ANISOTROPICS - + #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED) Texture2D _AnisoColorMap; float4 _AnisoColorMap_ST; @@ -26883,10 +27488,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AnisoAdd; float _AnisoUseBaseColor; float _AnisoUseLightColor; - + float _AnisoGlobalMask; float _AnisoGlobalMaskBlendType; - + float _Aniso0Strength; float _Aniso0Power; float _Aniso0Offset; @@ -26897,7 +27502,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Aniso0ToonMode; float _Aniso0Edge; float _Aniso0Blur; - + float _Aniso1Strength; float _Aniso1Power; float _Aniso1Offset; @@ -26910,7 +27515,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Aniso1Blur; #endif //endex - + //ifex _MatcapEnable==0 #ifdef POI_MATCAP0 #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED) @@ -26964,6 +27569,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _MatcapEmissionStrength; float _MatcapNormal; float _MatcapHueShiftEnabled; + float _MatcapHueShiftColorSpace; float _MatcapHueShiftSpeed; float _MatcapHueShift; int _MatcapApplyToAlphaEnabled; @@ -26972,7 +27578,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _MatcapApplyToAlphaBlending; float _MatcapTPSDepthEnabled; float _MatcapTPSMaskStrength; - + float _Matcap0ALEnabled; float _Matcap0ALAlphaAddBand; float4 _Matcap0ALAlphaAdd; @@ -27038,6 +27644,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Matcap2EmissionStrength; float _Matcap2Normal; float _Matcap2HueShiftEnabled; + float _Matcap2HueShiftColorSpace; float _Matcap2HueShiftSpeed; float _Matcap2HueShift; int _Matcap2ApplyToAlphaEnabled; @@ -27046,7 +27653,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Matcap2ApplyToAlphaBlending; float _Matcap2TPSDepthEnabled; float _Matcap2TPSMaskStrength; - + float _Matcap1ALEnabled; float _Matcap1ALAlphaAddBand; float4 _Matcap1ALAlphaAdd; @@ -27059,7 +27666,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Matcap1ALChronoPanSpeed; #endif //endex - + //ifex _Matcap3Enable==0 #ifdef POI_MATCAP2 #if defined(PROP_MATCAP3) || !defined(OPTIMIZER_ENABLED) @@ -27113,6 +27720,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Matcap3EmissionStrength; float _Matcap3Normal; float _Matcap3HueShiftEnabled; + float _Matcap3HueShiftColorSpace; float _Matcap3HueShiftSpeed; float _Matcap3HueShift; int _Matcap3ApplyToAlphaEnabled; @@ -27121,7 +27729,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Matcap3ApplyToAlphaBlending; float _Matcap3TPSDepthEnabled; float _Matcap3TPSMaskStrength; - + float _Matcap2ALEnabled; float _Matcap2ALAlphaAddBand; float4 _Matcap2ALAlphaAdd; @@ -27134,7 +27742,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Matcap2ALChronoPanSpeed; #endif //endex - + //ifex _Matcap4Enable==0 #ifdef POI_MATCAP3 #if defined(PROP_MATCAP4) || !defined(OPTIMIZER_ENABLED) @@ -27188,6 +27796,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Matcap4EmissionStrength; float _Matcap4Normal; float _Matcap4HueShiftEnabled; + float _Matcap4HueShiftColorSpace; float _Matcap4HueShiftSpeed; float _Matcap4HueShift; int _Matcap4ApplyToAlphaEnabled; @@ -27196,7 +27805,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Matcap4ApplyToAlphaBlending; float _Matcap4TPSDepthEnabled; float _Matcap4TPSMaskStrength; - + float _Matcap3ALEnabled; float _Matcap3ALAlphaAddBand; float4 _Matcap3ALAlphaAdd; @@ -27222,7 +27831,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float matcapALChronoPanBand; float matcapALChronoPanSpeed; }; - + //ifex _CubeMapEnabled==0 #ifdef _CUBEMAP #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED) @@ -27260,7 +27869,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _CubeMapSmoothness; #endif //endex - + //ifex _EnableALDecal==0 #ifdef POI_AUDIOLINK #ifdef POI_AL_DECAL @@ -27270,28 +27879,28 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _ALUVRotation; float _ALUVRotationSpeed; float4 _ALDecaldCircleDimensions; - + float _ALDecalUVMode; - + float _ALDecalVolumeStep; float _ALDecalVolumeClipMin; float _ALDecalVolumeClipMax; - + float _ALDecalBandStep; float _ALDecalBandClipMin; float _ALDecalBandClipMax; - + float _ALDecalShapeClip; float _ALDecalShapeClipVolumeWidth; float _ALDecalShapeClipBandWidth; - + #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _ALDecalColorMask; float4 _ALDecalColorMask_ST; float2 _ALDecalColorMaskPan; float _ALDecalColorMaskUV; #endif - + float _ALDecalVolume; float _ALDecalBaseBoost; float _ALDecalTrebleBoost; @@ -27314,7 +27923,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableVolumeColor==0 #ifdef POI_AUDIOLINK #ifdef POI_AL_VOLUMECOLOR @@ -27334,13 +27943,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableFlipbook==0 #ifdef _SUNDISK_HIGH_QUALITY - + UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray); float4 _FlipbookTexArray_ST; - + float4 _FlipbookColor; float _FlipbookColorThemeIndex; float _FlipbookFPS; @@ -27368,7 +27977,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _FlipbookMultiply; float _FlipbookAdd; float _FlipbookBlendType; - + #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED) Texture2D _FlipbookMask; #endif @@ -27378,21 +27987,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _FlipbookMaskChannel; float _FlipbookMaskGlobalMask; float _FlipbookMaskGlobalMaskBlendType; - + // anim float _FlipbookMovementType; float4 _FlipbookStartEndOffset; float _FlipbookMovementSpeed; - + // Crossfade float _FlipbookCrossfadeEnabled; float2 _FlipbookCrossfadeRange; - + // Hueshift float _FlipbookHueShiftEnabled; + float _FlipbookHueShiftColorSpace; float _FlipbookHueShiftSpeed; float _FlipbookHueShift; - + #ifdef POI_AUDIOLINK float _FlipbookChronotensityEnabled; float _FlipbookChronotensityBand; @@ -27409,7 +28019,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableRimLighting==0 #ifdef _GLOSSYREFLECTIONS_OFF float _Is_NormalMapToRimLight; @@ -27459,7 +28069,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _AudioLinkRimBrightnessAdd; #endif #endif - + #ifdef _RIMSTYLE_UTS2 float _RimLight; float _Is_LightColor_RimLight; @@ -27483,7 +28093,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif float _Tweak_RimLightMaskLevel; #endif - + #ifdef _RIMSTYLE_LILTOON float4 _RimColor; #if defined(PROP_RIMCOLORTEX) || !defined(OPTIMIZER_ENABLED) @@ -27509,13 +28119,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _RimIndirBlur; int _RimBlendMode; #endif - + float _RimGlobalMask; float _RimGlobalMaskBlendType; float _RimApplyGlobalMaskIndex; float _RimApplyGlobalMaskBlendType; - + float _RimHueShiftEnabled; + float _RimHueShiftColorSpace; float _RimHueShiftSpeed; float _RimHueShift; #endif @@ -27525,7 +28136,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Is_NormalMapToRim2Light; float4 _Rim2LightColor; float _Rim2LightColorThemeIndex; - + #ifdef _RIM2STYLE_POIYOMI float _Rim2LightingInvert; float _Rim2Width; @@ -27573,7 +28184,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _AudioLinkRim2BrightnessAdd; #endif #endif - + #ifdef _RIM2STYLE_UTS2 float _Rim2Light; float _Is_LightColor_Rim2Light; @@ -27597,7 +28208,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif float _Tweak_Rim2LightMaskLevel; #endif - + #ifdef _RIM2STYLE_LILTOON float4 _Rim2Color; #if defined(PROP_RIM2COLORTEX) || !defined(OPTIMIZER_ENABLED) @@ -27624,18 +28235,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Rim2IndirBlur; int _Rim2BlendMode; #endif - + float _Rim2GlobalMask; float _Rim2GlobalMaskBlendType; float _Rim2ApplyGlobalMaskIndex; float _Rim2ApplyGlobalMaskBlendType; - + float _Rim2HueShiftEnabled; + float _Rim2HueShiftColorSpace; float _Rim2HueShiftSpeed; float _Rim2HueShift; #endif //endex - + //ifex _EnableDepthRimLighting==0 #ifdef _POI_DEPTH_RIMLIGHT float _DepthRimNormalToUse; @@ -27653,13 +28265,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DepthRimMixLightColor; float _DepthRimType; float _DepthRimBrightness; - + static float2 sobelSamplePoints[9] = { float2(-1, 1), float2(0, 1), float2(1, 1), float2(-1, 0), float2(0, 0), float2(1, 01), float2(-1, -1), float2(0, -1), float2(1, -1) }; - + static float sobelXMatrix[9] = { 1, 0, -1, 2, 0, -2, @@ -27672,7 +28284,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" }; #endif //endex - + //ifex _GlitterEnable==0 #ifdef _SUNDISK_SIMPLE float4 _GlitterRandomRotationSpeed; @@ -27699,20 +28311,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlitterJaggyFix; float _GlitterTextureRotation; float2 _GlitterUVPanning; - + float _GlitterHueShiftEnabled; + float _GlitteHueShiftColorSpace; float _GlitterHueShiftSpeed; float _GlitterHueShift; float _GlitterHideInShadow; float _GlitterScaleWithLighting; - + float _GlitterRandomColors; float2 _GlitterMinMaxSaturation; float2 _GlitterMinMaxBrightness; float _GlitterRandomSize; float4 _GlitterMinMaxSize; float _GlitterRandomRotation; - + #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _GlitterMask; #endif @@ -27735,7 +28348,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _GlitterTexture_ST; float2 _GlitterTexturePan; float _GlitterTextureUV; - + float _GlitterALEnabled; float _GlitterALAlphaAddBand; float4 _GlitterALAlphaAdd; @@ -27753,7 +28366,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlitterALChronoRotationSpeed; #endif //endex - + //ifex _SubsurfaceScattering==0 #ifdef POI_SUBSURFACESCATTERING float4 _SSSColor; @@ -27764,7 +28377,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _SSSThicknessMapPan; float _SSSThicknessMapUV; float _SSSThicknessMapChannel; - + float _SSSThicknessMod; float _SSSStrength; float _SSSSpread; @@ -27772,7 +28385,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _SSSBaseColorMix; #endif //endex - + //ifex _MochieBRDF==0 #ifdef MOCHIE_PBR #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED) @@ -27792,10 +28405,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _MochieMetallicMapsReflectionMaskChannel; float _MochieMetallicMapsSpecularMaskChannel; float _PBRNormalSelect; - + float _MochieReflectionTintThemeIndex; float _MochieSpecularTintThemeIndex; - + float _MochieRoughnessMultiplier; float _MochieMetallicMultiplier; float _MochieReflectionStrength; @@ -27809,7 +28422,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _PBRMaskScaleTiling; float _MochieMetallicMasksUV; float4 _MochieMetallicMasksPan; - + float _Specular2ndLayer; float _MochieSpecularStrength2; float _MochieRoughnessMultiplier2; @@ -27824,7 +28437,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _BRDFTPSReflectionMaskStrength; float _BRDFTPSSpecularMaskStrength; float _BRDFTPSDepthEnabled; - + float _MochieMetallicGlobalMask; float _MochieMetallicGlobalMaskBlendType; float _MochieSmoothnessGlobalMask; @@ -27835,7 +28448,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _MochieSpecularStrengthGlobalMaskBlendType; #endif //endex - + //ifex _ClearCoatBRDF==0 #ifdef POI_CLEARCOAT #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED) @@ -27865,7 +28478,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _ClearCoatTPSMaskStrength; float _ClearCoatTPSDepthMaskEnabled; float _ClearCoatNormalSelect; - + samplerCUBE _ClearCoatFallback; float4 _ClearCoatFallback_HDR; float _ClearCoatForceFallback; @@ -27875,7 +28488,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _ClearCoatGSAAVariance; float _ClearCoatGSAAThreshold; float _ClearcoatFresnel; - + float _ClearCoatGlobalMask; float _ClearCoatGlobalMaskBlendType; float _ClearCoatSmoothnessGlobalMask; @@ -27886,7 +28499,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _ClearCoatSpecularStrengthGlobalMaskBlendType; #endif //endex - + //ifex _StylizedSpecular==0 #ifdef POI_STYLIZED_StylizedSpecular #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED) @@ -27895,7 +28508,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _HighColor_Tex_ST; float2 _HighColor_TexPan; float _HighColor_TexUV; - + #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _Set_HighColorMask; #endif @@ -27904,7 +28517,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Set_HighColorMaskUV; float _Set_HighColorMaskChannel; float _Tweak_HighColorMaskLevel; - + float _StylizedSpecularInvertMask; + /* #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED) Texture2D _StylizedSpecularOptMap1; @@ -27912,7 +28526,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _StylizedSpecularOptMap1_ST; float2 _StylizedSpecularOptMap1Pan; float _StylizedSpecularOptMap1UV; - + #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED) Texture2D _StylizedSpecularOptMap2; #endif @@ -27920,17 +28534,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _StylizedSpecularOptMap2Pan; float _StylizedSpecularOptMap2UV; */ - + float4 _HighColor; float _UseLightColor; - + float _HighColor_Power; float _StylizedSpecularFeather; float _Layer1Strength; - + float _StylizedSpecularIgnoreNormal; float _StylizedSpecularIgnoreShadow; - + float _Layer2Size; float _StylizedSpecular2Feather; float _Layer2Strength; @@ -27942,10 +28556,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _Is_SpecularToHighColor; #endif //endex - + //ifex _EnablePathing==0 #ifdef POI_PATHING - + #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED) Texture2D _PathingMap; SamplerState SmpRepeatPoint; @@ -27953,7 +28567,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _PathingMap_ST; float2 _PathingMapPan; float _PathingMapUV; - + #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED) Texture2D _PathingColorMap; #endif @@ -27978,12 +28592,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _PathEmissionStrength; float4 _PathSoftness; float4 _PathSegments; - + float _PathColorRThemeIndex; float _PathColorGThemeIndex; float _PathColorBThemeIndex; float _PathColorAThemeIndex; - + #ifdef POI_AUDIOLINK float _PathALAutoCorrelator; float _PathALAutoCorrelatorMode; @@ -27995,7 +28609,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _PathALAutoCorrelatorRangeB; float _PathALAutoCorrelatorA; float2 _PathALAutoCorrelatorRangeA; - + float _PathALHistory; float _PathALHistoryMode; float _PathALHistoryBandR; @@ -28010,13 +28624,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _PathALHistoryBandA; float2 _PathALHistoryRangeA; float _PathALHistoryA; - + float _PathALColorChord; float _PathALCCR; float _PathALCCG; float _PathALCCB; float _PathALCCA; - + // Time Offset float _PathALTimeOffset; half _AudioLinkPathTimeOffsetBandR; @@ -28027,7 +28641,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" half2 _AudioLinkPathTimeOffsetB; half _AudioLinkPathTimeOffsetBandA; half2 _AudioLinkPathTimeOffsetA; - + // Emission Offset float _PathALEmissionOffset; half _AudioLinkPathEmissionAddBandR; @@ -28038,7 +28652,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" half2 _AudioLinkPathEmissionAddB; half _AudioLinkPathEmissionAddBandA; half2 _AudioLinkPathEmissionAddA; - + // Length Offset float _PathALWidthOffset; half _AudioLinkPathWidthOffsetBandR; @@ -28049,7 +28663,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" half2 _AudioLinkPathWidthOffsetB; half _AudioLinkPathWidthOffsetBandA; half2 _AudioLinkPathWidthOffsetA; - + // Chrono Time float _PathALChrono; float _PathChronoBandR; @@ -28067,7 +28681,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableMirrorOptions==0 #ifdef POI_MIRROR float _VisibilityMode; @@ -28091,7 +28705,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VisibilityVRCCameraScreenshot; #endif //endex - + //ifex _EnableTouchGlow==0 #ifdef GRAIN #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED) @@ -28103,7 +28717,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DepthMaskChannel; float _DepthMaskGlobalMask; float _DepthMaskGlobalMaskBlendType; - + // Color float _DepthColorToggle; float _DepthColorBlendMode; @@ -28113,7 +28727,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _DepthTexture_ST; float2 _DepthTexturePan; float _DepthTextureUV; - + float3 _DepthColor; float _DepthColorThemeIndex; float _DepthColorMinDepth; @@ -28121,9 +28735,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DepthColorMinValue; float _DepthColorMaxValue; float _DepthEmissionStrength; - + // Emission - + // Alpha float _DepthAlphaToggle; float _DepthAlphaMinValue; @@ -28132,7 +28746,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DepthAlphaMaxDepth; #endif //endex - + //ifex _TextEnabled==0 #ifdef EFFECT_BUMP sampler2D _TextGlyphs; @@ -28143,12 +28757,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _TextPositionUV; float _TextNumericUV; float _TextPixelRange; - + float _TextFPSEnabled; float _TextPositionEnabled; float _TextTimeEnabled; float _TextNumericEnabled; - + float4 _TextFPSColor; float _TextFPSEmissionStrength; fixed4 _TextFPSPadding; @@ -28156,7 +28770,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _TextFPSScale; float _TextFPSRotation; float _TextFPSOutlineColor; - + fixed _TextPositionVertical; float4 _TextPositionColor; float _TextPositionEmissionStrength; @@ -28164,14 +28778,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _TextPositionOffset; float2 _TextPositionScale; float _TextPositionRotation; - + float4 _TextTimeColor; float _TextTimeEmissionStrength; fixed4 _TextTimePadding; float2 _TextTimeOffset; float2 _TextTimeScale; float _TextTimeRotation; - + float4 _TextNumericColor; float _TextNumericEmissionStrength; fixed4 _TextNumericPadding; @@ -28182,14 +28796,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _TextNumericWholeDigits; float _TextNumericDecimalDigits; float _TextNumericTrimZeroes; - + float _TextFPSColorThemeIndex; float _TextPositionColorThemeIndex; float _TextTimeColorThemeIndex; float _TextNumericColorThemeIndex; - + float3 globalTextEmission; - + #define ASCII_SPACE 32 #define ASCII_LEFT_PARENTHESIS 40 #define ASCII_RIGHT_PARENTHESIS 41 @@ -28208,10 +28822,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define ASCII_T 84 #define ASCII_SEMICOLON 58 #define glyphWidth 0.0625 - + #endif //endex - + //ifex _FXProximityColor==0 float _FXProximityColor; float _FXProximityColorType; @@ -28223,7 +28837,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _FXProximityColorMaxDistance; float _FXProximityColorBackFace; //endex - + //ifex _PostProcess==0 #ifdef POSTPROCESS #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED) @@ -28234,7 +28848,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _PPMaskUV; float _PPMaskChannel; float _PPMaskInvert; - + float3 _PPTint; float3 _PPRGB; float _PPHue; @@ -28243,21 +28857,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _PPBrightness; float _PPLightness; float _PPHDR; - + float _PPHueShiftColorSpace; float _PPPosterization; float _PPPosterizationAmount; const static float COLORS = 32; - + #endif //endex - + //ifex _NormalCorrect==0 #ifdef POI_NORMALCORRECT float _NormalCorrectAmount; float3 _NormalCorrectOrigin; #endif //endex - + //ifex _VideoEffectsEnable==0 #ifdef POI_VIDEO_EFFECTS float _VideoEffectsEnable; @@ -28273,7 +28887,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VideoMaskTextureUV; float _VideoMaskTextureChannel; #endif - + float _VideoType; float2 _VideoResolution; sampler2D _VideoGameboyRamp; @@ -28283,13 +28897,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VideoRepeatVideoTexture; float _VideoPixelateToResolution; float2 _VideoMaskPanning; - + float _VideoSaturation; float _VideoContrast; float _VideoEmissionEnabled; #endif //endex - + //ifex _BacklightEnabled!=1 #ifdef POI_BACKLIGHT float4 _BacklightColor; @@ -28309,7 +28923,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _BacklightBackfaceMask; #endif //endex - + //ifex _BSSEnabled!=1 #ifdef POIBS_ENABLE float _CustomColors; @@ -28319,10 +28933,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _FogScale; float _FogHeightOffset; float _FogHeightScale; - + uniform float2 _CustomFogTextureToScreenRatio; uniform float _StereoCameraEyeOffset; - + uniform float _CustomFogOffset; uniform float _CustomFogAttenuation; uniform float _CustomFogHeightFogStartY; @@ -28332,7 +28946,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex #endif //endex - + //ifex _VoronoiEnabled!=1 #ifdef POI_VORONOI #if defined(PROP_VORONOIMASK) || !defined(OPTIMIZER_ENABLED) @@ -28367,18 +28981,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _VoronoiAffectsMaterialAlpha; float _VoronoiGlobalMask; float _VoronoiGlobalMaskBlendType; - + // AudioLink int _AudioLinkVoronoiInnerEmissionBand; float2 _AudioLinkVoronoiInnerEmission; int _AudioLinkVoronoiOuterEmissionBand; float2 _AudioLinkVoronoiOuterEmission; - + int _AudioLinkVoronoiGradientMinAddBand; float _AudioLinkVoronoiGradientMinAdd; int _AudioLinkVoronoiGradientMaxAddBand; float _AudioLinkVoronoiGradientMaxAdd; - + int _AudioLinkVoronoiChronoSpeedXType; int _AudioLinkVoronoiChronoSpeedXBand; float _AudioLinkVoronoiChronoSpeedXSpeed; @@ -28390,7 +29004,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AudioLinkVoronoiChronoSpeedZSpeed; #endif //endex - + struct appdata { float4 vertex : POSITION; @@ -28403,9 +29017,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 uv3 : TEXCOORD3; uint vertexId : SV_VertexID; UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO }; - + struct VertexOut { float4 pos : SV_POSITION; @@ -28418,14 +29031,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 lightmapUV : TEXCOORD7; float2 fogCoord: TEXCOORD10; UNITY_SHADOW_COORDS(11) - + UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; - + struct PoiMesh { - + // 0 Vertex normal // 1 Fragment normal float3 normals[2]; @@ -28448,8 +29061,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 parallaxUV; float2 dx; float2 dy; + uint isRightHand; }; - + struct PoiCam { float3 viewDir; @@ -28466,9 +29080,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 screenUV; float vDotN; float4 worldDirection; - + }; - + struct PoiMods { float4 Mask; @@ -28483,10 +29097,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float globalMask[16]; float ALTime[8]; }; - + struct PoiLight { - + float3 direction; float attenuation; float attenuationStrength; @@ -28519,7 +29133,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float directLuminance; float indirectLuminance; float finalLuminance; - + #if defined(VERTEXLIGHT_ON) // Non Important Lights float4 vDotNL; @@ -28536,17 +29150,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" half4 vertexVDotNH; half4 vDotLH; #endif - + }; - + struct PoiVertexLights { - + float3 direction; float3 color; float attenuation; }; - + struct PoiFragData { float smoothness; @@ -28554,34 +29168,34 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float metallic; float specularMask; float reflectionMask; - + float3 baseColor; float3 finalColor; float alpha; float3 emission; float toggleVertexLights; }; - + float4 poiTransformClipSpacetoScreenSpaceFrag(float4 clipPos) { float4 positionSS = float4(clipPos.xyz * clipPos.w, clipPos.w); positionSS.xy = positionSS.xy / _ScreenParams.xy; return positionSS; } - + // glsl_mod behaves better on negative numbers, and // in some situations actually outperforms HLSL's fmod() #ifndef glsl_mod #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y)))) #endif - + uniform float random_uniform_float_only_used_to_stop_compiler_warnings = 0.0f; - + float2 poiUV(float2 uv, float4 tex_st) { return uv * tex_st.xy + tex_st.zw; } - + float2 vertexUV(in VertexOut o, int index) { switch(index) @@ -28598,7 +29212,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return o.uv[0].xy; } } - + float2 vertexUV(in appdata v, int index) { switch(index) @@ -28615,67 +29229,67 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return v.uv0.xy; } } - + //Lighting Helpers float calculateluminance(float3 color) { return color.r * 0.299 + color.g * 0.587 + color.b * 0.114; } - + // Set by VRChat (as of open beta 1245) // _VRChatCameraMode: 0 => Normal, 1 => VR HandCam, 2 => Desktop Handcam, 3 => Screenshot/Photo // _VRChatMirrorMode: 0 => Normal, 1 => Mirror (VR), 2 => Mirror (Deskie) float _VRChatCameraMode; float _VRChatMirrorMode; - + float VRCCameraMode() { return _VRChatCameraMode; } - + float VRCMirrorMode() { return _VRChatMirrorMode; } - + bool IsInMirror() { return unity_CameraProjection[2][0] != 0.f || unity_CameraProjection[2][1] != 0.f; } - + bool IsOrthographicCamera() { return unity_OrthoParams.w == 1 || UNITY_MATRIX_P[3][3] == 1; } - + float shEvaluateDiffuseL1Geomerics_local(float L0, float3 L1, float3 n) { // average energy float R0 = max(0, L0); - + // avg direction of incoming light float3 R1 = 0.5f * L1; - + // directional brightness float lenR1 = length(R1); - + // linear angle between normal and direction 0-1 //float q = 0.5f * (1.0f + dot(R1 / lenR1, n)); //float q = dot(R1 / lenR1, n) * 0.5 + 0.5; float q = dot(normalize(R1), n) * 0.5 + 0.5; q = saturate(q); // Thanks to ScruffyRuffles for the bug identity. - + // power for q // lerps from 1 (linear) to 3 (cubic) based on directionality float p = 1.0f + 2.0f * lenR1 / R0; - + // dynamic range constant // should vary between 4 (highly directional) and 0 (ambient) float a = (1.0f - lenR1 / R0) / (1.0f + lenR1 / R0); - + return R0 * (a + (1.0f - a) * (p + 1.0f) * pow(q, p)); } - + half3 BetterSH9(half4 normal) { float3 indirect; @@ -28687,9 +29301,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirect += SHEvalLinearL2(normal); return indirect; } - + // Silent's code ends here - + float3 getCameraForward() { #if UNITY_SINGLE_PASS_STEREO @@ -28701,7 +29315,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif return normalize(p2 - p1); } - + half3 GetSHLength() { half3 x, x1; @@ -28713,7 +29327,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" x1.b = length(unity_SHBb); return x + x1; } - + float3 BoxProjection(float3 direction, float3 position, float4 cubemapPosition, float3 boxMin, float3 boxMax) { #if UNITY_SPECCUBE_BOX_PROJECTION @@ -28727,22 +29341,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif return direction; } - + float poiMax(float2 i) { return max(i.x, i.y); } - + float poiMax(float3 i) { return max(max(i.x, i.y), i.z); } - + float poiMax(float4 i) { return max(max(max(i.x, i.y), i.z), i.w); } - + float3 calculateNormal(in float3 baseNormal, in PoiMesh poiMesh, in Texture2D normalTexture, in float4 normal_ST, in float2 normalPan, in float normalUV, in float normalIntensity) { float3 normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(normalTexture, _MainTex, poiUV(poiMesh.uv[normalUV], normal_ST), normalPan), normalIntensity); @@ -28752,42 +29366,42 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" normal.z * baseNormal ); } - + float remap(float x, float minOld, float maxOld, float minNew = 0, float maxNew = 1) { return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); } - + float2 remap(float2 x, float2 minOld, float2 maxOld, float2 minNew = 0, float2 maxNew = 1) { return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); } - + float3 remap(float3 x, float3 minOld, float3 maxOld, float3 minNew = 0, float3 maxNew = 1) { return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); } - + float4 remap(float4 x, float4 minOld, float4 maxOld, float4 minNew = 0, float4 maxNew = 1) { return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); } - + float remapClamped(float minOld, float maxOld, float x, float minNew = 0, float maxNew = 1) { return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); } - + float2 remapClamped(float2 minOld, float2 maxOld, float2 x, float2 minNew, float2 maxNew) { return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); } - + float3 remapClamped(float3 minOld, float3 maxOld, float3 x, float3 minNew, float3 maxNew) { return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); } - + float4 remapClamped(float4 minOld, float4 maxOld, float4 x, float4 minNew, float4 maxNew) { return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); @@ -28796,7 +29410,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return ((height * - 1) + 1) * (poiCam.tangentViewDir.xy / poiCam.tangentViewDir.z); } - + /* 0: Zero float4(0.0, 0.0, 0.0, 0.0), 1: One float4(1.0, 1.0, 1.0, 1.0), @@ -28810,7 +29424,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 9: SrcAlphaSaturate saturate(sourceColor.aaaa), 10: OneMinusSrcAlpha float4(1.0, 1.0, 1.0, 1.0) - sourceColor.aaaa, */ - + float4 poiBlend(const float sourceFactor, const float4 sourceColor, const float destinationFactor, const float4 destinationColor, const float4 blendFactor) { float4 sA = 1 - blendFactor; @@ -28827,10 +29441,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" saturate(sourceColor.aaaa), 1 - sA, }; - + return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA); } - + // Average float blendAverage(float base, float blend) { @@ -28840,40 +29454,40 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return (base + blend) / 2.0; } - + // Color burn float blendColorBurn(float base, float blend) { return (blend == 0.0) ? blend : max((1.0 - ((1.0 - base) * rcp(random_uniform_float_only_used_to_stop_compiler_warnings + blend))), 0.0); } - + float3 blendColorBurn(float3 base, float3 blend) { return float3(blendColorBurn(base.r, blend.r), blendColorBurn(base.g, blend.g), blendColorBurn(base.b, blend.b)); } - + // Color Dodge float blendColorDodge(float base, float blend) { return (blend == 1.0) ? blend : min(base / (1.0 - blend), 1.0); } - + float3 blendColorDodge(float3 base, float3 blend) { return float3(blendColorDodge(base.r, blend.r), blendColorDodge(base.g, blend.g), blendColorDodge(base.b, blend.b)); } - + // Darken float blendDarken(float base, float blend) { return min(blend, base); } - + float3 blendDarken(float3 base, float3 blend) { return float3(blendDarken(base.r, blend.r), blendDarken(base.g, blend.g), blendDarken(base.b, blend.b)); } - + // Exclusion float blendExclusion(float base, float blend) { @@ -28883,18 +29497,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return base + blend - 2.0 * base * blend; } - + // Reflect float blendReflect(float base, float blend) { return (blend == 1.0) ? blend : min(base * base / (1.0 - blend), 1.0); } - + float3 blendReflect(float3 base, float3 blend) { return float3(blendReflect(base.r, blend.r), blendReflect(base.g, blend.g), blendReflect(base.b, blend.b)); } - + // Glow float blendGlow(float base, float blend) { @@ -28904,18 +29518,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return blendReflect(blend, base); } - + // Overlay float blendOverlay(float base, float blend) { return base < 0.5 ? (2.0 * base * blend) : (1.0 - 2.0 * (1.0 - base) * (1.0 - blend)); } - + float3 blendOverlay(float3 base, float3 blend) { return float3(blendOverlay(base.r, blend.r), blendOverlay(base.g, blend.g), blendOverlay(base.b, blend.b)); } - + // Hard Light float blendHardLight(float base, float blend) { @@ -28925,77 +29539,77 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return blendOverlay(blend, base); } - + // Vivid light float blendVividLight(float base, float blend) { return (blend < 0.5) ? blendColorBurn(base, (2.0 * blend)) : blendColorDodge(base, (2.0 * (blend - 0.5))); } - + float3 blendVividLight(float3 base, float3 blend) { return float3(blendVividLight(base.r, blend.r), blendVividLight(base.g, blend.g), blendVividLight(base.b, blend.b)); } - + // Hard mix float blendHardMix(float base, float blend) { return (blendVividLight(base, blend) < 0.5) ? 0.0 : 1.0; } - + float3 blendHardMix(float3 base, float3 blend) { return float3(blendHardMix(base.r, blend.r), blendHardMix(base.g, blend.g), blendHardMix(base.b, blend.b)); } - + // Lighten float blendLighten(float base, float blend) { return max(blend, base); } - + float3 blendLighten(float3 base, float3 blend) { return float3(blendLighten(base.r, blend.r), blendLighten(base.g, blend.g), blendLighten(base.b, blend.b)); } - + // Linear Burn float blendLinearBurn(float base, float blend) { // Note : Same implementation as BlendSubtractf return max(base + blend - 1.0, 0.0); } - + float3 blendLinearBurn(float3 base, float3 blend) { // Note : Same implementation as BlendSubtract return max(base + blend - float3(1.0, 1.0, 1.0), float3(0.0, 0.0, 0.0)); } - + // Linear Dodge float blendLinearDodge(float base, float blend) { // Note : Same implementation as BlendAddf return min(base + blend, 1.0); } - + float3 blendLinearDodge(float3 base, float3 blend) { // Note : Same implementation as BlendAdd return base + blend; } - + // Linear light float blendLinearLight(float base, float blend) { return blend < 0.5 ? blendLinearBurn(base, (2.0 * blend)) : blendLinearDodge(base, (2.0 * (blend - 0.5))); } - + float3 blendLinearLight(float3 base, float3 blend) { return float3(blendLinearLight(base.r, blend.r), blendLinearLight(base.g, blend.g), blendLinearLight(base.b, blend.b)); } - + // Multiply float blendMultiply(float base, float blend) { @@ -29005,7 +29619,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return base * blend; } - + // Negation float blendNegation(float base, float blend) { @@ -29015,7 +29629,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend); } - + // Normal float blendNormal(float base, float blend) { @@ -29025,7 +29639,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return blend; } - + // Phoenix float blendPhoenix(float base, float blend) { @@ -29035,83 +29649,83 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return min(base, blend) - max(base, blend) + float3(1.0, 1.0, 1.0); } - + // Pin light float blendPinLight(float base, float blend) { return (blend < 0.5) ? blendDarken(base, (2.0 * blend)) : blendLighten(base, (2.0 * (blend - 0.5))); } - + float3 blendPinLight(float3 base, float3 blend) { return float3(blendPinLight(base.r, blend.r), blendPinLight(base.g, blend.g), blendPinLight(base.b, blend.b)); } - + // Screen float blendScreen(float base, float blend) { return 1.0 - ((1.0 - base) * (1.0 - blend)); } - + float3 blendScreen(float3 base, float3 blend) { return float3(blendScreen(base.r, blend.r), blendScreen(base.g, blend.g), blendScreen(base.b, blend.b)); } - + // Soft Light float blendSoftLight(float base, float blend) { return (blend < 0.5) ? (2.0 * base * blend + base * base * (1.0 - 2.0 * blend)) : (sqrt(base) * (2.0 * blend - 1.0) + 2.0 * base * (1.0 - blend)); } - + float3 blendSoftLight(float3 base, float3 blend) { return float3(blendSoftLight(base.r, blend.r), blendSoftLight(base.g, blend.g), blendSoftLight(base.b, blend.b)); } - + // Subtract float blendSubtract(float base, float blend) { return max(base - blend, 0.0); } - + float3 blendSubtract(float3 base, float3 blend) { return max(base - blend, 0.0); } - + // Difference float blendDifference(float base, float blend) { return abs(base - blend); } - + float3 blendDifference(float3 base, float3 blend) { return abs(base - blend); } - + // Divide float blendDivide(float base, float blend) { return base / max(blend, 0.0001); } - + float3 blendDivide(float3 base, float3 blend) { return base / max(blend, 0.0001); } - + float blendMixed(float base, float blend) { return base + base * blend; } - + float3 blendMixed(float3 base, float3 blend) { return base + base * blend; } - + float3 customBlend(float3 base, float3 blend, float blendType, float alpha = 1) { float3 output = base; @@ -29130,7 +29744,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return output; } - + float3 customBlend(float base, float blend, float blendType, float alpha = 1) { float3 output = base; @@ -29148,7 +29762,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return output; } - + #define REPLACE 0 #define SUBSTRACT 1 #define MULTIPLY 2 @@ -29157,7 +29771,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define MAX 5 #define AVERAGE 6 #define ADD 7 - + float maskBlend(float baseMask, float blendMask, float blendType) { float output = 0; @@ -29174,7 +29788,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return saturate(output); } - + float globalMaskBlend(float baseMask, float globalMaskIndex, float blendType, PoiMods poiMods) { if (globalMaskIndex == 0) @@ -29186,27 +29800,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return maskBlend(baseMask, poiMods.globalMask[globalMaskIndex - 1], blendType); } } - + float random(float2 p) { return frac(sin(dot(p, float2(12.9898, 78.2383))) * 43758.5453123); } - + float2 random2(float2 p) { return frac(sin(float2(dot(p, float2(127.1, 311.7)), dot(p, float2(269.5, 183.3)))) * 43758.5453); } - + float3 random3(float2 p) { return frac(sin(float3(dot(p, float2(127.1, 311.7)), dot(p, float2(269.5, 183.3)), dot(p, float2(248.3, 315.9)))) * 43758.5453); } - + float3 random3(float3 p) { return frac(sin(float3(dot(p, float3(127.1, 311.7, 248.6)), dot(p, float3(269.5, 183.3, 423.3)), dot(p, float3(248.3, 315.9, 184.2)))) * 43758.5453); } - + float3 randomFloat3(float2 Seed, float maximum) { return (.5 + float3( @@ -29215,7 +29829,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453) ) * .5) * (maximum); } - + float3 randomFloat3Range(float2 Seed, float Range) { return (float3( @@ -29224,7 +29838,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453) ) * 2 - 1) * Range; } - + float3 randomFloat3WiggleRange(float2 Seed, float Range, float wiggleSpeed, float timeOffset) { float3 rando = (float3( @@ -29235,7 +29849,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float speed = 1 + wiggleSpeed; return float3(sin(((_Time.x + timeOffset) + rando.x * PI) * speed), sin(((_Time.x + timeOffset) + rando.y * PI) * speed), sin(((_Time.x + timeOffset) + rando.z * PI) * speed)) * Range; } - + void poiDither(float4 In, float4 ScreenPosition, out float4 Out) { float2 uv = ScreenPosition.xy * _ScreenParams.xy; @@ -29256,7 +29870,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" static const float HCLmaxL = 0.530454533953517; // == exp(HCLgamma / HCLy0) - 0.5 static const float3 wref = float3(1.0, 1.0, 1.0); #define TAU 6.28318531 - + float3 HUEtoRGB(in float H) { float R = abs(H * 6 - 3) - 1; @@ -29264,7 +29878,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float B = 2 - abs(H * 6 - 4); return saturate(float3(R, G, B)); } - + float3 RGBtoHCV(in float3 RGB) { // Based on work by Sam Hocevar and Emil Persson @@ -29274,27 +29888,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float H = abs((Q.w - Q.y) / (6 * C + Epsilon) + Q.z); return float3(H, C, Q.x); } - - float3 HSVtoRGB(in float3 HSV) - { - float3 RGB = HUEtoRGB(HSV.x); - return ((RGB - 1) * HSV.y + 1) * HSV.z; + + float3 RGBtoHSV(float3 c){ + float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); + float4 p = lerp(float4(c.bg, K.wz), float4(c.gb, K.xy), step(c.b, c.g)); + float4 q = lerp(float4(p.xyw, c.r), float4(c.r, p.yzx), step(p.x, c.r)); + + float d = q.x - min(q.w, q.y); + float e = 1.0e-10; + return float3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); } - - float3 RGBtoHSV(in float3 RGB) - { - float3 HCV = RGBtoHCV(RGB); - float S = HCV.y / (HCV.z + Epsilon); - return float3(HCV.x, S, HCV.z); + + float3 HSVtoRGB(float3 c){ + float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); + float3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www); + return c.z * lerp(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); } - + float3 HSLtoRGB(in float3 HSL) { float3 RGB = HUEtoRGB(HSL.x); float C = (1 - abs(2 * HSL.z - 1)) * HSL.y; return (RGB - 0.5) * C + HSL.z; } - + float3 RGBtoHSL(in float3 RGB) { float3 HCV = RGBtoHCV(RGB); @@ -29302,24 +29919,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon); return float3(HCV.x, S, L); } - + void DecomposeHDRColor(in float3 linearColorHDR, out float3 baseLinearColor, out float exposure) { // Optimization/adaptation of https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/GUI/ColorMutator.cs#L23 but skips weird photoshop stuff float maxColorComponent = max(linearColorHDR.r, max(linearColorHDR.g, linearColorHDR.b)); bool isSDR = maxColorComponent <= 1.0; - + float scaleFactor = isSDR ? 1.0 : (1.0 / maxColorComponent); exposure = isSDR ? 0.0 : log(maxColorComponent) * 1.44269504089; // ln(2) - + baseLinearColor = scaleFactor * linearColorHDR; } - + float3 ApplyHDRExposure(float3 linearColor, float exposure) { return linearColor * pow(2, exposure); } - + // Transforms an RGB color using a matrix. Note that S and V are absolute values here float3 ModifyViaHSV(float3 color, float h, float s, float v) { @@ -29329,12 +29946,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" colorHSV.z = saturate(colorHSV.z + v); return HSVtoRGB(colorHSV); } - + float3 ModifyViaHSV(float3 color, float3 HSVMod) { return ModifyViaHSV(color, HSVMod.x, HSVMod.y, HSVMod.z); } - + float4x4 brightnessMatrix(float brightness) { return float4x4( @@ -29344,11 +29961,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" brightness, brightness, brightness, 1 ); } - + float4x4 contrastMatrix(float contrast) { float t = (1.0 - contrast) / 2.0; - + return float4x4( contrast, 0, 0, 0, 0, contrast, 0, 0, @@ -29356,22 +29973,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" t, t, t, 1 ); } - + float4x4 saturationMatrix(float saturation) { float3 luminance = float3(0.3086, 0.6094, 0.0820); - + float oneMinusSat = 1.0 - saturation; - + float3 red = luminance.x * oneMinusSat; red += float3(saturation, 0, 0); - + float3 green = luminance.y * oneMinusSat; green += float3(0, saturation, 0); - + float3 blue = luminance.z * oneMinusSat; blue += float3(0, 0, saturation); - + return float4x4( red, 0, green, 0, @@ -29379,7 +29996,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, 0, 0, 1 ); } - + float4 PoiColorBCS(float4 color, float brightness, float contrast, float saturation) { return mul(color, mul(brightnessMatrix(brightness), mul(contrastMatrix(contrast), saturationMatrix(saturation)))); @@ -29388,68 +30005,87 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return mul(float4(color, 1), mul(brightnessMatrix(brightness), mul(contrastMatrix(contrast), saturationMatrix(saturation)))).rgb; } - + float3 linear_srgb_to_oklab(float3 c) { float l = 0.4122214708 * c.x + 0.5363325363 * c.y + 0.0514459929 * c.z; float m = 0.2119034982 * c.x + 0.6806995451 * c.y + 0.1073969566 * c.z; float s = 0.0883024619 * c.x + 0.2817188376 * c.y + 0.6299787005 * c.z; - + float l_ = pow(l, 1.0 / 3.0); float m_ = pow(m, 1.0 / 3.0); float s_ = pow(s, 1.0 / 3.0); - + return float3( 0.2104542553 * l_ + 0.7936177850 * m_ - 0.0040720468 * s_, 1.9779984951 * l_ - 2.4285922050 * m_ + 0.4505937099 * s_, 0.0259040371 * l_ + 0.7827717662 * m_ - 0.8086757660 * s_ ); } - + float3 oklab_to_linear_srgb(float3 c) { float l_ = c.x + 0.3963377774 * c.y + 0.2158037573 * c.z; float m_ = c.x - 0.1055613458 * c.y - 0.0638541728 * c.z; float s_ = c.x - 0.0894841775 * c.y - 1.2914855480 * c.z; - + float l = l_ * l_ * l_; float m = m_ * m_ * m_; float s = s_ * s_ * s_; - + return float3( + 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s, - 1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s, - 0.0041960863 * l - 0.7034186147 * m + 1.7076147010 * s ); } - + float3 hueShift(float3 color, float shift) { - float3 oklab = linear_srgb_to_oklab(max(color, 0.0000000001)); + float3 oklab = linear_srgb_to_oklab(color); + float chroma = length(oklab.yz); + + if (chroma < 1e-5) { + // No hue to shift for achromatic colors + return color; + } + float hue = atan2(oklab.z, oklab.y); hue += shift * PI * 2; // Add the hue shift - - float chroma = length(oklab.yz); + oklab.y = cos(hue) * chroma; oklab.z = sin(hue) * chroma; - + return oklab_to_linear_srgb(oklab); } - - float3 hueShift(float4 color, float shift) + + float3 hueShiftHSV(float3 color, float hueOffset) { - return hueShift(color.rgb, shift); + float3 hsv = float3(hueOffset, 0, 0); + float3 hsvCol = RGBtoHSV(color); + return HSVtoRGB(hsvCol + hsv); } - - /* - float3 hueShift(float3 color, float hueOffset) + + float3 hueShift(float3 color, float shift, float ColorSpace) { - color = RGBtoHSV(color); - color.x = frac(hueOffset +color.x); - return HSVtoRGB(color); + switch(ColorSpace) + { + // OkLab Hue Shift + case 0.0: + return hueShift(color, shift); + // HSV Hue Shift + case 1.0: + return hueShiftHSV(color, shift); + default: + return float3(1.0, 0.0, 0.0); + } } - */ - + + float3 hueShift(float4 color, float shift, float ColorSpace) + { + return hueShift(color.rgb, shift, ColorSpace); + } + // LCH float xyzF(float t) { @@ -29459,7 +30095,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655)); } - + float4x4 poiRotationMatrixFromAngles(float x, float y, float z) { float angleX = radians(x); @@ -29469,7 +30105,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1); - + float angleY = radians(y); c = cos(angleY); s = sin(angleY); @@ -29477,7 +30113,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, 1, 0, 0, - s, 0, c, 0, 0, 0, 0, 1); - + float angleZ = radians(z); c = cos(angleZ); s = sin(angleZ); @@ -29485,10 +30121,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); - + return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix); } - + float4x4 poiRotationMatrixFromAngles(float3 angles) { float angleX = radians(angles.x); @@ -29498,7 +30134,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1); - + float angleY = radians(angles.y); c = cos(angleY); s = sin(angleY); @@ -29506,7 +30142,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, 1, 0, 0, - s, 0, c, 0, 0, 0, 0, 1); - + float angleZ = radians(angles.z); c = cos(angleZ); s = sin(angleZ); @@ -29514,10 +30150,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); - + return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix); } - + float3 getCameraPosition() { #ifdef USING_STEREO_MATRICES @@ -29525,7 +30161,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif return _WorldSpaceCameraPos; } - + float2 calcPixelScreenUVs(half4 grabPos) { half2 uv = grabPos.xy / (grabPos.w + 0.0000000001); @@ -29534,60 +30170,60 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else uv.xy *= _ScreenParams.xy; #endif - + return uv; } - + float CalcMipLevel(float2 texture_coord) { float2 dx = ddx(texture_coord); float2 dy = ddy(texture_coord); float delta_max_sqr = max(dot(dx, dx), dot(dy, dy)); - + return 0.5 * log2(delta_max_sqr); } - + float inverseLerp(float A, float B, float T) { return (T - A) / (B - A); } - + float inverseLerp2(float2 a, float2 b, float2 value) { float2 AB = b - a; float2 AV = value - a; return dot(AV, AB) / dot(AB, AB); } - + float inverseLerp3(float3 a, float3 b, float3 value) { float3 AB = b - a; float3 AV = value - a; return dot(AV, AB) / dot(AB, AB); } - + float inverseLerp4(float4 a, float4 b, float4 value) { float4 AB = b - a; float4 AV = value - a; return dot(AV, AB) / dot(AB, AB); } - + /* MIT License - + Copyright (c) 2019 wraikny - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -29595,29 +30231,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + VertexTransformShader is dependent on: */ - + float4 quaternion_conjugate(float4 v) { return float4( v.x, -v.yzw ); } - + float4 quaternion_mul(float4 v1, float4 v2) { float4 result1 = (v1.x * v2 + v1 * v2.x); - + float4 result2 = float4( - dot(v1.yzw, v2.yzw), cross(v1.yzw, v2.yzw) ); - + return float4(result1 + result2); } - + // angle : radians float4 get_quaternion_from_angle(float3 axis, float angle) { @@ -29625,45 +30261,45 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float cs = cos(angle * 0.5); return float4(axis * sn, cs); } - + float4 quaternion_from_vector(float3 inVec) { return float4(0.0, inVec); } - + float degree_to_radius(float degree) { return ( degree / 180.0 * PI ); } - + float3 rotate_with_quaternion(float3 inVec, float3 rotation) { float4 qx = get_quaternion_from_angle(float3(1, 0, 0), radians(rotation.x)); float4 qy = get_quaternion_from_angle(float3(0, 1, 0), radians(rotation.y)); float4 qz = get_quaternion_from_angle(float3(0, 0, 1), radians(rotation.z)); - + #define MUL3(A, B, C) quaternion_mul(quaternion_mul((A), (B)), (C)) float4 quaternion = normalize(MUL3(qx, qy, qz)); float4 conjugate = quaternion_conjugate(quaternion); - + float4 inVecQ = quaternion_from_vector(inVec); - + float3 rotated = ( MUL3(quaternion, inVecQ, conjugate) ).yzw; - + return rotated; } - + float4 transform(float4 input, float4 pos, float4 rotation, float4 scale) { input.rgb *= (scale.xyz * scale.w); input = float4(rotate_with_quaternion(input.xyz, rotation.xyz * rotation.w) + (pos.xyz * pos.w), input.w); return input; } - + float2 RotateUV(float2 _uv, float _radian, float2 _piv, float _time) { float RotateUV_ang = _radian; @@ -29671,17 +30307,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float RotateUV_sin = sin(_time * RotateUV_ang); return (mul(_uv - _piv, float2x2(RotateUV_cos, -RotateUV_sin, RotateUV_sin, RotateUV_cos)) + _piv); } - + /* MIT END */ - + float3 RotateAroundAxis(float3 original, float3 axis, float radian) { float s = sin(radian); float c = cos(radian); float one_minus_c = 1.0 - c; - + axis = normalize(axis); float3x3 rot_mat = { one_minus_c * axis.x * axis.x + c, one_minus_c * axis.x * axis.y - axis.z * s, one_minus_c * axis.z * axis.x + axis.y * s, @@ -29690,14 +30326,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" }; return mul(rot_mat, original); } - + float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex) { float3 outputColor = srcColor; if (themeIndex != 0) { themeIndex = max(themeIndex - 1, 0); - + if (themeIndex <= 3) { outputColor = poiMods.globalColorTheme[themeIndex]; @@ -29714,7 +30350,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return outputColor; } - + float3 lilToneCorrection(float3 c, float4 hsvg) { // gamma @@ -29730,7 +30366,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // hsv - > rgb return hsv.z - hsv.z * hsv.y + hsv.z * hsv.y * saturate(abs(frac(hsv.x + float3(1.0, 2.0 / 3.0, 1.0 / 3.0)) * 6.0 - 3.0) - 1.0); } - + float3 lilBlendColor(float3 dstCol, float3 srcCol, float3 srcA, int blendMode) { float3 ad = dstCol + srcCol; @@ -29742,24 +30378,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (blendMode == 3) outCol = mu; // Multiply return lerp(dstCol, outCol, srcA); } - + float lilIsIn0to1(float f) { float value = 0.5 - abs(f - 0.5); return saturate(value / clamp(fwidth(value), 0.0001, 1.0)); } - + float lilIsIn0to1(float f, float nv) { float value = 0.5 - abs(f - 0.5); return saturate(value / clamp(fwidth(value), 0.0001, nv)); } - + float poiEdgeLinearNoSaturate(float value, float border) { return (value - border) / clamp(fwidth(value), 0.0001, 1.0); } - + float3 poiEdgeLinearNoSaturate(float value, float3 border) { return float3( @@ -29768,29 +30404,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" (value - border.z) / clamp(fwidth(value), 0.0001, 1.0) ); } - + float poiEdgeLinearNoSaturate(float value, float border, float blur) { float borderMin = saturate(border - blur * 0.5); float borderMax = saturate(border + blur * 0.5); return (value - borderMin) / saturate(borderMax - borderMin + fwidth(value)); } - + float poiEdgeLinearNoSaturate(float value, float border, float blur, float borderRange) { float borderMin = saturate(border - blur * 0.5 - borderRange); float borderMax = saturate(border + blur * 0.5); return (value - borderMin) / saturate(borderMax - borderMin + fwidth(value)); } - + float poiEdgeNonLinearNoSaturate(float value, float border) { // return (value - border) / clamp(fwidth(value), 0.0001, 1.0); - + float fwidthValue = fwidth(value); return smoothstep(border - fwidthValue, border + fwidthValue, value); } - + float poiEdgeNonLinearNoSaturate(float value, float border, float blur) { float fwidthValue = fwidth(value); @@ -29798,7 +30434,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float borderMax = saturate(border + blur * 0.5); return smoothstep(borderMin - fwidthValue, borderMax + fwidthValue, value); } - + float poiEdgeNonLinearNoSaturate(float value, float border, float blur, float borderRange) { float fwidthValue = fwidth(value); @@ -29806,32 +30442,32 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float borderMax = saturate(border + blur * 0.5); return smoothstep(borderMin - fwidthValue, borderMax + fwidthValue, value); } - + float poiEdgeNonLinear(float value, float border) { return saturate(poiEdgeNonLinearNoSaturate(value, border)); } - + float poiEdgeNonLinear(float value, float border, float blur) { return saturate(poiEdgeNonLinearNoSaturate(value, border, blur)); } - + float poiEdgeNonLinear(float value, float border, float blur, float borderRange) { return saturate(poiEdgeNonLinearNoSaturate(value, border, blur, borderRange)); } - + float poiEdgeLinear(float value, float border) { return saturate(poiEdgeLinearNoSaturate(value, border)); } - + float poiEdgeLinear(float value, float border, float blur) { return saturate(poiEdgeLinearNoSaturate(value, border, blur)); } - + float poiEdgeLinear(float value, float border, float blur, float borderRange) { return saturate(poiEdgeLinearNoSaturate(value, border, blur, borderRange)); @@ -29841,12 +30477,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return LinearToGammaSpace(col); } - + float3 OpenLitSRGBToLinear(float3 col) { return GammaToLinearSpace(col); } - + float OpenLitLuminance(float3 rgb) { #if defined(UNITY_COLORSPACE_GAMMA) @@ -29855,7 +30491,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return dot(rgb, float3(0.0396819152, 0.458021790, 0.00609653955)); #endif } - + float3 AdjustLitLuminance(float3 rgb, float targetLuminance) { float currentLuminance; @@ -29864,11 +30500,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else currentLuminance = dot(rgb, float3(0.0396819152, 0.458021790, 0.00609653955)); #endif - + float luminanceRatio = targetLuminance / currentLuminance; return rgb * luminanceRatio; } - + float3 ClampLuminance(float3 rgb, float minLuminance, float maxLuminance) { float currentLuminance = dot(rgb, float3(0.299, 0.587, 0.114)); @@ -29877,19 +30513,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float luminanceRatio = clamp(min(maxRatio, max(minRatio, 1.0)), 0.0, 1.0); return lerp(rgb, rgb * luminanceRatio, luminanceRatio < 1.0); } - + float3 MaxLuminance(float3 rgb, float maxLuminance) { float currentLuminance = dot(rgb, float3(0.299, 0.587, 0.114)); float luminanceRatio = (currentLuminance != 0) ? maxLuminance / max(currentLuminance, 0.00001) : 1.0; return lerp(rgb, rgb * luminanceRatio, currentLuminance > maxLuminance); } - + float OpenLitGray(float3 rgb) { return dot(rgb, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); } - + void OpenLitShadeSH9ToonDouble(float3 lightDirection, out float3 shMax, out float3 shMin) { #if !defined(LIGHTMAP_ON) @@ -29917,13 +30553,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" shMin = 0.0; #endif } - + float3 OpenLitComputeCustomLightDirection(float4 lightDirectionOverride) { float3 customDir = length(lightDirectionOverride.xyz) * normalize(mul((float3x3)unity_ObjectToWorld, lightDirectionOverride.xyz)); return lightDirectionOverride.w ? customDir : lightDirectionOverride.xyz; // .w isn't doc'd anywhere and is always 0 unless end user changes it + } - + float3 OpenLitLightingDirectionForSH9() { float3 mainDir = _WorldSpaceLightPos0.xyz * OpenLitLuminance(_LightColor0.rgb); @@ -29934,12 +30571,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 sh9Dir = 0; float3 sh9DirAbs = 0; #endif - + float3 lightDirectionForSH9 = sh9Dir + mainDir; lightDirectionForSH9 = dot(lightDirectionForSH9, lightDirectionForSH9) < 0.000001 ? 0 : normalize(lightDirectionForSH9); return lightDirectionForSH9; } - + float3 OpenLitLightingDirection(float4 lightDirectionOverride) { float3 mainDir = _WorldSpaceLightPos0.xyz * OpenLitLuminance(_LightColor0.rgb); @@ -29951,28 +30588,28 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 sh9DirAbs = 0; #endif float3 customDir = OpenLitComputeCustomLightDirection(lightDirectionOverride); - + return normalize(sh9DirAbs + mainDir + customDir); } - + float3 OpenLitLightingDirection() { float4 customDir = float4(0.001, 0.002, 0.001, 0.0); return OpenLitLightingDirection(customDir); } - + inline float4 CalculateFrustumCorrection() { float x1 = -UNITY_MATRIX_P._31 / (UNITY_MATRIX_P._11 * UNITY_MATRIX_P._34); float x2 = -UNITY_MATRIX_P._32 / (UNITY_MATRIX_P._22 * UNITY_MATRIX_P._34); return float4(x1, x2, 0, UNITY_MATRIX_P._33 / UNITY_MATRIX_P._34 + x1 * UNITY_MATRIX_P._13 + x2 * UNITY_MATRIX_P._23); } - + inline float CorrectedLinearEyeDepth(float z, float B) { return 1.0 / (z / UNITY_MATRIX_P._34 + B); } - + // Silent's code float2 sharpSample(float4 texelSize, float2 p) { @@ -29982,7 +30619,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" p = (p - 0.5) * texelSize.xy; return p; } - + void applyToGlobalMask(inout PoiMods poiMods, int index, int blendType, float val) { float valBlended = saturate(maskBlend(poiMods.globalMask[index], val, blendType)); @@ -30006,7 +30643,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" case 15: poiMods.globalMask[15] = valBlended; break; } } - + void assignValueToVectorFromIndex(inout float4 vec, int index, float value) { switch(index) @@ -30017,7 +30654,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" case 3: vec[3] = value; break; } } - + // SNose float3 mod289(float3 x) { @@ -30031,7 +30668,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return mod289(((x * 34.0) + 1.0) * x); } - + float snoise(float2 v) { const float4 C = float4(0.211324865405187, // (3.0 - sqrt(3.0)) / 6.0 @@ -30047,7 +30684,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" i = mod289(i); // Avoid truncation effects in permutation float3 p = permute(permute(i.y + float3(0.0, i1.y, 1.0)) + i.x + float3(0.0, i1.x, 1.0)); - + float3 m = max(0.5 - float3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0); m = m * m ; m = m * m ; @@ -30061,35 +30698,35 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" g.yz = a0.yz * x12.xz + h.yz * x12.yw; return 130.0 * dot(m, g); } - + float nsqDistance(float2 a, float2 b) { return dot(a - b, a - b); } - + float poiInvertToggle(in float value, in float toggle) { return (toggle == 0 ? value : 1 - value); } - + float3 PoiBlendNormal(float3 dstNormal, float3 srcNormal) { return float3(dstNormal.xy + srcNormal.xy, dstNormal.z * srcNormal.z); } - + float3 lilTransformDirOStoWS(float3 directionOS, bool doNormalize) { if (doNormalize) return normalize(mul((float3x3)unity_ObjectToWorld, directionOS)); else return mul((float3x3)unity_ObjectToWorld, directionOS); } - + float2 poiGetWidthAndHeight(Texture2D tex) { uint width, height; tex.GetDimensions(width, height); return float2(width, height); } - + float2 poiGetWidthAndHeight(Texture2DArray tex) { uint width, height, element; @@ -30098,25 +30735,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } //ifex _EnableAudioLink==0 #ifdef POI_AUDIOLINK - + // Convenient mechanism to read from the AudioLink texture that handles reading off the end of one line and onto the next above it. float4 AudioLinkDataMultiline(uint2 xycoord) { return AudioLinkData(uint2(xycoord.x % AUDIOLINK_WIDTH, xycoord.y + xycoord.x / AUDIOLINK_WIDTH)); } - + // Mechanism to sample between two adjacent pixels and lerp between them, like "linear" supesampling float4 AudioLinkLerp(float2 xy) { return lerp(AudioLinkData(xy), AudioLinkData(xy + int2(1, 0)), frac(xy.x)); } - + // Same as AudioLinkLerp but properly handles multiline reading. float4 AudioLinkLerpMultiline(float2 xy) { return lerp(AudioLinkDataMultiline(xy), AudioLinkDataMultiline(xy + float2(1, 0)), frac(xy.x)); } - + //Tests to see if Audio Link texture is available bool AudioLinkIsAvailable() { @@ -30128,7 +30765,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return _AudioTexture_TexelSize.z > 16; #endif } - + //Get version of audiolink present in the world, 0 if no audiolink is present float AudioLinkGetVersion() { @@ -30138,7 +30775,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else dims = _AudioTexture_TexelSize.zw; #endif - + if (dims.x >= 128) return AudioLinkData(ALPASS_GENERALVU).x; else if (dims.x > 16) @@ -30146,17 +30783,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" else return 0; } - + // This pulls data from this texture. #define AudioLinkGetSelfPixelData(xy) _SelfTexture2D[xy] - + // Extra utility functions for time. uint AudioLinkDecodeDataAsUInt(uint2 indexloc) { uint4 rpx = AudioLinkData(indexloc); return rpx.r + rpx.g * 1024 + rpx.b * 1048576 + rpx.a * 1073741824; } - + //Note: This will truncate time to every 134,217.728 seconds (~1.5 days of an instance being up) to prevent floating point aliasing. // if your code will alias sooner, you will need to use a different function. It should be safe to use this on all times. float AudioLinkDecodeDataAsSeconds(uint2 indexloc) @@ -30165,15 +30802,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //Can't just divide by float. Bug in Unity's HLSL compiler. return float(time / 1000) + float(time % 1000) / 1000.; } - + #define ALDecodeDataAsSeconds(x) AudioLinkDecodeDataAsSeconds(x) #define ALDecodeDataAsUInt(x) AudioLinkDecodeDataAsUInt(x) - + float AudioLinkRemap(float t, float a, float b, float u, float v) { return ((t - a) / (b - a)) * (v - u) + u; } - + float3 AudioLinkHSVtoRGB(float3 HSV) { float3 RGB = 0; @@ -30211,11 +30848,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float M = HSV.z - C; return RGB + M; } - + float3 AudioLinkCCtoRGB(float bin, float intensity, int rootNote) { float note = bin / AUDIOLINK_EXPBINS; - + float hue = 0.0; note *= 12.0; note = glsl_mod(4. - note + rootNote, 12.0); @@ -30241,48 +30878,48 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float val = intensity - 0.1; return AudioLinkHSVtoRGB(float3(fmod(hue, 1.0), 1.0, clamp(val, 0.0, 1.0))); } - + // Sample the amplitude of a given frequency in the DFT, supports frequencies in [13.75; 14080]. float4 AudioLinkGetAmplitudeAtFrequency(float hertz) { float note = AUDIOLINK_EXPBINS * log2(hertz / AUDIOLINK_BOTTOM_FREQUENCY); return AudioLinkLerpMultiline(ALPASS_DFT + float2(note, 0)); } - + // Sample the amplitude of a given semitone in an octave. Octave is in [0; 9] while note is [0; 11]. float AudioLinkGetAmplitudeAtNote(float octave, float note) { float quarter = note * 2.0; return AudioLinkLerpMultiline(ALPASS_DFT + float2(octave * AUDIOLINK_EXPBINS + quarter, 0)); } - + // Get a reasonable drop-in replacement time value for _Time.y with the // given chronotensity index [0; 7] and AudioLink band [0; 3]. float AudioLinkGetChronoTime(uint index, uint band) { return (AudioLinkDecodeDataAsUInt(ALPASS_CHRONOTENSITY + uint2(index, band))) / 100000.0; } - + // Get a chronotensity value in the interval [0; 1], modulated by the speed input, // with the given chronotensity index [0; 7] and AudioLink band [0; 3]. float AudioLinkGetChronoTimeNormalized(uint index, uint band, float speed) { return frac(AudioLinkGetChronoTime(index, band) * speed); } - + // Get a chronotensity value in the interval [0; interval], modulated by the speed input, // with the given chronotensity index [0; 7] and AudioLink band [0; 3]. float AudioLinkGetChronoTimeInterval(uint index, uint band, float speed, float interval) { return AudioLinkGetChronoTimeNormalized(index, band, speed) * interval; } - + float getBandAtTime(float band, float time, float size = 1.0f) { //return remap(UNITY_SAMPLE_TEX2D(_AudioTexture, float2(time * width, band/128.0)).r, min(size,.9999), 1); return remapClamped(min(size, .9999), 1, AudioLinkData(ALPASS_AUDIOBASS + uint2(time * AUDIOLINK_WIDTH, band)).r); } - + fixed3 maximize(fixed3 c) { if (c.x == 0 && c.y == 0 && c.z == 0) @@ -30290,11 +30927,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" else return c / max(c.r, max(c.g, c.b)); } - + void initPoiAudioLink(inout PoiMods poiMods) { if (!_AudioLinkAnimToggle) return; - + if (AudioLinkIsAvailable()) { poiMods.audioLinkAvailable = true; @@ -30309,25 +30946,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalColorTheme[5] = AudioLinkData( ALPASS_CCCOLORS + uint2( 1, 0 ) ); poiMods.globalColorTheme[6] = AudioLinkData( ALPASS_CCCOLORS + uint2( 2, 0 ) ); poiMods.globalColorTheme[7] = AudioLinkData( ALPASS_CCCOLORS + uint2( 3, 0 ) ); - + poiMods.globalColorTheme[4] = float4(maximize(AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) )),1.0); poiMods.globalColorTheme[5] = float4(maximize(AudioLinkData( ALPASS_CCCOLORS + uint2( 1, 0 ) )),1.0); poiMods.globalColorTheme[6] = float4(maximize(AudioLinkData( ALPASS_CCCOLORS + uint2( 2, 0 ) )),1.0); poiMods.globalColorTheme[7] = float4(maximize(AudioLinkData( ALPASS_CCCOLORS + uint2( 3, 0 ) )),1.0); */ - + poiMods.globalColorTheme[4] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(2, 0))[0], AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0); poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0))[0], AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0); poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0))[0], AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0); poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0))[0], AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0); - + poiMods.globalColorTheme[8] = AudioLinkData(ALPASS_THEME_COLOR0); poiMods.globalColorTheme[9] = AudioLinkData(ALPASS_THEME_COLOR1); poiMods.globalColorTheme[10] = AudioLinkData(ALPASS_THEME_COLOR2); poiMods.globalColorTheme[11] = AudioLinkData(ALPASS_THEME_COLOR3); return; } - + if (_AudioLinkBandOverridesEnabled) { poiMods.audioLinkAvailable = true; @@ -30337,7 +30974,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.audioLink[3] = _AudioLinkBandOverrideSliders.w; } } - + void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) { if (_DebugWaveform) @@ -30386,21 +31023,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.emission += (AudioLinkDecodeDataAsUInt(ALPASS_CHRONOTENSITY + uint2(1, 0)) % 1000000) / 1000000.0; } } - + void SetupAudioLink(inout PoiFragData poiFragData, inout PoiMods poiMods, in PoiMesh poiMesh) { initPoiAudioLink(poiMods); DebugVisualizer(poiFragData, poiMesh, poiMods); - + if (_AudioLinkCCStripY) { poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].y * AUDIOLINK_WIDTH, 0)).rgb * .5; } } - + #endif //endex - + //ifex _BSSEnabled!=1 #ifdef POIBS_ENABLE //ifex _BSSBloomfog!=1 @@ -30415,7 +31052,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" (screenPosNormalized.y + - 0.5) * _CustomFogTextureToScreenRatio.y + 0.5 ,clipPos.z,clipPos.w); } - + inline float GetHeightFogIntensity(float3 worldPos, float fogHeightOffset, float fogHeightScale) { float heightFogIntensity = _CustomFogHeightFogHeight + _CustomFogHeightFogStartY; @@ -30424,7 +31061,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" heightFogIntensity = clamp(heightFogIntensity, 0, 1); return ((-heightFogIntensity * 2) + 3) * (heightFogIntensity * heightFogIntensity); } - + inline float GetFogIntensity(float3 distance, float fogStartOffset, float fogScale) { float fogIntensity = max(dot(distance, distance) + - fogStartOffset, 0); @@ -30436,7 +31073,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex #endif //endex - + //ifex _EnableDepthBulge==0 #if defined(POI_DEPTHBULGE) void applyDepthBulgeFX(inout VertexOut o) @@ -30444,15 +31081,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 pos = UnityObjectToClipPos(o.localPos); float4 grabPos = ComputeGrabScreenPos(pos); float depth = SAMPLE_DEPTH_TEXTURE_LOD(_CameraDepthTexture, float4(grabPos.xy / grabPos.w, 0, 0)); - + #if defined(PROP_DEPTHBULGEMASK) || !defined(OPTIMIZER_ENABLED) float depthBulgeMask = tex2Dlod(_DepthBulgeMask, float4(poiUV(vertexUV(o, _DepthBulgeMaskUV), _DepthBulgeMask_ST), 0, 0))[_DepthBulgeMaskChannel]; #else float depthBulgeMask = 1.0; #endif - + depth = Linear01Depth(depth); - + float intersect = 0; if (depth != 1) { @@ -30463,16 +31100,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } float4 offset = intersect * _DepthBulgeHeight * float4(o.normal, 0); - + offset = IsInMirror() ? 0 : offset; offset *= depthBulgeMask; - + o.worldPos.xyz += offset.xyz; o.localPos.xyz += mul(unity_WorldToObject, float4(offset.xyz, 0)).xyz; } #endif //endex - + VertexOut vert( #ifndef POI_TESSELLATED appdata v @@ -30489,7 +31126,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v); #endif UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - + //ifex _EnableUDIMDiscardOptions==0 #ifdef POI_UDIMDISCARD UNITY_BRANCH @@ -30502,20 +31139,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" udim += (v.uv1.xy * (_UDIMDiscardUV == 1)); udim += (v.uv2.xy * (_UDIMDiscardUV == 2)); udim += (v.uv3.xy * (_UDIMDiscardUV == 3)); - + float isDiscarded = 0; float4 xMask = float4( (udim.x >= 0 && udim.x < 1), (udim.x >= 1 && udim.x < 2), (udim.x >= 2 && udim.x < 3), (udim.x >= 3 && udim.x < 4)); - + isDiscarded += (udim.y >= 0 && udim.y < 1) * dot(float4(_UDIMDiscardRow0_0, _UDIMDiscardRow0_1, _UDIMDiscardRow0_2, _UDIMDiscardRow0_3), xMask); isDiscarded += (udim.y >= 1 && udim.y < 2) * dot(float4(_UDIMDiscardRow1_0, _UDIMDiscardRow1_1, _UDIMDiscardRow1_2, _UDIMDiscardRow1_3), xMask); isDiscarded += (udim.y >= 2 && udim.y < 3) * dot(float4(_UDIMDiscardRow2_0, _UDIMDiscardRow2_1, _UDIMDiscardRow2_2, _UDIMDiscardRow2_3), xMask); isDiscarded += (udim.y >= 3 && udim.y < 4) * dot(float4(_UDIMDiscardRow3_0, _UDIMDiscardRow3_1, _UDIMDiscardRow3_2, _UDIMDiscardRow3_3), xMask); - + isDiscarded *= any(float4(udim.y >= 0, udim.y < 4, udim.x >= 0, udim.x < 4)); // never discard outside 4x4 grid in pos coords - + // Use a threshold so that there's some room for animations to be close to 0, but not exactly 0 const float threshold = 0.001; if(isDiscarded > threshold) // Early Return skips rest of vertex shader @@ -30525,7 +31162,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _VertexManipulationsEnabled==0 #ifdef AUTO_EXPOSURE float4 audioLinkBands = 0; @@ -30544,7 +31181,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" audioLinkBands.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r; audioLinkBands.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r; audioLinkBands.w = AudioLinkData(ALPASS_AUDIOTREBLE).r; - + if (any(_VertexLocalTranslationALMin) || any(_VertexLocalTranslationALMax)) { ALLocalTranslation = lerp(_VertexLocalTranslationALMin, _VertexLocalTranslationALMax, audioLinkBands[_VertexLocalTranslationALBand]); @@ -30581,37 +31218,37 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } #endif - + // Local Transformation float4 rotation = float4(_VertexManipulationLocalRotation.xyz + float3(180, 0, 0) + _VertexManipulationLocalRotationSpeed * _Time.x + ALrotation + CTALRotation, _VertexManipulationLocalRotation.w); v.normal = rotate_with_quaternion(v.normal, rotation.xyz); v.tangent.xyz = rotate_with_quaternion(v.tangent.xyz, rotation.xyz); v.vertex = transform(v.vertex, _VertexManipulationLocalTranslation + float4(ALLocalTranslation, 0) + ALSpectrumLocalOffset, rotation, _VertexManipulationLocalScale + float4(ALScale, 0)); o.normal = UnityObjectToWorldNormal(v.normal); - + #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED) float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(vertexUV(v, _VertexManipulationHeightMaskUV), _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0))[_VertexManipulationHeightMaskChannel] - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal; #else float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal; #endif - + if (_VertexBarrelMode) { v.vertex.xz = lerp(v.vertex.xz, normalize(v.vertex.xz) * _VertexBarrelWidth + v.vertex.xz * _VertexBarrelHeight, _VertexBarrelAlpha); } - + if (_VertexSphereMode) { v.vertex.xyz = lerp(v.vertex.xyz, normalize(v.vertex.xyz + _VertexSphereCenter.xyz) * _VertexSphereRadius + v.vertex.xyz * _VertexSphereHeight, _VertexSphereAlpha); } - + if (_VertexTornadoMode) { v.vertex.xz = lerp(v.vertex.xz, float3(v.vertex.xz + float2(cos(_Time.y * _VertexTornadoSpeed + v.vertex.y * _VertexTornadoIntensity) * _VertexTornadoRadius, sin(_Time.y * _VertexTornadoSpeed + v.vertex.y * _VertexTornadoIntensity) * _VertexTornadoRadius), v.vertex.y), smoothstep(_VertexTornadoBaseHeight, _VertexTornadoTopHeight, v.vertex.y)); } - + v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz; - + // rounding UNITY_BRANCH if (_VertexRoundingEnabled) @@ -30630,7 +31267,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _EnableDissolve==0 #ifdef DISTORT UNITY_BRANCH @@ -30643,41 +31280,41 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" dissolveUdim += (v.uv1.xy * (_UVTileDissolveUV == 1)); dissolveUdim += (v.uv2.xy * (_UVTileDissolveUV == 2)); dissolveUdim += (v.uv3.xy * (_UVTileDissolveUV == 3)); - + float isDiscardedFromDissolve = 0; float4 xMaskDissolve = float4((dissolveUdim.x >= 0 && dissolveUdim.x < 1), (dissolveUdim.x >= 1 && dissolveUdim.x < 2), (dissolveUdim.x >= 2 && dissolveUdim.x < 3), (dissolveUdim.x >= 3 && dissolveUdim.x < 4)); - + isDiscardedFromDissolve += (dissolveUdim.y >= 0 && dissolveUdim.y < 1) * dot(float4(_UVTileDissolveAlpha_Row0_0, _UVTileDissolveAlpha_Row0_1, _UVTileDissolveAlpha_Row0_2, _UVTileDissolveAlpha_Row0_3), xMaskDissolve); isDiscardedFromDissolve += (dissolveUdim.y >= 1 && dissolveUdim.y < 2) * dot(float4(_UVTileDissolveAlpha_Row1_0, _UVTileDissolveAlpha_Row1_1, _UVTileDissolveAlpha_Row1_2, _UVTileDissolveAlpha_Row1_3), xMaskDissolve); isDiscardedFromDissolve += (dissolveUdim.y >= 2 && dissolveUdim.y < 3) * dot(float4(_UVTileDissolveAlpha_Row2_0, _UVTileDissolveAlpha_Row2_1, _UVTileDissolveAlpha_Row2_2, _UVTileDissolveAlpha_Row2_3), xMaskDissolve); isDiscardedFromDissolve += (dissolveUdim.y >= 3 && dissolveUdim.y < 4) * dot(float4(_UVTileDissolveAlpha_Row3_0, _UVTileDissolveAlpha_Row3_1, _UVTileDissolveAlpha_Row3_2, _UVTileDissolveAlpha_Row3_3), xMaskDissolve); - + isDiscardedFromDissolve *= any(float4(dissolveUdim.y >= 0, dissolveUdim.y < 4, dissolveUdim.x >= 0, dissolveUdim.x < 4)); // never discard outside 4x4 grid in pos coords - + // Use a threshold so that there's some room for animations to be close to 1, but not exactly 1 const float threshold = 0.999; if (isDiscardedFromDissolve > threshold) // Early Return skips rest of vertex shader - + { return (VertexOut)POI_NAN; } } #endif //endex - + //ifex _EnableMirrorOptions==0 #ifdef POI_MIRROR float notVisible = 0; - + if (_VisibilityMode == 1) // VRC - + { float mirrorMode = VRCMirrorMode(); float cameraMode = VRCCameraMode(); - + notVisible += (!_VisibilityVRCRegular && ((mirrorMode == 0) && (cameraMode == 0))); notVisible += (!_VisibilityVRCMirrorVR && (mirrorMode == 1)); notVisible += (!_VisibilityVRCMirrorDesktop && (mirrorMode == 2)); @@ -30686,50 +31323,50 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" notVisible += (!_VisibilityVRCCameraScreenshot && (cameraMode == 3)); } else if (_Mirror != 0) // Generic (CVR, etc) - + { notVisible += (_Mirror == 1) ^ IsInMirror(); } - + if (notVisible) // Early Return skips rest of vertex shader - + { return (VertexOut)POI_NAN; } #endif //endex - + o.normal = UnityObjectToWorldNormal(v.normal); o.tangent.xyz = UnityObjectToWorldDir(v.tangent); o.tangent.w = v.tangent.w; o.vertexColor = v.color; - + o.uv[0] = float4(v.uv0.xy, v.uv1.xy); o.uv[1] = float4(v.uv2.xy, v.uv3.xy); - + #if defined(LIGHTMAP_ON) o.lightmapUV.xy = v.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw; #endif #ifdef DYNAMICLIGHTMAP_ON o.lightmapUV.zw = v.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; #endif - + o.localPos = v.vertex; o.worldPos = mul(unity_ObjectToWorld, o.localPos); - + float3 localOffset = float3(0, 0, 0); float3 worldOffset = float3(0, 0, 0); - + //ifex _EnableOutlines!=1 #ifdef POI_PASS_OUTLINE float outlineMask = tex2Dlod(_OutlineMask, float4(poiUV(vertexUV(v, _OutlineMaskUV), _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0))[_OutlineMaskChannel]; - + //UNITY_BRANCH if (_OutlineVertexColorMask > 0) { outlineMask *= lerp(1, v.color[_OutlineVertexColorMask - 1], _OutlineVertexColorMaskStrength); } - + float3 outlineNormal = _OutlineSpace ? o.normal : v.normal; //UNITY_BRANCH if (_OutlineUseVertexColorNormals) @@ -30737,7 +31374,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 outlineTangent; float3 outlineBinormal; if (_OutlineSpace) // 0 Local, 1 World - + { outlineTangent = o.tangent; outlineBinormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w); @@ -30750,7 +31387,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 outlineVectorTS = v.color.rgb * 2.0 - 1.0; outlineNormal = outlineVectorTS.x * outlineTangent + outlineVectorTS.y * outlineBinormal + outlineVectorTS.z * outlineNormal; } - + float offsetMultiplier = 1; float distanceOffset = 1; //UNITY_BRANCH @@ -30758,7 +31395,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { distanceOffset *= lerp(1.0, clamp((distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz)), 0.0f, _OutlinesMaxDistance), _OutlineFixWidth); } - + float lineWidth = _LineWidth; #ifdef POI_AUDIOLINK // Due to PoiMods.audioLink being frag only I'll just @@ -30772,9 +31409,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } #endif - + float3 offset = outlineNormal * (lineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset; - + //UNITY_BRANCH if (_OutlineExpansionMode == 2) { @@ -30787,7 +31424,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { float3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal); offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy))); - + offset *= offsetMultiplier; offset *= distanceOffset; } @@ -30808,10 +31445,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _VertexGlitchingEnabled==0 #if defined(POI_VERTEX_GLITCHING) - + bool canGlitch = true; if (_VertexGlitchMirrorEnable && _VertexGlitchMirror > 0) { @@ -30825,26 +31462,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" forward.y = 0; forward = normalize(forward); float3 glitchDirection = normalize(cross(float3(0, 1, 0), forward)); - + float glitchAmount = 0; - + #if defined(POI_VERTEX_GLITCHING_TEXTURE) // if(_VertexGlitchingUseTexture) // { float uvl = o.worldPos.y * _VertexGlitchDensity + _Time.x * _VertexGlitchMapPanSpeed; float uvr = o.worldPos.y * _VertexGlitchDensity - _Time.x * _VertexGlitchMapPanSpeed; - + float3 glitchTextureL = 1; float3 glitchTextureR = 1; - + #if defined(POI_VERTEX_GLITCHING_TEXTURE) || !defined(OPTIMIZER_ENABLED) glitchTextureL = tex2Dlod(_VertexGlitchMap, float4(uvl, uvl, 0, 0)).rgb; glitchTextureR = tex2Dlod(_VertexGlitchMap, float4(uvr, uvr, 0, 0)).rgb; #endif - + glitchAmount += (glitchTextureL.r - 0.5) * 2; glitchAmount += - (glitchTextureR.r - 0.5) * 2; - + glitchAmount += (glitchTextureL.g - 0.5) * 2; glitchAmount += - (glitchTextureR.b - 0.5) * 2; // } else { @@ -30852,24 +31489,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" glitchAmount += frac(sin(dot(_Time.xy + o.worldPos.y, float2(12.9898, 78.233))) * 43758.5453123) * 2 - 1; // } #endif - + float time = _Time.y * _VertexGlitchFrequency; - + float randomGlitch = (sin(time) + sin(2.2 * time + 5.52) + sin(2.9 * time + 0.93) + sin(4.6 * time + 8.94)) / 4; float3 glitchOffset = 0; - + #ifdef POI_AUDIOLINK if (AudioLinkIsAvailable() && _VertexGlitchingAudioLinkEnabled) { // float4 audioLinkData = AudioLinkData(ALPASS_AUDIOBASS); - + float audioIntensity = AudioLinkData(ALPASS_AUDIOBASS).r * (_VertexGlitchingAudioLinkBand == 0) + AudioLinkData(ALPASS_AUDIOLOWMIDS).r * (_VertexGlitchingAudioLinkBand == 1) + AudioLinkData(ALPASS_AUDIOHIGHMIDS).r * (_VertexGlitchingAudioLinkBand == 2) + AudioLinkData(ALPASS_AUDIOTREBLE).r * (_VertexGlitchingAudioLinkBand == 3) + AudioLinkData(ALPASS_FILTEREDVU_INTENSITY).r * (_VertexGlitchingAudioLinkBand == 4); - + if(_VertexGlitchingAudiolinkOverride) { glitchOffset = glitchAmount * glitchDirection * (_VertexGlitchStrength * .01) * audioIntensity; @@ -30884,22 +31521,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else glitchOffset = glitchAmount * glitchDirection * (_VertexGlitchStrength * .01) * step(_VertexGlitchThreshold, randomGlitch); #endif - + localOffset += glitchOffset; worldOffset += mul(unity_ObjectToWorld, glitchOffset); } #endif //endex - + o.localPos.rgb += localOffset; o.worldPos.rgb += worldOffset; - + //ifex _EnableDepthBulge==0 #if defined(POI_DEPTHBULGE) && (defined(POI_PASS_BASE) || defined(POI_PASS_ADD)) applyDepthBulgeFX(o); #endif //endex - + //ifex _BSSEnabled!=1 #ifdef POIBS_ENABLE //ifex _BSSBloomfog!=1 @@ -30910,9 +31547,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex #endif //endex - + o.pos = UnityObjectToClipPos(o.localPos); - + #ifdef POI_PASS_OUTLINE #if defined(UNITY_REVERSED_Z) //DX @@ -30923,7 +31560,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //o.grabPos = ComputeGrabScreenPos(o.pos); - + #ifndef FORWARD_META_PASS #if !defined(UNITY_PASS_SHADOWCASTER) UNITY_TRANSFER_SHADOW(o, o.uv[0].xy); @@ -30932,9 +31569,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" TRANSFER_SHADOW_CASTER_NOPOS(o, o.pos); #endif #endif - + UNITY_TRANSFER_FOG(o, o.pos); - + if (_RenderingReduceClipDistance) { if (o.pos.w < _ProjectionParams.y * 1.01 && o.pos.w > 0) @@ -30946,14 +31583,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif } } - + #ifdef POI_PASS_META o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST); #endif - + return o; } - + #if defined(_STOCHASTICMODE_DELIOT_HEITZ) #define POI2D_SAMPLER_STOCHASTIC(tex, texSampler, uv, useStochastic) (useStochastic ? DeliotHeitzSampleTexture(tex, sampler##texSampler, uv) : POI2D_SAMPLER(tex, texSampler, uv)) #define POI2D_SAMPLER_PAN_STOCHASTIC(tex, texSampler, uv, pan, useStochastic) (useStochastic ? DeliotHeitzSampleTexture(tex, sampler##texSampler, POI_PAN_UV(uv, pan)) : POI2D_SAMPLER_PAN(tex, texSampler, uv, pan)) @@ -30964,7 +31601,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define POI2D_SAMPLER_PAN_STOCHASTIC(tex, texSampler, uv, pan, useStochastic) (useStochastic ? HextileSampleTexture(tex, sampler##texSampler, POI_PAN_UV(uv, pan), false) : POI2D_SAMPLER_PAN(tex, texSampler, uv, pan)) #define POI2D_SAMPLER_PANGRAD_STOCHASTIC(tex, texSampler, uv, pan, dx, dy, useStochastic) (useStochastic ? HextileSampleTexture(tex, sampler##texSampler, POI_PAN_UV(uv, pan), false, dx, dy) : POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, dx, dy)) #endif - + #ifndef POI2D_SAMPLER_STOCHASTIC #define POI2D_SAMPLER_STOCHASTIC(tex, texSampler, uv, useStochastic) (POI2D_SAMPLER(tex, texSampler, uv)) #endif @@ -30974,17 +31611,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #ifndef POI2D_SAMPLER_PANGRAD_STOCHASTIC #define POI2D_SAMPLER_PANGRAD_STOCHASTIC(tex, texSampler, uv, pan, dx, dy, useStochastic) (POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, dx, dy)) #endif - + // When using, properties won't properly lock at optimize time; needs macro evaluation implemented // #define POI2D_SAMPLER_STOCHASTIC_INLINED(tex, texSampler) (POI2D_SAMPLER_STOCHASTIC(tex, texSampler, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Stochastic)) // #define POI2D_SAMPLER_PAN_STOCHASTIC_INLINED(tex, texSampler) (POI2D_SAMPLER_PAN_STOCHASTIC(tex, texSampler, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Pan, tex##Stochastic)) - + // #define POI2D_MAINTEX_SAMPLER_STOCHASTIC_INLINED(tex) (POI2D_SAMPLER_STOCHASTIC(tex, _MainTex, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Stochastic)) // #define POI2D_MAINTEX_SAMPLER_PAN_STOCHASTIC_INLINED(tex) (POI2D_SAMPLER_PAN_STOCHASTIC(tex, _MainTex, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Pan, tex##Stochastic)) - + // Deliot, Heitz 2019 - Fast, but non-histogram-preserving (ends up looking a bit blurry and lower contrast) // https://eheitzresearch.wordpress.com/738-2/ - + // Classic Magic Numbers fracsin #if !defined(_STOCHASTICMODE_NONE) float2 StochasticHash2D2D (float2 s) @@ -30992,7 +31629,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return frac(sin(glsl_mod(float2(dot(s, float2(127.1,311.7)), dot(s, float2(269.5,183.3))), 3.14159)) * 43758.5453); } #endif - + #if defined(_STOCHASTICMODE_DELIOT_HEITZ) // UV Offsets and blend weights // UVBW[0...2].xy = UV Offsets @@ -31002,46 +31639,46 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // UV transformed into triangular grid space with UV scaled by approximation of 2*sqrt(3) const float2x2 stochasticSkewedGrid = float2x2(1.0, -0.57735027, 0.0, 1.15470054); float2 skewUV = mul(stochasticSkewedGrid, uv * 3.4641 * _StochasticDeliotHeitzDensity); - + // Vertex IDs and barycentric coords float2 vxID = floor(skewUV); float3 bary = float3(frac(skewUV), 0); bary.z = 1.0 - bary.x - bary.y; - + float3x3 pos = float3x3( float3(vxID, bary.z), float3(vxID + float2(0, 1), bary.y), float3(vxID + float2(1, 0), bary.x) ); - + float3x3 neg = float3x3( float3(vxID + float2(1, 1), -bary.z), float3(vxID + float2(1, 0), 1.0 - bary.y), float3(vxID + float2(0, 1), 1.0 - bary.x) ); - + return (bary.z > 0) ? pos : neg; } - + float4 DeliotHeitzSampleTexture(Texture2D tex, SamplerState texSampler, float2 uv, float2 dx, float2 dy) { // UVBW[0...2].xy = UV Offsets // UVBW[0...2].z = Blend Weights float3x3 UVBW = DeliotHeitzStochasticUVBW(uv); - + //blend samples with calculated weights return mul(tex.SampleGrad(texSampler, uv + StochasticHash2D2D(UVBW[0].xy), dx, dy), UVBW[0].z) + mul(tex.SampleGrad(texSampler, uv + StochasticHash2D2D(UVBW[1].xy), dx, dy), UVBW[1].z) + mul(tex.SampleGrad(texSampler, uv + StochasticHash2D2D(UVBW[2].xy), dx, dy), UVBW[2].z) ; } - + float4 DeliotHeitzSampleTexture(Texture2D tex, SamplerState texSampler, float2 uv) { float2 dx = ddx(uv), dy = ddy(uv); return DeliotHeitzSampleTexture(tex, texSampler, uv, dx, dy); } #endif // defined(_STOCHASTICMODE_DELIOT_HEITZ) - + #if defined(_STOCHASTICMODE_HEXTILE) // HexTiling: Slower, but histogram-preserving // SPDX-License-Idenfitier: MIT @@ -31053,22 +31690,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" const float2x2 stochasticInverseSkewedGrid = float2x2(1.0, 0.5, 0.0, 1.0/1.15470054); return mul(stochasticInverseSkewedGrid, vertex) * 0.288675; } - + float2x2 HextileLoadRot2x2(float2 idx, float rotStrength) { float angle = abs(idx.x * idx.y) + abs(idx.x + idx.y) + PI; - + // remap to +/-pi angle = glsl_mod(angle, 2 * PI); if(angle < 0) angle += 2 * PI; if(angle > PI) angle -= 2 * PI; - + angle *= rotStrength; - + float cs = cos(angle), si = sin(angle); return float2x2(cs, -si, si, cs); } - + // UV Offsets and base blend weights // UVBWR[0...2].xy = UV Offsets // UVBWR[0...2].zw = rotation costh/sinth -> reconstruct rotation matrix with float2x2(UVBWR[n].z, -UVBWR[n].w, UVBWR[n].w, UVBWR[n].z) @@ -31079,30 +31716,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // Skew input space into simplex triangle grid (3.4641 ~= 2*sqrt(3)) const float2x2 stochasticSkewedGrid = float2x2(1.0, -0.57735027, 0.0, 1.15470054); float2 skewedCoord = mul(stochasticSkewedGrid, uv * 3.4641 * _StochasticHexGridDensity); - + float2 baseId = float2(floor(skewedCoord)); float3 temp = float3(frac(skewedCoord), 0); temp.z = 1 - temp.x - temp.y; - + float s = step(0.0, -temp.z); float s2 = 2 * s - 1; - + float3 weights = float3(-temp.z * s2, s - temp.y * s2, s - temp.x * s2); - + float2 vertex0 = baseId + float2(s, s); float2 vertex1 = baseId + float2(s, 1 - s); float2 vertex2 = baseId + float2(1 - s, s); - + float2 cen0 = HextileMakeCenUV(vertex0), cen1 = HextileMakeCenUV(vertex1), cen2 = HextileMakeCenUV(vertex2); float2x2 rot0 = float2x2(1, 0, 0, 1), rot1 = float2x2(1, 0, 0, 1), rot2 = float2x2(1, 0, 0, 1); - + if(_StochasticHexRotationStrength > 0) { rot0 = HextileLoadRot2x2(vertex0, _StochasticHexRotationStrength); rot1 = HextileLoadRot2x2(vertex1, _StochasticHexRotationStrength); rot2 = HextileLoadRot2x2(vertex2, _StochasticHexRotationStrength); } - + return float4x4( float4(mul(uv - cen0, rot0) + cen0 + StochasticHash2D2D(vertex0), rot0[0].x, -rot0[0].y), float4(mul(uv - cen1, rot1) + cen1 + StochasticHash2D2D(vertex1), rot1[0].x, -rot1[0].y), @@ -31110,68 +31747,68 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4(weights, 0) ); } - + float4 HextileSampleTexture(Texture2D tex, SamplerState texSampler, float2 uv, bool isNormalMap, float2 dUVdx, float2 dUVdy) { // For some reason doing this instead of just calculating it directly prevents it from \ // breaking after a certain number of textures use it. I don't understand why yet float4x4 UVBWR = HextileUVBWR(uv); - + // 2D Rotation Matrices for dUVdx/dy // Not sure if this constant folds during compiling when rot is locked at 0, so force it float2x2 rot0 = float2x2(1, 0, 0, 1), rot1 = float2x2(1, 0, 0, 1), rot2 = float2x2(1, 0, 0, 1); - + if(_StochasticHexRotationStrength > 0) { rot0 = float2x2(UVBWR[0].z, -UVBWR[0].w, UVBWR[0].w, UVBWR[0].z); rot1 = float2x2(UVBWR[1].z, -UVBWR[1].w, UVBWR[1].w, UVBWR[1].z); rot2 = float2x2(UVBWR[2].z, -UVBWR[2].w, UVBWR[2].w, UVBWR[2].z); } - + // Weights float3 W = UVBWR[3].xyz; - + // Sample texture // float3x4 c = float3x4( // tex.SampleGrad(texSampler, UVBWR[0].xy, mul(dUVdx, rot0), mul(dUVdy, rot0)), // tex.SampleGrad(texSampler, UVBWR[1].xy, mul(dUVdx, rot1), mul(dUVdy, rot1)), // tex.SampleGrad(texSampler, UVBWR[2].xy, mul(dUVdx, rot2), mul(dUVdy, rot2)) // ); - + float4 c0 = tex.SampleGrad(texSampler, UVBWR[0].xy, mul(dUVdx, rot0), mul(dUVdy, rot0)); float4 c1 = tex.SampleGrad(texSampler, UVBWR[1].xy, mul(dUVdx, rot1), mul(dUVdy, rot1)); float4 c2 = tex.SampleGrad(texSampler, UVBWR[2].xy, mul(dUVdx, rot2), mul(dUVdy, rot2)); - + // Blend samples using luminance // This is technically incorrect for normal maps, but produces very similar // results to blending using normal map gradients (steepness) const float3 Lw = float3(0.299, 0.587, 0.114); float3 Dw = float3(dot(c0.xyz, Lw), dot(c1.xyz, Lw), dot(c2.xyz, Lw)); - + Dw = lerp(1.0, Dw, _StochasticHexFallOffContrast); W = Dw * pow(W, _StochasticHexFallOffPower); // In the original hextiling there's a Gain3 step here, but it seems to slow things down \ // and cause the UVs to break, so I've omitted it. Looks fine without - + W /= (W.x + W.y + W.z); return W.x * c0 + W.y * c1 + W.z * c2; } - + float4 HextileSampleTexture(Texture2D tex, SamplerState texSampler, float2 uv, bool isNormalMap) { return HextileSampleTexture(tex, texSampler, uv, isNormalMap, ddx(uv), ddy(uv)); } #endif // defined(_STOCHASTICMODE_HEXTILE) - + void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods) { poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod); - + if (_AlphaGlobalMask > 0) { poiFragData.alpha = maskBlend(poiFragData.alpha, poiMods.globalMask[_AlphaGlobalMask - 1], _AlphaGlobalMaskBlendType); } - + //ifex _AlphaDistanceFade==0 && isNotAnimated(_AlphaDistanceFade) if (_AlphaDistanceFade) { @@ -31184,7 +31821,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.alpha *= distanceFadeMultiplier; } //endex - + //ifex _AlphaFresnel==0 && isNotAnimated(_AlphaFresnel) if (_AlphaFresnel) { @@ -31198,7 +31835,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.alpha *= holoRim; } //endex - + //ifex _AlphaAngular==0 && isNotAnimated(_AlphaAngular) if (_AlphaAngular) { @@ -31231,7 +31868,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.alpha *= angularAlphaMod; } //endex - + //ifex _AlphaAudioLinkEnabled==0 && isNotAnimated(_AlphaAudioLinkEnabled) #ifdef POI_AUDIOLINK if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled) @@ -31240,9 +31877,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + } - + //ifex _AlphaDithering==0 && isNotAnimated(_AlphaDithering) inline half Dither8x8Bayer(int x, int y) { @@ -31260,12 +31897,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int r = y * 8 + x; return dither[r]; } - + half calcDither(half2 grabPos) { return Dither8x8Bayer(glsl_mod(grabPos.x, 8), glsl_mod(grabPos.y, 8)); } - + void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam) { if (_AlphaDithering) @@ -31275,7 +31912,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } //endex - + //ifex _AlphaToCoverage==0 && isNotAnimated(_AlphaToCoverage) void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh) { @@ -31295,24 +31932,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } //endex - + void calculateGlobalThemes(inout PoiMods poiMods) { // Theme colors are defined as HDR; convert to SDR and do the HSV adjustment, then re-apply exposure float4 themeColorExposures = 0; float4 themeColor0, themeColor1, themeColor2, themeColor3 = 0; - + DecomposeHDRColor(_GlobalThemeColor0.rgb, themeColor0.rgb, themeColorExposures.x); DecomposeHDRColor(_GlobalThemeColor1.rgb, themeColor1.rgb, themeColorExposures.y); DecomposeHDRColor(_GlobalThemeColor2.rgb, themeColor2.rgb, themeColorExposures.z); DecomposeHDRColor(_GlobalThemeColor3.rgb, themeColor3.rgb, themeColorExposures.w); - + poiMods.globalColorTheme[0] = float4(ApplyHDRExposure(ModifyViaHSV(themeColor0.rgb, frac(_GlobalThemeHue0 + _GlobalThemeHueSpeed0 * _Time.x), _GlobalThemeSaturation0, _GlobalThemeValue0), themeColorExposures.x), _GlobalThemeColor0.a); poiMods.globalColorTheme[1] = float4(ApplyHDRExposure(ModifyViaHSV(themeColor1.rgb, frac(_GlobalThemeHue1 + _GlobalThemeHueSpeed1 * _Time.x), _GlobalThemeSaturation1, _GlobalThemeValue1), themeColorExposures.y), _GlobalThemeColor1.a); poiMods.globalColorTheme[2] = float4(ApplyHDRExposure(ModifyViaHSV(themeColor2.rgb, frac(_GlobalThemeHue2 + _GlobalThemeHueSpeed2 * _Time.x), _GlobalThemeSaturation2, _GlobalThemeValue2), themeColorExposures.z), _GlobalThemeColor2.a); poiMods.globalColorTheme[3] = float4(ApplyHDRExposure(ModifyViaHSV(themeColor3.rgb, frac(_GlobalThemeHue3 + _GlobalThemeHueSpeed3 * _Time.x), _GlobalThemeSaturation3, _GlobalThemeValue3), themeColorExposures.w), _GlobalThemeColor3.a); } - + //ifex _GlobalMaskTexturesEnable==0 #ifdef POI_GLOBALMASK_TEXTURES void ApplyGlobalMaskTextures(in PoiMesh poiMesh, inout PoiMods poiMods) @@ -31334,7 +31971,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[3] = gmcol0[3]; } #endif - + #if defined(PROP_GLOBALMASKTEXTURE1) || !defined(OPTIMIZER_ENABLED) float4 gmcol1 = POI2D_SAMPLER_PAN(_GlobalMaskTexture1, _MainTex, poiUV(poiMesh.uv[_GlobalMaskTexture1UV], _GlobalMaskTexture1_ST), _GlobalMaskTexture1Pan); if (_GlobalMaskTexture1Split) @@ -31352,7 +31989,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[7] = gmcol1[3]; } #endif - + #if defined(PROP_GLOBALMASKTEXTURE2) || !defined(OPTIMIZER_ENABLED) float4 gmcol2 = POI2D_SAMPLER_PAN(_GlobalMaskTexture2, _MainTex, poiUV(poiMesh.uv[_GlobalMaskTexture2UV], _GlobalMaskTexture2_ST), _GlobalMaskTexture2Pan); if (_GlobalMaskTexture2Split) @@ -31370,7 +32007,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[11] = gmcol2[3]; } #endif - + #if defined(PROP_GLOBALMASKTEXTURE3) || !defined(OPTIMIZER_ENABLED) float4 gmcol3 = POI2D_SAMPLER_PAN(_GlobalMaskTexture3, _MainTex, poiUV(poiMesh.uv[_GlobalMaskTexture3UV], _GlobalMaskTexture3_ST), _GlobalMaskTexture3Pan); if (_GlobalMaskTexture3Split) @@ -31455,7 +32092,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (_GlobalMaskToggleOn_13) poiMods.globalMask[13] = 1; if (_GlobalMaskToggleOn_14) poiMods.globalMask[14] = 1; if (_GlobalMaskToggleOn_15) poiMods.globalMask[15] = 1; - + poiMods.globalMask[0] *= (1 - _GlobalMaskToggleOff_0); poiMods.globalMask[1] *= (1 - _GlobalMaskToggleOff_1); poiMods.globalMask[2] *= (1 - _GlobalMaskToggleOff_2); @@ -31474,10 +32111,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[15] *= (1 - _GlobalMaskToggleOff_15); } //endex - + } //endex - + float customDistanceBlend(float base, float blend, float blendType) { switch(blendType) @@ -31487,7 +32124,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" default: return 0; break; } } - + void handleGlobalMaskDistance(int index, bool enable, bool type, float minAlpha, float maxAlpha, float min, float max, int blendType, in PoiMesh poiMesh, inout PoiMods poiMods) { if (enable) @@ -31497,7 +32134,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[index] = saturate(customDistanceBlend(poiMods.globalMask[index], val, blendType)); } } - + void ApplyGlobalMaskModifiers(in PoiMesh poiMesh, inout PoiMods poiMods, in PoiCam poiCam) { //ifex _GlobalMaskModifiersBackfaceEnable==0 @@ -31523,7 +32160,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[15] *= _GlobalMaskBackface_15 == 0 ? 1 : (facingMode == (_GlobalMaskBackface_15)); } //endex - + //ifex _GlobalMaskModifiersMirrorEnable==0 if (_GlobalMaskModifiersMirrorEnable) { @@ -31532,7 +32169,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" mirrorMode = VRCMirrorMode() > 0; else // Generic (CVR, etc) mirrorMode = IsInMirror(); - + mirrorMode += 1; // _GlobalMaskMirror is 0 for ignore, 1 for outside mirror only, 2 for in mirror only poiMods.globalMask[0] *= _GlobalMaskMirror_0 == 0 ? 1 : (mirrorMode == (_GlobalMaskMirror_0)); @@ -31553,7 +32190,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[15] *= _GlobalMaskMirror_15 == 0 ? 1 : (mirrorMode == (_GlobalMaskMirror_15)); } //endex - + //ifex _GlobalMaskModifiersCameraEnable==0 if (_GlobalMaskModifiersCameraEnable) { @@ -31629,12 +32266,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _GlobalMaskDistanceEnable_15==0 handleGlobalMaskDistance(15, _GlobalMaskDistanceEnable_15, _GlobalMaskDistanceType_15, _GlobalMaskDistanceMinAlpha_15, _GlobalMaskDistanceMaxAlpha_15, _GlobalMaskDistanceMin_15, _GlobalMaskDistanceMax_15, _GlobalMaskDistanceBlendType_15, poiMesh, poiMods); //endex - + } //endex - + } - + //ifex _GlobalMaskVertexColorRed==0 && _GlobalMaskVertexColorGreen==0 && _GlobalMaskVertexColorBlue==0 && _GlobalMaskVertexColorAlpha==0 void ApplyGlobalMaskVertexColors(in PoiMesh poiMesh, inout PoiMods poiMods) { @@ -31661,7 +32298,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } //endex - + //ifex _EnableUDIMDiscardOptions==0 #ifdef POI_UDIMDISCARD void applyUDIMDiscard(in VertexOut i) @@ -31669,29 +32306,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if(_UDIMDiscardMode == 1) // Don't run if in vertex mode { float2 udim = floor(vertexUV(i, _UDIMDiscardUV)); - + float isDiscarded = 0; float4 xMask = float4( (udim.x >= 0 && udim.x < 1), (udim.x >= 1 && udim.x < 2), (udim.x >= 2 && udim.x < 3), (udim.x >= 3 && udim.x < 4)); - + isDiscarded += (udim.y >= 0 && udim.y < 1) * dot(float4(_UDIMDiscardRow0_0, _UDIMDiscardRow0_1, _UDIMDiscardRow0_2, _UDIMDiscardRow0_3), xMask); isDiscarded += (udim.y >= 1 && udim.y < 2) * dot(float4(_UDIMDiscardRow1_0, _UDIMDiscardRow1_1, _UDIMDiscardRow1_2, _UDIMDiscardRow1_3), xMask); isDiscarded += (udim.y >= 2 && udim.y < 3) * dot(float4(_UDIMDiscardRow2_0, _UDIMDiscardRow2_1, _UDIMDiscardRow2_2, _UDIMDiscardRow2_3), xMask); isDiscarded += (udim.y >= 3 && udim.y < 4) * dot(float4(_UDIMDiscardRow3_0, _UDIMDiscardRow3_1, _UDIMDiscardRow3_2, _UDIMDiscardRow3_3), xMask); - + isDiscarded *= any(float4(udim.y >= 0, udim.y < 4, udim.x >= 0, udim.x < 4)); // never discard outside 4x4 grid in pos coords - + const float threshold = 0.001; clip(threshold - isDiscarded); // Clip if discarded } - + return; } #endif //endex - + float2 calculatePolarCoordinate(in PoiMesh poiMesh) { float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter; @@ -31701,10 +32338,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float phi_frac = frac(phi); angle = fwidth(phi) - 0.0001 < fwidth(phi_frac) ? phi : phi_frac; angle *= _PolarLengthScale; - + return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower); } - + float2 MonoPanoProjection(float3 coords) { float3 normalizedCoords = normalize(coords); @@ -31718,7 +32355,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" sphereCoords = float2(1.0, 1.0) - sphereCoords; return (sphereCoords + float4(0, 1 - unity_StereoEyeIndex, 1, 1.0).xy) * float4(0, 1 - unity_StereoEyeIndex, 1, 1.0).zw; } - + float2 StereoPanoProjection(float3 coords) { float3 normalizedCoords = normalize(coords); @@ -31732,12 +32369,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" sphereCoords = float2(0.5, 1.0) - sphereCoords; return (sphereCoords + float4(0, 1 - unity_StereoEyeIndex, 1, 0.5).xy) * float4(0, 1 - unity_StereoEyeIndex, 1, 0.5).zw; } - + float2 calculateWorldUV(in PoiMesh poiMesh) { return float2(_UVModWorldPos0 != 3 ? poiMesh.worldPos[ _UVModWorldPos0] : 0.0f, _UVModWorldPos1 != 3 ? poiMesh.worldPos[_UVModWorldPos1] : 0.0f); } - + float2 calculatelocalUV(in PoiMesh poiMesh) { float localUVs[8]; @@ -31749,10 +32386,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" localUVs[5] = poiMesh.vertexColor.g; localUVs[6] = poiMesh.vertexColor.b; localUVs[7] = poiMesh.vertexColor.a; - + return float2(localUVs[_UVModLocalPos0],localUVs[_UVModLocalPos1]); } - + float2 calculatePanosphereUV(in PoiMesh poiMesh) { float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1; @@ -31767,22 +32404,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float4 flowVector = -1; #endif - + #if defined(PROP_DISTORTIONFLOWTEXTURE1) || !defined(OPTIMIZER_ENABLED) float4 flowVector1 = POI2D_SAMPLER_PAN(_DistortionFlowTexture1, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTexture1UV], _DistortionFlowTexture1_ST), _DistortionFlowTexture1Pan) * 2 - 1; #else float4 flowVector1 = -1; #endif - + #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED) half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan)[_DistortionMaskChannel]; #else half distortionMask = 1; #endif - + half distortionStrength = _DistortionStrength; half distortionStrength1 = _DistortionStrength1; - + #ifdef POI_AUDIOLINK UNITY_BRANCH if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle) @@ -31791,14 +32428,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" distortionStrength1 += lerp(_DistortionStrength1AudioLink.x, _DistortionStrength1AudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrength1AudioLinkBand))).r); } #endif - + flowVector *= distortionStrength; flowVector1 *= distortionStrength1; return poiMesh.uv[_DistortionUvToDistort] + ((flowVector.xy + flowVector1.xy) / 2) * distortionMask; } #endif //endex - + //ifex _PoiParallax==0 #ifdef POI_PARALLAX inline float2 POM(in PoiLight poiLight, sampler2D heightMap, in PoiMesh poiMesh, float3 worldViewDir, float3 viewDirTan, int minSamples, int maxSamples, float parallax, float refPlane, float2 tilling, float2 curv) @@ -31812,7 +32449,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float heightMask = 1; #endif - + float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST); float2 dx = ddx(uvs); float2 dy = ddy(uvs); @@ -31886,7 +32523,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #ifdef UNITY_PASS_SHADOWCASTER } #endif - + return uvs + finalTexOffset; } /* @@ -31899,7 +32536,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 uvDelta = tangentViewDir.xy * (stepSize * strength); float prevStepHeight = stepHeight; float prevSurfaceHeight = surfaceHeight; - + [unroll(20)] for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++) { @@ -31910,13 +32547,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" stepHeight -= stepSize; surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset; } - + [unroll(3)] for (int k = 0; k < 3; k++) { uvDelta *= 0.5; stepSize *= 0.5; - + if (stepHeight < surfaceHeight) { uvOffset += uvDelta; @@ -31957,7 +32594,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (_ParallaxUV == 7) poiMesh.uv[7] += offset; #endif */ - + #if defined(OPTIMIZER_ENABLED) poiMesh.uv[_ParallaxUV] = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV)); #else @@ -31974,7 +32611,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _BlackLightMaskingEnabled==0 #ifdef POI_BLACKLIGHTMASKING void calculateBlackLightMasks(in PoiMesh poiMesh, inout PoiMods poiMods) @@ -31992,7 +32629,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" applyToGlobalMask(poiMods, _BlackLightMasking0GlobalMaskIndex - 1, _BlackLightMasking0GlobalMaskBlendType, smoothstep(_BlackLightMasking0Range.y, _BlackLightMasking0Range.x, distance(poiMesh.worldPos, lightPos))); } } - + if (_BlackLightMasking1GlobalMaskIndex > 0) { if (unity_LightColor[lightIndex].a == _BlackLightMasking1Key) @@ -32000,7 +32637,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" applyToGlobalMask(poiMods, _BlackLightMasking1GlobalMaskIndex - 1, _BlackLightMasking1GlobalMaskBlendType, smoothstep(_BlackLightMasking1Range.y, _BlackLightMasking1Range.x, distance(poiMesh.worldPos, lightPos))); } } - + if (_BlackLightMasking2GlobalMaskIndex > 0) { if (unity_LightColor[lightIndex].a == _BlackLightMasking2Key) @@ -32008,7 +32645,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" applyToGlobalMask(poiMods, _BlackLightMasking2GlobalMaskIndex - 1, _BlackLightMasking2GlobalMaskBlendType, smoothstep(_BlackLightMasking0Range.y, _BlackLightMasking0Range.x, distance(poiMesh.worldPos, lightPos))); } } - + if (_BlackLightMasking3GlobalMaskIndex > 0) { if (unity_LightColor[lightIndex].a == _BlackLightMasking3Key) @@ -32023,17 +32660,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { applyToGlobalMask(poiMods, _BlackLightMasking0GlobalMaskIndex - 1, _BlackLightMasking0GlobalMaskBlendType, 0); } - + if (_BlackLightMasking1GlobalMaskIndex > 0) { applyToGlobalMask(poiMods, _BlackLightMasking1GlobalMaskIndex - 1, _BlackLightMasking1GlobalMaskBlendType, 0); } - + if (_BlackLightMasking2GlobalMaskIndex > 0) { applyToGlobalMask(poiMods, _BlackLightMasking2GlobalMaskIndex - 1, _BlackLightMasking2GlobalMaskBlendType, 0); } - + if (_BlackLightMasking3GlobalMaskIndex > 0) { applyToGlobalMask(poiMods, _BlackLightMasking3GlobalMaskIndex - 1, _BlackLightMasking3GlobalMaskBlendType, 0); @@ -32042,7 +32679,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _DetailEnabled==0 #ifdef FINALPASS void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) @@ -32052,10 +32689,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else half3 detailTexture = 0.21763764082 * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex); #endif - + poiFragData.baseColor.rgb *= LerpWhiteTo(detailTexture * _DetailBrightness * unity_ColorSpaceDouble.rgb, poiMods.detailMask.r * _DetailTexIntensity); } - + void ApplyDetailNormal(inout PoiMods poiMods, inout PoiMesh poiMesh) { #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED) @@ -32063,14 +32700,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else poiMods.detailMask = 1; #endif - + #ifdef POI_BACKFACE if (!poiMesh.isFrontFace) { poiMods.detailMask.rg *= _BackFaceDetailIntensity; } #endif - + if (_DetailTexGlobalMask > 0) { poiMods.detailMask.r = maskBlend(poiMods.detailMask.r, poiMods.globalMask[_DetailTexGlobalMask-1], _DetailTexGlobalMaskBlendType); @@ -32079,7 +32716,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { poiMods.detailMask.g = maskBlend(poiMods.detailMask.g, poiMods.globalMask[_DetailNormalGlobalMask-1], _DetailNormalGlobalMaskBlendType); } - + #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED) half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN_STOCHASTIC(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan, _DetailNormalMapStochastic), _DetailNormalMapScale * poiMods.detailMask.g); poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal); @@ -32087,7 +32724,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _MainVertexColoringEnabled==0 void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh) { @@ -32101,7 +32738,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } //endex - + //ifex _BackFaceEnabled!=1 #ifdef POI_BACKFACE void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods) @@ -32113,8 +32750,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #if defined(PROP_BACKFACETEXTURE) || !defined(OPTIMIZER_ENABLED) backFaceColor *= POI2D_SAMPLER_PAN(_BackFaceTexture, _MainTex, poiUV(poiMesh.uv[_BackFaceTextureUV], _BackFaceTexture_ST), _BackFaceTexturePan); #endif - backFaceColor.rgb = hueShift(backFaceColor.rgb, frac(_BackFaceHueShift + _BackFaceHueShiftSpeed * _Time.x) * _BackFaceHueShiftEnabled); - + + if (_BackFaceHueShiftEnabled) + { + backFaceColor.rgb = hueShift(backFaceColor.rgb, frac(_BackFaceHueShift + _BackFaceHueShiftSpeed * _Time.x), _BackFaceShiftColorSpace); + } + float backFaceMask = 1; #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED) backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan)[_BackFaceMaskChannel]; @@ -32123,24 +32764,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { backFaceMask *= backFaceColor.a; } - + poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask); - + UNITY_BRANCH if (_BackFaceReplaceAlpha) { poiFragData.alpha = backFaceColor.a; } - + poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask; poiMods.globalEmission = poiMods.globalEmission * _BackFaceEmissionLimiter; } } #endif //endex - + //ifex _RGBMaskEnabled==0 - + void RGBABlendColor(inout PoiFragData poiFragData, in float mask, in float4 color, float emissionStrength, in float blendType, in float blendAdd, in float enabled) { if (!enabled) return; @@ -32148,7 +32789,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, color.rgb, blendType), alpha); poiFragData.emission += color.rgb * emissionStrength * alpha; } - + void RGBABlendNormals(inout float3 tangentSpaceNormal, float3 normalToBlendWith, float maskValue, int blendMode) { if (blendMode == 0) @@ -32160,7 +32801,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" tangentSpaceNormal = BlendNormals(tangentSpaceNormal, normalToBlendWith); } } - + #ifdef VIGNETTE #if !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE) void calculateRGBNormals(inout PoiMesh poiMesh, inout PoiMods poiMods) @@ -32168,30 +32809,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // Only define this if we actually have any normal map textures. Can't do the same in color textures because users can tint #if defined(PROP_RGBNORMALR) || defined(PROP_RGBNORMALG) || defined(PROP_RGBNORMALB) || defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED) float4 rgbMask = 1; - + #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED) if (_RGBMaskType == 0) { rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _trilinear_repeat, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan); } #endif - + if (_RGBMaskType == 1) { rgbMask = poiMesh.vertexColor; } - + float4 maskFinal = 1; maskFinal.r = rgbMask[_RgbNormalRMaskChannel]; maskFinal.g = rgbMask[_RgbNormalGMaskChannel]; maskFinal.b = rgbMask[_RgbNormalBMaskChannel]; maskFinal.a = rgbMask[_RgbNormalAMaskChannel]; - + if (_RgbNormalRGlobalMaskChannel > 0) maskFinal.r = customBlend(maskFinal.r, poiMods.globalMask[_RgbNormalRGlobalMaskChannel - 1], _RgbNormalRGlobalMaskBlendType); if (_RgbNormalGGlobalMaskChannel > 0) maskFinal.g = customBlend(maskFinal.g, poiMods.globalMask[_RgbNormalGGlobalMaskChannel - 1], _RgbNormalGGlobalMaskBlendType); if (_RgbNormalBGlobalMaskChannel > 0) maskFinal.b = customBlend(maskFinal.b, poiMods.globalMask[_RgbNormalBGlobalMaskChannel - 1], _RgbNormalBGlobalMaskBlendType); if (_RgbNormalAGlobalMaskChannel > 0) maskFinal.a = customBlend(maskFinal.a, poiMods.globalMask[_RgbNormalAGlobalMaskChannel - 1], _RgbNormalAGlobalMaskBlendType); - + #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED) if (_RgbNormalRScale > 0 && _RGBARedEnable) { @@ -32223,7 +32864,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif } #endif - + void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) { float4 rgbMask = float4(1, 1, 1, 1); @@ -32231,19 +32872,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 green = float4(poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), _GreenColor.a); float4 blue = float4(poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), _BlueColor.a); float4 alpha = float4(poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), _AlphaColor.a); - + #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED) if (_RGBMaskType == 0) { rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _trilinear_repeat, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan); } #endif - + if (_RGBMaskType == 1) { rgbMask = poiMesh.vertexColor; } - + #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED) red *= POI2D_SAMPLER_PAN_STOCHASTIC(_RedTexture, _trilinear_repeat, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan.xy, _RedTextureStochastic); #endif @@ -32256,12 +32897,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED) alpha *= POI2D_SAMPLER_PAN_STOCHASTIC(_AlphaTexture, _trilinear_repeat, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan.xy, _AlphaTextureStochastic); #endif - + RGBABlendColor(poiFragData, globalMaskBlend(rgbMask[_RgbRedMaskChannel], _RgbRedGlobalMaskChannel, _RgbRedGlobalMaskBlendType, poiMods), red, _RGBARedEmissionStrength, _RGBARedBlendType, _RedAlphaAdd, _RGBARedEnable); RGBABlendColor(poiFragData, globalMaskBlend(rgbMask[_RgbGreenMaskChannel], _RgbGreenGlobalMaskChannel, _RgbGreenGlobalMaskBlendType, poiMods), green, _RGBAGreenEmissionStrength, _RGBAGreenBlendType, _GreenAlphaAdd, _RGBAGreenEnable); RGBABlendColor(poiFragData, globalMaskBlend(rgbMask[_RgbBlueMaskChannel], _RgbBlueGlobalMaskChannel, _RgbBlueGlobalMaskBlendType, poiMods), blue, _RGBABlueEmissionStrength, _RGBABlueBlendType, _BlueAlphaAdd, _RGBABlueEnable); RGBABlendColor(poiFragData, globalMaskBlend(rgbMask[_RgbAlphaMaskChannel], _RgbAlphaGlobalMaskChannel, _RgbAlphaGlobalMaskBlendType, poiMods), alpha, _RGBAAlphaEmissionStrength, _RGBAAlphaBlendType, _AlphaAlphaAdd, _RGBAAlphaEnable); - + if (_RGBAPBRRedEnabled || _RGBAPBRGreenEnabled || _RGBAPBRBlueEnabled || _RGBAPBRAlphaEnabled) { #if defined(PROP_RGBASMOOTHNESSMAPS) || !defined(OPTIMIZER_ENABLED) @@ -32270,7 +32911,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { smoothnessMaps = POI2D_SAMPLER_PAN_STOCHASTIC(_RGBASmoothnessMaps, _trilinear_repeat, poiUV(poiMesh.uv[_RGBASmoothnessMapsUV], _RGBASmoothnessMaps_ST), _RGBASmoothnessMapsPan.xy, _RGBASmoothnessMapsStochastic); } - + if (_RGBARedPBRSplitMaskSample && _RGBAPBRRedEnabled && _RGBARedEnable) { smoothnessMaps.r = POI2D_SAMPLER_PAN_STOCHASTIC(_RGBASmoothnessMaps, _trilinear_repeat, poiUV(poiMesh.uv[_RGBARedPBRUV], _RGBARedPBRMaskScaleTiling), _RGBARedPBRMasksPan.xy, _RGBARedPBRSplitMaskStochastic).r; @@ -32287,20 +32928,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { smoothnessMaps.a = POI2D_SAMPLER_PAN_STOCHASTIC(_RGBASmoothnessMaps, _trilinear_repeat, poiUV(poiMesh.uv[_RGBAAlphaPBRUV], _RGBAAlphaPBRMaskScaleTiling), _RGBAAlphaPBRMasksPan.xy, _RGBAAlphaPBRSplitMaskStochastic).a; } - + poiFragData.smoothness = lerp(poiFragData.smoothness, poiInvertToggle(smoothnessMaps.r, _RGBARedSmoothnessInvert), rgbMask[_RgbRedMaskChannel] * (_RGBAPBRRedEnabled && _RGBARedEnable)); poiFragData.smoothness = lerp(poiFragData.smoothness, poiInvertToggle(smoothnessMaps.g, _RGBAGreenSmoothnessInvert), rgbMask[_RgbGreenMaskChannel] * (_RGBAPBRGreenEnabled && _RGBAGreenEnable)); poiFragData.smoothness = lerp(poiFragData.smoothness, poiInvertToggle(smoothnessMaps.b, _RGBABlueSmoothnessInvert), rgbMask[_RgbBlueMaskChannel] * (_RGBAPBRBlueEnabled && _RGBABlueEnable)); poiFragData.smoothness = lerp(poiFragData.smoothness, poiInvertToggle(smoothnessMaps.a, _RGBAAlphaSmoothnessInvert), rgbMask[_RgbAlphaMaskChannel] * (_RGBAPBRAlphaEnabled && _RGBAAlphaEnable)); #endif - + #if defined(PROP_RGBAMETALLICMAPS) || !defined(OPTIMIZER_ENABLED) float4 metallicMaps = 1; if (!_RGBARedPBRSplitMaskSample || !_RGBAGreenPBRSplitMaskSample || !_RGBABluePBRSplitMaskSample || !_RGBAAlphaPBRSplitMaskSample) { metallicMaps = POI2D_SAMPLER_PAN_STOCHASTIC(_RGBAMetallicMaps, _trilinear_repeat, poiUV(poiMesh.uv[_RGBAMetallicMapsUV], _RGBAMetallicMaps_ST), _RGBAMetallicMapsPan.xy, _RGBAMetallicMapsStochastic); } - + if (_RGBARedPBRSplitMaskSample && _RGBAPBRRedEnabled && _RGBARedEnable) { metallicMaps.r = POI2D_SAMPLER_PAN_STOCHASTIC(_RGBAMetallicMaps, _trilinear_repeat, poiUV(poiMesh.uv[_RGBARedPBRUV], _RGBARedPBRMaskScaleTiling), _RGBARedPBRMasksPan.xy, _RGBARedPBRSplitMaskStochastic).r; @@ -32317,7 +32958,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { metallicMaps.a = POI2D_SAMPLER_PAN_STOCHASTIC(_RGBAMetallicMaps, _trilinear_repeat, poiUV(poiMesh.uv[_RGBAAlphaPBRUV], _RGBAAlphaPBRMaskScaleTiling), _RGBAAlphaPBRMasksPan.xy, _RGBAAlphaPBRSplitMaskStochastic).a; } - + poiFragData.metallic = lerp(poiFragData.metallic, poiInvertToggle(metallicMaps.r, _RGBARedMetallicInvert), rgbMask[_RgbRedMaskChannel] * (_RGBAPBRRedEnabled && _RGBARedEnable)); poiFragData.metallic = lerp(poiFragData.metallic, poiInvertToggle(metallicMaps.g, _RGBAGreenMetallicInvert), rgbMask[_RgbGreenMaskChannel] * (_RGBAPBRGreenEnabled && _RGBAGreenEnable)); poiFragData.metallic = lerp(poiFragData.metallic, poiInvertToggle(metallicMaps.b, _RGBABlueMetallicInvert), rgbMask[_RgbBlueMaskChannel] * (_RGBAPBRBlueEnabled && _RGBABlueEnable)); @@ -32327,10 +32968,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _ShadingEnabled==0 #ifdef VIGNETTE_MASKED - + #ifdef _LIGHTINGMODE_CLOTH float V_SmithGGXCorrelated(float roughness, float NoV, float NoL) { @@ -32345,16 +32986,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // clamp to the maximum value representable in mediump return v; } - + float D_GGX(float roughness, float NoH) { // Walter et al. 2007, "Microfacet Models for Refraction through Rough Surfaces" - + // In mediump, there are two problems computing 1.0 - NoH^2 // 1) 1.0 - NoH^2 suffers floating point cancellation when NoH^2 is close to 1 (highlights) // 2) NoH doesn't have enough precision around 1.0 // Both problem can be fixed by computing 1-NoH^2 in highp and providing NoH in highp as well - + // However, we can do better using Lagrange's identity: // ||a x b||^2 = ||a||^2 ||b||^2 - (a . b)^2 // since N and H are unit vectors: ||N x H||^2 = 1.0 - NoH^2 @@ -32362,13 +33003,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // enough precision). // Overall this yields better performance, keeping all computations in mediump float oneMinusNoHSquared = 1.0 - NoH * NoH; - + float a = NoH * roughness; float k = roughness / (oneMinusNoHSquared + a * a); float d = k * k * (1.0 / UNITY_PI); return d; } - + // https://github.com/google/filament/blob/main/shaders/src/brdf.fs#L94-L100 float D_Charlie(float roughness, float NoH) { @@ -32378,14 +33019,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float sin2h = max(1.0 - cos2h, 0.0078125); // 0.0078125 = 2^(-14/2), so sin2h^2 > 0 in fp16 return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * UNITY_PI); } - + // https://github.com/google/filament/blob/main/shaders/src/brdf.fs#L136-L139 float V_Neubelt(float NoV, float NoL) { // Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886" return 1.0 / (4.0 * (NoL + NoV - NoL * NoV)); } - + float Distribution(float roughness, float NoH, float cloth) { //ifex _ClothLerp==0 @@ -32396,7 +33037,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH); } - + float Visibility(float roughness, float NoV, float NoL, float cloth) { //ifex _ClothLerp==0 @@ -32407,25 +33048,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL); } - + float F_Schlick(float3 f0, float f90, float VoH) { // Schlick 1994, "An Inexpensive BRDF Model for Physically-Based Rendering" return f0 + (f90 - f0) * pow(1.0 - VoH, 5); } - + float F_Schlick(float3 f0, float VoH) { float f = pow(1.0 - VoH, 5.0); return f + f0 * (1.0 - f); } - + float Fresnel(float3 f0, float LoH) { float f90 = saturate(dot(f0, float(50.0 * 0.33).xxx)); return F_Schlick(f0, f90, LoH); } - + float Fd_Burley(float roughness, float NoV, float NoL, float LoH) { // Burley 2012, "Physically-Based Shading at Disney" @@ -32434,23 +33075,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float viewScatter = F_Schlick(1.0, f90, NoV); return lightScatter * viewScatter; } - + // Energy conserving wrap diffuse term, does *not* include the divide by PI float Fd_Wrap(float NoL, float w) { return saturate((NoL + w) / pow(1.0 + w, 2)); } - + float4 SampleDFG(float NoV, float perceptualRoughness) { return _ClothDFG.Sample(sampler_ClothDFG, float3(NoV, perceptualRoughness, 0)); } - + float3 EnvBRDF(float2 dfg, float3 f0) { return f0 * dfg.x + dfg.y; } - + float3 EnvBRDFMultiscatter(float3 dfg, float3 f0, float cloth) { //ifex _ClothLerp==0 @@ -32461,7 +33102,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z; } - + float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth) { //ifex _ClothLerp==0 @@ -32472,7 +33113,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1; } - + // float ClothMetallic(float cloth) { @@ -32484,21 +33125,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex return cloth <= 0.5 ? 1 : 0; } - + float3 Specular(float roughness, PoiLight poiLight, float f0, float3 normal, float cloth) { float NoL = poiLight.nDotLSaturated; float NoH = poiLight.nDotH; float LoH = poiLight.lDotH; float NoV = poiLight.nDotV; - + float D = Distribution(roughness, NoH, cloth); float V = Visibility(roughness, NoV, NoL, cloth); float3 F = Fresnel(f0, LoH); - + return (D * V) * F; } - + float3 getBoxProjection(float3 direction, float3 position, float4 cubemapPosition, float3 boxMin, float3 boxMax) { #if UNITY_SPECCUBE_BOX_PROJECTION @@ -32509,29 +33150,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" direction = direction * scalar + (position - cubemapPosition.xyz); } #endif - + return direction; } - + float SpecularAO(float NoV, float ao, float roughness) { return clamp(pow(NoV + ao, exp2(-16.0 * roughness - 1.0)) - 1.0 + ao, 0.0, 1.0); } - + float3 IndirectSpecular(float3 dfg, float roughness, float occlusion, float energyCompensation, float cloth, float3 indirectDiffuse, float f0, PoiLight poiLight, PoiFragData poiFragData, PoiCam poiCam, PoiMesh poiMesh) { float3 normal = poiMesh.normals[1]; - + float3 reflDir = reflect(-poiCam.viewDir, normal); - + Unity_GlossyEnvironmentData envData; envData.roughness = roughness; envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin.xyz, unity_SpecCube0_BoxMax.xyz); - + float3 probe0 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE(unity_SpecCube0), unity_SpecCube0_HDR, envData); float3 indirectSpecular = probe0; - + #if UNITY_SPECCUBE_BLENDING UNITY_BRANCH if (unity_SpecCube0_BoxMin.w < 0.99999) @@ -32541,15 +33182,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirectSpecular = lerp(probe1, probe0, unity_SpecCube0_BoxMin.w); } #endif - + float horizon = min(1 + dot(reflDir, normal), 1); indirectSpecular = indirectSpecular * horizon * horizon * energyCompensation * EnvBRDFMultiscatter(dfg, f0, cloth); - + indirectSpecular *= SpecularAO(poiLight.nDotV, occlusion, roughness); return indirectSpecular; }; #endif - + #ifdef _LIGHTINGMODE_WRAPPED // Wrapped // Green’s model with adjustable energy @@ -32558,7 +33199,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float RTWrapFunc(in float dt, in float w, in float norm) { float cw = saturate(w); - + float o = (dt + cw) / ((1.0 + cw) * (1.0 + cw * norm)); float flt = 1.0 - 0.85 * norm; if (w > 1.0) @@ -32567,21 +33208,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return o; } - + float3 GreenWrapSH(float fA) // Greens unoptimized and non-normalized - + { float fAs = saturate(fA); float4 t = float4(fA + 1, fAs - 1, fA - 2, fAs + 1); // DJL edit: allow wrapping to L0-only at w=2 return float3(t.x, -t.z * t.x / 3, 0.25 * t.y * t.y * t.w); } float3 GreenWrapSHOpt(float fW) // optimised and normalized https://blog.selfshadow.com/2012/01/07/righting-wrap-part-2/ - + { const float4 t0 = float4(0.0, 1.0 / 4.0, -1.0 / 3.0, -1.0 / 2.0); const float4 t1 = float4(1.0, 2.0 / 3.0, 1.0 / 4.0, 0.0); float3 fWs = float3(fW, fW, saturate(fW)); // DJL edit: allow wrapping to L0-only at w=2 - + float3 r; r.xyz = t0.xxy * fWs + t0.xzw; r.xyz = r.xyz * fWs + t1.xyz; @@ -32592,33 +33233,33 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 x0, x1, x2; float3 conv = lerp(GreenWrapSH(wrap), GreenWrapSHOpt(wrap), _LightingWrappedNormalization); // Should try optimizing this... conv *= float3(1, 1.5, 4); // Undo pre-applied cosine convolution by using the inverse - + // Constant (L0) x0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w); // Remove pre-applied constant part from L(2,0) to apply correct convolution float3 L2_0 = float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / - 3.0; x0 -= L2_0; - + // Linear (L1) polynomial terms x1.r = dot(unity_SHAr.xyz, normal); x1.g = dot(unity_SHAg.xyz, normal); x1.b = dot(unity_SHAb.xyz, normal); - + // 4 of the quadratic (L2) polynomials float4 vB = normal.xyzz * normal.yzzx; x2.r = dot(unity_SHBr, vB); x2.g = dot(unity_SHBg, vB); x2.b = dot(unity_SHBb, vB); - + // Final (5th) quadratic (L2) polynomial float vC = normal.x * normal.x - normal.y * normal.y; x2 += unity_SHC.rgb * vC; // Move back the constant part of L(2,0) x2 += L2_0; - + return x0 * conv.x + x1 * conv.y + x2 * conv.z; } - + float3 GetSHDirectionL1() { // For efficiency, we only get the direction from L1. @@ -32633,7 +33274,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return ShadeSH9_wrapped(maxDirection, 0); } #endif - + #ifdef _LIGHTINGMODE_SHADEMAP void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight) { @@ -32643,37 +33284,37 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" shadowAttenuation = lerp(1, poiLight.additiveShadow, poiLight.attenuationStrength); //attenuation = poiLight.attenuation; #endif - + float MainColorFeatherStep = _BaseColor_Step - _BaseShade_Feather; float firstColorFeatherStep = _ShadeColor_Step - _1st2nd_Shades_Feather; - + #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED) float4 firstShadeMap = POI2D_SAMPLER_PAN(_1st_ShadeMap, _MainTex, poiUV(poiMesh.uv[_1st_ShadeMapUV], _1st_ShadeMap_ST), _1st_ShadeMapPan); #else float4 firstShadeMap = float4(1, 1, 1, 1); #endif firstShadeMap = lerp(firstShadeMap, float4(poiFragData.baseColor, 1), _Use_BaseAs1st); - + #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED) float4 secondShadeMap = POI2D_SAMPLER_PAN(_2nd_ShadeMap, _MainTex, poiUV(poiMesh.uv[_2nd_ShadeMapUV], _2nd_ShadeMap_ST), _2nd_ShadeMapPan); #else float4 secondShadeMap = float4(1, 1, 1, 1); #endif secondShadeMap = lerp(secondShadeMap, firstShadeMap, _Use_1stAs2nd); - + firstShadeMap.rgb *= _1st_ShadeColor.rgb; //* lighColor secondShadeMap.rgb *= _2nd_ShadeColor.rgb; //* LightColor; - + float shadowMask = 1; shadowMask *= _Use_1stShadeMapAlpha_As_ShadowMask ? (_1stShadeMapMask_Inverse ? (1.0 - firstShadeMap.a) : firstShadeMap.a) : 1; shadowMask *= _Use_2ndShadeMapAlpha_As_ShadowMask ? (_2ndShadeMapMask_Inverse ? (1.0 - secondShadeMap.a) : secondShadeMap.a) : 1; - + float mainShadowMask = saturate(1 - ((poiLight.lightMap) - MainColorFeatherStep) / (_BaseColor_Step - MainColorFeatherStep) * (shadowMask)); float firstSecondShadowMask = saturate(1 - ((poiLight.lightMap) - firstColorFeatherStep) / (_ShadeColor_Step - firstColorFeatherStep) * (shadowMask)); - + mainShadowMask *= poiLight.shadowMask * _ShadowStrength; firstSecondShadowMask *= poiLight.shadowMask * _ShadowStrength; - + // 0 lerp | 1 multiply if (_ShadingShadeMapBlendType == 0) { @@ -32686,7 +33327,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.rampedLightMap = 1 - mainShadowMask; } #endif - + #ifdef _LIGHTINGMODE_REALISTIC // For https://docs.unity3d.com/Manual/LightMode-Mixed-Subtractive.html #if defined(LIGHTMAP_ON) && defined(SHADOWS_SCREEN) @@ -32694,13 +33335,32 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define SUBTRACTIVE_LIGHTING 1 #endif #endif - - void ApplySubtractiveLighting(inout UnityIndirect indirectLight) + + float FadeShadows(float attenuation, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiCam poiCam) + { + #if HANDLE_SHADOWS_BLENDING_IN_GI || ADDITIONAL_MASKED_DIRECTIONAL_SHADOWS + // UNITY_LIGHT_ATTENUATION doesn't fade shadows for us. + + #if ADDITIONAL_MASKED_DIRECTIONAL_SHADOWS + attenuation = poiLight.attenuation; + #endif + + float viewZ = dot(_WorldSpaceCameraPos - poiMesh.worldPos, UNITY_MATRIX_V[2].xyz); + float shadowFadeDistance = UnityComputeShadowFadeDistance(poiMesh.worldPos, viewZ); + float shadowFade = UnityComputeShadowFade(shadowFadeDistance); + float bakedAttenuation = UnitySampleBakedOcclusion(poiMesh.lightmapUV.xy, poiMesh.worldPos); + attenuation = UnityMixRealtimeAndBakedShadows(attenuation, bakedAttenuation, shadowFade); + #endif + + return attenuation; + } + + void ApplySubtractiveLighting(inout UnityIndirect indirectLight, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiCam poiCam) { #if SUBTRACTIVE_LIGHTING - poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier)); - - float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz)); + poiLight.attenuation = FadeShadows(poiLight.attenuation, poiLight, poiMesh, poiCam); + + float ndotl = saturate(dot(poiMesh.normals[0], _WorldSpaceLightPos0.xyz)); float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb; float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate; subtractedLight = max(subtractedLight, unity_ShadowColor.rgb); @@ -32708,45 +33368,37 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirectLight.diffuse = min(subtractedLight, indirectLight.diffuse); #endif } - + UnityIndirect CreateIndirectLight(in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight) { UnityIndirect indirectLight; indirectLight.diffuse = 0; indirectLight.specular = 0; - + #if defined(LIGHTMAP_ON) indirectLight.diffuse = DecodeLightmap(UNITY_SAMPLE_TEX2D(unity_Lightmap, poiMesh.lightmapUV.xy)); - + #if defined(DIRLIGHTMAP_COMBINED) - float4 lightmapDirection = UNITY_SAMPLE_TEX2D_SAMPLER( - unity_LightmapInd, unity_Lightmap, poiMesh.lightmapUV.xy - ); - indirectLight.diffuse = DecodeDirectionalLightmap( - indirectLight.diffuse, lightmapDirection, poiMesh.normals[1] - ); + float4 lightmapDirection = UNITY_SAMPLE_TEX2D_SAMPLER(unity_LightmapInd, unity_Lightmap, poiMesh.lightmapUV.xy); + indirectLight.diffuse = DecodeDirectionalLightmap(indirectLight.diffuse, lightmapDirection, poiMesh.normals[1]); #endif - ApplySubtractiveLighting(indirectLight); + + ApplySubtractiveLighting(indirectLight, poiLight, poiMesh, poiCam); #endif - + #if defined(DYNAMICLIGHTMAP_ON) float3 dynamicLightDiffuse = DecodeRealtimeLightmap( UNITY_SAMPLE_TEX2D(unity_DynamicLightmap, poiMesh.lightmapUV.zw) ); - + #if defined(DIRLIGHTMAP_COMBINED) - float4 dynamicLightmapDirection = UNITY_SAMPLE_TEX2D_SAMPLER( - unity_DynamicDirectionality, unity_DynamicLightmap, - poiMesh.lightmapUV.zw - ); - indirectLight.diffuse += DecodeDirectionalLightmap( - dynamicLightDiffuse, dynamicLightmapDirection, poiMesh.normals[1] - ); + float4 dynamicLightmapDirection = UNITY_SAMPLE_TEX2D_SAMPLER(unity_DynamicDirectionality, unity_DynamicLightmap, poiMesh.lightmapUV.zw); + indirectLight.diffuse += DecodeDirectionalLightmap(dynamicLightDiffuse, dynamicLightmapDirection, poiMesh.normals[1]); #else indirectLight.diffuse += dynamicLightDiffuse; #endif #endif - + #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON) #if UNITY_LIGHT_PROBE_PROXY_VOLUME if (unity_ProbeVolumeParams.x == 1) @@ -32767,24 +33419,45 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1))); #endif #endif - + indirectLight.diffuse *= poiLight.occlusion; - + return indirectLight; } #endif - + float GetRemapMinValue(float scale, float offset) { return clamp(-offset / scale, -0.01f, 1.01f); // Remap min - + } float GetRemapMaxValue(float scale, float offset) { return clamp((1.0f - offset) / scale, -0.01f, 1.01f); // Remap Max - + } - + + half4 POI_BRDF_PBS(half3 diffColor, half3 specColor, half oneMinusReflectivity, half smoothness, float3 normal, float3 viewDir, UnityLight light, UnityIndirect gi) + { + float3 reflDir = reflect(viewDir, normal); + + half nl = saturate(dot(normal, light.dir)); + half nv = saturate(dot(normal, viewDir)); + + // Vectorize Pow4 to save instructions + half2 rlPow4AndFresnelTerm = Pow4(float2(dot(reflDir, light.dir), 1 - nv)); // use R.L instead of N.H to save couple of instructions + half rlPow4 = rlPow4AndFresnelTerm.x; // power exponent must match kHorizontalWarpExp in NHxRoughness() function in GeneratedTextures.cpp + half fresnelTerm = rlPow4AndFresnelTerm.y; + + half grazingTerm = saturate(smoothness + (1 - oneMinusReflectivity)); + + half3 color = BRDF3_Direct(diffColor, specColor, rlPow4, smoothness); + color *= light.color * nl; + color += BRDF3_Indirect(diffColor, specColor, gi, grazingTerm, fresnelTerm); + + return half4(color, 1); + } + void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam) { float shadowAttenuation = lerp(1, poiLight.attenuation, poiLight.attenuationStrength); @@ -32793,7 +33466,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" shadowAttenuation = lerp(1, poiLight.additiveShadow, poiLight.attenuationStrength); //attenuation = poiLight.attenuation; #endif - + #ifdef POI_PASS_ADD if (_LightingAdditiveType == 3) { @@ -32820,11 +33493,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float passthrough = _LightingAdditivePassthrough; #endif - + float2 ToonAddGradient = float2(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd); - + if (ToonAddGradient.x == ToonAddGradient.y) ToonAddGradient.y += 0.0001; - + poiLight.rampedLightMap = smoothstep(ToonAddGradient.y, ToonAddGradient.x, 1 - (.5 * poiLight.nDotL + .5)); #if defined(POINT) || defined(SPOT) poiLight.finalLighting = lerp(poiLight.directColor * max(min(poiLight.additiveShadow, poiLight.detailShadow), passthrough), poiLight.indirectColor, smoothstep(ToonAddGradient.x, ToonAddGradient.y, 1 - (.5 * poiLight.nDotL + .5))); @@ -32834,20 +33507,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return; } #endif - + float shadowStrength = _ShadowStrength * poiLight.shadowMask; - + #ifdef POI_PASS_OUTLINE shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength); #endif - + // These blocks shouldn't need ifex, they should be removed on lock when their keywords aren't present - + #ifdef _LIGHTINGMODE_FLAT poiLight.finalLighting = poiLight.directColor * attenuation * shadowAttenuation; - poiLight.rampedLightMap = poiLight.nDotLSaturated; + if (_ForceFlatRampedLightmap) + { + poiLight.rampedLightMap = smoothstep(0.4, 0.6, poiLight.nDotLNormalized); + } + else + { + poiLight.rampedLightMap = 1; + } #endif - + #ifdef _LIGHTINGMODE_TEXTURERAMP float2 rampUVs = poiLight.lightMap + _ShadowOffset; if (_ToonRampCount > 1) @@ -32857,26 +33537,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D_SAMPLER(_ToonRamp, _linear_clamp, rampUVs).rgb, shadowStrength); poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap) * attenuation; #endif - + #ifdef _LIGHTINGMODE_MULTILAYER_MATH #if defined(PROP_MULTILAYERMATHBLURMAP) || !defined(OPTIMIZER_ENABLED) float4 blurMap = POI2D_SAMPLER_PAN(_MultilayerMathBlurMap, _MainTex, poiUV(poiMesh.uv[_MultilayerMathBlurMapUV], _MultilayerMathBlurMap_ST), _MultilayerMathBlurMapPan); #else float4 blurMap = 1; #endif - + float4 lns = float4(1, 1, 1, 1); - + float shadowAttenuationNoStrength = poiLight.attenuation; #if defined(POINT) || defined(SPOT) shadowAttenuationNoStrength = poiLight.additiveShadow; #endif - + float3 lightMap = poiLight.lightMapNoAttenuation.xxx; lightMap.x *= lerp(1.0, shadowAttenuationNoStrength, _ShadowReceive); lightMap.y *= lerp(1.0, shadowAttenuationNoStrength, _Shadow2ndReceive); lightMap.z *= lerp(1.0, shadowAttenuationNoStrength, _Shadow3rdReceive); - + float4 shadowBorderMask = 1; if (_ShadowBorderMapToggle) { @@ -32884,19 +33564,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 shadowShift0 = float2(_ShadowAOShift.x, _ShadowAOShift.y); float2 shadowShift1 = float2(_ShadowAOShift.z, _ShadowAOShift.w); float2 shadowShift2 = float2(_ShadowAOShift2.x, _ShadowAOShift2.y); - + //float2 shadowShift0 = float2(GetRemapMinValue(_ShadowAOShift.x, _ShadowAOShift.y), GetRemapMaxValue(_ShadowAOShift.x, _ShadowAOShift.y)); //float2 shadowShift1 = float2(GetRemapMinValue(_ShadowAOShift.z, _ShadowAOShift.w), GetRemapMaxValue(_ShadowAOShift.z, _ShadowAOShift.w)); //float2 shadowShift2 = float2(GetRemapMinValue(_ShadowAOShift2.x, _ShadowAOShift2.y), GetRemapMaxValue(_ShadowAOShift2.x, _ShadowAOShift2.y)); - + shadowShift0.y = (shadowShift0.x == shadowShift0.y) ? (shadowShift0.y + 0.001f) : shadowShift0.y; shadowShift1.y = (shadowShift1.x == shadowShift1.y) ? (shadowShift1.y + 0.001f) : shadowShift1.y; shadowShift2.y = (shadowShift2.x == shadowShift2.y) ? (shadowShift2.y + 0.001f) : shadowShift2.y; - + shadowShift0 = float2(1.0f / (shadowShift0.y - shadowShift0.x), shadowShift0.x / (shadowShift0.x - shadowShift0.y)); shadowShift1 = float2(1.0f / (shadowShift1.y - shadowShift1.x), shadowShift1.x / (shadowShift1.x - shadowShift1.y)); shadowShift2 = float2(1.0f / (shadowShift2.y - shadowShift2.x), shadowShift2.x / (shadowShift2.x - shadowShift2.y)); - + #if defined(PROP_SHADOWBORDERMASK) || !defined(OPTIMIZER_ENABLED) float2 shadowBorderMaskUV = poiUV(poiMesh.uv[_ShadowBorderMaskUV], _ShadowBorderMask_ST); if (_ShadowBorderMaskLOD) @@ -32908,14 +33588,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" shadowBorderMask = POI2D_SAMPLER_PAN(_ShadowBorderMask, _linear_repeat, shadowBorderMaskUV, _ShadowBorderMaskPan); } #endif - + shadowBorderMask.r = saturate(shadowBorderMask.r * shadowShift0.x + shadowShift0.y); shadowBorderMask.g = saturate(shadowBorderMask.g * shadowShift1.x + shadowShift1.y); shadowBorderMask.b = saturate(shadowBorderMask.b * shadowShift2.x + shadowShift2.y); - + lightMap.xyz = _ShadowPostAO ? lightMap.xyz : lightMap.xyz * shadowBorderMask.rgb; } - + if (_LightingMulitlayerNonLinear) { lns.x = poiEdgeNonLinearNoSaturate(lightMap.x, _ShadowBorder, _ShadowBlur * blurMap.r); @@ -32937,7 +33617,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //poiLight.finalLighting = lns.rgb; //return; float3 indirectColor = 1; - + if (_ShadowColor.a > 0) { #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED) @@ -32969,7 +33649,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a; indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z); } - + indirectColor = lerp(indirectColor, indirectColor * poiFragData.baseColor, _ShadowMainStrength); poiLight.rampedLightMap = lns.x; indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb * _ShadowBorderColor.a); @@ -32977,11 +33657,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirectColor = lerp(poiLight.directColor, indirectColor, shadowStrength * poiLight.shadowMask); poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x) * attenuation; #endif - + #ifdef _LIGHTINGMODE_SHADEMAP poiLight.finalLighting = poiLight.directColor * attenuation; #endif - + #ifdef _LIGHTINGMODE_REALISTIC UnityLight light; light.dir = poiLight.direction; @@ -32997,11 +33677,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirectLight.diffuse = max(indirectLight.diffuse * _PPLightingMultiplier, 0); indirectLight.diffuse = max(indirectLight.diffuse + _PPLightingAddition, 0); #endif - + poiLight.rampedLightMap = poiLight.nDotLSaturated; - poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, indirectLight).xyz, _LightingMinLightBrightness); + poiLight.finalLighting = max(POI_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, indirectLight).xyz, _LightingMinLightBrightness); #endif - + #ifdef _LIGHTINGMODE_CLOTH #if defined(PROP_CLOTHMETALLICSMOOTHNESSMAP) || !defined(OPTIMIZER_ENABLED) float4 clothmapsample = POI2D_SAMPLER_PAN(_ClothMetallicSmoothnessMap, _MainTex, poiUV(poiMesh.uv[_ClothMetallicSmoothnessMapUV], _ClothMetallicSmoothnessMap_ST), _ClothMetallicSmoothnessMapPan); @@ -33016,22 +33696,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float reflectance = _ClothReflectance; float clothmask = 1; #endif - + float perceptualRoughness = pow(roughness, 2); float clampedRoughness = max(0.002, perceptualRoughness); - + float f0 = 0.16 * reflectance * reflectance * (1 - metallic) + poiFragData.baseColor * metallic; float3 fresnel = Fresnel(f0, poiLight.nDotV); - + float3 dfg = SampleDFG(poiLight.nDotV, perceptualRoughness); - + float energyCompensation = EnvBRDFEnergyCompensation(dfg, f0, clothmask); - + poiLight.finalLighting = Fd_Burley(perceptualRoughness, poiLight.nDotV, poiLight.nDotLSaturated, poiLight.lDotH); - poiLight.finalLighting *= _LightColor0 * attenuation * shadowAttenuation * poiLight.nDotLSaturated; + poiLight.finalLighting *= poiLight.directColor * attenuation * shadowAttenuation * poiLight.nDotLSaturated; poiLight.rampedLightMap = poiLight.nDotLSaturated; + float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F - + #ifdef UNITY_PASS_FORWARDBASE float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w); float3 indirectDiffuse; @@ -33039,15 +33720,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirectDiffuse.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, poiMesh.normals[1]); indirectDiffuse.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, poiMesh.normals[1]); indirectDiffuse = max(0, indirectDiffuse); - + indirectDiffuse = lerp(indirectDiffuse, dot(indirectDiffuse, float3(0.299, 0.587, 0.114)), _LightingMonochromatic); + float3 indirectSpecular = IndirectSpecular(dfg, roughness, poiLight.occlusion, energyCompensation, clothmask, indirectDiffuse, f0, poiLight, poiFragData, poiCam, poiMesh); poiLight.finalLightAdd += max(0, specular + indirectSpecular); poiLight.finalLighting += indirectDiffuse * poiLight.occlusion; + #endif - + poiFragData.baseColor.xyz *= (1 - metallic); #endif - + #ifdef _LIGHTINGMODE_WRAPPED #define GREYSCALE_VECTOR float3(.33333, .33333, .33333) float3 directColor = _LightColor0.rgb * saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)); @@ -33057,19 +33740,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif directColor = lerp(directColor, dot(directColor, float3(0.299, 0.587, 0.114)), _LightingMonochromatic); // Duplicated from Lightdata due to recreating the light colour indirectColor = lerp(indirectColor, dot(indirectColor, float3(0.299, 0.587, 0.114)), _LightingMonochromatic); // Ditto^ - + float3 ShadeSH9Plus_2 = GetSHMaxL1(); float bw_topDirectLighting_2 = dot(_LightColor0.rgb, GREYSCALE_VECTOR); float bw_directLighting = dot(directColor, GREYSCALE_VECTOR); float bw_indirectLighting = dot(indirectColor, GREYSCALE_VECTOR); float bw_topIndirectLighting = dot(ShadeSH9Plus_2, GREYSCALE_VECTOR); - + poiLight.lightMap = smoothstep(0, bw_topIndirectLighting + bw_topDirectLighting_2, bw_indirectLighting + bw_directLighting) * min(poiLight.detailShadow, shadowAttenuation); poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap))); float3 mathRamp = lerp(float3(1, 1, 1), saturate(lerp((_LightingShadowColor * lerp(indirectColor, 1, _LightingIgnoreAmbientColor)), float3(1, 1, 1), saturate(poiLight.rampedLightMap))), _ShadowStrength); - + directColor *= saturate(poiLight.rampedLightMap + 1 - _ShadowStrength) * _LightingWrappedColor; - + float3 finalWrap = directColor + indirectColor; if (_LightingCapEnabled) { @@ -33082,11 +33765,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //finalWrap *= attenuation; poiLight.finalLighting = finalWrap * saturate(mathRamp + 1 - _ShadowStrength); #endif - + #ifdef _LIGHTINGMODE_SKIN float3 ambientNormalWorld = poiMesh.normals[1];//aTangentToWorld(s, s.blurredNormalTangent); poiLight.rampedLightMap = poiLight.nDotLSaturated; - + // Scattering mask. #if defined(PROP_SKINTHICKNESS) || !defined(OPTIMIZER_ENABLED) float subsurface = 1 - POI2D_SAMPLER_PAN(_SkinThicknessMap, _MainTex, poiUV(poiMesh.uv[_SkinThicknessMapUV], _SkinThicknessMap_ST), _SkinThicknessMapPan).r; @@ -33102,33 +33785,33 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" subsurface = pow(subsurface, _SkinThicknessPower); } float skinScattering = saturate(subsurface * _SssScale * 2); - + // Skin subsurface depth absorption tint. // cf http://www.crytek.com/download/2014_03_25_CRYENGINE_GDC_Schultz.pdf pg 35 // link dead, https://ia600902.us.archive.org/25/items/crytek_presentations/2014_03_25_CRYENGINE_GDC_Schultz.pdf half3 absorption = exp((1.0h - subsurface) * _SssTransmissionAbsorption.rgb); - + // Albedo scale for absorption assumes ~0.5 luminance for Caucasian skin. absorption *= saturate(poiFragData.baseColor * unity_ColorSpaceDouble.rgb); - + // Blurred normals for indirect diffuse and direct scattering. ambientNormalWorld = normalize(lerp(poiMesh.normals[1], ambientNormalWorld, _SssBumpBlur)); - + float ndlBlur = dot(poiMesh.normals[1], poiLight.direction) * 0.5h + 0.5h; float lumi = dot(poiLight.directColor, half3(0.2126h, 0.7152h, 0.0722h)); float4 sssLookupUv = float4(ndlBlur, skinScattering * lumi, 0.0f, 0.0f); half3 sss = poiLight.lightMap * tex2Dlod(_SkinLUT, sssLookupUv).rgb; poiLight.finalLighting = lerp(poiLight.directColor, min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) * poiLight.occlusion + (sss * poiLight.directColor), poiLight.directColor), _ShadowStrength * poiLight.shadowMask) * attenuation; #endif - + #ifdef _LIGHTINGMODE_SDF float3 forward = normalize(UnityObjectToWorldDir(float4(_SDFForward.xyz, 1))); float3 left = normalize(UnityObjectToWorldDir(float4(_SDFLeft.xyz, 1))); float3 lightDirHorizontal = normalize(float3(poiLight.direction.x, 0, poiLight.direction.z)); - + float lightAtten = 1 - (dot(lightDirHorizontal, forward) * 0.5 + 0.5); float filpU = sign(dot(lightDirHorizontal, left)); - + #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED) float shadowSDF = POI2D_SAMPLER_PAN(_SDFShadingTexture, _MainTex, poiUV(poiMesh.uv[_SDFShadingTextureUV], _SDFShadingTexture_ST) * float2(filpU, 1), _SDFShadingTexturePan).r; #else @@ -33136,14 +33819,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif float blur = _SDFBlur * 0.1; float faceShadow = smoothstep(lightAtten - blur, lightAtten + blur, shadowSDF) * poiLight.detailShadow; - + float3 indirectColor = _LightingShadowColor.rgb; indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor); indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask); - + poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, faceShadow) * attenuation; #endif - + if (poiFragData.toggleVertexLights) { #if defined(VERTEXLIGHT_ON) @@ -33164,7 +33847,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (lightingMode == 0) { vertexLighting = max(vertexLighting, poiLight.vColor[index] * poiLight.vSaturatedDotNL[index] * poiLight.detailShadow); // Realistic - + } //UNITY_BRANCH // Toon @@ -33182,13 +33865,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + #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 PoiMesh poiMesh, in PoiCam poiCam) + 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] + calcParallax(depth + 1, poiCam); + 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 = 1.0 - uv.x; + 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); @@ -33197,17 +33891,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) + inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed, float colorSpace) { //UNITY_BRANCH if (enabled) { - color = hueShift(color, shift + _Time.x * shiftSpeed); + color = hueShift(color, shift + _Time.x * shiftSpeed, colorSpace); } return color; } - + inline float applyTilingClipping(float enabled, float2 uv) { float ret = 1; @@ -33221,7 +33914,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return ret; } - + struct PoiDecal { float m_DecalFaceMask; @@ -33244,7 +33937,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" half m_DecalRotationSpeed; float m_DecalEmissionStrength; float m_DecalBlendAlpha; - float m_DecalOverrideAlpha; + float m_DecalAlphaBlendMode; + float m_DecalHueShiftColorSpace; float m_DecalHueShiftEnabled; float m_DecalHueShift; float m_DecalHueShiftSpeed; @@ -33257,7 +33951,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; @@ -33277,7 +33974,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 m_AudioLinkDecalChannelSeparation; float m_AudioLinkDecalChannelSeparationBand; #endif - + float4 decalColor; float2 decalScale; float decalRotation; @@ -33286,14 +33983,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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 @@ -33307,44 +34004,63 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #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, poiMesh, 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); + decalColor.rgb = decalHueShift(m_DecalHueShiftEnabled, decalColor.rgb, m_DecalHueShift + poiLight.nDotV * m_DecalHueAngleStrength, m_DecalHueShiftSpeed, m_DecalHueShiftColorSpace); 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) + + 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, m_DecalSideOffset +sideMod, m_DecalDepth, poiMesh, poiCam); + 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); + decalColor.rgb = decalHueShift(m_DecalHueShiftEnabled, decalColor.rgb, m_DecalHueShift + poiLight.nDotV * m_DecalHueAngleStrength, m_DecalHueShiftSpeed, m_DecalHueShiftColorSpace); 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); + 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 = 0; + 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, poiMesh, poiCam); - float2 uvSample1 = decalUV(m_DecalTextureUV, m_DecalPosition - positionOffset, m_DecalRotation + decalRotation, m_DecalRotationSpeed, decalScale, m_DecalSideOffset +sideMod, m_DecalDepth, poiMesh, poiCam); - + 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); - sample1.rgb = decalHueShift(m_DecalHueShiftEnabled, sample1.rgb, m_DecalHueShift + poiLight.nDotV * m_DecalHueAngleStrength, m_DecalHueShiftSpeed); - + + sample0.rgb = decalHueShift(m_DecalHueShiftEnabled, sample0.rgb, m_DecalHueShift + poiLight.nDotV * m_DecalHueAngleStrength, m_DecalHueShiftSpeed, m_DecalHueShiftColorSpace); + sample1.rgb = decalHueShift(m_DecalHueShiftEnabled, sample1.rgb, m_DecalHueShift + poiLight.nDotV * m_DecalHueAngleStrength, m_DecalHueShiftSpeed, m_DecalHueShiftColorSpace); + float3 channelSeparationColor = HUEtoRGB(frac(m_DecalChannelSeparationHue)); - + if (m_DecalChannelSeparationPremultiply) { decalColor.rgb = lerp(sample0 * sample0.a, sample1 * sample1.a, channelSeparationColor); @@ -33356,19 +34072,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -33382,49 +34102,112 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } 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) { - alphaOverride += 1; + 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]); + //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 { - decalAlpha = lerp(decalAlpha, 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); } } - - if (m_DecalFaceMask > 0) + + if (m_DecalApplyGlobalMaskIndex > 0) { - if (m_DecalFaceMask == 1 && !poiMesh.isFrontFace) + 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) { - decalColor.a *= 0; + videoDimensions.xy *= float2((decalScale.y / decalScale.x), 1); } - else if (m_DecalFaceMask == 2 && poiMesh.isFrontFace) + else { - decalColor.a *= 0; + videoDimensions.xy *= float2(1, (decalScale.x / decalScale.y)); } } - - float decalAlphaMixed = decalColor.a * saturate(m_DecalBlendAlpha + audioLinkDecalAlpha); - - if (m_DecalApplyGlobalMaskIndex > 0) + + if (CorrectionType != 2) { - applyToGlobalMask(poiMods, m_DecalApplyGlobalMaskIndex - 1, m_DecalApplyGlobalMaskBlendType, decalAlphaMixed); + 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)); + } + } } - - 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); + 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) @@ -33432,7 +34215,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float4 decalMask = 1; #endif - + #ifdef TPS_Penetrator if (_DecalTPSDepthMaskEnabled) { @@ -33442,11 +34225,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; @@ -33473,6 +34256,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Decal0.m_DecalBlendAlpha = _DecalBlendAlpha; Decal0.m_DecalOverrideAlpha = _DecalOverrideAlpha; Decal0.m_DecalHueShiftEnabled = _DecalHueShiftEnabled; + Decal0.m_DecalHueShiftColorSpace = _DecalHueShiftColorSpace; Decal0.m_DecalHueShift = _DecalHueShift; Decal0.m_DecalHueShiftSpeed = _DecalHueShiftSpeed; Decal0.m_DecalDepth = _Decal0Depth; @@ -33484,9 +34268,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; @@ -33505,30 +34291,73 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Decal0.m_AudioLinkDecalSideMax = _AudioLinkDecal0SideMax; Decal0.m_AudioLinkDecalChannelSeparation = _AudioLinkDecal0ChannelSeparation; Decal0.m_AudioLinkDecalChannelSeparationBand = _AudioLinkDecal0ChannelSeparationBand; - + Decal0.InitAudiolink(poiMods); #endif - - #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED) - //ifex _Decal0ChannelSeparationEnable==0 - if (_Decal0ChannelSeparationEnable) + + if (!_Decal0VideoEnabled) { - Decal0.SampleDecalChannelSeparation(_DecalTexture, poiMods, poiLight, poiMesh, poiCam); + + #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); } - //endex - //ifex _Decal0ChannelSeparationEnable==1 - if (!_Decal0ChannelSeparationEnable) + else { - Decal0.SampleDecal(_DecalTexture, poiMods, poiLight, poiMesh, poiCam); + 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); + } } - //endex - #else - Decal0.SampleDecalNoTexture(poiMods, poiLight, poiMesh, poiCam); - #endif - Decal0.Apply(alphaOverride, decalAlpha, poiFragData, poiMesh, poiCam, poiMods, poiLight); #endif //endex - + //ifex _DecalEnabled1==0 #ifdef GEOM_TYPE_BRANCH_DETAIL PoiDecal Decal1; @@ -33555,6 +34384,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Decal1.m_DecalBlendAlpha = _DecalBlendAlpha1; Decal1.m_DecalOverrideAlpha = _DecalOverrideAlpha1; Decal1.m_DecalHueShiftEnabled = _DecalHueShiftEnabled1; + Decal1.m_DecalHueShiftColorSpace = _DecalHueShiftColorSpace1; Decal1.m_DecalHueShift = _DecalHueShift1; Decal1.m_DecalHueShiftSpeed = _DecalHueShiftSpeed1; Decal1.m_DecalDepth = _Decal1Depth; @@ -33566,9 +34396,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; @@ -33587,30 +34419,71 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Decal1.m_AudioLinkDecalSideMax = _AudioLinkDecal1SideMax; Decal1.m_AudioLinkDecalChannelSeparation = _AudioLinkDecal1ChannelSeparation; Decal1.m_AudioLinkDecalChannelSeparationBand = _AudioLinkDecal1ChannelSeparationBand; - + Decal1.InitAudiolink(poiMods); #endif - - #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED) - //ifex _Decal1ChannelSeparationEnable==0 - if (_Decal1ChannelSeparationEnable) + + if (!_Decal1VideoEnabled) { - Decal1.SampleDecalChannelSeparation(_DecalTexture1, poiMods, poiLight, poiMesh, poiCam); + #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); } - //endex - //ifex _Decal1ChannelSeparationEnable==1 - if (!_Decal1ChannelSeparationEnable) + else { - Decal1.SampleDecal(_DecalTexture1, poiMods, poiLight, poiMesh, poiCam); + 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); + } } - //endex - #else - Decal1.SampleDecalNoTexture(poiMods, poiLight, poiMesh, poiCam); - #endif - Decal1.Apply(alphaOverride, decalAlpha, poiFragData, poiMesh, poiCam, poiMods, poiLight); #endif //endex - + //ifex _DecalEnabled2==0 #ifdef GEOM_TYPE_FROND PoiDecal Decal2; @@ -33636,6 +34509,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Decal2.m_DecalEmissionStrength = _DecalEmissionStrength2; Decal2.m_DecalBlendAlpha = _DecalBlendAlpha2; Decal2.m_DecalOverrideAlpha = _DecalOverrideAlpha2; + Decal2.m_DecalHueShiftColorSpace = _DecalHueShiftColorSpace2; Decal2.m_DecalHueShiftEnabled = _DecalHueShiftEnabled2; Decal2.m_DecalHueShift = _DecalHueShift2; Decal2.m_DecalHueShiftSpeed = _DecalHueShiftSpeed2; @@ -33648,9 +34522,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; @@ -33669,30 +34545,70 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Decal2.m_AudioLinkDecalSideMax = _AudioLinkDecal2SideMax; Decal2.m_AudioLinkDecalChannelSeparation = _AudioLinkDecal2ChannelSeparation; Decal2.m_AudioLinkDecalChannelSeparationBand = _AudioLinkDecal2ChannelSeparationBand; - + Decal2.InitAudiolink(poiMods); #endif - - #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED) - //ifex _Decal2ChannelSeparationEnable==0 - if (_Decal2ChannelSeparationEnable) + if (!_Decal2VideoEnabled) { - Decal2.SampleDecalChannelSeparation(_DecalTexture2, poiMods, poiLight, poiMesh, poiCam); + #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); } - //endex - //ifex _Decal2ChannelSeparationEnable==1 - if (!_Decal2ChannelSeparationEnable) + else { - Decal2.SampleDecal(_DecalTexture2, poiMods, poiLight, poiMesh, poiCam); + 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); + } } - //endex - #else - Decal2.SampleDecalNoTexture(poiMods, poiLight, poiMesh, poiCam); - #endif - Decal2.Apply(alphaOverride, decalAlpha, poiFragData, poiMesh, poiCam, poiMods, poiLight); #endif //endex - + //ifex _DecalEnabled3==0 #ifdef DEPTH_OF_FIELD_COC_VIEW PoiDecal Decal3; @@ -33718,6 +34634,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Decal3.m_DecalEmissionStrength = _DecalEmissionStrength3; Decal3.m_DecalBlendAlpha = _DecalBlendAlpha3; Decal3.m_DecalOverrideAlpha = _DecalOverrideAlpha3; + Decal3.m_DecalHueShiftColorSpace = _DecalHueShiftColorSpace3; Decal3.m_DecalHueShiftEnabled = _DecalHueShiftEnabled3; Decal3.m_DecalHueShift = _DecalHueShift3; Decal3.m_DecalHueShiftSpeed = _DecalHueShiftSpeed3; @@ -33730,9 +34647,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; @@ -33751,40 +34670,81 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Decal3.m_AudioLinkDecalSideMax = _AudioLinkDecal3SideMax; Decal3.m_AudioLinkDecalChannelSeparation = _AudioLinkDecal3ChannelSeparation; Decal3.m_AudioLinkDecalChannelSeparationBand = _AudioLinkDecal3ChannelSeparationBand; - + Decal3.InitAudiolink(poiMods); #endif - - #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED) - //ifex _Decal3ChannelSeparationEnable==0 - if (_Decal3ChannelSeparationEnable) + if (!_Decal3VideoEnabled) { - Decal3.SampleDecalChannelSeparation(_DecalTexture3, poiMods, poiLight, poiMesh, poiCam); + #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); } - //endex - //ifex _Decal3ChannelSeparationEnable==1 - if (!_Decal3ChannelSeparationEnable) + else { - Decal3.SampleDecal(_DecalTexture3, poiMods, poiLight, poiMesh, poiCam); + 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); + } } - //endex - #else - Decal3.SampleDecalNoTexture(poiMods, poiLight, poiMesh, poiCam); - #endif - Decal3.Apply(alphaOverride, decalAlpha, poiFragData, poiMesh, poiCam, poiMods, poiLight); #endif //endex - if (alphaOverride) - { - - //poiFragData.baseColor = decalAlpha; - poiFragData.alpha *= decalAlpha; - } + //if (alphaOverride) + //{ + + //poiFragData.baseColor = decalAlpha; + //poiFragData.alpha *= decalAlpha; + + //} //poiFragData.baseColor = saturate(poiFragData.baseColor); - + } #endif - + //ifex _EnableDissolve==0 #ifdef DISTORT void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods, in PoiCam poiCam, in PoiLight poiLight) @@ -33804,19 +34764,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { dissolveMask = maskBlend(dissolveMask, poiMods.globalMask[_DissolveMaskGlobalMask - 1], _DissolveMaskGlobalMaskBlendType); } - + #if defined(PROP_DISSOLVETOTEXTURE) || !defined(OPTIMIZER_ENABLED) dissolveToTexture = POI2D_SAMPLER_PAN(_DissolveToTexture, _MainTex, poiUV(poiMesh.uv[_DissolveToTextureUV], _DissolveToTexture_ST), _DissolveToTexturePan) * float4(poiThemeColor(poiMods, _DissolveTextureColor.rgb, _DissolveTextureColorThemeIndex), _DissolveTextureColor.a); #else - dissolveToTexture = _DissolveTextureColor; + dissolveToTexture = float4(poiThemeColor(poiMods, _DissolveTextureColor.rgb, _DissolveTextureColorThemeIndex), _DissolveTextureColor.a); #endif - + #if defined(PROP_DISSOLVENOISETEXTURE) || !defined(OPTIMIZER_ENABLED) float dissolveNoiseTexture = POI2D_SAMPLER_PAN(_DissolveNoiseTexture, _MainTex, poiUV(poiMesh.uv[_DissolveNoiseTextureUV], _DissolveNoiseTexture_ST), _DissolveNoiseTexturePan).r; #else float dissolveNoiseTexture = 1; #endif - + float da = _DissolveAlpha + _DissolveAlpha0 + _DissolveAlpha1 @@ -33829,22 +34789,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" + _DissolveAlpha8 + _DissolveAlpha9; float dds = _DissolveDetailStrength; - + if (_UVTileDissolveEnabled) { float2 udim = floor(poiMesh.uv[(int)_UVTileDissolveUV]); - + float4 xMask = float4((udim.x >= 0 && udim.x < 1), (udim.x >= 1 && udim.x < 2), (udim.x >= 2 && udim.x < 3), (udim.x >= 3 && udim.x < 4)); - + da += (udim.y >= 0 && udim.y < 1) * dot(float4(_UVTileDissolveAlpha_Row0_0, _UVTileDissolveAlpha_Row0_1, _UVTileDissolveAlpha_Row0_2, _UVTileDissolveAlpha_Row0_3), xMask); da += (udim.y >= 1 && udim.y < 2) * dot(float4(_UVTileDissolveAlpha_Row1_0, _UVTileDissolveAlpha_Row1_1, _UVTileDissolveAlpha_Row1_2, _UVTileDissolveAlpha_Row1_3), xMask); da += (udim.y >= 2 && udim.y < 3) * dot(float4(_UVTileDissolveAlpha_Row2_0, _UVTileDissolveAlpha_Row2_1, _UVTileDissolveAlpha_Row2_2, _UVTileDissolveAlpha_Row2_3), xMask); da += (udim.y >= 3 && udim.y < 4) * dot(float4(_UVTileDissolveAlpha_Row3_0, _UVTileDissolveAlpha_Row3_1, _UVTileDissolveAlpha_Row3_2, _UVTileDissolveAlpha_Row3_3), xMask); } - + #ifdef POI_AUDIOLINK UNITY_BRANCH if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable) @@ -33853,10 +34813,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]); } #endif - + da = saturate(da); dds = saturate(dds); - + if (_DissolveMaskInvert) { dissolveMask = 1 - dissolveMask; @@ -33881,33 +34841,33 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" da *= dissolveMask; dissolveAlpha = da; edgeAlpha = 0; - + [flatten] switch(_DissolveType) { default: // Basic (case 1) - + { da = remap(da, 0, 1, -_DissolveEdgeWidth, 1); dissolveAlpha = da; //Adjust detail strength to avoid artifacts dds *= smoothstep(1, 0.99, da) * lerp(1, smoothstep(0, lerp(0.01, 0.1, dds), da), _DissolveDetailEdgeSmoothing); float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds); - + noise = saturate(noise * 0.998 + 0.001); dissolveAlpha = dissolveAlpha >= noise; edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha); break; } case 2: // Point to Point - + { float3 direction; float3 currentPos; float distanceTo = 0; direction = normalize(_DissolveEndPoint - _DissolveStartPoint); currentPos = lerp(_DissolveStartPoint, _DissolveEndPoint, dissolveAlpha); - + UNITY_BRANCH if (_DissolveP2PWorldLocal != 1) { @@ -33924,17 +34884,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" dissolveAlpha = (distanceTo < 0) ? 1 : 0; edgeAlpha *= 1 - dissolveAlpha; } - + if (_DissolveP2PClamp) { dissolveAlpha = saturate(dissolveAlpha * smoothstep(0, 0.01, da) + smoothstep(0.99, 1, da)); edgeAlpha *= smoothstep(0, 0.01, da); } - + break; } case 3: // Spherical - + { if (_SphericalDissolveInvert) { @@ -33944,14 +34904,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { da = remap(da, 0, 1, -_DissolveEdgeWidth, 1); } - + dissolveAlpha = da; dds *= smoothstep(0, 0.2 * dds + 0.01, dissolveAlpha) * lerp(1, smoothstep(1, 1 - 0.2 * dds - 0.01, dissolveAlpha), _DissolveDetailEdgeSmoothing); float currentDistance = lerp(0, _SphericalDissolveRadius, dissolveAlpha); float fragDistance = distance(_SphericalDissolveCenter, poiMesh.localPos.xyz); float normalizedDistance; normalizedDistance = (fragDistance - currentDistance) / (_SphericalDissolveRadius + 0.0001) - dissolveDetailNoise * dds; - + if (_SphericalDissolveInvert) { dissolveAlpha = (normalizedDistance > 0) ? 1 : 0; @@ -33962,62 +34922,62 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" dissolveAlpha = (normalizedDistance < 0) ? 1 : 0; edgeAlpha = smoothstep(_DissolveEdgeWidth + .00001, 0, normalizedDistance); } - + if (_SphericalDissolveClamp) { da = lerp(da, 1 - da, _SphericalDissolveInvert); dissolveAlpha = saturate(dissolveAlpha * smoothstep(0, 0.01, da) + smoothstep(0.99, 1, da)); edgeAlpha *= smoothstep(0, 0.01, da); } - + break; } case 4: // CenterOut - + { float ramp = 0.5; float noise; - + [flatten] switch(_CenterOutDissolveMode) { case 1: // View Direction - + { ramp = saturate(lerp(poiLight.vertexNDotV, poiLight.nDotV, _CenterOutDissolveNormals)); break; } case 2: // Custom Direction - + { ramp = dot(normalize(_CenterOutDissolveDirection), lerp(poiMesh.normals[0], poiMesh.normals[1], _CenterOutDissolveNormals)); ramp = saturate(ramp * .5 + 0.5); break; } case 3: // Light Direction - + { ramp = lerp(poiLight.vertexNDotL, poiLight.nDotL, _CenterOutDissolveNormals); ramp = saturate(ramp * .5 + 0.5); break; } } - + if (_CenterOutDissolvePower != 1) { ramp = pow(ramp, _CenterOutDissolvePower); } - + if (!_CenterOutDissolveInvert) { ramp = 1 - ramp; } - + da = remap(da, 0, 1, -_DissolveEdgeWidth, 1); dissolveAlpha = da; //Adjust detail strength to avoid artifacts dds *= smoothstep(1, 0.99, da) * lerp(1, smoothstep(0, lerp(0.01, 0.1, dds), da), _DissolveDetailEdgeSmoothing); - + noise = saturate(ramp - dissolveDetailNoise * dds); noise = saturate(noise * 0.998 + 0.001); dissolveAlpha = dissolveAlpha >= noise; @@ -34025,27 +34985,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" break; } } - + #ifndef POI_SHADOW UNITY_BRANCH if (_DissolveHueShiftEnabled) { - dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed); + dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed, _DissolveHueShiftColorSpace); } #endif - + poiFragData.alpha = lerp(poiFragData.alpha, dissolveToTexture.a, dissolveAlpha * .999999); - + #if !defined(POI_PASS_OUTLINE) && !defined(UNITY_PASS_SHADOWCASTER) poiFragData.baseColor = lerp(poiFragData.baseColor, dissolveToTexture.rgb, dissolveAlpha * .999999); - + if (_DissolveApplyGlobalMaskIndex > 0) { applyToGlobalMask(poiMods, _DissolveApplyGlobalMaskIndex - 1, _DissolveApplyGlobalMaskBlendType, dissolveAlpha * .999999); } if (_DissolveInverseApplyGlobalMaskIndex > 0) { - applyToGlobalMask(poiMods, _DissolveInverseApplyGlobalMaskIndex - 1, _DissolveInverseApplyGlobalMaskBlendType, 1-(dissolveAlpha * .999999)); + applyToGlobalMask(poiMods, _DissolveInverseApplyGlobalMaskIndex - 1, _DissolveInverseApplyGlobalMaskBlendType, 1 - (dissolveAlpha * .999999)); } UNITY_BRANCH if (_DissolveEdgeWidth || (_DissolveType == 2 && _DissolveP2PEdgeLength != 0)) @@ -34055,25 +35015,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" UNITY_BRANCH if (_DissolveEdgeHueShiftEnabled) { - edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed); + edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed, _DissolveEdgeHueShiftColorSpace); } #endif poiFragData.baseColor = lerp(poiFragData.baseColor, edgeColor.rgb, smoothstep(0, 1 - _DissolveEdgeHardness * .99999999999, edgeAlpha)); } - + poiFragData.emission += lerp(0, dissolveToTexture * _DissolveToEmissionStrength, dissolveAlpha) + lerp(0, edgeColor.rgb * _DissolveEdgeEmission, smoothstep(0, 1 - _DissolveEdgeHardness * .99999999999, edgeAlpha)); #endif } #endif //endex - + //ifex _EnableAniso==0 #ifdef POI_ANISOTROPICS /* float D_GGX_Anisotropic(float at, float ab, float TdotH, float BdotH, float NdotH) { // Burley 2012, "Physically-Based Shading at Disney" - + // The values at and ab are perceptualRoughness^2, a2 is therefore perceptualRoughness^4 // The dot product below computes perceptualRoughness^8. We cannot fit in fp16 without clamping // the roughness to too high values so we perform the dot product and the division in fp32 @@ -34083,7 +35043,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float b2 = a2 / d2; return a2 * b2 * b2 * (1.0 / UNITY_PI); } - + //-------------------------------------GGX Anisotropic visibility function float V_SmithGGXCorrelated_Anisotropic(float at, float ab, float TdotV, float BdotV, float TdotL, float BdotL, float NdotV, float NdotL) { @@ -34093,7 +35053,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return 0.5 / (lambdaV + lambdaL); } */ - + float calculateAnisotropics(float3 binormal, float offset, float3 normal, float3 viewDir, float3 LightDirection, float exponent, float strength, float shadowMask) { float3 ShiftedTangent = normalize(binormal + offset * normal); @@ -34103,14 +35063,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float dirAtten = smoothstep(-1.0, 0.0, dotTH); return saturate(dirAtten * pow(sinTH, exponent) * strength) * shadowMask; } - + float aaEdgeFeather(float value, float edge, float feather) { float edgeMin = saturate(edge - feather * 0.5); float edgeMax = saturate(edge + feather * 0.5); return saturate((value - edgeMin) / saturate(edgeMax - edgeMin + fwidth(value))); } - + void applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods) { #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED) @@ -34118,33 +35078,33 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float4 specMap = float4(1, 1, 1, 0); #endif - + float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow); #ifdef POI_PASS_ADD shadowMask *= poiLight.additiveShadow; #endif - + if (_AnisoGlobalMask > 0) { - shadowMask = customBlend(shadowMask, poiMods.globalMask[_AnisoGlobalMask-1], _AnisoGlobalMaskBlendType); + shadowMask = customBlend(shadowMask, poiMods.globalMask[_AnisoGlobalMask - 1], _AnisoGlobalMaskBlendType); } - + float spec0 = calculateAnisotropics(lerp(poiMesh.binormal[1], poiMesh.tangent[1], _Aniso0SwitchDirection), _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask); float spec1 = calculateAnisotropics(lerp(poiMesh.binormal[1], poiMesh.tangent[1], _Aniso1SwitchDirection), _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso1Power * 1000, _Aniso1Strength, shadowMask); - + spec0 = lerp(spec0, aaEdgeFeather(spec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode); spec1 = lerp(spec1, aaEdgeFeather(spec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode); - + float3 spec0Color = specMap.rgb * poiThemeColor(poiMods, _Aniso0Tint.rgb, _Aniso0TintIndex); float3 spec1Color = specMap.rgb * poiThemeColor(poiMods, _Aniso1Tint.rgb, _Aniso1TintIndex); - + float3 finalSpec = saturate(saturate(spec0 * spec0Color) + saturate(spec1 * spec1Color)) * lerp(1, poiFragData.baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.directColor, float3(0.299, 0.587, 0.114)), poiLight.directColor, _AnisoUseLightColor); float3 baseColor = poiFragData.baseColor; - + poiFragData.baseColor = lerp(poiFragData.baseColor, spec1Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.directColor, float3(0.299, 0.587, 0.114)), poiLight.directColor, _AnisoUseLightColor), _AnisoReplace * spec1); poiFragData.baseColor = lerp(poiFragData.baseColor, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.directColor, float3(0.299, 0.587, 0.114)), poiLight.directColor, _AnisoUseLightColor), _AnisoReplace * spec0); poiLight.finalLightAdd += max(0, finalSpec * _AnisoAdd); - + if (poiFragData.toggleVertexLights) { #if defined(VERTEXLIGHT_ON) @@ -34152,15 +35112,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { float vSpec0 = calculateAnisotropics(lerp(poiMesh.binormal[1], poiMesh.tangent[1], _Aniso0SwitchDirection), _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vSaturatedDotNL[index]); float vSpec1 = calculateAnisotropics(lerp(poiMesh.binormal[1], poiMesh.tangent[1], _Aniso1SwitchDirection), _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vSaturatedDotNL[index]); - + vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode); vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode); - + float3 vSpec0Color = spec0Color; float3 vSpec1Color = spec1Color; - + poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * vSpec0Color) + saturate(vSpec1 * vSpec1Color)) * lerp(1, poiFragData.baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor) * _AnisoAdd); - + poiFragData.baseColor = lerp(poiFragData.baseColor, vSpec1Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec1); poiFragData.baseColor = lerp(poiFragData.baseColor, vSpec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0); } @@ -34169,7 +35129,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //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) { @@ -34181,7 +35141,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { matcapMask = maskBlend(matcapMask, poiMods.globalMask[globalMaskIndex - 1], globalMaskBlendType); } - + #ifdef POI_AUDIOLINK if (matcapALD.matcapALEnabled > 0) { @@ -34189,7 +35149,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; @@ -34200,7 +35160,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -34212,7 +35172,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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; } @@ -34248,13 +35208,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -34272,7 +35232,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float matcapIntensity; struct MatcapAudioLinkData matcapALD; //endex - + //ifex _MatcapEnable==0 // Matcap 1 #ifdef POI_MATCAP0 @@ -34286,14 +35246,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -34308,9 +35268,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -34327,7 +35287,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a); #endif - + matcapIntensity = _MatcapIntensity; #ifdef POI_AUDIOLINK if (matcapALD.matcapALEnabled > 0) @@ -34338,54 +35298,54 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif matcap.rgb *= matcapIntensity; matcap.rgb = lerp(matcap.rgb, matcap.rgb * poiFragData.baseColor.rgb, _MatcapBaseColorMix); - + #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); - + //UNITY_BRANCH if (_MatcapHueShiftEnabled) { - matcap.rgb = hueShift(matcap.rgb, _MatcapHueShift + _Time.x * _MatcapHueShiftSpeed); + matcap.rgb = hueShift(matcap.rgb, _MatcapHueShift + _Time.x * _MatcapHueShiftSpeed, _MatcapHueShiftColorSpace); } - + 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 @@ -34402,14 +35362,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -34424,9 +35384,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -34443,7 +35403,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a); #endif - + matcapIntensity = _Matcap2Intensity; #ifdef POI_AUDIOLINK if (matcapALD.matcapALEnabled > 0) @@ -34454,7 +35414,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif matcap2.rgb *= matcapIntensity; matcap2.rgb = lerp(matcap2.rgb, matcap2.rgb * poiFragData.baseColor.rgb, _Matcap2BaseColorMix); - + #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED) matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan)[_Matcap2MaskChannel]; #else @@ -34464,50 +35424,50 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { 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); + matcap2.rgb = hueShift(matcap2.rgb, _Matcap2HueShift + _Time.x * _Matcap2HueShiftSpeed, _Matcap2HueShiftColorSpace); } - + 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; @@ -34518,14 +35478,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -34540,9 +35500,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -34559,7 +35519,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else matcap3 = float4(poiThemeColor(poiMods, _Matcap3Color.rgb, _Matcap3ColorThemeIndex), _Matcap3Color.a); #endif - + matcapIntensity = _Matcap3Intensity; #ifdef POI_AUDIOLINK if (matcapALD.matcapALEnabled > 0) @@ -34570,7 +35530,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif matcap3.rgb *= matcapIntensity; matcap3.rgb = lerp(matcap3.rgb, matcap3.rgb * poiFragData.baseColor.rgb, _Matcap3BaseColorMix); - + #if defined(PROP_MATCAP3MASK) || !defined(OPTIMIZER_ENABLED) matcap3Mask = POI2D_SAMPLER_PAN(_Matcap3Mask, _MainTex, poiUV(poiMesh.uv[_Matcap3MaskUV], _Matcap3Mask_ST), _Matcap3MaskPan)[_Matcap3MaskChannel]; #else @@ -34580,50 +35540,50 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { 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); + matcap3.rgb = hueShift(matcap3.rgb, _Matcap3HueShift + _Time.x * _Matcap3HueShiftSpeed, _Matcap3HueShiftColorSpace); } - + 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; @@ -34634,14 +35594,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -34656,9 +35616,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) @@ -34675,7 +35635,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else matcap4 = float4(poiThemeColor(poiMods, _Matcap4Color.rgb, _Matcap4ColorThemeIndex), _Matcap4Color.a); #endif - + matcapIntensity = _Matcap4Intensity; #ifdef POI_AUDIOLINK if (matcapALD.matcapALEnabled > 0) @@ -34686,7 +35646,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif matcap4.rgb *= matcapIntensity; matcap4.rgb = lerp(matcap4.rgb, matcap4.rgb * poiFragData.baseColor.rgb, _Matcap4BaseColorMix); - + #if defined(PROP_MATCAP4MASK) || !defined(OPTIMIZER_ENABLED) matcap4Mask = POI2D_SAMPLER_PAN(_Matcap4Mask, _MainTex, poiUV(poiMesh.uv[_Matcap4MaskUV], _Matcap4Mask_ST), _Matcap4MaskPan)[_Matcap4MaskChannel]; #else @@ -34696,52 +35656,52 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { 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); + matcap4.rgb = hueShift(matcap4.rgb, _Matcap4HueShift + _Time.x * _Matcap4HueShiftSpeed, _Matcap4HueShiftColorSpace); } - + 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 - + //ifex _CubeMapEnabled==0 #ifdef _CUBEMAP #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED) @@ -34758,7 +35718,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods) { float3 CubeMapUV = 0; - + switch(_CubeMapUVMode) { case 0: // Skybox @@ -34774,7 +35734,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" CubeMapUV = poiMesh.objNormal; break; } - + #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED) if (any(_CubeMapRotation.xyz) || any(_CubeMapRotationPan.xyz)) { @@ -34784,36 +35744,36 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" CubeMapUV = RotateAroundYInDegrees(CubeMapUV.xzy, _CubeMapRotation.z + (_CubeMapRotationPan.z * _Time.y)).xzy; } float4 cubeMap = texCUBElod(_CubeMap, float4(CubeMapUV, (1 - _CubeMapSmoothness) * (1 - _CubeMapSmoothness) * 8)); - + cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex); #else float4 cubeMap = float4(0.21763764082, 0.21763764082, 0.21763764082, .5) * float4(poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex), 1); #endif - + cubeMap.rgb *= _CubeMapIntensity; #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED) float CubeMapMask = POI2D_SAMPLER_PAN(_CubeMapMask, _MainTex, poiUV(poiMesh.uv[_CubeMapMaskUV], _CubeMapMask_ST), _CubeMapMaskPan)[_CubeMapMaskChannel]; #else float CubeMapMask = 1; #endif - + if (_CubeMapMaskGlobalMask > 0) { CubeMapMask = maskBlend(CubeMapMask, poiMods.globalMask[_CubeMapMaskGlobalMask - 1], _CubeMapMaskGlobalMaskBlendType); } - + if (_CubeMapMaskInvert) { CubeMapMask = 1 - CubeMapMask; } - + //UNITY_BRANCH if (_CubeMapHueShiftEnabled) { cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed); cubeMap = PoiColorBCS(cubeMap, _CubeMapBrightness, _CubeMapContrast, _CubeMapSaturation); //cubeMap.rgb = ModifyViaHSV(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed, _CubeMapSaturation, _CubeMapValue); - + } CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask)); float cubeMapAlpha = CubeMapMask * cubeMap.a * _CubeMapBlendAmount; @@ -34824,7 +35784,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _EnableALDecal==0 #ifdef POI_AUDIOLINK #ifdef POI_AL_DECAL @@ -34838,7 +35798,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { colorAndMask.a = customBlend(colorAndMask.a, poiMods.globalMask[_ALDecalGlobalMask-1], _ALDecalGlobalMaskBlendType); } - + float2 uv = poiMesh.uv[_ALDecalUV]; float2 decalCenter = _ALUVPosition; float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed); @@ -34846,10 +35806,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) - _ALUVScale.xz / 2 + _ALUVPosition, _ALUVScale.yw / 2 + _ALUVPosition, float2(0, 0), float2(1, 1)); - + // Mask float4 audioLinkMask = 1.0; - + // UV float2 aluv = uv; if (_ALDecalUVMode == 1) @@ -34858,7 +35818,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" aluv.x = frac(atan2(uvdir.y, uvdir.x) * UNITY_INV_TWO_PI); aluv.y = length(uvdir); } - + // Scale / Offset / Step float maskY = aluv.y; if (_ALDecalUVMode == 1) @@ -34870,29 +35830,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { maskX = remap(maskX, _ALDecaldCircleDimensions.z, _ALDecaldCircleDimensions.w, 0, 1); } - + float maskVolume = _ALDecalVolumeStep != 0.0 ? floor(maskY * _ALDecalVolumeStep) / _ALDecalVolumeStep : maskY; float maskBand = _ALDecalBandStep != 0.0 ? floor(maskX * _ALDecalBandStep) / _ALDecalBandStep : maskX; - + // Copy audioLinkMask.r = maskVolume; audioLinkMask.g = maskBand; - + // Clip audioLinkMask.b = maskVolume < _ALDecalVolumeClipMin || maskVolume > _ALDecalVolumeClipMax ? 0.0 : audioLinkMask.b; audioLinkMask.b = maskBand < _ALDecalBandClipMin || maskBand > _ALDecalBandClipMax ? 0.0 : audioLinkMask.b; - + // Shape Clip if (_ALDecalShapeClip) { float volumeth = _ALDecalShapeClipVolumeWidth; if (_ALDecalVolumeStep != 0.0) audioLinkMask.b = frac(maskY * _ALDecalVolumeStep) > volumeth ? 0.0 : audioLinkMask.b; - + float bandwidth = _ALDecalUVMode == 1 ? _ALDecalShapeClipBandWidth / aluv.y : _ALDecalShapeClipBandWidth; float bandth = 1.0 - bandwidth; if (_ALDecalBandStep != 0.0) audioLinkMask.b = frac(maskX * _ALDecalBandStep + bandth * 0.5) < bandth ? 0.0 : audioLinkMask.b; } - + // AudioLink float2 audioLinkUV = float2(frac(audioLinkMask.g * 2.0), 4.5 / 4.0 + floor(audioLinkMask.g * 2.0) / 4.0); audioLinkUV.y *= 0.0625; @@ -34902,27 +35862,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" audioLinkValue = saturate(audioLinkValue) * audioLinkMask.b; //clip(audioLinkValue - .5); audioLinkValue *= colorAndMask.a; - + if (!poiMods.audioLinkAvailable) { audioLinkValue = 0; } - + float3 alColorChord = _AudioTexture.Sample(sampler_linear_clamp, float2(maskX, 24.5 / 64.0)).rgb; float volumeColorSrc = audioLinkMask.g; if (_ALDecalVolumeColorSource == 1) volumeColorSrc = audioLinkMask.r; if (_ALDecalVolumeColorSource == 2) volumeColorSrc = audioVal; - + float3 lowColor = _ALDecalVolumeColorLow.rgb * poiThemeColor(poiMods, _ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorLowThemeIndex); float3 midColor = _ALDecalVolumeColorMid.rgb * poiThemeColor(poiMods, _ALDecalVolumeColorMid.rgb, _ALDecalVolumeColorMidThemeIndex); float3 highColor = _ALDecalVolumeColorHigh.rgb * poiThemeColor(poiMods, _ALDecalVolumeColorHigh.rgb, _ALDecalVolumeColorHighThemeIndex); - + float3 volumeColor = lerp(lowColor, midColor, saturate(volumeColorSrc * 2)); volumeColor = lerp(volumeColor, highColor, saturate(volumeColorSrc * 2 - 1)); - + float3 emissionColor = lerp(lowColor * _ALDecalLowEmission, midColor * _ALDecalMidEmission, saturate(volumeColorSrc * 2)); emissionColor = lerp(emissionColor, highColor * _ALDecalHighEmission, saturate(volumeColorSrc * 2 - 1)); - + //poiFragData.baseColor = lerp(poiFragData.baseColor, volumeColor, audioLinkValue); #if defined(POI_PASS_BASE) || defined(POI_PASS_ADD) poiFragData.emission += emissionColor * audioLinkValue; @@ -34933,24 +35893,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableVolumeColor==0 #ifdef POI_AUDIOLINK #ifdef POI_AL_VOLUMECOLOR void ApplyAudioLinkVolumeColor(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods) { float volume = AudioLinkLerpMultiline(ALPASS_DFT + float2(poiMesh.uv[_ALVolumeColorUV][_ALVolumeColorDirection] * AUDIOLINK_ETOTALBINS, 0.0)).b; - + float3 lowColor = _ALVolumeColorLow.rgb * poiThemeColor(poiMods, _ALVolumeColorLow.rgb, _ALVolumeColorLowThemeIndex); float3 midColor = _ALVolumeColorMid.rgb * poiThemeColor(poiMods, _ALVolumeColorMid.rgb, _ALVolumeColorMidThemeIndex); float3 highColor = _ALVolumeColorHigh.rgb * poiThemeColor(poiMods, _ALVolumeColorHigh.rgb, _ALVolumeColorHighThemeIndex); - + float3 volumeColor = lerp(lowColor, midColor, saturate(volume * 2)); volumeColor = lerp(volumeColor, highColor, saturate(volume * 2 - 1)); - + float3 emissionColor = lerp(lowColor * _ALLowEmission, midColor * _ALMidEmission, saturate(volume * 2)); emissionColor = lerp(emissionColor, highColor * _ALHighEmission, saturate(volume * 2 - 1)); - + #if defined(POI_PASS_BASE) || defined(POI_PASS_ADD) poiFragData.emission += emissionColor * poiMods.audioLinkAvailable; poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor, _ALVolumeColorBlendType), saturate(_ALVolumeColorBlendAlpha * poiMods.audioLinkAvailable)); @@ -34959,10 +35919,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableFlipbook==0 #ifdef _SUNDISK_HIGH_QUALITY - + void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) { #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED) @@ -34977,14 +35937,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" flipBookMask = maskBlend(flipBookMask, poiMods.globalMask[_FlipbookMaskGlobalMask-1], _FlipbookMaskGlobalMaskBlendType); } float4 flipbookScaleOffset = _FlipbookScaleOffset; - + #ifdef POI_AUDIOLINK if (poiMods.audioLinkAvailable) { flipbookScaleOffset.xy += lerp(_AudioLinkFlipbookScale.xy, _AudioLinkFlipbookScale.zw, poiMods.audioLink[_AudioLinkFlipbookScaleBand]); } #endif - + flipbookScaleOffset.xy = 1 - flipbookScaleOffset.xy; float2 uv = frac(poiMesh.uv[_FlipbookTexArrayUV]); float theta = radians(_FlipbookRotation + _Time.z * _FlipbookRotationSpeed); @@ -34995,7 +35955,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" uv = float2((uv.x - spriteCenter.x) * cs - (uv.y - spriteCenter.y) * sn + spriteCenter.x, (uv.x - spriteCenter.x) * sn + (uv.y - spriteCenter.y) * cs + spriteCenter.y); float4 sideOffset = float4(-(_FlipbookSideOffset.x), _FlipbookSideOffset.y, -(_FlipbookSideOffset.z), _FlipbookSideOffset.w); float2 newUV = remap(uv, float2(0, 0) + flipbookScaleOffset.xy / 2 + flipbookScaleOffset.zw + sideOffset.xz, float2(1, 1) - flipbookScaleOffset.xy / 2 + flipbookScaleOffset.zw + sideOffset.yw, float2(0, 0), float2(1, 1)); - + UNITY_BRANCH if (_FlipbookTiled == 0) { @@ -35009,7 +35969,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float height; float totalFrames; _FlipbookTexArray.GetDimensions(width, height, totalFrames); - + if (_FlipbookStartAndEnd) { totalFrames -= (totalFrames - min(max(_FlipbookStartFrame, _FlipbookEndFrame), totalFrames)); @@ -35047,6 +36007,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame))); + UNITY_BRANCH if (_FlipbookCrossfadeEnabled) { @@ -35058,7 +36019,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % totalFramesCF))); flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame))); } - + UNITY_BRANCH if (_FlipbookIntensityControlsAlpha) { @@ -35073,11 +36034,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex); } - + UNITY_BRANCH if (_FlipbookHueShiftEnabled) { - flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed); + flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed, _FlipbookHueShiftColorSpace); } half flipbookAlpha = 1; #ifdef POI_AUDIOLINK @@ -35086,11 +36047,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" flipbookAlpha += saturate(lerp(_AudioLinkFlipbookAlpha.x, _AudioLinkFlipbookAlpha.y, poiMods.audioLink[_AudioLinkFlipbookAlphaBand])); } #endif - + #if !defined(POI_PASS_OUTLINE) && !defined(UNITY_PASS_SHADOWCASTER) - + poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, flipBookPixel.rgb, _FlipbookBlendType), flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha); - + float flipbookEmissionStrength = _FlipbookEmissionStrength; #ifdef POI_AUDIOLINK if (poiMods.audioLinkAvailable) @@ -35098,11 +36059,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" flipbookEmissionStrength += max(lerp(_AudioLinkFlipbookEmission.x, _AudioLinkFlipbookEmission.y, poiMods.audioLink[_AudioLinkFlipbookEmissionBand]), 0); } #endif - + poiFragData.emission += lerp(0, flipBookPixel.rgb * flipbookEmissionStrength, flipBookPixel.a * _FlipbookColor.a * flipBookMask * flipbookAlpha); - + #endif - + UNITY_BRANCH if (_FlipbookAlphaControlsFinalAlpha) { @@ -35110,36 +36071,36 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif } - + #endif //endex - + //ifex _EnableRimLighting==0 && _EnableRim2Lighting==0 #if defined(_GLOSSYREFLECTIONS_OFF) || defined(POI_RIM2) #if defined(_RIMSTYLE_POIYOMI) || defined(_RIM2STYLE_POIYOMI) - void ApplyPoiyomiRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, inout PoiMods poiMods, float Is_NormalMapToRimLight, float RimInvert, float RimPower, float RimStrength, float RimShadowWidth, float RimShadowToggle, float RimWidth, float RimBlendStrength, float RimMask, float RimGlobalMask, float RimGlobalMaskBlendType, float4 RimTex, float4 RimLightColor, float RimLightColorThemeIndex, float RimHueShiftEnabled, float RimHueShift, float RimHueShiftSpeed, float RimSharpness, float RimShadowMaskRampType, float RimShadowMaskInvert, float RimShadowMaskStrength, float2 RimShadowAlpha, float RimApplyGlobalMaskIndex, float RimApplyGlobalMaskBlendType, float RimBaseColorMix, float RimBrightness, float RimBlendMode, half AudioLinkRimWidthBand, float2 AudioLinkRimWidthAdd, half AudioLinkRimEmissionBand, float2 AudioLinkRimEmissionAdd, half AudioLinkRimBrightnessBand, float2 AudioLinkRimBrightnessAdd, float rimBias, float rimBiasIntensity, int RimApplyAlpha, float RimApplyAlphaBlend) + void ApplyPoiyomiRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, inout PoiMods poiMods, float Is_NormalMapToRimLight, float RimInvert, float RimPower, float RimStrength, float RimShadowWidth, float RimShadowToggle, float RimWidth, float RimBlendStrength, float RimMask, float RimGlobalMask, float RimGlobalMaskBlendType, float4 RimTex, float4 RimLightColor, float RimLightColorThemeIndex, float RimHueShiftEnabled, float RimHueShift, float RimHueShiftColorSpace, float RimHueShiftSpeed, float RimSharpness, float RimShadowMaskRampType, float RimShadowMaskInvert, float RimShadowMaskStrength, float2 RimShadowAlpha, float RimApplyGlobalMaskIndex, float RimApplyGlobalMaskBlendType, float RimBaseColorMix, float RimBrightness, float RimBlendMode, half AudioLinkRimWidthBand, float2 AudioLinkRimWidthAdd, half AudioLinkRimEmissionBand, float2 AudioLinkRimEmissionAdd, half AudioLinkRimBrightnessBand, float2 AudioLinkRimBrightnessAdd, float rimBias, float rimBiasIntensity, int RimApplyAlpha, float RimApplyAlphaBlend) { float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], Is_NormalMapToRimLight))); - + UNITY_BRANCH if (RimInvert) { viewDotNormal = 1 - viewDotNormal; } - + viewDotNormal = pow(viewDotNormal, RimPower); - + if (RimShadowWidth && RimShadowToggle) { viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, RimShadowWidth); } - + viewDotNormal *= lerp(1, rimBias, rimBiasIntensity); - + float rimStrength = RimStrength; - + float rimWidth = lerp( - .05, 1, RimWidth); - + float blendStrength = RimBlendStrength; #ifdef POI_AUDIOLINK UNITY_BRANCH @@ -35151,24 +36112,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif float rimMask = RimMask; - + if (RimGlobalMask > 0) { - rimMask = maskBlend(rimMask, poiMods.globalMask[RimGlobalMask-1], RimGlobalMaskBlendType); + rimMask = maskBlend(rimMask, poiMods.globalMask[RimGlobalMask - 1], RimGlobalMaskBlendType); } - + float4 rimColor = RimTex; rimColor *= float4(poiThemeColor(poiMods, RimLightColor.rgb, RimLightColorThemeIndex), RimLightColor.a); - + UNITY_BRANCH if (RimHueShiftEnabled) { - rimColor.rgb = hueShift(rimColor.rgb, RimHueShift + _Time.x * RimHueShiftSpeed); + rimColor.rgb = hueShift(rimColor.rgb, RimHueShift + _Time.x * RimHueShiftSpeed, RimHueShiftColorSpace); } - + float rim = 1 - smoothstep(min(RimSharpness, rimWidth), rimWidth, viewDotNormal); rim *= RimLightColor.a * rimColor.a * rimMask; - + if (RimShadowToggle) { switch(RimShadowMaskRampType) @@ -35185,22 +36146,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" break; } } - + if (RimApplyGlobalMaskIndex > 0) { - applyToGlobalMask(poiMods, RimApplyGlobalMaskIndex-1, RimApplyGlobalMaskBlendType, rim * blendStrength); + applyToGlobalMask(poiMods, RimApplyGlobalMaskIndex - 1, RimApplyGlobalMaskBlendType, rim * blendStrength); } - + if (RimApplyAlpha == 1) // Add + { poiFragData.alpha += lerp(0, saturate(rim), RimApplyAlphaBlend); poiFragData.alpha = saturate(poiFragData.alpha); } if (RimApplyAlpha == 2) // Multiply + { poiFragData.alpha *= lerp(1, saturate(rim), RimApplyAlphaBlend); } - + float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, RimBaseColorMix); finalRimColor *= RimBrightness; // Add 0, Replace 1, Multiply 2, Mixed 3 @@ -35216,13 +36179,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif #if defined(_RIMSTYLE_UTS2) || defined(_RIM2STYLE_UTS2) - void ApplyUTS2RimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods, float Set_RimLightMask_var, float RimGlobalMask, float RimGlobalMaskBlendType, float4 RimLightColor, float RimLightColorThemeIndex, float Is_LightColor_RimLight, float Is_NormalMapToRimLight, float RimLight_Power, float RimLight_InsideMask, float RimLight_FeatherOff, float LightDirection_MaskOn, float Tweak_LightDirection_MaskLevel, float Add_Antipodean_RimLight, float4 Ap_RimLightColor, float RimApColorThemeIndex, float Is_LightColor_Ap_RimLight, float Ap_RimLight_Power, float Ap_RimLight_FeatherOff, float Tweak_RimLightMaskLevel, float RimHueShiftEnabled, float RimHueShift, float RimHueShiftSpeed) + void ApplyUTS2RimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods, float Set_RimLightMask_var, float RimGlobalMask, float RimGlobalMaskBlendType, float4 RimLightColor, float RimLightColorThemeIndex, float Is_LightColor_RimLight, float Is_NormalMapToRimLight, float RimLight_Power, float RimLight_InsideMask, float RimLight_FeatherOff, float LightDirection_MaskOn, float Tweak_LightDirection_MaskLevel, float Add_Antipodean_RimLight, float4 Ap_RimLightColor, float RimApColorThemeIndex, float Is_LightColor_Ap_RimLight, float Ap_RimLight_Power, float Ap_RimLight_FeatherOff, float Tweak_RimLightMaskLevel, float RimHueShiftEnabled, float RimHueShift, float RimHueShiftColorSpace, float RimHueShiftSpeed) { if (RimGlobalMask > 0) { - Set_RimLightMask_var = maskBlend(Set_RimLightMask_var, poiMods.globalMask[RimGlobalMask-1], RimGlobalMaskBlendType); + Set_RimLightMask_var = maskBlend(Set_RimLightMask_var, poiMods.globalMask[RimGlobalMask - 1], RimGlobalMaskBlendType); } - + float3 rimColor = float3(poiThemeColor(poiMods, RimLightColor.rgb, RimLightColorThemeIndex)); float3 _Is_LightColor_RimLight_var = lerp(rimColor, (rimColor * poiLight.directColor), Is_LightColor_RimLight); float _RimArea_var = (1.0 - dot(lerp(poiMesh.normals[0], poiMesh.normals[1], Is_NormalMapToRimLight), poiCam.viewDir)); @@ -35236,87 +36199,96 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" UNITY_BRANCH if (RimHueShiftEnabled) { - _RimLight_var = hueShift(_RimLight_var, RimHueShift + _Time.x * RimHueShiftSpeed); + _RimLight_var = hueShift(_RimLight_var, RimHueShift + _Time.x * RimHueShiftSpeed, RimHueShiftColorSpace); } poiFragData.baseColor += _RimLight_var; } #endif #if defined(_RIMSTYLE_LILTOON) || defined(_RIM2STYLE_LILTOON) - void ApplyLiltoonRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods, float4 RimColor, float4 RimIndirColor, float4 RimColorTex, float RimMainStrength, float RimNormalStrength, float RimDirRange, float RimIndirRange, float RimFresnelPower, float RimBackfaceMask, float RimDirStrength, float RimBorder, float RimBlur, float RimIndirBorder, float RimIndirBlur, float RimShadowMask, float RimEnableLighting, float RimVRParallaxStrength, float RimGlobalMask, float RimGlobalMaskBlendType, float RimHueShiftEnabled, float RimHueShift, float RimHueShiftSpeed, int RimBlendMode) + void ApplyLiltoonRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods, float4 RimColor, float4 RimIndirColor, float4 RimColorTex, float RimMainStrength, float RimNormalStrength, float RimDirRange, float RimIndirRange, float RimFresnelPower, float RimBackfaceMask, float RimDirStrength, float RimBorder, float RimBlur, float RimIndirBorder, float RimIndirBlur, float RimShadowMask, float RimEnableLighting, float RimVRParallaxStrength, float RimGlobalMask, float RimGlobalMaskBlendType, float RimHueShiftEnabled, float RimHueShift, float RimHueShiftColorSpace, float RimHueShiftSpeed, int RimBlendMode) { if (RimGlobalMask > 0) { - RimColorTex.a = maskBlend(RimColorTex.a, poiMods.globalMask[RimGlobalMask-1], RimGlobalMaskBlendType); + RimColorTex.a = maskBlend(RimColorTex.a, poiMods.globalMask[RimGlobalMask - 1], RimGlobalMaskBlendType); } float4 rimColor = RimColor; float4 rimIndirColor = RimIndirColor; rimColor *= RimColorTex; rimIndirColor *= RimColorTex; - + if (RimHueShiftEnabled) { - rimColor.rgb = hueShift(rimColor.rgb, RimHueShift + _Time.x * RimHueShiftSpeed); - rimIndirColor.rgb = hueShift(rimIndirColor.rgb, RimHueShift + _Time.x * RimHueShiftSpeed); + rimColor.rgb = hueShift(rimColor.rgb, RimHueShift + _Time.x * RimHueShiftSpeed, RimHueShiftColorSpace); + rimIndirColor.rgb = hueShift(rimIndirColor.rgb, RimHueShift + _Time.x * RimHueShiftSpeed, RimHueShiftColorSpace); } - + rimColor.rgb = lerp(rimColor.rgb, rimColor.rgb * poiFragData.baseColor, RimMainStrength); - + // View direction float3 centerViewDir = !IsOrthographicCamera() ? normalize(getCameraPosition() - poiMesh.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22); float3 viewDir = lerp(centerViewDir, poiCam.viewDir, RimVRParallaxStrength); - + // Normal float3 normal = lerp(poiMesh.normals[0], poiMesh.normals[1], RimNormalStrength); float nvabs = abs(dot(normal, viewDir)); - + // Factor float lnRaw = dot(poiLight.direction, normal) * 0.5 + 0.5; float lnDir = saturate((lnRaw + RimDirRange) / (1.0 + RimDirRange)); - float lnIndir = saturate((1.0-lnRaw + RimIndirRange) / (1.0 + RimIndirRange)); + float lnIndir = saturate((1.0 - lnRaw + RimIndirRange) / (1.0 + RimIndirRange)); float rim = pow(saturate(1.0 - nvabs), RimFresnelPower); rim = !poiMesh.isFrontFace && RimBackfaceMask ? 0.0 : rim; float rimDir = lerp(rim, rim * lnDir, RimDirStrength); float rimIndir = rim * lnIndir * RimDirStrength; - + rimDir = poiEdgeLinear(rimDir, RimBorder, RimBlur); rimIndir = poiEdgeLinear(rimIndir, RimIndirBorder, RimIndirBlur); - + rimDir = lerp(rimDir, rimDir * poiLight.rampedLightMap, RimShadowMask); rimIndir = lerp(rimIndir, rimIndir * poiLight.rampedLightMap, RimShadowMask); - - float3 lightCol = poiLight.directColor + poiLight.indirectColor; + + float3 lightCol = poiLight.finalLighting; + /* #if !defined(POI_PASS_ADD) rimColor.rgb = lerp(rimColor.rgb, rimColor.rgb * lightCol, RimEnableLighting); #else - if(RimBlendMode < 3) rimColor.rgb *= lightCol * RimEnableLighting; + if (RimBlendMode < 3) rimColor.rgb *= lightCol * RimEnableLighting; #endif - poiFragData.baseColor = lilBlendColor(poiFragData.baseColor, rimColor.rgb, rimDir * rimColor.a, RimBlendMode); - poiFragData.baseColor = lilBlendColor(poiFragData.baseColor, rimIndirColor.rgb, rimIndir * rimIndirColor.a, RimBlendMode); + // Blend + */ + #if !defined(POI_PASS_ADD) + float3 rimLightMul = 1 - RimEnableLighting + lightCol * RimEnableLighting; + #else + float3 rimLightMul = RimBlendMode < 3 ? lightCol * RimEnableLighting : 1; + #endif + + poiFragData.finalColor = lilBlendColor(poiFragData.finalColor, rimColor.rgb * rimLightMul, rimDir * rimColor.a, RimBlendMode); + poiFragData.finalColor = lilBlendColor(poiFragData.finalColor, rimIndirColor.rgb * rimLightMul, rimIndir * rimIndirColor.a, RimBlendMode); } #endif #endif //endex - + //ifex _EnableDepthRimLighting==0 #ifdef _POI_DEPTH_RIMLIGHT - + float PositivePow(float base, float power) { return pow(max(abs(base), Epsilon), power); } - + float GetScaleWithHight() { return _ScreenParams.y / 1080; } - + float GetSSRimScale(float z) { float w = (1.0 / (PositivePow(z + saturate(UNITY_MATRIX_P._m00), 1.5) + 0.75)) * GetScaleWithHight(); w *= lerp(1, UNITY_MATRIX_P._m00, 0.60 * saturate(0.25 * z * z)); return w < 0.01 ? 0 : w; } - + void ApplyDepthRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, inout PoiLight poiLight, in PoiMods poiMods) { float rim = 0; @@ -35324,35 +36296,35 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 direction = poiCam.worldDirection * perspectiveDivide; float2 screenPos = poiCam.posScreenSpace.xy * perspectiveDivide; float z = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, screenPos); - + #if UNITY_REVERSED_Z if (z == 0) return; #else if (z == 1) return; #endif - + float depth = CorrectedLinearEyeDepth(z, direction.w); - + switch(_DepthRimType) { case 0: { float3 viewPos = UnityObjectToViewPos(poiMesh.localPos); float3 viewDir = normalize(viewPos); - + float3 viewNorm = mul((float3x3)UNITY_MATRIX_V, poiMesh.normals[_DepthRimNormalToUse]); float3 viewCrossNorm = cross(viewDir, viewNorm); float2 N_View = normalize(float2(-viewCrossNorm.y, viewCrossNorm.x)); - + float3 viewLight = mul((float3x3)UNITY_MATRIX_V, poiLight.direction); float3 viewCrossLight = cross(viewDir, viewLight); float2 L_View = normalize(float2(-viewCrossLight.y, viewCrossLight.x)); - + //float lDotN = saturate(poiLight.nDotL + _RimLightLength); float scale = _DepthRimWidth * GetSSRimScale(depth); float2 ssUV1 = clamp(screenPos + N_View * .1 * scale, 0, _ScreenParams.xy - 1); float depthDiff = z - SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, ssUV1) ; - + rim = smoothstep(0.24 * _DepthRimSharpness * z, 0.25 * z, depthDiff); rim *= lerp(1, (dot(L_View, N_View) > 0), _DepthRimHideInShadow); } @@ -35373,9 +36345,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } break; } - + float3 rimColor = poiThemeColor(poiMods, _DepthRimColor.rgb, _DepthRimColorThemeIndex).rgb * lerp(1, poiLight.directColor, _DepthRimMixLightColor) * lerp(1, poiFragData.baseColor, _DepthRimMixBaseColor) * _DepthRimBrightness; - + #ifdef POI_PASS_BASE poiLight.finalLightAdd += rim * rimColor * _DepthRimAdditiveLighting; #endif @@ -35386,10 +36358,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _GlitterEnable==0 #ifdef _SUNDISK_SIMPLE - + float3 RandomColorFromPoint(float2 rando, PoiMods poiMods) { fixed hue = random2(rando.x + rando.y).x; @@ -35398,7 +36370,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 hsv = float3(hue, saturation, value); return HSVtoRGB(hsv); } - + void applyGlitter(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods) { float glitterRotationTimeOffset = 0; @@ -35408,17 +36380,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" glitterRotationTimeOffset += AudioLinkGetChronoTime(_GlitterALChronoRotationSpeedType, _GlitterALChronoRotationSpeedBand) * _GlitterALChronoRotationSpeed; } #endif - + for (int glitterLayer = 0; glitterLayer < _GlitterLayers; glitterLayer++) { // Scale - + float2 st = (poiMesh.uv[_GlitterUV] + _GlitterUVPanning.xy * _Time.x) * _GlitterFrequency; - + // Tile the space float2 i_st = floor(st); float2 f_st = frac(st); - + float m_dist = 10.; // minimun distance float2 m_point = 0; // minimum point float2 randoPoint = 0; @@ -35433,7 +36405,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" pos = pos * _GlitterRandomLocation; float2 diff = neighbor + pos - f_st; float dist = length(diff); - + if (dist < m_dist) { dank = diff; @@ -35443,9 +36415,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } } - + float randomFromPoint = random(randoPoint); - + float size = _GlitterSize; UNITY_BRANCH if (_GlitterRandomSize) @@ -35458,16 +36430,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" size = saturate(size + lerp(_GlitterALSizeAdd.x, _GlitterALSizeAdd.y, poiMods.audioLink[_GlitterALSizeAddBand])); } #endif - + // Assign a color using the closest point position //color += dot(m_point, float2(.3, .6)); - + // Add distance field to closest point center // color.g = m_dist; - + // Show isolines //color -= abs(sin(40.0 * m_dist)) * 0.07; - + // Draw cell center half glitterAlpha = 1; switch(_GlitterShape) @@ -35505,11 +36477,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } break; } - + float3 finalGlitter = 0; - + half3 glitterColor = poiThemeColor(poiMods, _GlitterColor.rgb, _GlitterColorThemeIndex); - + float3 norm = lerp(poiMesh.normals[0], poiMesh.normals[1], _GlitterUseNormals); float3 randomRotation = 0; float glitterSpeedOffset = 0; @@ -35531,7 +36503,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange); } - + float3 glitterReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm)); finalGlitter = lerp(0, _GlitterMinBrightness * glitterAlpha, glitterAlpha) + max(pow(saturate(dot(lerp(glitterReflectionDirection, poiCam.viewDir, _GlitterBias), poiCam.viewDir)), _GlitterContrast), 0); finalGlitter *= glitterAlpha; @@ -35550,29 +36522,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange); } - + float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm)); - + glitterAlpha *= poiLight.nDotLSaturated; - + float3 halfDir = normalize(poiLight.direction + poiCam.viewDir); float specAngle = max(dot(halfDir, glitterLightReflectionDirection), 0.0); - + finalGlitter = lerp(0, _GlitterMinBrightness * glitterAlpha, glitterAlpha) + max(pow(specAngle, _GlitterContrast), 0); - + glitterColor *= poiLight.directColor; finalGlitter *= glitterAlpha; - + break; } - + glitterColor *= lerp(1, poiFragData.baseColor, _GlitterUseSurfaceColor); #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED) glitterColor *= POI2D_SAMPLER_PAN(_GlitterColorMap, _MainTex, poiUV(poiMesh.uv[_GlitterColorMapUV], _GlitterColorMap_ST), _GlitterColorMapPan).rgb; #endif float2 uv = remapClamped(-size, size, dank, 0, 1); UNITY_BRANCH - + if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0 || _GlitterRandomRotationSpeed.x != 0 || _GlitterRandomRotationSpeed.y && !_GlitterShape || glitterRotationTimeOffset != 0) { float2 fakeUVCenter = float2(.5, .5); @@ -35593,7 +36565,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float sn = sin(theta); uv = float2((uv.x - fakeUVCenter.x) * cs - (uv.y - fakeUVCenter.y) * sn + fakeUVCenter.x, (uv.x - fakeUVCenter.x) * sn + (uv.y - fakeUVCenter.y) * cs + fakeUVCenter.y); } - + #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED) float4 glitterTexture = POI2D_SAMPLER_PANGRAD(_GlitterTexture, _linear_clamp, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan, poiMesh.dx, poiMesh.dy); #else @@ -35606,37 +36578,37 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float glitterMask = 1; #endif - + #ifdef POI_AUDIOLINK if (_GlitterALEnabled) { glitterMask = clamp(glitterMask + lerp(_GlitterALAlphaAdd.x, _GlitterALAlphaAdd.y, poiMods.audioLink[_GlitterALAlphaAddBand]), 0, glitterMask); } #endif - + if (_GlitterMaskInvert) { glitterMask = 1 - glitterMask; } - + glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow); glitterMask *= lerp(1, poiLight.directLuminance, _GlitterScaleWithLighting); glitterMask *= _GlitterColor.a; - + if (_GlitterMaskGlobalMask > 0) { glitterMask = maskBlend(glitterMask, poiMods.globalMask[_GlitterMaskGlobalMask - 1], _GlitterMaskGlobalMaskBlendType); } - + if (_GlitterRandomColors) { glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y), poiMods); } - + UNITY_BRANCH if (_GlitterHueShiftEnabled) { - glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed); + glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed, _GlitteHueShiftColorSpace); } float GlitterbrightnessOffset = 0; #ifdef POI_AUDIOLINK @@ -35645,7 +36617,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" GlitterbrightnessOffset = max(GlitterbrightnessOffset +lerp(_GlitterALMaxBrightnessAdd.x, _GlitterALMaxBrightnessAdd.y, poiMods.audioLink[_GlitterALMaxBrightnessBand]), 0); } #endif - + UNITY_BRANCH if (_GlitterBlendType == 1) { @@ -35660,7 +36632,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _SubsurfaceScattering==0 #ifdef POI_SUBSURFACESCATTERING void applySubsurfaceScattering(in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiFragData poiFragData) @@ -35670,7 +36642,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" SSS = POI2D_SAMPLER_PAN(_SSSThicknessMap, _MainTex, poiUV(poiMesh.uv[_SSSThicknessMapUV], _SSSThicknessMap_ST), _SSSThicknessMapPan); SSS.a = 1 - SSS.a; #endif - + float3 vLTLight = poiLight.direction + poiMesh.normals[0] * _SSSDistortion; float flTDot = pow(saturate(dot(poiCam.viewDir, -vLTLight)), _SSSSpread) * _SSSStrength; #ifdef UNITY_PASS_FORWARDBASE @@ -35678,7 +36650,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float3 fLT = poiLight.additiveShadow * (flTDot) * saturate(SSS.a + - 1 * _SSSThicknessMod); #endif - + #if defined(POINT) || defined(SPOT) poiLight.finalLightAdd += fLT * poiLight.directColor * _SSSColor * SSS.rgb * lerp(1, poiFragData.baseColor, _SSSBaseColorMix); #endif @@ -35686,10 +36658,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _MochieBRDF==0 && _ClearCoatBRDF==0 #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT) - + /* * Copyright 2022 orels1 * @@ -35699,45 +36671,45 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - + // https://github.com/orels1/orels-Unity-Shaders - + float GSAA_Filament(float3 worldNormal, float perceptualRoughness, float gsaaVariance, float gsaaThreshold) { // Kaplanyan 2016, "Stable specular highlights" // Tokuyoshi 2017, "Error Reduction and Simplification for Shading Anti-Aliasing" // Tokuyoshi and Kaplanyan 2019, "Improved Geometric Specular Antialiasing" - + // This implementation is meant for deferred rendering in the original paper but // we use it in forward rendering as well (as discussed in Tokuyoshi and Kaplanyan // 2019). The main reason is that the forward version requires an expensive transform // of the float vector by the tangent frame for every light. This is therefore an // approximation but it works well enough for our needs and provides an improvement // over our original implementation based on Vlachos 2015, "Advanced VR Rendering". - + float3 du = ddx(worldNormal); float3 dv = ddy(worldNormal); - + float variance = gsaaVariance * (dot(du, du) + dot(dv, dv)); - + float roughness = perceptualRoughness * perceptualRoughness; float kernelRoughness = min(2.0 * variance, gsaaThreshold); float squareRoughness = saturate(roughness * roughness + kernelRoughness); - + return sqrt(sqrt(squareRoughness)); } - + /* MIT END */ - + bool SceneHasReflections() { float width, height; unity_SpecCube0.GetDimensions(width, height); return !(width * height < 2); } - + float3 GetWorldReflections(float3 reflDir, float3 worldPos, float roughness) { float3 baseReflDir = reflDir; @@ -35755,7 +36727,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return p0; } - + float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float4 hdrData, float3 reflectionDir) { float3 reflections = 0; @@ -35802,7 +36774,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" reflections *= pl.occlusion; return reflections; } - + float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness) { float visibilityTerm = 0; @@ -35810,26 +36782,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { float rough = roughness; float rough2 = roughness * roughness; - + float lambdaV = nDotL * (nDotV * (1 - rough) + rough); float lambdaL = nDotV * (nDotL * (1 - rough) + rough); - + visibilityTerm = 0.5f / (lambdaV + lambdaL + 1e-5f); float d = (nDotH * rough2 - nDotH) * nDotH + 1.0f; float dotTerm = UNITY_INV_PI * rough2 / (d * d + 1e-7f); - + visibilityTerm *= dotTerm * UNITY_PI; } return visibilityTerm; } - + void GetSpecFresTerm(float nDotL, float nDotV, float nDotH, float lDotH, inout float3 specularTerm, inout float3 fresnelTerm, float3 specCol, float roughness) { specularTerm = GetGGXTerm(nDotL, nDotV, nDotH, roughness); fresnelTerm = FresnelTerm(specCol, lDotH); specularTerm = max(0, specularTerm * max(0.00001, nDotL)); } - + float GetRoughness(float smoothness) { float rough = 1 - smoothness; @@ -35838,7 +36810,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _MochieBRDF==0 #ifdef MOCHIE_PBR void MetallicAndSpecularFragDataInit(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) @@ -35848,13 +36820,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float metallic = _MochieMetallicMultiplier; float specularMask = 1; float reflectionMask = 1; - + smoothness *= poiFragData.smoothness; smoothness2 *= poiFragData.smoothness2; metallic *= poiFragData.metallic; specularMask *= poiFragData.specularMask; reflectionMask *= poiFragData.reflectionMask; - + #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED) float4 PBRMaps = POI2D_SAMPLER_PAN_STOCHASTIC(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan, _MochieMetallicMapsStochastic); UNITY_BRANCH @@ -35864,7 +36836,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" assignValueToVectorFromIndex(PBRMaps, _MochieMetallicMapsReflectionMaskChannel, PBRSplitMask[_MochieMetallicMapsReflectionMaskChannel]); assignValueToVectorFromIndex(PBRMaps, _MochieMetallicMapsSpecularMaskChannel, PBRSplitMask[_MochieMetallicMapsSpecularMaskChannel]); } - + if (_MochieMetallicMapsMetallicChannel < 4) { metallic *= PBRMaps[_MochieMetallicMapsMetallicChannel]; @@ -35883,10 +36855,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" specularMask *= PBRMaps[_MochieMetallicMapsSpecularMaskChannel]; } #endif - + reflectionMask *= _MochieReflectionStrength; specularMask *= _MochieSpecularStrength; - + if (_MochieMetallicMapInvert) { metallic = 1 - metallic; @@ -35904,14 +36876,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { specularMask = 1 - specularMask; } - + poiFragData.smoothness *= smoothness; poiFragData.smoothness2 *= smoothness2; poiFragData.metallic *= metallic; poiFragData.specularMask *= specularMask; poiFragData.reflectionMask *= reflectionMask; } - + void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, inout PoiMods poiMods) { float smoothness = poiFragData.smoothness; @@ -35919,7 +36891,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float metallic = poiFragData.metallic; float specularMask = poiFragData.specularMask; float reflectionMask = poiFragData.reflectionMask; - + if (_MochieMetallicGlobalMask > 0) { metallic = customBlend(metallic, poiMods.globalMask[_MochieMetallicGlobalMask - 1], _MochieMetallicGlobalMaskBlendType); @@ -35937,7 +36909,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { specularMask = customBlend(specularMask, poiMods.globalMask[_MochieSpecularStrengthGlobalMask - 1], _MochieSpecularStrengthGlobalMaskBlendType); } - + #ifdef TPS_Penetrator if (_BRDFTPSDepthEnabled) { @@ -35945,7 +36917,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" specularMask = lerp(0, specularMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSSpecularMaskStrength); } #endif - + float roughness = GetRoughness(smoothness); float roughness2 = GetRoughness(smoothness2); float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic); @@ -35963,10 +36935,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } float brdfRoughness = percepRough * percepRough; brdfRoughness = max(brdfRoughness, 0.002); - + float brdfRoughness2 = percepRough2 * percepRough2; brdfRoughness2 = max(brdfRoughness2, 0.002); - + float3 diffuse = poiFragData.baseColor; float3 specular = 0; float3 specular2 = 0; @@ -35974,24 +36946,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 vSpecular2 = 0; float3 reflections = 0; float3 environment = 0; - + #if defined(POINT) || defined(SPOT) float attenuation = lerp(poiLight.additiveShadow, 1, _IgnoreCastedShadows); #else float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows)); #endif - + float3 fresnelTerm = 1; float3 specularTerm = 1; - + float pbrNDotL = lerp(poiLight.vertexNDotL, poiLight.nDotL, _PBRNormalSelect); float pbrNDotV = lerp(poiLight.vertexNDotV, poiLight.nDotV, _PBRNormalSelect); float pbrNDotH = lerp(poiLight.vertexNDotH, poiLight.nDotH, _PBRNormalSelect); float3 pbrReflectionDir = lerp(poiCam.vertexReflectionDir, poiCam.reflectionDir, _PBRNormalSelect); - + GetSpecFresTerm(pbrNDotL, pbrNDotV, pbrNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness); specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation; - + if (poiFragData.toggleVertexLights) { #if defined(VERTEXLIGHT_ON) @@ -36006,14 +36978,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif } - + if (_Specular2ndLayer == 1) { float3 fresnelTerm = 1; float3 specularTerm = 1; GetSpecFresTerm(pbrNDotL, pbrNDotV, pbrNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2); specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2; - + if (poiFragData.toggleVertexLights) { #if defined(VERTEXLIGHT_ON) @@ -36029,7 +37001,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif } } - + float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0)); float grazingTerm = saturate(smoothness + (1 - omr)); float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, _MochieReflCube_HDR, pbrReflectionDir); @@ -36041,11 +37013,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { reflections = surfaceReduction * reflCol * lerp(1, FresnelLerp(specCol, grazingTerm, pbrNDotV), _RefSpecFresnelBack); } - + reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex); reflections *= reflectionMask; diffuse = lerp(diffuse, diffuse * omr, reflectionMask); - + environment = max(specular + vSpecular, specular2 + vSpecular2); environment += reflections; diffuse *= poiLight.finalLighting; @@ -36062,10 +37034,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float smoothness = _ClearCoatSmoothness; float reflectionMask = _ClearCoatReflectionStrength; float specularMask = _ClearCoatSpecularStrength; - + #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED) float4 PBRMaps = POI2D_SAMPLER_PAN_STOCHASTIC(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan, _ClearCoatMapsStochastic); - + if (_ClearCoatMapsClearCoatMaskChannel < 4) { clearCoatMask *= PBRMaps[_ClearCoatMapsClearCoatMaskChannel]; @@ -36083,7 +37055,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" specularMask *= PBRMaps[_ClearCoatMapsSpecularMaskChannel]; } #endif - + if (_ClearCoatGlobalMask > 0) { clearCoatMask = customBlend(clearCoatMask, poiMods.globalMask[_ClearCoatGlobalMask - 1], _ClearCoatGlobalMaskBlendType); @@ -36100,7 +37072,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { specularMask = customBlend(specularMask, poiMods.globalMask[_ClearCoatSpecularStrengthGlobalMask - 1], _ClearCoatSpecularStrengthGlobalMaskBlendType); } - + if (_ClearCoatMaskInvert) { clearCoatMask = 1 - clearCoatMask; @@ -36123,7 +37095,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" clearCoatMask = lerp(0, clearCoatMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _ClearCoatTPSMaskStrength); } #endif - + float roughness = GetRoughness(smoothness); float3 specCol = 0.220916301; float omr = unity_ColorSpaceDielectricSpec.a; @@ -36135,22 +37107,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } float brdfRoughness = percepRough * percepRough; brdfRoughness = max(brdfRoughness, 0.002); - + float3 diffuse = 0; float3 specular = 0; float3 vSpecular = 0; float3 reflections = 0; float3 environment = 0; float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _CCIgnoreCastedShadows)); - + float3 fresnelTerm = 1; float3 specularTerm = 1; - + float clearcoatNDotL = lerp(poiLight.vertexNDotL, poiLight.nDotL, _ClearCoatNormalSelect); float clearcoatNDotV = lerp(poiLight.vertexNDotV, poiLight.nDotV, _ClearCoatNormalSelect); float clearcoatNDotH = lerp(poiLight.vertexNDotH, poiLight.nDotH, _ClearCoatNormalSelect); float3 clearcoatReflectionDir = lerp(poiCam.vertexReflectionDir, poiCam.reflectionDir, _ClearCoatNormalSelect); - + GetSpecFresTerm(clearcoatNDotL, clearcoatNDotV, clearcoatNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness); specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation; if (poiFragData.toggleVertexLights) @@ -36167,14 +37139,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif } - + float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0)); float grazingTerm = saturate(smoothness + (1 - omr)); float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, _ClearCoatFallback_HDR, clearcoatReflectionDir); reflections = surfaceReduction * reflCol * lerp(1, FresnelLerp(specCol, grazingTerm, clearcoatNDotV), _ClearcoatFresnel); reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflectionMask; diffuse = lerp(diffuse, diffuse * omr, reflectionMask); - + environment = specular + vSpecular; #ifdef UNITY_PASS_FORWARDBASE environment += reflections; @@ -36185,7 +37157,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _StylizedSpecular==0 #ifdef POI_STYLIZED_StylizedSpecular void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods) @@ -36196,7 +37168,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float3 specularMap = 1; #endif - + // Spec 1 float specMask1 = 0; float specMask2 = 0; @@ -36210,21 +37182,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" specMask1 += poiEdgeNonLinear(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength; specMask2 += poiEdgeNonLinear(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength; } - + #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED) float specularMask = POI2D_SAMPLER_PAN(_Set_HighColorMask, _MainTex, poiUV(poiMesh.uv[_Set_HighColorMaskUV], _Set_HighColorMask_ST), _Set_HighColorMaskPan)[_Set_HighColorMaskChannel]; #else float specularMask = 1; #endif - + if(_StylizedSpecularInvertMask) + { + specularMask = 1 - specularMask; + } specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel); - + float specMask = saturate(specMask1 + specMask2) * specularMask * lerp(poiLight.rampedLightMap, 1, _StylizedSpecularIgnoreShadow); float attenuation = min(lerp(poiLight.nDotLSaturated, 1, _StylizedSpecularIgnoreNormal), lerp(lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows), 1, _StylizedSpecularIgnoreShadow)); #ifdef POI_PASS_ADD attenuation *= lerp(poiLight.additiveShadow, 1, _SSIgnoreCastedShadows); #endif - + float finalSpecMask = min(min(specMask, poiLight.occlusion), attenuation) * _StylizedSpecularStrength; switch(_Is_BlendAddToHiColor) { @@ -36245,9 +37220,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), finalSpecMask); break; } - + //poiFragData.baseColor = _StylizedSpecularStrength; - + float3 vSpecMask = 0; if (poiFragData.toggleVertexLights) { @@ -36266,7 +37241,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" vSpecMask = poiEdgeNonLinear(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation[index]; vSpecMask = max(vSpecMask, poiEdgeNonLinear(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation[index]); } - + vSpecMask *= specularMask; float finalSpecMask = min(min(vSpecMask, poiLight.occlusion), attenuation) * _StylizedSpecularStrength; switch(_Is_BlendAddToHiColor) @@ -36294,7 +37269,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _EnablePathing==0 #ifdef POI_PATHING void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) @@ -36323,25 +37298,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" PathColor[1] = _PathColorG; PathColor[2] = _PathColorB; PathColor[3] = _PathColorA; - + // Combined data if (_PathGradientType == 1) { path = (path.r + path.g + path.b + path.a) * .25; } - + #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED) float4 pathColorMap = POI2D_SAMPLER_PAN(_PathingColorMap, _MainTex, poiUV(poiMesh.uv[_PathingColorMapUV], _PathingColorMap_ST), _PathingColorMapPan); #else float4 pathColorMap = float4(1, 1, 1, 1); #endif - + float4 pathAudioLinkEmission = 0; float4 pathTime = 0; float3 pathAlpha[4] = { float3(0.0, 0.0, 0.0), float3(0.0, 0.0, 0.0), float3(0.0, 0.0, 0.0), float3(0.0, 0.0, 0.0) }; - + #ifdef POI_AUDIOLINK float4 chronoType = float4(_PathChronoTypeR, _PathChronoTypeG, _PathChronoTypeB, _PathChronoTypeA); float4 chronoBand = float4(_PathChronoBandR, _PathChronoBandG, _PathChronoBandB, _PathChronoBandA); @@ -36354,7 +37329,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4(_PathALHistoryR, _PathALHistoryBandR, _PathALHistoryRangeR[0], _PathALHistoryRangeR[1]), float4(_PathALHistoryG, _PathALHistoryBandG, _PathALHistoryRangeG[0], _PathALHistoryRangeG[1]), float4(_PathALHistoryB, _PathALHistoryBandB, _PathALHistoryRangeB[0], _PathALHistoryRangeB[1]), float4(_PathALHistoryA, _PathALHistoryBandA, _PathALHistoryRangeA[0], _PathALHistoryRangeA[1]) }; - + if (poiMods.audioLinkAvailable) { if (_PathALTimeOffset) @@ -36368,7 +37343,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy; pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy; } - + if (_PathALWidthOffset) { pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR; @@ -36388,7 +37363,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]); pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]); } - + if(_PathALColorChord) { if (_PathALCCR) @@ -36410,7 +37385,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } #endif - + [unroll] for (int index = 0; index < 4; index++) { @@ -36423,7 +37398,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]); } - + if (_PathALChrono) { timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index]; @@ -36431,13 +37406,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif pathTime[index] = _PathTime[index] != -999.0f ? frac(_PathTime[index] + _PathOffset[index] + timeOffset) : frac(_Time.x * _PathSpeed[index] + _PathOffset[index] + timeOffset); - + if (_PathSegments[index]) { float pathSegments = abs(_PathSegments[index]); pathTime = (ceil(pathTime * pathSegments) - .5) / pathSegments; } - + if (path[index]) { // Cutting it in half because it goes out in both directions for now @@ -36452,7 +37427,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } #endif - + //fill pathAlpha[index].x = pathTime[index] > path[index]; //path @@ -36461,7 +37436,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" pathAlpha[index].z = saturate((1 - distance(pathTime[index], path[index])) - (1 - pathWidth)) * (1 / pathWidth); pathAlpha[index].z += saturate(distance(pathTime[index], path[index]) - (1 - pathWidth)) * (1 / pathWidth); pathAlpha[index] = smoothstep(0, _PathSoftness[index] + .00001, pathAlpha[index]); - + #ifdef POI_AUDIOLINK if (poiMods.audioLinkAvailable) { @@ -36469,23 +37444,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { // history[index]: [0]: on/off, [1]: band, [2]/[3] min/max float historyUV = lerp(history[index][2], history[index][3], path[index]); - + if (_PathSegments[index]) { float pathSegments = abs(_PathSegments[index]); historyUV = (ceil(historyUV * pathSegments) - .5) / pathSegments; } - + historyUV *= AUDIOLINK_WIDTH; - + float historyValue = AudioLinkLerp(ALPASS_AUDIOLINK + float2(historyUV, history[index][1]))[0]; - + if(_PathALHistoryMode == 0) // Mask pathAlpha[index] *= historyValue; else // Override pathAlpha[index] = historyValue; } - + if (_PathALAutoCorrelator && autoCorrelator[index][0] != 0) { // autoCorrelator[index]: [0]: on/off, [1]/[2]: min/max @@ -36495,33 +37470,33 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { autoCorrelatorUV = abs(1. - autoCorrelatorUV * 2.); } - + if (_PathSegments[index]) { float pathSegments = abs(_PathSegments[index]); autoCorrelatorUV = (ceil(autoCorrelatorUV * pathSegments) - .5) / pathSegments; } - + // Normalize Autocorrelator Value float autoCorrelatorValue = AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0))[0]; float autoCorrelatorMax = AudioLinkLerp(ALPASS_AUTOCORRELATOR); autoCorrelatorValue = saturate(abs(autoCorrelatorValue) * rcp(autoCorrelatorMax)); - + // Autocorrelator is normalized, so can look weird at lower volume levels. use Filtered VU intensity to make it smoothly fall off at low volume levels. float4 vu = AudioLinkData(ALPASS_FILTEREDVU_INTENSITY + uint2(0, 0)); autoCorrelatorValue *= smoothstep(0.01, 0.2, vu); - + if(_PathALAutoCorrelatorMode == 0) // Mask pathAlpha[index] *= autoCorrelatorValue; else // Override pathAlpha[index] = autoCorrelatorValue; - + } } #endif } } - + // Emission pathEmission = 0; pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r); @@ -36529,7 +37504,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" pathEmission += pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * (_PathEmissionStrength[2] + pathAudioLinkEmission.b); pathEmission += pathAlpha[3][_PathTypeA] * poiThemeColor(poiMods, PathColor[3].rgb, _PathColorAThemeIndex) * (_PathEmissionStrength[3] + pathAudioLinkEmission.a); pathEmission *= pathColorMap.rgb * pathColorMap.a; - + float3 colorReplace = 0; colorReplace = pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * pathColorMap.rgb; albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[0].a * pathAlpha[0][_PathTypeR]); @@ -36539,16 +37514,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[2].a * pathAlpha[2][_PathTypeB]); colorReplace = pathAlpha[3][_PathTypeA] * poiThemeColor(poiMods, PathColor[3].rgb, _PathColorAThemeIndex) * pathColorMap.rgb; albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[3].a * pathAlpha[3][_PathTypeA]); - + float alpha = max(max(max(pathAlpha[0][_PathTypeR], pathAlpha[1][_PathTypeG]), pathAlpha[2][_PathTypeB]), pathAlpha[3][_PathTypeA]); - + poiFragData.alpha *= lerp(1, alpha, _PathingOverrideAlpha); poiFragData.baseColor = albedo.rgb; poiFragData.emission += pathEmission; } #endif //endex - + //ifex _EnableMirrorOptions==0 #ifdef POI_MIRROR void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) @@ -36564,7 +37539,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { inMirror = IsInMirror(); } - + #if (defined(POI_PASS_BASE) || defined(POI_PASS_ADD)) #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED) float4 mirrorTexture = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiUV(poiMesh.uv[_MirrorTextureUV], _MirrorTexture_ST), _MirrorTexturePan); @@ -36583,50 +37558,50 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _EnableTouchGlow==0 #ifdef GRAIN void applyDepthFX(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods) { float3 touchEmission = 0; - + float perspectiveDivide = 1.0f / poiCam.clipPos.w; float4 direction = poiCam.worldDirection * perspectiveDivide; float2 screenPos = poiCam.posScreenSpace * perspectiveDivide; float z = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, screenPos); - + #if UNITY_REVERSED_Z if (z == 0) #else if (z == 1) #endif return; - + float depth = CorrectedLinearEyeDepth(z, direction.w); float3 worldpos = direction * depth + _WorldSpaceCameraPos.xyz; /* finalColor.rgb = frac(worldpos); return; */ - + float diff = distance(worldpos, poiMesh.worldPos); //poiFragData.finalColor = diff; - + #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED) float depthMask = POI2D_SAMPLER_PAN(_DepthMask, _MainTex, poiUV(poiMesh.uv[_DepthMaskUV], _DepthMask_ST), _DepthMaskPan)[_DepthMaskChannel]; #else float depthMask = 1; #endif - + if (_DepthMaskGlobalMask > 0) { depthMask = maskBlend(depthMask, poiMods.globalMask[_DepthMaskGlobalMask - 1], _DepthMaskGlobalMaskBlendType); } - + if (_DepthColorToggle) { float colorBlendAlpha = lerp(_DepthColorMinValue, _DepthColorMaxValue, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff)); - + #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED) float2 depthTextureUV = float2(0, 0); if (_DepthTextureUV == 8) @@ -36641,7 +37616,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex); #endif - + switch(_DepthColorBlendMode) { case 0: @@ -36662,7 +37637,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask; } - + if (_DepthAlphaToggle) { poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask); @@ -36670,10 +37645,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _TextEnabled==0 #ifdef EFFECT_BUMP - + float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv) { float theta = radians(rotation); @@ -36682,20 +37657,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float sn = sin(theta); float2 centerPoint = offset + .5; uv = float2((uv.x - centerPoint.x) * cs - (uv.y - centerPoint.y) * sn + centerPoint.x, (uv.x - centerPoint.x) * sn + (uv.y - centerPoint.y) * cs + centerPoint.y); - + return remap(uv, float2(0, 0) + offset + (scale * .5), float2(1, 1) + offset - (scale * .5), float2(0, 0), float2(1, 1)); } - + float2 getAsciiCoordinate(float index) { return float2((index - 1) / 16, 1 - ((floor(index / 16 - glyphWidth)) / 16)); } - + float median(float r, float g, float b) { return max(min(r, g), min(max(r, g), b)); } - + void ApplyPositionText(inout PoiFragData poiFragData, float2 uv, in PoiMods poiMods) { float3 cameraPos = clamp(getCameraPosition(), -999, 999); @@ -36722,30 +37697,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" positionArray[17] = floor(absCameraPos.z % 10) + 48; positionArray[18] = ASCII_PERIOD; positionArray[19] = floor((absCameraPos.z * 10) % 10) + 48; - + uv = TransformUV(_TextPositionOffset, _TextPositionRotation, _TextPositionScale, uv); - + if (uv.x > 1 || uv.x < 0 || uv.y > 1 || uv.y < 0) { return; } - + float currentCharacter = floor(uv.x * totalCharacters); float2 glyphPos = getAsciiCoordinate(positionArray[currentCharacter]); - + float2 startUV = float2(1 / totalCharacters * currentCharacter, 0); float2 endUV = float2(1 / totalCharacters * (currentCharacter + 1), 1); - + fixed4 textPositionPadding = _TextPositionPadding; textPositionPadding *= 1 / totalCharacters; - + uv = remapClamped(startUV, endUV, uv, float2(glyphPos.x + textPositionPadding.x, glyphPos.y - glyphWidth + textPositionPadding.y), float2(glyphPos.x + glyphWidth - textPositionPadding.z, glyphPos.y - textPositionPadding.w)); - + if (uv.x > glyphPos.x + glyphWidth - textPositionPadding.z - .001 || uv.x < glyphPos.x + textPositionPadding.x + .001 || uv.y > glyphPos.y - textPositionPadding.w - .001 || uv.y < glyphPos.y - glyphWidth + textPositionPadding.y + .001) { return; } - + float3 samp = tex2D(_TextGlyphs, TRANSFORM_TEX(uv, _TextGlyphs)).rgb; float2 msdfUnit = _TextPixelRange / _TextGlyphs_TexelSize.zw; float sigDist = median(samp.r, samp.g, samp.b) - 0.5; @@ -36754,7 +37729,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextPositionColor.rgb, _TextPositionColorThemeIndex), opacity * _TextPositionColor.a); globalTextEmission += poiThemeColor(poiMods, _TextPositionColor.rgb, _TextPositionColorThemeIndex) * opacity * _TextPositionEmissionStrength; } - + void ApplyTimeText(inout PoiFragData poiFragData, float2 uv, in PoiMods poiMods) { float instanceTime = _Time.y; @@ -36771,30 +37746,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" timeArray[5] = ASCII_SEMICOLON; timeArray[6] = floor((seconds * .1) % 10) + 48; timeArray[7] = floor(seconds % 10) + 48; - + uv = TransformUV(_TextTimeOffset, _TextTimeRotation, _TextTimeScale, uv); - + if (uv.x > 1 || uv.x < 0 || uv.y > 1 || uv.y < 0) { return; } - + float currentCharacter = floor(uv.x * totalCharacters); float2 glyphPos = getAsciiCoordinate(timeArray[currentCharacter]); // 0.1428571 = 1/7 = 1 / totalCharacters float startUV = 1 / totalCharacters * currentCharacter; float endUV = 1 / totalCharacters * (currentCharacter + 1); - + fixed4 textTimePadding = _TextTimePadding; textTimePadding *= 1 / totalCharacters; - + uv = remapClamped(float2(startUV, 0), float2(endUV, 1), uv, float2(glyphPos.x + textTimePadding.x, glyphPos.y - glyphWidth + textTimePadding.y), float2(glyphPos.x + glyphWidth - textTimePadding.z, glyphPos.y - textTimePadding.w)); - + if (uv.x > glyphPos.x + glyphWidth - textTimePadding.z - .001 || uv.x < glyphPos.x + textTimePadding.x + .001 || uv.y > glyphPos.y - textTimePadding.w - .001 || uv.y < glyphPos.y - glyphWidth + textTimePadding.y + .001) { return; } - + float3 samp = tex2D(_TextGlyphs, TRANSFORM_TEX(uv, _TextGlyphs)).rgb; float2 msdfUnit = _TextPixelRange / _TextGlyphs_TexelSize.zw; float sigDist = median(samp.r, samp.g, samp.b) - 0.5; @@ -36803,7 +37778,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextTimeColor.rgb, _TextTimeColorThemeIndex), opacity * _TextTimeColor.a); globalTextEmission += poiThemeColor(poiMods, _TextTimeColor.rgb, _TextTimeColorThemeIndex) * opacity * _TextTimeEmissionStrength; } - + void ApplyFPSText(inout PoiFragData poiFragData, float2 uv, in PoiMods poiMods) { float smoothDeltaTime = clamp(unity_DeltaTime.w, 0, 999); @@ -36816,30 +37791,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" fpsArray[4] = floor((smoothDeltaTime * .01) % 10) + 48; fpsArray[5] = floor((smoothDeltaTime * .1) % 10) + 48; fpsArray[6] = floor(smoothDeltaTime % 10) + 48; - + uv = TransformUV(_TextFPSOffset, _TextFPSRotation, _TextFPSScale, uv); - + if (uv.x > 1 || uv.x < 0 || uv.y > 1 || uv.y < 0) { return; } - + float currentCharacter = floor(uv.x * totalCharacters); float2 glyphPos = getAsciiCoordinate(fpsArray[currentCharacter]); // 0.1428571 = 1/7 = 1 / totalCharacters float startUV = 1 / totalCharacters * currentCharacter; float endUV = 1 / totalCharacters * (currentCharacter + 1); - + float4 textFPSPadding = _TextFPSPadding; textFPSPadding *= 1 / totalCharacters; - + uv = remapClamped(float2(startUV, 0), float2(endUV, 1), uv, float2(glyphPos.x + textFPSPadding.x, glyphPos.y - glyphWidth + textFPSPadding.y), float2(glyphPos.x + glyphWidth - textFPSPadding.z, glyphPos.y - textFPSPadding.w)); - + if (uv.x > glyphPos.x + glyphWidth - textFPSPadding.z - .001 || uv.x < glyphPos.x + textFPSPadding.x + .001 || uv.y > glyphPos.y - textFPSPadding.w - .001 || uv.y < glyphPos.y - glyphWidth + textFPSPadding.y + .001) { return; } - + float3 samp = tex2D(_TextGlyphs, TRANSFORM_TEX(uv, _TextGlyphs)).rgb; float2 msdfUnit = _TextPixelRange / _TextGlyphs_TexelSize.zw; float sigDist = median(samp.r, samp.g, samp.b) - 0.5; @@ -36848,7 +37823,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a); globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength; } - + void ApplyNumericText(inout PoiFragData poiFragData, float2 uv, in PoiMods poiMods) { // If both digits are set to zero: exit. @@ -36856,7 +37831,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return; } - + uint wholeNumber = 0; uint decimalNumber = 0; uint wholeDigits = _TextNumericWholeDigits; @@ -36864,18 +37839,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float NumericArray[10]; // 10 is the max amount of characters = 1 sign + 4 max whole digits + 1 decimal mark + 4 max decimal digits uint arrayIndex = 0; float totalCharacters = 1 + wholeDigits + decimalDigits; // Sign Character + Whole Digits + Decimal Digits - + //Determine Sign (_TextNumericValue is usually animated) float charSign = _TextNumericValue >= 0 ? ASCII_SPACE : ASCII_NEGATIVE; - + NumericArray[arrayIndex] = charSign; //First character is always the sign arrayIndex++; - + //Isolate whole number and fill array if (wholeDigits > 0) { wholeNumber = uint(glsl_mod(abs(_TextNumericValue), pow(10, wholeDigits))); - + int expIndex = -1 * (wholeDigits - 1); // Exponent Index bool leadingZero = true; // Pouplate the Array @@ -36885,7 +37860,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int digit = floor(glsl_mod(wholeNumber * pow(10, expIndex), 10)); // Take the resulting value and add 48 to get the corresponding location in the font array. NumericArray[arrayIndex] = digit + 48; - + //Trim Leading Zeroes, but leave at least one. if (_TextNumericTrimZeroes == true) { @@ -36904,7 +37879,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" arrayIndex++; } } - + // Isolate decimal number and fill array if (decimalDigits > 0) { @@ -36913,9 +37888,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int decimalPointer = arrayIndex; arrayIndex++; totalCharacters++; - + decimalNumber = uint(frac(abs(_TextNumericValue)) * pow(10.00001, decimalDigits)); // Isolate the decimal number - + int expIndex = -1 * (decimalDigits - 1); // Exponent Index //Populate the Array with the remaining digits while (arrayIndex < (uint)(totalCharacters)) @@ -36924,34 +37899,34 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int digit = floor(glsl_mod(decimalNumber * pow(10, expIndex), 10)); // Take the resulting value and add 48 to get the corresponding location in the font array. NumericArray[arrayIndex] = digit + 48; - + expIndex++; arrayIndex++; } } - + uv = TransformUV(_TextNumericOffset, _TextNumericRotation, _TextNumericScale, uv); - + if (uv.x > 1 || uv.x < 0 || uv.y > 1 || uv.y < 0) { return; } - + float currentCharacter = floor(uv.x * totalCharacters); float2 glyphPos = getAsciiCoordinate(NumericArray[currentCharacter]); float startUV = 1 / totalCharacters * currentCharacter; float endUV = 1 / totalCharacters * (currentCharacter + 1); - + float4 textNumericPadding = _TextNumericPadding; textNumericPadding *= 1 / totalCharacters; - + uv = remapClamped(float2(startUV, 0), float2(endUV, 1), uv, float2(glyphPos.x + textNumericPadding.x, glyphPos.y - glyphWidth + textNumericPadding.y), float2(glyphPos.x + glyphWidth - textNumericPadding.z, glyphPos.y - textNumericPadding.w)); - + if (uv.x > glyphPos.x + glyphWidth - textNumericPadding.z - .001 || uv.x < glyphPos.x + textNumericPadding.x + .001 || uv.y > glyphPos.y - textNumericPadding.w - .001 || uv.y < glyphPos.y - glyphWidth + textNumericPadding.y + .001) { return; } - + float3 samp = tex2D(_TextGlyphs, TRANSFORM_TEX(uv, _TextGlyphs)).rgb; float2 msdfUnit = _TextPixelRange / _TextGlyphs_TexelSize.zw; float sigDist = median(samp.r, samp.g, samp.b) - 0.5; @@ -36960,12 +37935,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextNumericColor.rgb, _TextNumericColorThemeIndex), opacity * _TextNumericColor.a); globalTextEmission += poiThemeColor(poiMods, _TextNumericColor.rgb, _TextNumericColorThemeIndex) * opacity * _TextNumericEmissionStrength; } - + void ApplyTextOverlayColor(inout PoiFragData poiFragData, PoiMesh poiMesh, in PoiMods poiMods) { globalTextEmission = 0; float positionalOpacity = 0; - + if (_TextFPSEnabled == 1) ApplyFPSText(poiFragData, poiMesh.uv[_TextFPSUV], poiMods); if (_TextPositionEnabled == 1) @@ -36974,12 +37949,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods); if (_TextNumericEnabled == 1) ApplyNumericText(poiFragData, poiMesh.uv[_TextNumericUV], poiMods); - + poiFragData.emission += globalTextEmission; } #endif //endex - + //ifex _PostProcess==0 #ifdef POSTPROCESS float3 poiPosterize(float3 color, float steps) @@ -36991,7 +37966,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" newColor.b = floor(newColor.b * steps) / steps; return HSVtoRGB(newColor); } - + float oetf_sRGB_scalar(float L) { float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055; @@ -36999,12 +37974,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" V = L * 12.92; return V; } - + float3 oetf_sRGB(float3 L) { return float3(oetf_sRGB_scalar(L.r), oetf_sRGB_scalar(L.g), oetf_sRGB_scalar(L.b)); } - + float eotf_sRGB_scalar(float V) { float L = pow((V + 0.055) / 1.055, 2.4); @@ -37012,26 +37987,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" L = V / 12.92; return L; } - + float3 GetHDR(float3 rgb) { return float3(eotf_sRGB_scalar(rgb.r), eotf_sRGB_scalar(rgb.g), eotf_sRGB_scalar(rgb.b)); } - + float3 GetContrast(float3 col, float contrast) { return lerp(float3(0.5, 0.5, 0.5), col, contrast); } - + float3 GetSaturation(float3 col, float interpolator) { return lerp(dot(col, float3(0.3, 0.59, 0.11)), col, interpolator); } - + void applyPostProcessing(inout PoiFragData poiFragData, in PoiMesh poiMesh) { float3 col = poiFragData.finalColor; - col = hueShift(col, _PPHue); + col = hueShift(col, _PPHue, _PPHueShiftColorSpace); col *= _PPTint; col *= _PPRGB; col = GetSaturation(col, _PPSaturation); @@ -37039,24 +38014,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" col = GetContrast(col, _PPContrast); col *= _PPBrightness; col += _PPLightness; - + float ppMask = 1; #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED) ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan)[_PPMaskChannel]; ppMask = lerp(ppMask, 1 - ppMask, _PPMaskInvert); col = lerp(poiFragData.finalColor, col, ppMask); #endif - + if (_PPPosterization) { col = lerp(col, poiPosterize(col, _PPPosterizationAmount), ppMask); } - + poiFragData.finalColor = col; } #endif //endex - + // normal correct code from https://github.com/yoship1639/UniToon (MIT) //ifex _NormalCorrect==0 #ifdef POI_NORMALCORRECT @@ -37071,14 +38046,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _VideoEffectsEnable==0 #ifdef POI_VIDEO_EFFECTS float3 applyBacklight(float3 videoTexture, half backlightStrength) { return max(backlightStrength, videoTexture.rgb); } - + float3 applyViewAngleTN(float3 videoTexture, PoiCam poiCam, PoiMesh poiMesh) { float3 reflectionVector = normalize(reflect(poiCam.viewDir.rgb, poiMesh.normals[1].rgb)); @@ -37096,7 +38071,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" videoTexture = (lerp(videoTexture, videoTexture.gbr, sideShift)); return videoTexture; } - + float calculateCRTPixelBrightness(float2 uv) { float totalPixels = _VideoResolution.x * _VideoResolution.y; @@ -37105,7 +38080,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float currentPixelAlpha = currentPixelNumber / totalPixels; half electronBeamAlpha = frac(_Time.y * _VideoCRTRefreshRate); float electronBeamPixelNumber = totalPixels * electronBeamAlpha; - + float DistanceInPixelsFromCurrentElectronBeamPixel = 0; if (electronBeamPixelNumber >= currentPixelNumber) { @@ -37117,10 +38092,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } float CRTFrameTime = 1 / _VideoCRTRefreshRate; float timeSincecurrentPixelWasHitByElectronBeam = (DistanceInPixelsFromCurrentElectronBeamPixel / totalPixels); - + return saturate(_VideoCRTPixelEnergizedTime - timeSincecurrentPixelWasHitByElectronBeam); } - + void applyContrastSettings(inout float3 pixel) { #if !UNITY_COLORSPACE_GAMMA @@ -37131,18 +38106,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" pixel = GammaToLinearSpace(pixel); #endif } - + void applySaturationSettings(inout float3 pixel) { pixel = lerp(pixel.rgb, dot(pixel.rgb, float3(0.3, 0.59, 0.11)), - (_VideoSaturation)); } - + void applyVideoSettings(inout float3 pixel) { applySaturationSettings(pixel); applyContrastSettings(pixel); } - + void calculateLCD(inout float4 videoTexture, float3 pixels) { videoTexture.rgb = applyBacklight(videoTexture, _VideoBacklight * .01); @@ -37183,13 +38158,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" void calculateProjector(inout float4 videoTexture) { applyVideoSettings(videoTexture.rgb); - + float3 projectorColor = videoTexture * _VideoBacklight; videoTexture.r = clamp(projectorColor.r, videoTexture.r, 1000); videoTexture.g = clamp(projectorColor.g, videoTexture.g, 1000); videoTexture.b = clamp(projectorColor.b, videoTexture.b, 1000); } - + void applyVideoEffectsMainTex(inout float4 mainTexture, in PoiMesh poiMesh) { float2 uvs = poiMesh.uv[_MainTexUV]; @@ -37221,7 +38196,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 modifiedVideoTexture = 0; modifiedVideoTexture.rgb = poiFragData.baseColor; modifiedVideoTexture.a = poiFragData.alpha; - + // UNITY_BRANCH // if(_VideoRepeatVideoTexture == 1) // { @@ -37230,41 +38205,41 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // return; // } // } - + switch(_VideoType) { case 0: // LCD - + { calculateLCD(modifiedVideoTexture, pixels); break; } case 1: // TN - + { calculateTN(modifiedVideoTexture, pixels, poiCam, poiMesh); break; } case 2: // CRT - + { calculateCRT(modifiedVideoTexture, pixels, uvs); break; } case 3: // OLED - + { calculateOLED(modifiedVideoTexture, pixels); break; } case 4: // Gameboy - + { calculateGameboy(modifiedVideoTexture); break; } case 5: // Projector - + { calculateProjector(modifiedVideoTexture); break; @@ -37275,7 +38250,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float screenMask = 1; #endif - + poiFragData.baseColor = lerp(poiFragData.baseColor, modifiedVideoTexture, screenMask); // UNITY_BRANCH if (_VideoEmissionEnabled) @@ -37285,18 +38260,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _BacklightEnabled!=1 #ifdef POI_BACKLIGHT void ApplyBacklight(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiCam poiCam, inout PoiMods poiMods) { - + // Color float3 backlightColor = _BacklightColor.rgb; #if defined(PROP_BACKLIGHTCOLORTEX) || !defined(OPTIMIZER_ENABLED) backlightColor *= POI2D_SAMPLER_PAN(_BacklightColorTex, _MainTex, poiUV(poiMesh.uv[_BacklightColorTexUV], _BacklightColorTex_ST), _BacklightColorTexPan).rgb; #endif - + float3 normal = lerp(poiMesh.normals[0], poiMesh.normals[1], _BacklightNormalStrength); // Factor float3 headDir = normalize(getCameraPosition() - poiMesh.worldPos.xyz); @@ -37311,14 +38286,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" backlightLN = poiEdgeLinear(backlightLN, _BacklightBorder, _BacklightBlur); float backlight = saturate(backlightFactor * backlightLN); backlight = !poiMesh.isFrontFace && _BacklightBackfaceMask ? 0.0 : backlight; - + // Blend backlightColor = lerp(backlightColor, backlightColor * poiFragData.baseColor, _BacklightMainStrength); poiLight.finalLightAdd += backlight * backlightColor * poiLight.directColor; } #endif //endex - + //ifex _VoronoiEnabled!=1 #ifdef POI_VORONOI //1/7 @@ -37330,7 +38305,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return glsl_mod((34.0 * x + 1.0) * x, 289.0); } - + float3 inoise(float3 P, float jitter, out float3 randomPoint) { P *= 0.7f; // Scale adjustment @@ -37341,10 +38316,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 px = Permutation(Pi.x + oi); float3 py = Permutation(Pi.y + oi); float3 pz = Permutation(Pi.z + oi); - + float3 p, ox, oy, oz, dx, dy, dz; float3 F = 1e6; - + [unroll(3)] for (int i = 0; i < 3; i++) { @@ -37356,19 +38331,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { p = Permutation(px[i] + py[j] + pz[k] + oi); // pij1, pij2, pij3 float3 ogp = p; - + ox = frac(p * VoronoiK) - VoronoiKo; oy = glsl_mod(floor(p * VoronoiK), 7.0) * VoronoiK - VoronoiKo; - + p = Permutation(p); oz = frac(p * VoronoiK) - VoronoiKo; - + dx = Pf.x - of[i] + jitter * ox; dy = Pf.y - of[j] + jitter * oy; dz = Pf.z - of[k] + jitter * oz; - + float3 d = dx * dx + dy * dy + dz * dz; // dij1, dij2 and dij3, squared - + //Find lowest and second lowest distances for (int n = 0; n < 3; n++) { @@ -37386,17 +38361,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } } - + return F; } - + float voronoi2D(in float2 x, float scale, float2 speed, out float2 randomPoint) { x *= scale; x += speed * _Time.x; float2 n = floor(x); float2 f = frac(x); - + // first pass: regular voronoi float2 mg, mr; float md = 8.0; @@ -37407,10 +38382,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 g = float2(float(i), float(j)); float2 o = random2(n + g); float2 currentPoint = o; - + float2 r = g + o - f; float d = dot(r, r); - + if (d < md) { md = d; @@ -37420,7 +38395,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } } - + // second pass: distance to borders md = 8.0; for (int r = -2; r <= 2; r++) @@ -37429,9 +38404,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { float2 g = mg + float2(float(q), float(r)); float2 o = random2(n + g); - + float2 r = g + o - f; - + if (dot(mr - r, mr - r) > 0.00001) { md = min(md, dot(0.5 * (mr + r), normalize(r - mr))); @@ -37440,14 +38415,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return md; } - + float voronoi3D(in float3 x, float scale, float3 speed, out float3 randomPoint) { x *= scale; x += speed * _Time.x; float3 n = floor(x); float3 f = frac(x); - + // first pass: regular voronoi float3 mg, mr; float md = 8.0; @@ -37460,10 +38435,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 g = float3(float(h), float(i), float(j)); float3 o = random3(n + g); float3 currentPoint = o; - + float3 r = g + o - f; float d = dot(r, r); - + if (d < md) { md = d; @@ -37474,7 +38449,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } } - + // second pass: distance to borders md = 8.0; for (int r = -2; r <= 2; r++) @@ -37485,9 +38460,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { float3 g = mg + float3(float(p), float(q), float(r)); float3 o = random3(n + g); - + float3 r = g + o - f; - + if (dot(mr - r, mr - r) > 0.00001) { md = min(md, dot(0.5 * (mr + r), normalize(r - mr))); @@ -37497,7 +38472,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return md; } - + // fracal sum, range -1.0 - 1.0 float VoronoiNoise_Octaves(float3 p, float scale, float3 speed, int octaveNumber, float octaveScale, float octaveAttenuation, float jitter, float time, out float3 randomPoint) { @@ -37508,15 +38483,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // for (int i = 0; i < octaveNumber; i ++) // { float3 F = inoise(p * freq + time * speed, jitter, randomPoint) * weight; - + sum += sqrt(F[0]); - + // freq *= octaveScale; // weight *= 1.0f - octaveAttenuation; // } return sum; } - + float VoronoiNoiseDiff_Octaves(float3 p, float scale, float3 speed, int octaveNumber, float octaveScale, float octaveAttenuation, float jitter, float time, out float3 randomPoint) { float freq = scale; @@ -37526,26 +38501,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // for (int i = 0; i < octaveNumber; i ++) // { float3 F = inoise(p * freq + time * speed, jitter, randomPoint) * weight; - + sum += sqrt(F[1]) - sqrt(F[0]); - + // freq *= octaveScale; // weight *= 1.0f - octaveAttenuation; // } return sum; } - + void ApplyVoronoi(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) { float voronoiOctaveNumber = 1; float voronoiOctaveScale = 1; float voronoiOctaveAttenuation = 1; float3 randomPoint = 0; - + float voronoi = 0; - + float3 position = 0; - + UNITY_BRANCH if (_VoronoiSpace == 0) { @@ -37566,19 +38541,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float mask = 1; #endif - + if (_VoronoiGlobalMask > 0) { mask = maskBlend(mask, poiMods.globalMask[_VoronoiGlobalMask - 1], _VoronoiGlobalMaskBlendType); } - + #if defined(PROP_VORONOINOISE) || !defined(OPTIMIZER_ENABLED) float edgeNoise = POI2D_SAMPLER_PAN(_VoronoiNoise, _MainTex, poiUV(poiMesh.uv[_VoronoiNoiseUV], _VoronoiNoise_ST), _VoronoiNoisePan)[_VoronoiNoiseChannel]; #else float edgeNoise = 0; #endif edgeNoise *= _VoronoiNoiseIntensity; - + float3 voronoiSpeed = _VoronoiSpeed * 10; #ifdef POI_AUDIOLINK if (poiMods.audioLinkAvailable) @@ -37588,30 +38563,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" position.z += AudioLinkGetChronoTime(_AudioLinkVoronoiChronoSpeedZType, _AudioLinkVoronoiChronoSpeedZBand) * _AudioLinkVoronoiChronoSpeedZSpeed * 0.01; } #endif - + if (_VoronoiType == 0) // Basic - + { voronoi = voronoi2D(position.xy, _VoronoiScale, voronoiSpeed, randomPoint.xy); voronoi *= 1.55; // Range adjustment - + } if (_VoronoiType == 1) // Diff - + { voronoi = VoronoiNoiseDiff_Octaves(position, _VoronoiScale, voronoiSpeed, voronoiOctaveNumber, voronoiOctaveScale, voronoiOctaveAttenuation, 1, _Time.x, randomPoint); } if (_VoronoiType == 2) // Fixed Border - + { voronoi = voronoi3D(position, _VoronoiScale, voronoiSpeed, randomPoint); voronoi *= 1.8; // Range adjustment - + } - + float4 outerColor = _VoronoiOuterColor; float4 innerColor = _VoronoiInnerColor; - + if (_VoronoiEnableRandomCellColor == 1) { float3 rando = random3(randomPoint); @@ -37628,7 +38603,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" voronoiGradient.y -= _AudioLinkVoronoiGradientMaxAdd * poiMods.audioLink[_AudioLinkVoronoiGradientMaxAddBand]; #endif float ramp = smoothstep(voronoiGradient.x, voronoiGradient.y, voronoi); - + if (_VoronoiBlend == 0) { float4 voronoiColor = lerp(outerColor, innerColor, ramp); @@ -37650,28 +38625,28 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + float4 frag(VertexOut i, uint facing : SV_IsFrontFace) : SV_Target { UNITY_SETUP_INSTANCE_ID(i); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); - + PoiMesh poiMesh; PoiInitStruct(PoiMesh, poiMesh); - + PoiLight poiLight; PoiInitStruct(PoiLight, poiLight); - + PoiVertexLights poiVertexLights; PoiInitStruct(PoiVertexLights, poiVertexLights); - + PoiCam poiCam; PoiInitStruct(PoiCam, poiCam); - + PoiMods poiMods; PoiInitStruct(PoiMods, poiMods); poiMods.globalEmission = 1; - + PoiFragData poiFragData; poiFragData.smoothness = 1; poiFragData.smoothness2 = 1; @@ -37683,17 +38658,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.finalColor = float3(0, 0, 0); poiFragData.alpha = 1; poiFragData.toggleVertexLights = 0; - + #ifdef POI_UDIMDISCARD applyUDIMDiscard(i); #endif - + //ifex _NormalCorrect==0 #ifdef POI_NORMALCORRECT applyNormalCorrect(i); #endif //endex - + // Mesh Data //poiMesh.objectPosition = mul(unity_ObjectToWorld, float3(0, 0, 0)).xyz; poiMesh.objectPosition = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz; @@ -37707,7 +38682,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMesh.isFrontFace = facing; poiMesh.dx = ddx(poiMesh.uv[0]); poiMesh.dy = ddy(poiMesh.uv[0]); - + poiMesh.isRightHand = i.tangent.w > 0.0; + #ifndef POI_PASS_OUTLINE if (!poiMesh.isFrontFace && _FlipBackfaceNormals) { @@ -37716,14 +38692,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMesh.binormal[0] *= -1; } #endif - + poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22); float3 tanToWorld0 = float3(poiMesh.tangent[0].x, poiMesh.binormal[0].x, poiMesh.normals[0].x); float3 tanToWorld1 = float3(poiMesh.tangent[0].y, poiMesh.binormal[0].y, poiMesh.normals[0].y); float3 tanToWorld2 = float3(poiMesh.tangent[0].z, poiMesh.binormal[0].z, poiMesh.normals[0].z); float3 ase_tanViewDir = tanToWorld0 * poiCam.viewDir.x + tanToWorld1 * poiCam.viewDir.y + tanToWorld2 * poiCam.viewDir.z; poiCam.tangentViewDir = normalize(ase_tanViewDir); - + // 0-3 UV0-UV3 // 4 Panosphere UV // 5 world pos xz @@ -37742,7 +38718,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMesh.uv[6] = poiMesh.uv[0]; poiMesh.uv[7] = poiMesh.uv[0]; poiMesh.uv[8] = poiMesh.uv[0]; - + poiMesh.uv[4] = calculatePanosphereUV(poiMesh); poiMesh.uv[5] = calculateWorldUV(poiMesh); poiMesh.uv[6] = calculatePolarCoordinate(poiMesh); @@ -37757,7 +38733,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp)); poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5; */ - + //ifex _PoiParallax==0 #ifdef POI_PARALLAX #ifndef POI_PASS_OUTLINE @@ -37767,7 +38743,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + poiMods.globalMask[0] = 1; poiMods.globalMask[1] = 1; poiMods.globalMask[2] = 1; @@ -37799,16 +38775,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" ApplyGlobalMaskOptions(poiMods); } //endex - + float2 mainUV = poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST); - + if (_MainPixelMode) { mainUV = sharpSample(_MainTex_TexelSize, mainUV); } - + float4 mainTexture = POI2D_SAMPLER_PAN_STOCHASTIC(_MainTex, _MainTex, mainUV, _MainTexPan, _MainTexStochastic); - + //ifex _VideoEffectsEnable==0 #ifdef POI_VIDEO_EFFECTS if (_VideoEffectsEnable) @@ -37817,48 +38793,48 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + #if defined(PROP_BUMPMAP) || !defined(OPTIMIZER_ENABLED) poiMesh.tangentSpaceNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN_STOCHASTIC(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV].xy, _BumpMap_ST), _BumpMapPan, _BumpMapStochastic), _BumpScale); #else poiMesh.tangentSpaceNormal = UnpackNormal(float4(0.5, 0.5, 1, 1)); #endif - + //ifex _DetailEnabled==0 #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE) ApplyDetailNormal(poiMods, poiMesh); #endif //endex - + //ifex _RGBMaskEnabled==0 #if defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE) calculateRGBNormals(poiMesh, poiMods); #endif - + //endex - + float3 tangentSpaceNormal = UnpackNormal(float4(0.5, 0.5, 1, 1)); poiMesh.normals[0] = normalize( tangentSpaceNormal.x * poiMesh.tangent[0] + tangentSpaceNormal.y * poiMesh.binormal[0] + tangentSpaceNormal.z * poiMesh.normals[0] ); - + poiMesh.normals[1] = normalize( poiMesh.tangentSpaceNormal.x * poiMesh.tangent[0] + poiMesh.tangentSpaceNormal.y * poiMesh.binormal[0] + poiMesh.tangentSpaceNormal.z * poiMesh.normals[0] ); - + poiMesh.tangent[1] = cross(poiMesh.binormal[0], -poiMesh.normals[1]); poiMesh.binormal[1] = cross(-poiMesh.normals[1], poiMesh.tangent[0]); - + //ifex _EnableOutlines!=1 #ifdef POI_PASS_OUTLINE poiMesh.normals[1] = poiMesh.normals[0]; #endif //endex - + // Camera data poiCam.forwardDir = getCameraForward(); poiCam.worldPos = _WorldSpaceCameraPos; @@ -37878,14 +38854,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif poiCam.posScreenPixels = calcPixelScreenUVs(poiCam.posScreenSpace); poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1])); - + poiCam.worldDirection.xyz = poiMesh.worldPos.xyz - poiCam.worldPos; poiCam.worldDirection.w = dot(poiCam.clipPos, CalculateFrustumCorrection()); - + calculateGlobalThemes(poiMods); - + poiLight.finalLightAdd = 0; - + // Ambient Occlusion #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED) float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan); @@ -37893,12 +38869,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else poiLight.occlusion = 1; #endif - + if (_LightDataAOGlobalMaskR > 0) { poiLight.occlusion = maskBlend(poiLight.occlusion, poiMods.globalMask[_LightDataAOGlobalMaskR - 1], _LightDataAOGlobalMaskBlendTypeR); } - + // Detail Shadows #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED) float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan); @@ -37910,12 +38886,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else poiLight.detailShadow = 1; #endif - + if (_LightDataDetailShadowGlobalMaskR > 0) { poiLight.detailShadow = maskBlend(poiLight.detailShadow, poiMods.globalMask[_LightDataDetailShadowGlobalMaskR - 1], _LightDataDetailShadowGlobalMaskBlendTypeR); } - + // Shadow Masks #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED) float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan); @@ -37927,15 +38903,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { poiLight.shadowMask = maskBlend(poiLight.shadowMask, poiMods.globalMask[_LightDataShadowMaskGlobalMaskR - 1], _LightDataShadowMaskGlobalMaskBlendTypeR); } - + #ifdef UNITY_PASS_FORWARDBASE - + bool lightExists = false; if (any(_LightColor0.rgb >= 0.002)) { lightExists = true; } - + if (_LightingVertexLightingEnabled) { poiFragData.toggleVertexLights = 1; @@ -37944,7 +38920,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { poiFragData.toggleVertexLights = 0; } - + if (_LightingVertexLightingEnabled) { #if defined(VERTEXLIGHT_ON) @@ -37955,34 +38931,34 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" lengthSq += toLightX * toLightX; lengthSq += toLightY * toLightY; lengthSq += toLightZ * toLightZ; - + float4 lightAttenSq = unity_4LightAtten0; float4 atten = 1.0 / (1.0 + lengthSq * lightAttenSq); float4 vLightWeight = saturate(1 - (lengthSq * lightAttenSq / 25)); poiLight.vAttenuation = min(atten, vLightWeight * vLightWeight); - + poiLight.vDotNL = 0; poiLight.vDotNL += toLightX * poiMesh.normals[1].x; poiLight.vDotNL += toLightY * poiMesh.normals[1].y; poiLight.vDotNL += toLightZ * poiMesh.normals[1].z; - + float4 corr = rsqrt(lengthSq); poiLight.vertexVDotNL = max(0, poiLight.vDotNL * corr); - + poiLight.vertexVDotNL = 0; poiLight.vertexVDotNL += toLightX * poiMesh.normals[0].x; poiLight.vertexVDotNL += toLightY * poiMesh.normals[0].y; poiLight.vertexVDotNL += toLightZ * poiMesh.normals[0].z; - + poiLight.vertexVDotNL = max(0, poiLight.vDotNL * corr); - + poiLight.vSaturatedDotNL = saturate(poiLight.vDotNL); - + [unroll] for (int index = 0; index < 4; index++) { poiLight.vPosition[index] = float3(unity_4LightPosX0[index], unity_4LightPosY0[index], unity_4LightPosZ0[index]); - + float3 vertexToLightSource = poiLight.vPosition[index] - poiMesh.worldPos; poiLight.vDirection[index] = normalize(vertexToLightSource); poiLight.vColor[index] = _LightingAdditiveLimited ? MaxLuminance(unity_LightColor[index].rgb * poiLight.vAttenuation[index], _LightingAdditiveLimit) : unity_LightColor[index].rgb * poiLight.vAttenuation[index]; @@ -37991,38 +38967,38 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.vDotNL[index] = dot(poiMesh.normals[1], poiLight.vDirection[index]); poiLight.vCorrectedDotNL[index] = .5 * (poiLight.vDotNL[index] + 1); poiLight.vDotLH[index] = saturate(dot(poiLight.vDirection[index], poiLight.vHalfDir[index])); - + poiLight.vDotNH[index] = dot(poiMesh.normals[1], poiLight.vHalfDir[index]); poiLight.vertexVDotNH[index] = saturate(dot(poiMesh.normals[0], poiLight.vHalfDir[index])); } #endif } - + //UNITY_BRANCH if (_LightingColorMode == 0) // Poi Custom Light Color - + { float3 magic = max(BetterSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)), 0); float3 normalLight = _LightColor0.rgb + BetterSH9(float4(0, 0, 0, 1)); - + float magiLumi = calculateluminance(magic); float normaLumi = calculateluminance(normalLight); float maginormalumi = magiLumi + normaLumi; - + float magiratio = magiLumi / maginormalumi; float normaRatio = normaLumi / maginormalumi; - + float target = calculateluminance(magic * magiratio + normalLight * normaRatio); float3 properLightColor = magic + normalLight; float properLuminance = calculateluminance(magic + normalLight); poiLight.directColor = properLightColor * max(0.0001, (target / properLuminance)); - + poiLight.indirectColor = BetterSH9(float4(lerp(0, poiMesh.normals[1], _LightingIndirectUsesNormals), 1)); } - + //UNITY_BRANCH if (_LightingColorMode == 1) // More standard approach to light color - + { float3 indirectColor = BetterSH9(float4(poiMesh.normals[1], 1)); if (lightExists) @@ -38036,24 +39012,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.indirectColor = indirectColor * 0.5; } } - + if (_LightingColorMode == 2) // UTS style - + { poiLight.indirectColor = saturate(max(half3(0.05, 0.05, 0.05) * _Unlit_Intensity, max(ShadeSH9(half4(0.0, 0.0, 0.0, 1.0)), ShadeSH9(half4(0.0, -1.0, 0.0, 1.0)).rgb) * _Unlit_Intensity)); poiLight.directColor = max(poiLight.indirectColor, _LightColor0.rgb); } - + if (_LightingColorMode == 3) // OpenLit - + { float3 lightDirectionForSH9 = OpenLitLightingDirectionForSH9(); OpenLitShadeSH9ToonDouble(lightDirectionForSH9, poiLight.directColor, poiLight.indirectColor); poiLight.directColor += _LightColor0.rgb; // OpenLit does a few other things by default like clamp direct colour // see https://github.com/lilxyzw/OpenLit/blob/main/Assets/OpenLit/core.hlsl#L174 + } - + float lightMapMode = _LightingMapMode; //UNITY_BRANCH if (_LightingDirectionMode == 0) @@ -38077,23 +39054,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" lightMapMode == 1; } } - + if (_LightingDirectionMode == 3) // UTS - + { float3 defaultLightDirection = normalize(UNITY_MATRIX_V[2].xyz + UNITY_MATRIX_V[1].xyz); float3 lightDirection = normalize(lerp(defaultLightDirection, _WorldSpaceLightPos0.xyz, any(_WorldSpaceLightPos0.xyz))); poiLight.direction = lightDirection; } if (_LightingDirectionMode == 4) // OpenLit - + { poiLight.direction = OpenLitLightingDirection(); // float4 customDir = 0; // Do we want to give users to alter this (OpenLit always does!)? - + } - + if (_LightingDirectionMode == 5) // View Direction - + { float3 upViewDir = normalize(UNITY_MATRIX_V[1].xyz); float3 rightViewDir = normalize(UNITY_MATRIX_V[0].xyz); @@ -38104,12 +39081,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 rotatedViewPitch = RotateAroundAxis(rotatedViewCameraMeshOffset, rotatedViewYaw, pitchOffset_Rads); poiLight.direction = normalize(rotatedViewPitch); } - + if (!any(poiLight.direction)) { poiLight.direction = float3(.4, 1, .4); } - + poiLight.direction = normalize(poiLight.direction); poiLight.attenuationStrength = _LightingCastedShadows; poiLight.attenuation = 1; @@ -38118,7 +39095,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos) poiLight.attenuation *= attenuation; } - + + #if defined(HANDLE_SHADOWS_BLENDING_IN_GI) + half bakedAtten = UnitySampleBakedOcclusion(poiMesh.lightmapUV.xy, poiMesh.worldPos); + float zDist = dot(_WorldSpaceCameraPos - poiMesh.worldPos, UNITY_MATRIX_V[2].xyz); + float fadeDist = UnityComputeShadowFadeDistance(poiMesh.worldPos, zDist); + poiLight.attenuation = UnityMixRealtimeAndBakedShadows(poiLight.attenuation, bakedAtten, UnityComputeShadowFade(fadeDist)); + #endif + if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0) { lightMapMode = 1; @@ -38127,7 +39111,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.direction = normalize(float3(.4, 1, .4)); } } - + poiLight.halfDir = normalize(poiLight.direction + poiCam.viewDir); poiLight.vertexNDotL = dot(poiMesh.normals[0], poiLight.direction); poiLight.nDotL = dot(poiMesh.normals[1], poiLight.direction); @@ -38139,13 +39123,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.vertexNDotH = max(0.00001, dot(poiMesh.normals[0], poiLight.halfDir)); poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir); poiLight.lDotH = max(0.00001, dot(poiLight.direction, poiLight.halfDir)); - + // Poi special light map if (lightMapMode == 0) { float3 ShadeSH9Plus = GetSHLength(); float3 ShadeSH9Minus = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0; - + float3 greyScaleVector = float3(.33333, .33333, .33333); float bw_lightColor = dot(poiLight.directColor, greyScaleVector); float bw_directLighting = (((poiLight.nDotL * 0.5 + 0.5) * bw_lightColor * lerp(1, poiLight.attenuation, poiLight.attenuationStrength)) + dot(ShadeSH9(float4(poiMesh.normals[1], 1)), greyScaleVector)); @@ -38153,7 +39137,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float bw_bottomIndirectLighting = dot(ShadeSH9Minus, greyScaleVector); float bw_topIndirectLighting = dot(ShadeSH9Plus, greyScaleVector); float lightDifference = ((bw_topIndirectLighting + bw_lightColor) - bw_bottomIndirectLighting); - + poiLight.lightMap = smoothstep(0, lightDifference, bw_directLighting - bw_bottomIndirectLighting); poiLight.lightMapNoAttenuation = smoothstep(0, lightDifference, bw_directLightingNoAtten - bw_bottomIndirectLighting); } @@ -38176,10 +39160,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } poiLight.lightMapNoAttenuation *= poiLight.detailShadow; poiLight.lightMap *= poiLight.detailShadow; - + poiLight.directColor = max(poiLight.directColor, 0.0001); poiLight.indirectColor = max(poiLight.indirectColor, 0.0001); - + if (_LightingColorMode == 3) { // OpenLit @@ -38190,50 +39174,50 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.directColor = max(poiLight.directColor, poiLight.directColor * min(10000, (_LightingMinLightBrightness * rcp(calculateluminance(poiLight.directColor))))); poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor * min(10000, (_LightingMinLightBrightness * rcp(calculateluminance(poiLight.indirectColor))))); } - + poiLight.directColor = lerp(poiLight.directColor, dot(poiLight.directColor, float3(0.299, 0.587, 0.114)), _LightingMonochromatic); poiLight.indirectColor = lerp(poiLight.indirectColor, dot(poiLight.indirectColor, float3(0.299, 0.587, 0.114)), _LightingMonochromatic); - + if (_LightingCapEnabled) { poiLight.directColor = min(poiLight.directColor, _LightingCap); poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap); } - + if (_LightingForceColorEnabled) { poiLight.directColor = poiThemeColor(poiMods, _LightingForcedColor, _LightingForcedColorThemeIndex); } - + #ifdef UNITY_PASS_FORWARDBASE poiLight.directColor = max(poiLight.directColor * _PPLightingMultiplier, 0); poiLight.directColor = max(poiLight.directColor + _PPLightingAddition, 0); poiLight.indirectColor = max(poiLight.indirectColor * _PPLightingMultiplier, 0); poiLight.indirectColor = max(poiLight.indirectColor + _PPLightingAddition, 0); #endif - + #endif - + #ifdef POI_PASS_ADD if (!_LightingAdditiveEnable) { return float4(mainTexture.rgb * .0001, 1); } - + #if defined(DIRECTIONAL) if (_DisableDirectionalInAdd) { return float4(mainTexture.rgb * .0001, 1); } #endif - + poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz * _WorldSpaceLightPos0.w); #if defined(POINT) || defined(SPOT) #ifdef POINT unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz; poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r; #endif - + #ifdef SPOT unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)); poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz); @@ -38244,18 +39228,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos); poiLight.attenuationStrength = _LightingAdditiveCastedShadows; - poiLight.directColor = _LightingAdditiveLimited ? MaxLuminance(_LightColor0.rgb * poiLight.attenuation, _LightingAdditiveLimit) : _LightColor0.rgb * poiLight.attenuation; - + poiLight.directColor = _LightingAdditiveLimited ? MaxLuminance(_LightColor0.rgb * poiLight.attenuation, _LightingAdditiveLimit) : _LightColor0.rgb * poiLight.attenuation; + #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE) poiLight.indirectColor = 0; #else poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough); poiLight.indirectColor = _LightingAdditiveLimited ? MaxLuminance(poiLight.indirectColor, _LightingAdditiveLimit) : poiLight.indirectColor; #endif - + poiLight.directColor = lerp(poiLight.directColor, dot(poiLight.directColor, float3(0.299, 0.587, 0.114)), _LightingAdditiveMonochromatic); poiLight.indirectColor = lerp(poiLight.indirectColor, dot(poiLight.indirectColor, float3(0.299, 0.587, 0.114)), _LightingAdditiveMonochromatic); - + poiLight.halfDir = normalize(poiLight.direction + poiCam.viewDir); poiLight.nDotL = dot(poiMesh.normals[1], poiLight.direction); poiLight.nDotLSaturated = saturate(poiLight.nDotL); @@ -38267,7 +39251,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.vertexNDotL = dot(poiMesh.normals[0], poiLight.direction); poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir)); poiLight.vertexNDotH = max(0.00001, dot(poiMesh.normals[0], poiLight.halfDir)); - + // Normalized nDotL if (_LightingMapMode == 0 || _LightingMapMode == 1 || _LightingMapMode == 2) { @@ -38281,7 +39265,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.lightMapNoAttenuation = poiLight.lightMap; poiLight.lightMap *= lerp(1, poiLight.additiveShadow, poiLight.attenuationStrength); #endif - + //ifex _LightDataDebugEnabled==0 if (_LightDataDebugEnabled) { @@ -38349,28 +39333,28 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif } //endex - + //ifex _EnableAudioLink==0 #ifdef POI_AUDIOLINK SetupAudioLink(poiFragData, poiMods, poiMesh); #endif //endex - + //ifex _MochieBRDF==0 #if defined(MOCHIE_PBR) MetallicAndSpecularFragDataInit(poiFragData, poiMesh, poiMods); #endif //endex - + //ifex _BlackLightMaskingEnabled==0 #ifdef POI_BLACKLIGHTMASKING calculateBlackLightMasks(poiMesh, poiMods); #endif //endex - + poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex); poiFragData.alpha = mainTexture.a * _Color.a; - + //ifex _MainColorAdjustToggle==0 #ifdef COLOR_GRADING_HDR #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED) @@ -38378,7 +39362,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float4 hueShiftAlpha = 1; #endif - + if (_MainHueGlobalMask > 0) { hueShiftAlpha.r = maskBlend(hueShiftAlpha.r, poiMods.globalMask[_MainHueGlobalMask - 1], _MainHueGlobalMaskBlendType); @@ -38391,8 +39375,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { hueShiftAlpha.g = maskBlend(hueShiftAlpha.g, poiMods.globalMask[_MainBrightnessGlobalMask - 1], _MainBrightnessGlobalMaskBlendType); } - - if (_MainHueShiftToggle) + + if (_MainHueShiftToggle == 1) { float shift = _MainHueShift; #ifdef POI_AUDIOLINK @@ -38404,18 +39388,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif if (_MainHueShiftReplace) { - poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r); + poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x, _MainHueShiftColorSpace), hueShiftAlpha.r); } else { - poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x))); + poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)), _MainHueShiftColorSpace); } } - + if (_MainGradationStrength && _ColorGradingToggle) { #if !defined(UNITY_COLORSPACE_GAMMA) float3 tempColor = OpenLitLinearToSRGB(poiFragData.baseColor); + #else + float3 tempColor = poiFragData.baseColor; #endif #if defined(PROP_MAINGRADATIONTEX) || !defined(OPTIMIZER_ENABLED) tempColor.r = POI_SAMPLE_1D_X(_MainGradationTex, sampler_linear_clamp, tempColor.r).r; @@ -38429,18 +39415,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif poiFragData.baseColor = lerp(poiFragData.baseColor, tempColor, _MainGradationStrength); } - + poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), - (_Saturation) * hueShiftAlpha.b); poiFragData.baseColor = saturate(lerp(poiFragData.baseColor, poiFragData.baseColor * (_MainBrightness + 1), hueShiftAlpha.g)); #endif //endex - + #if defined(PROP_ALPHAMASK) || !defined(OPTIMIZER_ENABLED) - + if (_MainAlphaMaskMode) { float alphaMask = POI2D_SAMPLER_PAN(_AlphaMask, _MainTex, poiUV(poiMesh.uv[_AlphaMaskUV], _AlphaMask_ST), _AlphaMaskPan.xy).r; - alphaMask = saturate(alphaMask * _AlphaMaskScale + _AlphaMaskValue); + alphaMask = saturate(alphaMask * _AlphaMaskBlendStrength + (_AlphaMaskInvert ?_AlphaMaskValue * -1 : _AlphaMaskValue)); if (_AlphaMaskInvert) alphaMask = 1 - alphaMask; if (_MainAlphaMaskMode == 1) poiFragData.alpha = alphaMask; if (_MainAlphaMaskMode == 2) poiFragData.alpha = poiFragData.alpha * alphaMask; @@ -38448,7 +39434,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (_MainAlphaMaskMode == 4) poiFragData.alpha = saturate(poiFragData.alpha - alphaMask); } #endif - + //ifex _VideoEffectsEnable==0 #ifdef POI_VIDEO_EFFECTS if (_VideoEffectsEnable) @@ -38457,43 +39443,43 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods); - + //ifex _EnableTouchGlow==0 #ifdef GRAIN applyDepthFX(poiFragData, poiCam, poiMesh, poiMods); #endif //endex - + //ifex _DetailEnabled==0 #ifdef FINALPASS ApplyDetailColor(poiFragData, poiMesh, poiMods); #endif //endex - + //ifex _MainVertexColoringEnabled==0 applyVertexColor(poiFragData, poiMesh); //endex - + //ifex _BackFaceEnabled!=1 #ifdef POI_BACKFACE ApplyBackFaceColor(poiFragData, poiMesh, poiMods); #endif //endex - + //ifex _RGBMaskEnabled==0 #ifdef VIGNETTE calculateRGBMask(poiFragData, poiMesh, poiMods); #endif //endex - + //ifex _EnableDissolve==0 #ifdef DISTORT applyDissolve(poiFragData, poiMesh, poiMods, poiCam, poiLight); #endif //endex - + //ifex _ShadingEnabled==0 #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED) #ifndef POI_PASS_OUTLINE @@ -38503,7 +39489,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _ShadingEnabled==0 #ifdef VIGNETTE_MASKED #ifdef POI_PASS_OUTLINE @@ -38533,34 +39519,34 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { applyToGlobalMask(poiMods, _ShadingRampedLightMapInverseApplyGlobalMaskIndex - 1, _ShadingRampedLightMapInverseApplyGlobalMaskBlendType, 1 - poiLight.rampedLightMap); } - + poiLight.directLuminance = dot(poiLight.directColor, float3(0.299, 0.587, 0.114)); poiLight.indirectLuminance = dot(poiLight.directColor, float3(0.299, 0.587, 0.114)); poiLight.finalLuminance = dot(poiLight.finalLighting, float3(0.299, 0.587, 0.114)); //endex - + #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 - + //ifex _EnableAniso==0 #ifdef POI_ANISOTROPICS applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods); #endif //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) applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods); #endif //endex - + //ifex _CubeMapEnabled==0 #ifdef _CUBEMAP applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods); #endif //endex - + //ifex _EnableALDecal==0 #ifdef POI_AUDIOLINK #ifdef POI_AL_DECAL @@ -38568,7 +39554,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableVolumeColor==0 #ifdef POI_AUDIOLINK #ifdef POI_AL_VOLUMECOLOR @@ -38576,13 +39562,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableFlipbook==0 #ifdef _SUNDISK_HIGH_QUALITY applyFlipbook(poiFragData, poiMesh, poiMods); #endif //endex - + //ifex _EnableRimLighting==0 #ifdef _GLOSSYREFLECTIONS_OFF #ifdef _RIMSTYLE_POIYOMI @@ -38594,12 +39580,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float rimMask = 1; float rimBias = 0; #endif - - if(_RimMaskInvert) + + if (_RimMaskInvert) { rimMask = 1 - rimMask; } - + #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED) float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan); #else @@ -38619,8 +39605,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" AudioLinkRimBrightnessBand = _AudioLinkRimBrightnessBand; AudioLinkRimBrightnessAdd = _AudioLinkRimBrightnessAdd; #endif - - ApplyPoiyomiRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, _Is_NormalMapToRimLight, _RimLightingInvert, _RimPower, _RimStrength, _RimShadowWidth, _RimShadowToggle, _RimWidth, _RimBlendStrength, rimMask, _RimGlobalMask, _RimGlobalMaskBlendType, rimColor, _RimLightColor, _RimLightColorThemeIndex, _RimHueShiftEnabled, _RimHueShift, _RimHueShiftSpeed, _RimSharpness, _RimShadowMaskRampType, _RimShadowMaskInvert, _RimShadowMaskStrength, _RimShadowAlpha, _RimApplyGlobalMaskIndex, _RimApplyGlobalMaskBlendType, _RimBaseColorMix, _RimBrightness, _RimPoiBlendMode, AudioLinkRimWidthBand, AudioLinkRimWidthAdd, AudioLinkRimEmissionBand, AudioLinkRimEmissionAdd, AudioLinkRimBrightnessBand, AudioLinkRimBrightnessAdd, rimBias, _RimBiasIntensity, _RimApplyAlpha, _RimApplyAlphaBlend); + + ApplyPoiyomiRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, _Is_NormalMapToRimLight, _RimLightingInvert, _RimPower, _RimStrength, _RimShadowWidth, _RimShadowToggle, _RimWidth, _RimBlendStrength, rimMask, _RimGlobalMask, _RimGlobalMaskBlendType, rimColor, _RimLightColor, _RimLightColorThemeIndex, _RimHueShiftEnabled, _RimHueShift, _RimHueShiftColorSpace, _RimHueShiftSpeed, _RimSharpness, _RimShadowMaskRampType, _RimShadowMaskInvert, _RimShadowMaskStrength, _RimShadowAlpha, _RimApplyGlobalMaskIndex, _RimApplyGlobalMaskBlendType, _RimBaseColorMix, _RimBrightness, _RimPoiBlendMode, AudioLinkRimWidthBand, AudioLinkRimWidthAdd, AudioLinkRimEmissionBand, AudioLinkRimEmissionAdd, AudioLinkRimBrightnessBand, AudioLinkRimBrightnessAdd, rimBias, _RimBiasIntensity, _RimApplyAlpha, _RimApplyAlphaBlend); #endif #ifdef _RIMSTYLE_UTS2 #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED) @@ -38628,16 +39614,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float Set_RimLightMask_var = 1; #endif - ApplyUTS2RimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, Set_RimLightMask_var, _RimGlobalMask, _RimGlobalMaskBlendType, _RimLightColor, _RimLightColorThemeIndex, _Is_LightColor_RimLight, _Is_NormalMapToRimLight, _RimLight_Power, _RimLight_InsideMask, _RimLight_FeatherOff, _LightDirection_MaskOn, _Tweak_LightDirection_MaskLevel, _Add_Antipodean_RimLight, _Ap_RimLightColor, _RimApColorThemeIndex, _Is_LightColor_Ap_RimLight, _Ap_RimLight_Power, _Ap_RimLight_FeatherOff, _Tweak_RimLightMaskLevel, _RimHueShiftEnabled, _RimHueShift, _RimHueShiftSpeed); - #endif - #ifdef _RIMSTYLE_LILTOON - #if defined(PROP_RIMCOLORTEX) || !defined(OPTIMIZER_ENABLED) - float4 rimColorTex = POI2D_SAMPLER_PAN(_RimColorTex, _MainTex, poiUV(poiMesh.uv[_RimColorTexUV], _RimColorTex_ST), _RimColorTexPan); - #else - float4 rimColorTex = 1; - #endif - ApplyLiltoonRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, _RimColor, _RimIndirColor, rimColorTex, _RimMainStrength, _RimNormalStrength, _RimDirRange, _RimIndirRange, _RimFresnelPower, _RimBackfaceMask, _RimDirStrength, _RimBorder, _RimBlur, _RimIndirBorder, _RimIndirBlur, _RimShadowMask, _RimEnableLighting, _RimVRParallaxStrength, _RimGlobalMask, _RimGlobalMaskBlendType, _RimHueShiftEnabled, _RimHueShift, _RimHueShiftSpeed, _RimBlendMode); + ApplyUTS2RimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, Set_RimLightMask_var, _RimGlobalMask, _RimGlobalMaskBlendType, _RimLightColor, _RimLightColorThemeIndex, _Is_LightColor_RimLight, _Is_NormalMapToRimLight, _RimLight_Power, _RimLight_InsideMask, _RimLight_FeatherOff, _LightDirection_MaskOn, _Tweak_LightDirection_MaskLevel, _Add_Antipodean_RimLight, _Ap_RimLightColor, _RimApColorThemeIndex, _Is_LightColor_Ap_RimLight, _Ap_RimLight_Power, _Ap_RimLight_FeatherOff, _Tweak_RimLightMaskLevel, _RimHueShiftEnabled, _RimHueShift, _RimHueShiftColorSpace, _RimHueShiftSpeed); #endif + #endif //endex //ifex _EnableRim2Lighting==0 @@ -38651,12 +39630,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float rim2Mask = 1; float rim2Bias = 0; #endif - - if(_Rim2MaskInvert) + + if (_Rim2MaskInvert) { rim2Mask = 1 - rim2Mask; } - + #if defined(PROP_RIM2TEX) || !defined(OPTIMIZER_ENABLED) float4 rim2Color = POI2D_SAMPLER_PAN(_Rim2Tex, _MainTex, poiUV(poiMesh.uv[_Rim2TexUV], _Rim2Tex_ST), _Rim2TexPan); #else @@ -38676,7 +39655,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" AudioLinkRim2BrightnessBand = _AudioLinkRim2BrightnessBand; AudioLinkRim2BrightnessAdd = _AudioLinkRim2BrightnessAdd; #endif - ApplyPoiyomiRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, _Is_NormalMapToRim2Light, _Rim2LightingInvert, _Rim2Power, _Rim2Strength, _Rim2ShadowWidth, _Rim2ShadowToggle, _Rim2Width, _Rim2BlendStrength, rim2Mask, _Rim2GlobalMask, _Rim2GlobalMaskBlendType, rim2Color, _Rim2LightColor, _Rim2LightColorThemeIndex, _Rim2HueShiftEnabled, _Rim2HueShift, _Rim2HueShiftSpeed, _Rim2Sharpness, _Rim2ShadowMaskRampType, _Rim2ShadowMaskInvert, _Rim2ShadowMaskStrength, _Rim2ShadowAlpha, _Rim2ApplyGlobalMaskIndex, _Rim2ApplyGlobalMaskBlendType, _Rim2BaseColorMix, _Rim2Brightness, _RimPoi2BlendMode, AudioLinkRim2WidthBand, AudioLinkRim2WidthAdd, AudioLinkRim2EmissionBand, AudioLinkRim2EmissionAdd, AudioLinkRim2BrightnessBand, AudioLinkRim2BrightnessAdd, rim2Bias, _Rim2BiasIntensity, _Rim2ApplyAlpha, _Rim2ApplyAlphaBlend); + ApplyPoiyomiRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, _Is_NormalMapToRim2Light, _Rim2LightingInvert, _Rim2Power, _Rim2Strength, _Rim2ShadowWidth, _Rim2ShadowToggle, _Rim2Width, _Rim2BlendStrength, rim2Mask, _Rim2GlobalMask, _Rim2GlobalMaskBlendType, rim2Color, _Rim2LightColor, _Rim2LightColorThemeIndex, _Rim2HueShiftEnabled, _Rim2HueShift, _Rim2HueShiftColorSpace, _Rim2HueShiftSpeed, _Rim2Sharpness, _Rim2ShadowMaskRampType, _Rim2ShadowMaskInvert, _Rim2ShadowMaskStrength, _Rim2ShadowAlpha, _Rim2ApplyGlobalMaskIndex, _Rim2ApplyGlobalMaskBlendType, _Rim2BaseColorMix, _Rim2Brightness, _RimPoi2BlendMode, AudioLinkRim2WidthBand, AudioLinkRim2WidthAdd, AudioLinkRim2EmissionBand, AudioLinkRim2EmissionAdd, AudioLinkRim2BrightnessBand, AudioLinkRim2BrightnessAdd, rim2Bias, _Rim2BiasIntensity, _Rim2ApplyAlpha, _Rim2ApplyAlphaBlend); #endif #ifdef _RIM2STYLE_UTS2 #if defined(PROP_SET_RIM2LIGHTMASK) || !defined(OPTIMIZER_ENABLED) @@ -38684,19 +39663,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float Set_Rim2LightMask_var = 1; #endif - ApplyUTS2RimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, Set_Rim2LightMask_var, _Rim2GlobalMask, _Rim2GlobalMaskBlendType, _Rim2LightColor, _Rim2LightColorThemeIndex, _Is_LightColor_Rim2Light, _Is_NormalMapToRim2Light, _Rim2Light_Power, _Rim2Light_InsideMask, _Rim2Light_FeatherOff, _LightDirection_MaskOn2, _Tweak_LightDirection_MaskLevel2, _Add_Antipodean_Rim2Light, _Ap_Rim2LightColor, _Rim2ApColorThemeIndex, _Is_LightColor_Ap_Rim2Light, _Ap_Rim2Light_Power, _Ap_Rim2Light_FeatherOff, _Tweak_Rim2LightMaskLevel, _Rim2HueShiftEnabled, _Rim2HueShift, _Rim2HueShiftSpeed); - #endif - #ifdef _RIM2STYLE_LILTOON - #if defined(PROP_RIM2COLORTEX) || !defined(OPTIMIZER_ENABLED) - float4 rim2ColorTex = POI2D_SAMPLER_PAN(_Rim2ColorTex, _MainTex, poiUV(poiMesh.uv[_Rim2ColorTexUV], _Rim2ColorTex_ST), _Rim2ColorTexPan); - #else - float4 rim2ColorTex = 1; - #endif - ApplyLiltoonRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, _Rim2Color, _Rim2IndirColor, rim2ColorTex, _Rim2MainStrength, _Rim2NormalStrength, _Rim2DirRange, _Rim2IndirRange, _Rim2FresnelPower, _Rim2BackfaceMask, _Rim2DirStrength, _Rim2Border, _Rim2Blur, _Rim2IndirBorder, _Rim2IndirBlur, _Rim2ShadowMask, _Rim2EnableLighting, _Rim2VRParallaxStrength, _Rim2GlobalMask, _Rim2GlobalMaskBlendType, _Rim2HueShiftEnabled, _Rim2HueShift, _Rim2HueShiftSpeed, _Rim2BlendMode); + ApplyUTS2RimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, Set_Rim2LightMask_var, _Rim2GlobalMask, _Rim2GlobalMaskBlendType, _Rim2LightColor, _Rim2LightColorThemeIndex, _Is_LightColor_Rim2Light, _Is_NormalMapToRim2Light, _Rim2Light_Power, _Rim2Light_InsideMask, _Rim2Light_FeatherOff, _LightDirection_MaskOn2, _Tweak_LightDirection_MaskLevel2, _Add_Antipodean_Rim2Light, _Ap_Rim2LightColor, _Rim2ApColorThemeIndex, _Is_LightColor_Ap_Rim2Light, _Ap_Rim2Light_Power, _Ap_Rim2Light_FeatherOff, _Tweak_Rim2LightMaskLevel, _Rim2HueShiftEnabled, _Rim2HueShift, _Rim2HueShiftColorSpace, _Rim2HueShiftSpeed); #endif + #endif //endex - + //ifex _EnableDepthRimLighting==0 #ifdef _POI_DEPTH_RIMLIGHT if (!IsInMirror()) @@ -38705,19 +39677,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _GlitterEnable==0 #ifdef _SUNDISK_SIMPLE applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods); #endif //endex - + //ifex _StylizedSpecular==0 #ifdef POI_STYLIZED_StylizedSpecular stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods); #endif //endex - + //ifex _EnablePathing==0 #ifdef POI_PATHING // Only run pathing if a map exists. @@ -38726,39 +39698,39 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableMirrorOptions==0 #ifdef POI_MIRROR applyMirror(poiFragData, poiMesh, poiMods); #endif //endex - + //ifex _TextEnabled==0 #ifdef EFFECT_BUMP ApplyTextOverlayColor(poiFragData, poiMesh, poiMods); #endif //endex - + //ifex _VoronoiEnabled!=1 #ifdef POI_VORONOI ApplyVoronoi(poiFragData, poiMesh, poiMods); #endif //endex - + if (_AlphaPremultiply) { poiFragData.baseColor *= saturate(poiFragData.alpha); } poiFragData.finalColor = poiFragData.baseColor; - + poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting; - + //ifex _SubsurfaceScattering==0 #ifdef POI_SUBSURFACESCATTERING applySubsurfaceScattering(poiCam, poiLight, poiMesh, poiFragData); #endif //endex - + //ifex _MochieBRDF==0 #ifdef MOCHIE_PBR MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods); @@ -38769,78 +39741,103 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods); #endif //endex - + //ifex _BacklightEnabled!=1 #ifdef POI_BACKLIGHT ApplyBacklight(poiFragData, poiMesh, poiLight, poiCam, poiMods); #endif //endex - + + //ifex _EnableRimLighting==0 + #ifdef _GLOSSYREFLECTIONS_OFF + #ifdef _RIMSTYLE_LILTOON + #if defined(PROP_RIMCOLORTEX) || !defined(OPTIMIZER_ENABLED) + float4 rimColorTex = POI2D_SAMPLER_PAN(_RimColorTex, _MainTex, poiUV(poiMesh.uv[_RimColorTexUV], _RimColorTex_ST), _RimColorTexPan); + #else + float4 rimColorTex = 1; + #endif + ApplyLiltoonRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, _RimColor, _RimIndirColor, rimColorTex, _RimMainStrength, _RimNormalStrength, _RimDirRange, _RimIndirRange, _RimFresnelPower, _RimBackfaceMask, _RimDirStrength, _RimBorder, _RimBlur, _RimIndirBorder, _RimIndirBlur, _RimShadowMask, _RimEnableLighting, _RimVRParallaxStrength, _RimGlobalMask, _RimGlobalMaskBlendType, _RimHueShiftEnabled, _RimHueShift, _RimHueShiftColorSpace, _RimHueShiftSpeed, _RimBlendMode); + #endif + #endif + //endex + //ifex _EnableRim2Lighting==0 + #ifdef POI_RIM2 + #ifdef _RIM2STYLE_LILTOON + #if defined(PROP_RIM2COLORTEX) || !defined(OPTIMIZER_ENABLED) + float4 rim2ColorTex = POI2D_SAMPLER_PAN(_Rim2ColorTex, _MainTex, poiUV(poiMesh.uv[_Rim2ColorTexUV], _Rim2ColorTex_ST), _Rim2ColorTexPan); + #else + float4 rim2ColorTex = 1; + #endif + ApplyLiltoonRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods, _Rim2Color, _Rim2IndirColor, rim2ColorTex, _Rim2MainStrength, _Rim2NormalStrength, _Rim2DirRange, _Rim2IndirRange, _Rim2FresnelPower, _Rim2BackfaceMask, _Rim2DirStrength, _Rim2Border, _Rim2Blur, _Rim2IndirBorder, _Rim2IndirBlur, _Rim2ShadowMask, _Rim2EnableLighting, _Rim2VRParallaxStrength, _Rim2GlobalMask, _Rim2GlobalMaskBlendType, _Rim2HueShiftEnabled, _Rim2HueShift, _Rim2HueShiftColorSpace, _Rim2HueShiftSpeed, _Rim2BlendMode); + #endif + #endif + //endex + //ifex _FXProximityColor==0 if (_FXProximityColor) { float3 position = _FXProximityColorType ? poiMesh.worldPos : poiMesh.objectPosition; poiFragData.finalColor *= lerp(poiThemeColor(poiMods, _FXProximityColorMinColor.rgb, _FXProximityColorMinColorThemeIndex), poiThemeColor(poiMods, _FXProximityColorMaxColor.rgb, _FXProximityColorMaxColorThemeIndex), smoothstep(_FXProximityColorMinDistance, _FXProximityColorMaxDistance, distance(position, poiCam.worldPos))); - + if (_FXProximityColorBackFace) { poiFragData.finalColor = lerp(poiFragData.finalColor * _FXProximityColorMinColor.rgb, poiFragData.finalColor, saturate(poiMesh.isFrontFace)); } } //endex - + //UNITY_BRANCH if (_IgnoreFog == 0) { UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor); } - + poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha; - + //ifex _AlphaToCoverage==0 && isNotAnimated(_AlphaToCoverage) ApplyAlphaToCoverage(poiFragData, poiMesh); //endex - + //ifex _AlphaDithering==0 && isNotAnimated(_AlphaDithering) applyDithering(poiFragData, poiCam); //endex - + poiFragData.finalColor += poiLight.finalLightAdd; - + if (_Mode == POI_MODE_OPAQUE) { poiFragData.alpha = 1; } - + clip(poiFragData.alpha - _Cutoff); - + if (_Mode == POI_MODE_CUTOUT && !_AlphaToCoverage) { poiFragData.alpha = 1; } - + if (_AddBlendOp == 4) { poiFragData.alpha = saturate(poiFragData.alpha * _AlphaBoostFA); } - + if (_Mode != POI_MODE_TRANSPARENT) { poiFragData.finalColor *= poiFragData.alpha; } - + //ifex _BSSEnabled!=1 #ifdef POIBS_ENABLE poiFragData.finalColor += poiFragData.emission * poiMods.globalEmission; poiFragData.alpha = poiFragData.alpha * poiFragData.emission.z; poiFragData.emission = 0; - + //ifex _BSSBloomfog!=1 #ifdef POIBS_BLOOMFOG float3 fogDistance = i.worldPos + - _WorldSpaceCameraPos; float4 fogCol = -float4(poiFragData.finalColor, 1) + tex2D(_BloomPrePassTexture, i.fogCoord.xy); fogCol.a = -poiFragData.alpha; - + #ifdef BSSBLOOMFOGTYPE_HEIGHT poiFragData.finalColor = poiFragData.finalColor + (((GetHeightFogIntensity(i.worldPos, _FogHeightOffset, _FogHeightScale) * GetFogIntensity(fogDistance, _FogStartOffset, _FogScale)) + 1) * fogCol.rgb); poiFragData.alpha = poiFragData.alpha + (((GetHeightFogIntensity(i.worldPos, _FogHeightOffset, _FogHeightScale) * GetFogIntensity(fogDistance, _FogStartOffset, _FogScale)) + 1) * fogCol.a); @@ -38852,20 +39849,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex #endif //endex - + return float4(poiFragData.finalColor, poiFragData.alpha) + POI_SAFE_RGB0; } - + ENDCG } - + //ifex _EnableOutlines!=1 - + Pass { Name "Outline" Tags { "LightMode" = "ForwardBase" } - + Stencil { Ref [_OutlineStencilRef] @@ -38877,34 +39874,34 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Fail [_OutlineStencilFailOp] ZFail [_OutlineStencilZFailOp] //endex - + //ifex _OutlineStencilType==0 CompBack [_OutlineStencilBackCompareFunction] PassBack [_OutlineStencilBackPassOp] FailBack [_OutlineStencilBackFailOp] ZFailBack [_OutlineStencilBackZFailOp] - + CompFront [_OutlineStencilFrontCompareFunction] PassFront [_OutlineStencilFrontPassOp] FailFront [_OutlineStencilFrontFailOp] ZFailFront [_OutlineStencilFrontZFailOp] //endex } - + /* ColorMask [_ColorMask] BlendOp [_BlendOp], [_BlendOpAlpha] Blend [_SrcBlend] [_DstBlend] - ZWrite [_ZWrite] AlphaToMask [_AlphaToCoverage] Cull [_OutlineCull] */ AlphaToMask [_AlphaToCoverage] ZTest [_OutlineZTest] + ZWrite [_OutlineZWrite] Cull [_OutlineCull] BlendOp [_OutlineBlendOp], [_OutlineBlendOpAlpha] Blend [_OutlineSrcBlend] [_OutlineDstBlend], [_OutlineSrcBlendAlpha] [_OutlineDstBlendAlpha] - + CGPROGRAM /* // Disable warnings we aren't interested in @@ -38919,80 +39916,80 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex 0==0 #pragma skip_optimizations d3d11 //endex - + #pragma shader_feature_local _STOCHASTICMODE_DELIOT_HEITZ _STOCHASTICMODE_HEXTILE _STOCHASTICMODE_NONE - + //ifex _MainColorAdjustToggle==0 #pragma shader_feature COLOR_GRADING_HDR //endex - + //#pragma shader_feature KEYWORD - + #pragma skip_variants LIGHTMAP_ON DYNAMICLIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK DIRLIGHTMAP_COMBINED _MIXED_LIGHTING_SUBTRACTIVE #pragma skip_variants DECALS_OFF DECALS_3RT DECALS_4RT DECAL_SURFACE_GRADIENT _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 #pragma skip_variants _ADDITIONAL_LIGHT_SHADOWS #pragma skip_variants PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 #pragma skip_variants _SCREEN_SPACE_OCCLUSION - + //ifex _GlobalMaskTexturesEnable==0 #pragma shader_feature_local POI_GLOBALMASK_TEXTURES //endex - + //ifex _EnableUDIMDiscardOptions==0 #pragma shader_feature_local POI_UDIMDISCARD //endex - + //ifex _EnableDistortion==0 #pragma shader_feature USER_LUT //endex - + //ifex _PoiParallax==0 #pragma shader_feature_local POI_PARALLAX //endex - + //ifex _EnableAudioLink==0 #pragma shader_feature_local POI_AUDIOLINK //endex - + //ifex _BlackLightMaskingEnabled==0 #pragma shader_feature_local POI_BLACKLIGHTMASKING //endex - + //ifex _DetailEnabled==0 #pragma shader_feature FINALPASS //endex - + //ifex _VertexManipulationsEnabled==0 #pragma shader_feature AUTO_EXPOSURE //endex - + //ifex _VertexGlitchingEnabled==0 #pragma shader_feature_local POI_VERTEX_GLITCHING #pragma shader_feature_local POI_VERTEX_GLITCHING_TEXTURE //endex - + //ifex _EnableDepthBulge==0 #pragma shader_feature_local POI_DEPTHBULGE //endex - + //ifex _BackFaceEnabled!=1 #pragma shader_feature_local POI_BACKFACE //endex - + //ifex _RGBMaskEnabled==0 #pragma shader_feature VIGNETTE #pragma shader_feature GEOM_TYPE_MESH //endex - + //ifex _LTCGIEnabled!=1 #pragma shader_feature_local POI_LTCGI //endex - + //ifex _ShadingEnabled==0 #pragma shader_feature_local VIGNETTE_MASKED #pragma shader_feature_local _LIGHTINGMODE_TEXTURERAMP _LIGHTINGMODE_MULTILAYER_MATH _LIGHTINGMODE_SHADEMAP _LIGHTINGMODE_REALISTIC _LIGHTINGMODE_WRAPPED _LIGHTINGMODE_SKIN _LIGHTINGMODE_FLAT _LIGHTINGMODE_CLOTH _LIGHTINGMODE_SDF //endex - + //ifex _DecalEnabled==0 #pragma shader_feature GEOM_TYPE_BRANCH //endex @@ -39005,15 +40002,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _DecalEnabled3==0 #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW //endex - + //ifex _EnableDissolve==0 #pragma shader_feature DISTORT //endex - + //ifex _EnableAniso==0 #pragma shader_feature_local POI_ANISOTROPICS //endex - + //ifex _MatcapEnable==0 #pragma shader_feature_local POI_MATCAP0 #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL @@ -39030,23 +40027,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #pragma shader_feature_local POI_MATCAP3 #pragma shader_feature_local POI_MATCAP3_CUSTOM_NORMAL //endex - + //ifex _CubeMapEnabled==0 #pragma shader_feature_local _CUBEMAP //endex - + //ifex _EnableALDecal==0 #pragma shader_feature_local POI_AL_DECAL //endex - + //ifex _EnableVolumeColor==0 #pragma shader_feature_local POI_AL_VOLUMECOLOR //endex - + //ifex _EnableFlipbook==0 #pragma shader_feature _SUNDISK_HIGH_QUALITY //endex - + //ifex _EnableEmission==0 #pragma shader_feature _EMISSION //endex @@ -39059,7 +40056,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _EnableEmission3==0 #pragma shader_feature_local POI_EMISSION_3 //endex - + //ifex _EnableRimLighting==0 #pragma shader_feature_local _GLOSSYREFLECTIONS_OFF #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2 _RIMSTYLE_LILTOON @@ -39068,70 +40065,70 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #pragma shader_feature_local POI_RIM2 #pragma shader_feature_local _RIM2STYLE_POIYOMI _RIM2STYLE_UTS2 _RIM2STYLE_LILTOON //endex - + //ifex _EnableDepthRimLighting==0 #pragma shader_feature_local _POI_DEPTH_RIMLIGHT //endex - + //ifex _GlitterEnable==0 #pragma shader_feature _SUNDISK_SIMPLE //endex - + //ifex _SubsurfaceScattering==0 #pragma shader_feature_local POI_SUBSURFACESCATTERING //endex - + //ifex _MochieBRDF==0 #pragma shader_feature_local MOCHIE_PBR //endex //ifex _ClearCoatBRDF==0 #pragma shader_feature_local POI_CLEARCOAT //endex - + //ifex _EnableEnvironmentalRim==0 #pragma shader_feature_local POI_ENVIRORIM //endex - + //ifex _StylizedSpecular==0 #pragma shader_feature_local POI_STYLIZED_StylizedSpecular //endex - + //ifex _EnablePathing==0 #pragma shader_feature_local POI_PATHING //endex - + //ifex _EnableMirrorOptions==0 #pragma shader_feature_local POI_MIRROR //endex - + //ifex _EnableTouchGlow==0 #pragma shader_feature GRAIN //endex - + //ifex _TextEnabled==0 #pragma shader_feature EFFECT_BUMP //endex - + //ifex _PostProcess==0 #pragma shader_feature_local POSTPROCESS //endex - + //ifex _PoiInternalParallax==0 #pragma shader_feature_local POI_INTERNALPARALLAX //endex - + //ifex _NormalCorrect==0 #pragma shader_feature_local POI_NORMALCORRECT //endex - + //ifex _VideoEffectsEnable==0 #pragma shader_feature_local POI_VIDEO_EFFECTS //endex - + //ifex _BacklightEnabled!=1 #pragma shader_feature_local POI_BACKLIGHT //endex - + //ifex _BSSEnabled!=1 #pragma shader_feature_local POIBS_ENABLE //ifex _BSSBloomfog!=1 @@ -39139,17 +40136,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #pragma shader_feature_local BSSBLOOMFOGTYPE_HEIGHT //endex //endex - + //ifex _VoronoiEnabled!=1 #pragma shader_feature_local POI_VORONOI //endex - + #pragma multi_compile_fwdbase #pragma multi_compile_instancing #pragma multi_compile_fog - #pragma multi_compile _ VERTEXLIGHT_ON + #pragma multi_compile_fragment _ VERTEXLIGHT_ON #define POI_PASS_OUTLINE - + // UNITY Includes #include "UnityCG.cginc" #include "UnityStandardUtils.cginc" @@ -39160,16 +40157,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #include "UnityMetaPass.cginc" #endif #pragma vertex vert - + #pragma fragment frag - + #define DielectricSpec float4(0.04, 0.04, 0.04, 1.0 - 0.04) #define PI float(3.14159265359) #define Epsilon float(1e-10) - + #define POI2D_SAMPLE_TEX2D_SAMPLERGRAD(tex, samplertex, coord, dx, dy) tex.SampleGrad(sampler##samplertex, coord, dx, dy) #define POI2D_SAMPLE_TEX2D_SAMPLERGRADD(tex, samp, uv, pan, dx, dy) tex.SampleGrad(samp, POI_PAN_UV(uv, pan), dx, dy) - + #define POI_PAN_UV(uv, pan) (uv + _Time.x * pan) #define POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, POI_PAN_UV(uv, pan))) #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, dx, dy) (POI2D_SAMPLE_TEX2D_SAMPLERGRAD(tex, texSampler, POI_PAN_UV(uv, pan), dx, dy)) @@ -39182,29 +40179,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv)) #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, POI_PAN_UV(uv, pan))) #define POI_SAMPLE_CUBE_LOD(tex, samp, uv, lod) texCUBElod(tex, float4(uv, 0, lod)) - + #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED) #define POI_SAMPLE_SCREEN(tex, samp, uv) tex.Sample(samp, float3(uv, unity_StereoEyeIndex)) #else #define POI_SAMPLE_SCREEN(tex, samp, uv) tex.Sample(samp, uv) #endif - + // When using, properties won't properly lock at optimize time; needs macro evaluation implemented // #define POI2D_MAINTEX_SAMPLER_PAN_INLINED(tex, poiMesh) (POI2D_SAMPLER_PAN(tex, _MainTex, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Pan)) - + #define POI_SAFE_RGB0 float4(mainTexture.rgb * .0001, 0) #define POI_SAFE_RGB1 float4(mainTexture.rgb * .0001, 1) #define POI_SAFE_RGBA mainTexture - + #if defined(UNITY_COMPILER_HLSL) #define PoiInitStruct(type, name) name = (type)0; #else #define PoiInitStruct(type, name) #endif - + #define POI_ERROR(poiMesh, gridSize) lerp(float3(1, 0, 1), float3(0, 0, 0), fmod(floor((poiMesh.worldPos.x) * gridSize) + floor((poiMesh.worldPos.y) * gridSize) + floor((poiMesh.worldPos.z) * gridSize), 2) == 0) #define POI_NAN (asfloat(-1)) - + #define POI_MODE_OPAQUE 0 #define POI_MODE_CUTOUT 1 #define POI_MODE_FADE 2 @@ -39214,17 +40211,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define POI_MODE_MULTIPLICATIVE 6 #define POI_MODE_2XMULTIPLICATIVE 7 #define POI_MODE_TRANSCLIPPING 9 - + /* Texture2D ; float4 _ST; float2 Pan; float UV; float Stochastic; - + [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )] */ - + //ifex _EnableAudioLink==0 #ifdef POI_AUDIOLINK // Map of where features in AudioLink are. @@ -39257,7 +40254,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define ALPASS_FILTEREDVU uint2(24, 28) //Size: 4, 4 #define ALPASS_FILTEREDVU_INTENSITY uint2(24, 28) //Size: 4, 1 #define ALPASS_FILTEREDVU_MARKER uint2(24, 29) //Size: 4, 1 - + // Some basic constants to use (Note, these should be compatible with // future version of AudioLink, but may change. #define AUDIOLINK_SAMPHIST 3069 // Internal use for algos, do not change. @@ -39276,7 +40273,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define AUDIOLINK_DELAY_COEFFICIENT_MAX 0.9 #define AUDIOLINK_DFT_Q 4.0 #define AUDIOLINK_TREBLE_CORRECTION 5.0 - + // ColorChord constants #define COLORCHORD_EMAXBIN 192 #define COLORCHORD_IIR_DECAY_1 0.90 @@ -39286,13 +40283,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define COLORCHORD_NOTE_CLOSEST 3.0 #define COLORCHORD_NEW_NOTE_GAIN 8.0 #define COLORCHORD_MAX_NOTES 10 - + uniform float4 _AudioTexture_TexelSize; - + #ifdef SHADER_TARGET_SURFACE_ANALYSIS #define AUDIOLINK_STANDARD_INDEXING #endif - + // Mechanism to index into texture. #ifdef AUDIOLINK_STANDARD_INDEXING sampler2D _AudioTexture; @@ -39306,16 +40303,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" uniform float4 _Stored_TexelSize; #endif //endex - + float _GrabMode; float _Mode; - + float _StochasticDeliotHeitzDensity; float _StochasticHexGridDensity; float _StochasticHexRotationStrength; float _StochasticHexFallOffContrast; float _StochasticHexFallOffPower; - + #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED) Texture2D _LightingAOMaps; #endif @@ -39328,7 +40325,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _LightDataAOStrengthA; float _LightDataAOGlobalMaskR; float _LightDataAOGlobalMaskBlendTypeR; - + #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED) Texture2D _LightingDetailShadowMaps; #endif @@ -39345,7 +40342,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _LightingAddDetailShadowStrengthA; float _LightDataDetailShadowGlobalMaskR; float _LightDataDetailShadowGlobalMaskBlendTypeR; - + #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED) Texture2D _LightingShadowMasks; #endif @@ -39358,7 +40355,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _LightingShadowMaskStrengthA; float _LightDataShadowMaskGlobalMaskR; float _LightDataShadowMaskGlobalMaskBlendTypeR; - + // Lighting Data float _Unlit_Intensity; float _LightingColorMode; @@ -39389,13 +40386,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // Lighting Data Debug float _LightDataDebugEnabled; float _LightingDebugVisualize; - + float _IgnoreFog; float _RenderingReduceClipDistance; int _FlipBackfaceNormals; float _AddBlendOp; float _Cull; - + float4 _Color; float _ColorThemeIndex; UNITY_DECLARE_TEX2D(_MainTex); @@ -39421,7 +40418,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaMaskUV; float _AlphaMaskInvert; float _MainAlphaMaskMode; - float _AlphaMaskScale; + float _AlphaMaskBlendStrength; float _AlphaMaskValue; #endif float _Cutoff; @@ -39434,25 +40431,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _MainColorAdjustTexture_ST; float2 _MainColorAdjustTexturePan; float _MainColorAdjustTextureUV; + float _MainHueShiftColorSpace; float _MainHueShiftToggle; float _MainHueShiftReplace; float _MainHueShift; float _MainHueShiftSpeed; float _Saturation; float _MainBrightness; - + float _MainHueALCTEnabled; float _MainALHueShiftBand; float _MainALHueShiftCTIndex; float _MainHueALMotionSpeed; - + float _MainHueGlobalMask; float _MainHueGlobalMaskBlendType; float _MainSaturationGlobalMask; float _MainSaturationGlobalMaskBlendType; float _MainBrightnessGlobalMask; float _MainBrightnessGlobalMaskBlendType; - + #if defined(PROP_MAINGRADATIONTEX) || !defined(OPTIMIZER_ENABLED) Texture2D _MainGradationTex; #endif @@ -39460,11 +40458,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _MainGradationStrength; #endif //endex - + SamplerState sampler_linear_clamp; SamplerState sampler_linear_repeat; SamplerState sampler_trilinear_repeat; - + float _AlphaForceOpaque; float _AlphaMod; float _AlphaPremultiply; @@ -39474,13 +40472,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaSharpenedA2C; float _AlphaMipScale; //endex - + //ifex _AlphaDithering==0 && isNotAnimated(_AlphaDithering) float _AlphaDithering; float _AlphaDitherGradient; float _AlphaDitherBias; //endex - + //ifex _AlphaDistanceFade==0 && isNotAnimated(_AlphaDistanceFade) float _AlphaDistanceFade; float _AlphaDistanceFadeType; @@ -39491,7 +40489,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaDistanceFadeGlobalMask; float _AlphaDistanceFadeGlobalMaskBlendType; //endex - + //ifex _AlphaFresnel==0 && isNotAnimated(_AlphaFresnel) float _AlphaFresnel; float _AlphaFresnelAlpha; @@ -39501,7 +40499,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaFresnelGlobalMask; float _AlphaFresnelGlobalMaskBlendType; //endex - + //ifex _AlphaAngular==0 && isNotAnimated(_AlphaAngular) float _AlphaAngular; float _AngleType; @@ -39515,16 +40513,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaAngularGlobalMask; float _AlphaAngularGlobalMaskBlendType; //endex - + //ifex _AlphaAudioLinkEnabled==0 && isNotAnimated(_AlphaAudioLinkEnabled) float _AlphaAudioLinkEnabled; float2 _AlphaAudioLinkAddRange; float _AlphaAudioLinkAddBand; //endex - + float _AlphaGlobalMask; float _AlphaGlobalMaskBlendType; - + //ifex _EnableOutlines!=1 #ifdef POI_PASS_OUTLINE // outline Vertex Options @@ -39568,7 +40566,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _OutlineAlphaDistanceFadeMaxAlpha; float _OutlineAlphaDistanceFadeMin; float _OutlineAlphaDistanceFadeMax; - + float _OutlineShadowStrength; float _LineColorThemeIndex; float _Offset_Z; @@ -39585,7 +40583,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + float4 _GlobalThemeColor0; float4 _GlobalThemeColor1; float4 _GlobalThemeColor2; @@ -39606,7 +40604,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalThemeValue1; float _GlobalThemeValue2; float _GlobalThemeValue3; - + //ifex _GlobalMaskTexturesEnable==0 #ifdef POI_GLOBALMASK_TEXTURES #if defined(PROP_GLOBALMASKTEXTURE0) || !defined(OPTIMIZER_ENABLED) @@ -39622,7 +40620,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _GlobalMaskTexture0SplitPan_B; float4 _GlobalMaskTexture0SplitTilingOffset_A; float4 _GlobalMaskTexture0SplitPan_A; - + #if defined(PROP_GLOBALMASKTEXTURE1) || !defined(OPTIMIZER_ENABLED) Texture2D _GlobalMaskTexture1; #endif @@ -39636,7 +40634,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _GlobalMaskTexture1SplitPan_B; float4 _GlobalMaskTexture1SplitTilingOffset_A; float4 _GlobalMaskTexture1SplitPan_A; - + #if defined(PROP_GLOBALMASKTEXTURE2) || !defined(OPTIMIZER_ENABLED) Texture2D _GlobalMaskTexture2; #endif @@ -39650,7 +40648,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _GlobalMaskTexture2SplitPan_B; float4 _GlobalMaskTexture2SplitTilingOffset_A; float4 _GlobalMaskTexture2SplitPan_A; - + #if defined(PROP_GLOBALMASKTEXTURE3) || !defined(OPTIMIZER_ENABLED) Texture2D _GlobalMaskTexture3; #endif @@ -39669,7 +40667,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _GlobalMaskOptionsEnable==0 float _GlobalMaskOptionsEnable; int _GlobalMaskOptionsType; - + //ifex _GlobalMaskOptionsType!=0 float _GlobalMaskSlider_0; float _GlobalMaskSlider_1; @@ -39688,7 +40686,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskSlider_14; float _GlobalMaskSlider_15; //endex - + //ifex _GlobalMaskOptionsType!=1 float2 _GlobalMaskMinMaxSlider_0; float2 _GlobalMaskMinMaxSlider_1; @@ -39707,7 +40705,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _GlobalMaskMinMaxSlider_14; float2 _GlobalMaskMinMaxSlider_15; //endex - + //ifex _GlobalMaskOptionsType!=2 int _GlobalMaskToggleOn_0; int _GlobalMaskToggleOff_0; @@ -39762,7 +40760,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskBackface_14; float _GlobalMaskBackface_15; //endex - + //ifex _GlobalMaskModifiersMirrorEnable==0 float _GlobalMaskModifiersMirrorEnable; float _GlobalMaskMirrorVisibilityMode; @@ -39783,7 +40781,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskMirror_14; float _GlobalMaskMirror_15; //endex - + //ifex _GlobalMaskModifiersCameraEnable==0 float _GlobalMaskModifiersCameraEnable; float _GlobalMaskCamera_0; @@ -39803,10 +40801,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskCamera_14; float _GlobalMaskCamera_15; //endex - + //ifex _GlobalMaskModifiersDistanceEnable==0 int _GlobalMaskModifiersDistanceEnable; - + //ifex _GlobalMaskDistanceEnable_0==0 int _GlobalMaskDistanceEnable_0; int _GlobalMaskDistanceType_0; @@ -39816,7 +40814,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_0; int _GlobalMaskDistanceBlendType_0; //endex - + //ifex _GlobalMaskDistanceEnable_1==0 int _GlobalMaskDistanceEnable_1; int _GlobalMaskDistanceType_1; @@ -39826,7 +40824,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_1; int _GlobalMaskDistanceBlendType_1; //endex - + //ifex _GlobalMaskDistanceEnable_2==0 int _GlobalMaskDistanceEnable_2; int _GlobalMaskDistanceType_2; @@ -39836,7 +40834,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_2; int _GlobalMaskDistanceBlendType_2; //endex - + //ifex _GlobalMaskDistanceEnable_3==0 int _GlobalMaskDistanceEnable_3; int _GlobalMaskDistanceType_3; @@ -39846,7 +40844,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_3; int _GlobalMaskDistanceBlendType_3; //endex - + //ifex _GlobalMaskDistanceEnable_4==0 int _GlobalMaskDistanceEnable_4; int _GlobalMaskDistanceType_4; @@ -39856,7 +40854,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_4; int _GlobalMaskDistanceBlendType_4; //endex - + //ifex _GlobalMaskDistanceEnable_5==0 int _GlobalMaskDistanceEnable_5; int _GlobalMaskDistanceType_5; @@ -39866,7 +40864,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_5; int _GlobalMaskDistanceBlendType_5; //endex - + //ifex _GlobalMaskDistanceEnable_6==0 int _GlobalMaskDistanceEnable_6; int _GlobalMaskDistanceType_6; @@ -39876,7 +40874,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_6; int _GlobalMaskDistanceBlendType_6; //endex - + //ifex _GlobalMaskDistanceEnable_7==0 int _GlobalMaskDistanceEnable_7; int _GlobalMaskDistanceType_7; @@ -39886,7 +40884,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_7; int _GlobalMaskDistanceBlendType_7; //endex - + //ifex _GlobalMaskDistanceEnable_8==0 int _GlobalMaskDistanceEnable_8; int _GlobalMaskDistanceType_8; @@ -39896,7 +40894,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_8; int _GlobalMaskDistanceBlendType_8; //endex - + //ifex _GlobalMaskDistanceEnable_9==0 int _GlobalMaskDistanceEnable_9; int _GlobalMaskDistanceType_9; @@ -39906,7 +40904,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_9; int _GlobalMaskDistanceBlendType_9; //endex - + //ifex _GlobalMaskDistanceEnable_10==0 int _GlobalMaskDistanceEnable_10; int _GlobalMaskDistanceType_10; @@ -39916,7 +40914,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_10; int _GlobalMaskDistanceBlendType_10; //endex - + //ifex _GlobalMaskDistanceEnable_11==0 int _GlobalMaskDistanceEnable_11; int _GlobalMaskDistanceType_11; @@ -39926,7 +40924,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_11; int _GlobalMaskDistanceBlendType_11; //endex - + //ifex _GlobalMaskDistanceEnable_12==0 int _GlobalMaskDistanceEnable_12; int _GlobalMaskDistanceType_12; @@ -39936,7 +40934,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_12; int _GlobalMaskDistanceBlendType_12; //endex - + //ifex _GlobalMaskDistanceEnable_13==0 int _GlobalMaskDistanceEnable_13; int _GlobalMaskDistanceType_13; @@ -39946,7 +40944,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_13; int _GlobalMaskDistanceBlendType_13; //endex - + //ifex _GlobalMaskDistanceEnable_14==0 int _GlobalMaskDistanceEnable_14; int _GlobalMaskDistanceType_14; @@ -39956,7 +40954,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_14; int _GlobalMaskDistanceBlendType_14; //endex - + //ifex _GlobalMaskDistanceEnable_15==0 int _GlobalMaskDistanceEnable_15; int _GlobalMaskDistanceType_15; @@ -39967,7 +40965,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _GlobalMaskDistanceBlendType_15; //endex //endex - + int _GlobalMaskVertexColorLinearSpace; //ifex _GlobalMaskVertexColorRed==0 int _GlobalMaskVertexColorRed; @@ -39985,7 +40983,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _GlobalMaskVertexColorAlpha; int _GlobalMaskVertexColorAlphaBlendType; //endex - + //ifex _EnableUDIMDiscardOptions==0 #ifdef POI_UDIMDISCARD float _UDIMDiscardMode; @@ -40008,7 +41006,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _UDIMDiscardRow0_3; #endif //endex - + //ifex _EnableDistortion==0 #ifdef USER_LUT #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED) @@ -40017,14 +41015,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _DistortionFlowTexturePan; float _DistortionFlowTextureUV; #endif - + #if defined(PROP_DISTORTIONFLOWTEXTURE1) || !defined(OPTIMIZER_ENABLED) Texture2D _DistortionFlowTexture1; float4 _DistortionFlowTexture1_ST; float2 _DistortionFlowTexture1Pan; float _DistortionFlowTexture1UV; #endif - + #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _DistortionMask; float4 _DistortionMask_ST; @@ -40032,11 +41030,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DistortionMaskUV; float _DistortionMaskChannel; #endif - + float _DistortionUvToDistort; float _DistortionStrength; float _DistortionStrength1; - + #ifdef POI_AUDIOLINK half _EnableDistortionAudioLink; half2 _DistortionStrengthAudioLink; @@ -40053,22 +41051,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _PolarLengthScale; float _PolarSpiralPower; float _PanoUseBothEyes; - + float _UVModWorldPos0; float _UVModWorldPos1; float _UVModLocalPos0; float _UVModLocalPos1; - + //ifex _EnableAudioLink==0 #ifdef POI_AUDIOLINK float _AudioLinkDelay; float _AudioLinkAnimToggle; - + float _AudioLinkSmoothingBass; float _AudioLinkSmoothingLowMid; float _AudioLinkSmoothingHighMid; float _AudioLinkSmoothingTreble; - + float _DebugWaveform; float _DebugDFT; float _DebugBass; @@ -40081,36 +41079,36 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DebugAutocorrelator; float _DebugChronotensity; float _AudioLinkCCStripY; - + float _AudioLinkBandOverridesEnabled; float4 _AudioLinkBandOverrideSliders; #endif //endex - + //ifex _BlackLightMaskingEnabled==0 #ifdef POI_BLACKLIGHTMASKING float _BlackLightMasking0Key; float2 _BlackLightMasking0Range; float _BlackLightMasking0GlobalMaskIndex; float _BlackLightMasking0GlobalMaskBlendType; - + float _BlackLightMasking1Key; float2 _BlackLightMasking1Range; float _BlackLightMasking1GlobalMaskIndex; float _BlackLightMasking1GlobalMaskBlendType; - + float _BlackLightMasking2Key; float2 _BlackLightMasking2Range; float _BlackLightMasking2GlobalMaskIndex; float _BlackLightMasking2GlobalMaskBlendType; - + float _BlackLightMasking3Key; float2 _BlackLightMasking3Range; float _BlackLightMasking3GlobalMaskIndex; float _BlackLightMasking3GlobalMaskBlendType; #endif //endex - + //ifex _VertexManipulationsEnabled==0 #ifdef AUTO_EXPOSURE float4 _VertexManipulationLocalTranslation; @@ -40128,16 +41126,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VertexRoundingEnabled; int _VertexRoundingSpace; float _VertexRoundingDivision; - + //AL float _VertexAudioLinkEnabled; float3 _VertexLocalTranslationALMin; float3 _VertexLocalTranslationALMax; float _VertexLocalTranslationALBand; - + float3 _VertexLocalRotationAL; float _VertexLocalRotationALBand; - + float3 _VertexLocalRotationCTALSpeed; float _VertexLocalRotationCTALBandX; float _VertexLocalRotationCTALBandY; @@ -40145,39 +41143,39 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VertexLocalRotationCTALTypeX; float _VertexLocalRotationCTALTypeY; float _VertexLocalRotationCTALTypeZ; - + float4 _VertexLocalScaleALMin; float4 _VertexLocalScaleALMax; float _VertexLocalScaleALBand; - + float3 _VertexWorldTranslationALMin; float3 _VertexWorldTranslationALMax; float _VertexWorldTranslationALBand; - + float2 _VertexManipulationHeightAL; float _VertexManipulationHeightBand; - + float2 _VertexRoundingRangeAL; float _VertexRoundingRangeBand; - + float _VertexBarrelMode; float _VertexBarrelWidth; float _VertexBarrelAlpha; float _VertexBarrelHeight; - + float _VertexSphereMode; float _VertexSphereRadius; float _VertexSphereHeight; float _VertexSphereAlpha; float4 _VertexSphereCenter; - + float _VertexTornadoMode; float _VertexTornadoRadius; float _VertexTornadoSpeed; float _VertexTornadoIntensity; float _VertexTornadoBaseHeight; float _VertexTornadoTopHeight; - + float _VertexSpectrumMotion; float3 _VertexSpectrumOffsetMin; float3 _VertexSpectrumOffsetMax; @@ -40185,7 +41183,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VertexSpectrumUVDirection; #endif //endex - + //ifex _VertexGlitchingEnabled==0 #ifdef POI_VERTEX_GLITCHING //Vertex Glitching @@ -40198,35 +41196,35 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VertexGlitchFrequency; float _VertexGlitchStrength; float _VertexGlitchDensity; - + float _VertexGlitchMirrorEnable; float _VertexGlitchMirror; - + float _VertexGlitchMapPanSpeed; float _VertexGlitchingAudioLinkEnabled; float _VertexGlitchingAudioLinkBand; float _VertexGlitchingAudiolinkOverride; #endif //endex - + //ifex _MainVertexColoringEnabled==0 float _MainVertexColoringEnabled; float _MainVertexColoringLinearSpace; float _MainVertexColoring; float _MainUseVertexColorAlpha; //endex - + //ifex _ShadingEnabled==0 float _ShadowStrength; float _LightingIgnoreAmbientColor; float3 _LightingShadowColor; - + float _ShadingRampedLightMapApplyGlobalMaskIndex; float _ShadingRampedLightMapApplyGlobalMaskBlendType; - + float _ShadingRampedLightMapInverseApplyGlobalMaskIndex; float _ShadingRampedLightMapInverseApplyGlobalMaskBlendType; - + // Toon Lighting #ifdef _LIGHTINGMODE_TEXTURERAMP UNITY_DECLARE_TEX2D(_ToonRamp); @@ -40234,7 +41232,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _ToonRampCount; int _ToonRampUVSelector; #endif - + #ifdef _LIGHTINGMODE_WRAPPED float4 _LightingWrappedColor; float _LightingWrappedWrap; @@ -40242,7 +41240,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _LightingGradientStart; float _LightingGradientEnd; #endif - + #ifdef _LIGHTINGMODE_SHADEMAP float3 _1st_ShadeColor; #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED) @@ -40270,7 +41268,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _1st2nd_Shades_Feather; float _ShadingShadeMapBlendType; #endif - + #ifdef _LIGHTINGMODE_SKIN sampler2D _SkinLUT; float _SssScale; @@ -40286,7 +41284,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 _SssTransmissionAbsorption; float3 _SssColorBleedAoWeights; #endif - + #ifdef _LIGHTINGMODE_MULTILAYER_MATH float _ShadowBorderMapToggle; #if defined(PROP_SHADOWBORDERMASK) || !defined(OPTIMIZER_ENABLED) @@ -40299,7 +41297,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _ShadowBorderMaskLOD; float4 _ShadowAOShift; float4 _ShadowAOShift2; - + float4 _ShadowColor; float _LightingMulitlayerNonLinear; #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED) @@ -40341,26 +41339,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _ShadowBorderRange; float _ShadowMainStrength; #endif - + + #ifdef _LIGHTINGMODE_FLAT + float _ForceFlatRampedLightmap; + #endif + #ifdef _LIGHTINGMODE_CLOTH Texture2D_float _ClothDFG; SamplerState sampler_ClothDFG; - + #if defined(PROP_CLOTHMETALLICSMOOTHNESSMAP) || !defined(OPTIMIZER_ENABLED) Texture2D _ClothMetallicSmoothnessMap; #endif - + float4 _ClothMetallicSmoothnessMap_ST; float2 _ClothMetallicSmoothnessMapPan; float _ClothMetallicSmoothnessMapUV; float _ClothMetallicSmoothnessMapInvert; - + float _ClothLerp; float _ClothMetallic; float _ClothReflectance; float _ClothSmoothness; #endif - + #ifdef _LIGHTINGMODE_SDF #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _SDFShadingTexture; @@ -40372,14 +41374,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _SDFLeft; #endif #endif - + // Additive float _LightingAdditiveType; float _LightingAdditiveGradientStart; float _LightingAdditiveGradientEnd; float _LightingAdditiveDetailStrength; //endex - + //ifex _EnableDissolve==0 #ifdef DISTORT float _DissolveType; @@ -40393,35 +41395,35 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _DissolveTextureColor; float _DissolveEdgeColorThemeIndex; float _DissolveTextureColorThemeIndex; - + #if defined(PROP_DISSOLVETOTEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _DissolveToTexture; #endif float4 _DissolveToTexture_ST; float2 _DissolveToTexturePan; float _DissolveToTextureUV; - + #if defined(PROP_DISSOLVENOISETEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _DissolveNoiseTexture; #endif float4 _DissolveNoiseTexture_ST; float2 _DissolveNoiseTexturePan; float _DissolveNoiseTextureUV; - + #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED) Texture2D _DissolveDetailNoise; #endif float4 _DissolveDetailNoise_ST; float2 _DissolveDetailNoisePan; float _DissolveDetailNoiseUV; - + #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _DissolveMask; #endif float4 _DissolveMask_ST; float2 _DissolveMaskPan; float _DissolveMaskUV; - + float _DissolveMaskGlobalMask; float _DissolveMaskGlobalMaskBlendType; float _DissolveApplyGlobalMaskIndex; @@ -40437,27 +41439,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DissolveInvertNoise; float _DissolveInvertDetailNoise; float _DissolveToEmissionStrength; - + // Point to Point float _DissolveP2PWorldLocal; float _DissolveP2PEdgeLength; float _DissolveP2PClamp; float4 _DissolveStartPoint; float4 _DissolveEndPoint; - + // Spherical float3 _SphericalDissolveCenter; float _SphericalDissolveRadius; float _SphericalDissolveInvert; float _SphericalDissolveClamp; - + // CenterOut float _CenterOutDissolveMode; float3 _CenterOutDissolveDirection; float _CenterOutDissolveInvert; float _CenterOutDissolveNormals; float _CenterOutDissolvePower; - + // World Dissolve float _DissolveWorldShape; float4 _DissolveShapePosition; @@ -40465,12 +41467,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DissolveShapeScale; float _DissolveInvertShape; float _DissolveShapeEdgeLength; - + // UV Tile Dissolve float _UVTileDissolveEnabled; float _UVTileDissolveDiscardAtMax; float _UVTileDissolveUV; - + float _UVTileDissolveAlpha_Row3_0; float _UVTileDissolveAlpha_Row3_1; float _UVTileDissolveAlpha_Row3_2; @@ -40487,7 +41489,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _UVTileDissolveAlpha_Row0_1; float _UVTileDissolveAlpha_Row0_2; float _UVTileDissolveAlpha_Row0_3; - + float _DissolveAlpha0; float _DissolveAlpha1; float _DissolveAlpha2; @@ -40502,19 +41504,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DissolveEmissionSide; float _DissolveEmission1Side; float _DissolveUseVertexColors; - + float4 edgeColor; float edgeAlpha; float dissolveAlpha; float4 dissolveToTexture; - + + float _DissolveHueShiftColorSpace; + float _DissolveEdgeHueShiftColorSpace; float _DissolveHueShiftEnabled; float _DissolveHueShiftSpeed; float _DissolveHueShift; float _DissolveEdgeHueShiftEnabled; float _DissolveEdgeHueShiftSpeed; float _DissolveEdgeHueShift; - + // Audio Link #ifdef POI_AUDIOLINK fixed _EnableDissolveAudioLink; @@ -40525,7 +41529,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableALDecal==0 #ifdef POI_AUDIOLINK #ifdef POI_AL_DECAL @@ -40535,28 +41539,28 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _ALUVRotation; float _ALUVRotationSpeed; float4 _ALDecaldCircleDimensions; - + float _ALDecalUVMode; - + float _ALDecalVolumeStep; float _ALDecalVolumeClipMin; float _ALDecalVolumeClipMax; - + float _ALDecalBandStep; float _ALDecalBandClipMin; float _ALDecalBandClipMax; - + float _ALDecalShapeClip; float _ALDecalShapeClipVolumeWidth; float _ALDecalShapeClipBandWidth; - + #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _ALDecalColorMask; float4 _ALDecalColorMask_ST; float2 _ALDecalColorMaskPan; float _ALDecalColorMaskUV; #endif - + float _ALDecalVolume; float _ALDecalBaseBoost; float _ALDecalTrebleBoost; @@ -40579,13 +41583,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableFlipbook==0 #ifdef _SUNDISK_HIGH_QUALITY - + UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray); float4 _FlipbookTexArray_ST; - + float4 _FlipbookColor; float _FlipbookColorThemeIndex; float _FlipbookFPS; @@ -40613,7 +41617,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _FlipbookMultiply; float _FlipbookAdd; float _FlipbookBlendType; - + #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED) Texture2D _FlipbookMask; #endif @@ -40623,21 +41627,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _FlipbookMaskChannel; float _FlipbookMaskGlobalMask; float _FlipbookMaskGlobalMaskBlendType; - + // anim float _FlipbookMovementType; float4 _FlipbookStartEndOffset; float _FlipbookMovementSpeed; - + // Crossfade float _FlipbookCrossfadeEnabled; float2 _FlipbookCrossfadeRange; - + // Hueshift float _FlipbookHueShiftEnabled; + float _FlipbookHueShiftColorSpace; float _FlipbookHueShiftSpeed; float _FlipbookHueShift; - + #ifdef POI_AUDIOLINK float _FlipbookChronotensityEnabled; float _FlipbookChronotensityBand; @@ -40654,7 +41659,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableMirrorOptions==0 #ifdef POI_MIRROR float _VisibilityMode; @@ -40678,19 +41683,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VisibilityVRCCameraScreenshot; #endif //endex - + float _PPLightingMultiplier; float _PPLightingAddition; float _PPEmissionMultiplier; float _PPFinalColorMultiplier; - + //ifex _NormalCorrect==0 #ifdef POI_NORMALCORRECT float _NormalCorrectAmount; float3 _NormalCorrectOrigin; #endif //endex - + //ifex _VideoEffectsEnable==0 #ifdef POI_VIDEO_EFFECTS float _VideoEffectsEnable; @@ -40706,7 +41711,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VideoMaskTextureUV; float _VideoMaskTextureChannel; #endif - + float _VideoType; float2 _VideoResolution; sampler2D _VideoGameboyRamp; @@ -40716,13 +41721,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VideoRepeatVideoTexture; float _VideoPixelateToResolution; float2 _VideoMaskPanning; - + float _VideoSaturation; float _VideoContrast; float _VideoEmissionEnabled; #endif //endex - + //ifex _BacklightEnabled!=1 #ifdef POI_BACKLIGHT float4 _BacklightColor; @@ -40742,7 +41747,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _BacklightBackfaceMask; #endif //endex - + //ifex _BSSEnabled!=1 #ifdef POIBS_ENABLE float _CustomColors; @@ -40752,10 +41757,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _FogScale; float _FogHeightOffset; float _FogHeightScale; - + uniform float2 _CustomFogTextureToScreenRatio; uniform float _StereoCameraEyeOffset; - + uniform float _CustomFogOffset; uniform float _CustomFogAttenuation; uniform float _CustomFogHeightFogStartY; @@ -40765,7 +41770,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex #endif //endex - + //ifex _VoronoiEnabled!=1 #ifdef POI_VORONOI #if defined(PROP_VORONOIMASK) || !defined(OPTIMIZER_ENABLED) @@ -40800,18 +41805,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _VoronoiAffectsMaterialAlpha; float _VoronoiGlobalMask; float _VoronoiGlobalMaskBlendType; - + // AudioLink int _AudioLinkVoronoiInnerEmissionBand; float2 _AudioLinkVoronoiInnerEmission; int _AudioLinkVoronoiOuterEmissionBand; float2 _AudioLinkVoronoiOuterEmission; - + int _AudioLinkVoronoiGradientMinAddBand; float _AudioLinkVoronoiGradientMinAdd; int _AudioLinkVoronoiGradientMaxAddBand; float _AudioLinkVoronoiGradientMaxAdd; - + int _AudioLinkVoronoiChronoSpeedXType; int _AudioLinkVoronoiChronoSpeedXBand; float _AudioLinkVoronoiChronoSpeedXSpeed; @@ -40823,7 +41828,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AudioLinkVoronoiChronoSpeedZSpeed; #endif //endex - + struct appdata { float4 vertex : POSITION; @@ -40836,9 +41841,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 uv3 : TEXCOORD3; uint vertexId : SV_VertexID; UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO }; - + struct VertexOut { float4 pos : SV_POSITION; @@ -40851,14 +41855,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 lightmapUV : TEXCOORD7; float2 fogCoord: TEXCOORD10; UNITY_SHADOW_COORDS(11) - + UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; - + struct PoiMesh { - + // 0 Vertex normal // 1 Fragment normal float3 normals[2]; @@ -40881,8 +41885,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 parallaxUV; float2 dx; float2 dy; + uint isRightHand; }; - + struct PoiCam { float3 viewDir; @@ -40899,9 +41904,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 screenUV; float vDotN; float4 worldDirection; - + }; - + struct PoiMods { float4 Mask; @@ -40916,10 +41921,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float globalMask[16]; float ALTime[8]; }; - + struct PoiLight { - + float3 direction; float attenuation; float attenuationStrength; @@ -40952,7 +41957,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float directLuminance; float indirectLuminance; float finalLuminance; - + #if defined(VERTEXLIGHT_ON) // Non Important Lights float4 vDotNL; @@ -40969,17 +41974,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" half4 vertexVDotNH; half4 vDotLH; #endif - + }; - + struct PoiVertexLights { - + float3 direction; float3 color; float attenuation; }; - + struct PoiFragData { float smoothness; @@ -40987,34 +41992,34 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float metallic; float specularMask; float reflectionMask; - + float3 baseColor; float3 finalColor; float alpha; float3 emission; float toggleVertexLights; }; - + float4 poiTransformClipSpacetoScreenSpaceFrag(float4 clipPos) { float4 positionSS = float4(clipPos.xyz * clipPos.w, clipPos.w); positionSS.xy = positionSS.xy / _ScreenParams.xy; return positionSS; } - + // glsl_mod behaves better on negative numbers, and // in some situations actually outperforms HLSL's fmod() #ifndef glsl_mod #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y)))) #endif - + uniform float random_uniform_float_only_used_to_stop_compiler_warnings = 0.0f; - + float2 poiUV(float2 uv, float4 tex_st) { return uv * tex_st.xy + tex_st.zw; } - + float2 vertexUV(in VertexOut o, int index) { switch(index) @@ -41031,7 +42036,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return o.uv[0].xy; } } - + float2 vertexUV(in appdata v, int index) { switch(index) @@ -41048,67 +42053,67 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return v.uv0.xy; } } - + //Lighting Helpers float calculateluminance(float3 color) { return color.r * 0.299 + color.g * 0.587 + color.b * 0.114; } - + // Set by VRChat (as of open beta 1245) // _VRChatCameraMode: 0 => Normal, 1 => VR HandCam, 2 => Desktop Handcam, 3 => Screenshot/Photo // _VRChatMirrorMode: 0 => Normal, 1 => Mirror (VR), 2 => Mirror (Deskie) float _VRChatCameraMode; float _VRChatMirrorMode; - + float VRCCameraMode() { return _VRChatCameraMode; } - + float VRCMirrorMode() { return _VRChatMirrorMode; } - + bool IsInMirror() { return unity_CameraProjection[2][0] != 0.f || unity_CameraProjection[2][1] != 0.f; } - + bool IsOrthographicCamera() { return unity_OrthoParams.w == 1 || UNITY_MATRIX_P[3][3] == 1; } - + float shEvaluateDiffuseL1Geomerics_local(float L0, float3 L1, float3 n) { // average energy float R0 = max(0, L0); - + // avg direction of incoming light float3 R1 = 0.5f * L1; - + // directional brightness float lenR1 = length(R1); - + // linear angle between normal and direction 0-1 //float q = 0.5f * (1.0f + dot(R1 / lenR1, n)); //float q = dot(R1 / lenR1, n) * 0.5 + 0.5; float q = dot(normalize(R1), n) * 0.5 + 0.5; q = saturate(q); // Thanks to ScruffyRuffles for the bug identity. - + // power for q // lerps from 1 (linear) to 3 (cubic) based on directionality float p = 1.0f + 2.0f * lenR1 / R0; - + // dynamic range constant // should vary between 4 (highly directional) and 0 (ambient) float a = (1.0f - lenR1 / R0) / (1.0f + lenR1 / R0); - + return R0 * (a + (1.0f - a) * (p + 1.0f) * pow(q, p)); } - + half3 BetterSH9(half4 normal) { float3 indirect; @@ -41120,9 +42125,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirect += SHEvalLinearL2(normal); return indirect; } - + // Silent's code ends here - + float3 getCameraForward() { #if UNITY_SINGLE_PASS_STEREO @@ -41134,7 +42139,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif return normalize(p2 - p1); } - + half3 GetSHLength() { half3 x, x1; @@ -41146,7 +42151,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" x1.b = length(unity_SHBb); return x + x1; } - + float3 BoxProjection(float3 direction, float3 position, float4 cubemapPosition, float3 boxMin, float3 boxMax) { #if UNITY_SPECCUBE_BOX_PROJECTION @@ -41160,22 +42165,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif return direction; } - + float poiMax(float2 i) { return max(i.x, i.y); } - + float poiMax(float3 i) { return max(max(i.x, i.y), i.z); } - + float poiMax(float4 i) { return max(max(max(i.x, i.y), i.z), i.w); } - + float3 calculateNormal(in float3 baseNormal, in PoiMesh poiMesh, in Texture2D normalTexture, in float4 normal_ST, in float2 normalPan, in float normalUV, in float normalIntensity) { float3 normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(normalTexture, _MainTex, poiUV(poiMesh.uv[normalUV], normal_ST), normalPan), normalIntensity); @@ -41185,42 +42190,42 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" normal.z * baseNormal ); } - + float remap(float x, float minOld, float maxOld, float minNew = 0, float maxNew = 1) { return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); } - + float2 remap(float2 x, float2 minOld, float2 maxOld, float2 minNew = 0, float2 maxNew = 1) { return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); } - + float3 remap(float3 x, float3 minOld, float3 maxOld, float3 minNew = 0, float3 maxNew = 1) { return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); } - + float4 remap(float4 x, float4 minOld, float4 maxOld, float4 minNew = 0, float4 maxNew = 1) { return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); } - + float remapClamped(float minOld, float maxOld, float x, float minNew = 0, float maxNew = 1) { return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); } - + float2 remapClamped(float2 minOld, float2 maxOld, float2 x, float2 minNew, float2 maxNew) { return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); } - + float3 remapClamped(float3 minOld, float3 maxOld, float3 x, float3 minNew, float3 maxNew) { return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); } - + float4 remapClamped(float4 minOld, float4 maxOld, float4 x, float4 minNew, float4 maxNew) { return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); @@ -41229,7 +42234,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return ((height * - 1) + 1) * (poiCam.tangentViewDir.xy / poiCam.tangentViewDir.z); } - + /* 0: Zero float4(0.0, 0.0, 0.0, 0.0), 1: One float4(1.0, 1.0, 1.0, 1.0), @@ -41243,7 +42248,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 9: SrcAlphaSaturate saturate(sourceColor.aaaa), 10: OneMinusSrcAlpha float4(1.0, 1.0, 1.0, 1.0) - sourceColor.aaaa, */ - + float4 poiBlend(const float sourceFactor, const float4 sourceColor, const float destinationFactor, const float4 destinationColor, const float4 blendFactor) { float4 sA = 1 - blendFactor; @@ -41260,10 +42265,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" saturate(sourceColor.aaaa), 1 - sA, }; - + return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA); } - + // Average float blendAverage(float base, float blend) { @@ -41273,40 +42278,40 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return (base + blend) / 2.0; } - + // Color burn float blendColorBurn(float base, float blend) { return (blend == 0.0) ? blend : max((1.0 - ((1.0 - base) * rcp(random_uniform_float_only_used_to_stop_compiler_warnings + blend))), 0.0); } - + float3 blendColorBurn(float3 base, float3 blend) { return float3(blendColorBurn(base.r, blend.r), blendColorBurn(base.g, blend.g), blendColorBurn(base.b, blend.b)); } - + // Color Dodge float blendColorDodge(float base, float blend) { return (blend == 1.0) ? blend : min(base / (1.0 - blend), 1.0); } - + float3 blendColorDodge(float3 base, float3 blend) { return float3(blendColorDodge(base.r, blend.r), blendColorDodge(base.g, blend.g), blendColorDodge(base.b, blend.b)); } - + // Darken float blendDarken(float base, float blend) { return min(blend, base); } - + float3 blendDarken(float3 base, float3 blend) { return float3(blendDarken(base.r, blend.r), blendDarken(base.g, blend.g), blendDarken(base.b, blend.b)); } - + // Exclusion float blendExclusion(float base, float blend) { @@ -41316,18 +42321,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return base + blend - 2.0 * base * blend; } - + // Reflect float blendReflect(float base, float blend) { return (blend == 1.0) ? blend : min(base * base / (1.0 - blend), 1.0); } - + float3 blendReflect(float3 base, float3 blend) { return float3(blendReflect(base.r, blend.r), blendReflect(base.g, blend.g), blendReflect(base.b, blend.b)); } - + // Glow float blendGlow(float base, float blend) { @@ -41337,18 +42342,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return blendReflect(blend, base); } - + // Overlay float blendOverlay(float base, float blend) { return base < 0.5 ? (2.0 * base * blend) : (1.0 - 2.0 * (1.0 - base) * (1.0 - blend)); } - + float3 blendOverlay(float3 base, float3 blend) { return float3(blendOverlay(base.r, blend.r), blendOverlay(base.g, blend.g), blendOverlay(base.b, blend.b)); } - + // Hard Light float blendHardLight(float base, float blend) { @@ -41358,77 +42363,77 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return blendOverlay(blend, base); } - + // Vivid light float blendVividLight(float base, float blend) { return (blend < 0.5) ? blendColorBurn(base, (2.0 * blend)) : blendColorDodge(base, (2.0 * (blend - 0.5))); } - + float3 blendVividLight(float3 base, float3 blend) { return float3(blendVividLight(base.r, blend.r), blendVividLight(base.g, blend.g), blendVividLight(base.b, blend.b)); } - + // Hard mix float blendHardMix(float base, float blend) { return (blendVividLight(base, blend) < 0.5) ? 0.0 : 1.0; } - + float3 blendHardMix(float3 base, float3 blend) { return float3(blendHardMix(base.r, blend.r), blendHardMix(base.g, blend.g), blendHardMix(base.b, blend.b)); } - + // Lighten float blendLighten(float base, float blend) { return max(blend, base); } - + float3 blendLighten(float3 base, float3 blend) { return float3(blendLighten(base.r, blend.r), blendLighten(base.g, blend.g), blendLighten(base.b, blend.b)); } - + // Linear Burn float blendLinearBurn(float base, float blend) { // Note : Same implementation as BlendSubtractf return max(base + blend - 1.0, 0.0); } - + float3 blendLinearBurn(float3 base, float3 blend) { // Note : Same implementation as BlendSubtract return max(base + blend - float3(1.0, 1.0, 1.0), float3(0.0, 0.0, 0.0)); } - + // Linear Dodge float blendLinearDodge(float base, float blend) { // Note : Same implementation as BlendAddf return min(base + blend, 1.0); } - + float3 blendLinearDodge(float3 base, float3 blend) { // Note : Same implementation as BlendAdd return base + blend; } - + // Linear light float blendLinearLight(float base, float blend) { return blend < 0.5 ? blendLinearBurn(base, (2.0 * blend)) : blendLinearDodge(base, (2.0 * (blend - 0.5))); } - + float3 blendLinearLight(float3 base, float3 blend) { return float3(blendLinearLight(base.r, blend.r), blendLinearLight(base.g, blend.g), blendLinearLight(base.b, blend.b)); } - + // Multiply float blendMultiply(float base, float blend) { @@ -41438,7 +42443,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return base * blend; } - + // Negation float blendNegation(float base, float blend) { @@ -41448,7 +42453,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend); } - + // Normal float blendNormal(float base, float blend) { @@ -41458,7 +42463,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return blend; } - + // Phoenix float blendPhoenix(float base, float blend) { @@ -41468,83 +42473,83 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return min(base, blend) - max(base, blend) + float3(1.0, 1.0, 1.0); } - + // Pin light float blendPinLight(float base, float blend) { return (blend < 0.5) ? blendDarken(base, (2.0 * blend)) : blendLighten(base, (2.0 * (blend - 0.5))); } - + float3 blendPinLight(float3 base, float3 blend) { return float3(blendPinLight(base.r, blend.r), blendPinLight(base.g, blend.g), blendPinLight(base.b, blend.b)); } - + // Screen float blendScreen(float base, float blend) { return 1.0 - ((1.0 - base) * (1.0 - blend)); } - + float3 blendScreen(float3 base, float3 blend) { return float3(blendScreen(base.r, blend.r), blendScreen(base.g, blend.g), blendScreen(base.b, blend.b)); } - + // Soft Light float blendSoftLight(float base, float blend) { return (blend < 0.5) ? (2.0 * base * blend + base * base * (1.0 - 2.0 * blend)) : (sqrt(base) * (2.0 * blend - 1.0) + 2.0 * base * (1.0 - blend)); } - + float3 blendSoftLight(float3 base, float3 blend) { return float3(blendSoftLight(base.r, blend.r), blendSoftLight(base.g, blend.g), blendSoftLight(base.b, blend.b)); } - + // Subtract float blendSubtract(float base, float blend) { return max(base - blend, 0.0); } - + float3 blendSubtract(float3 base, float3 blend) { return max(base - blend, 0.0); } - + // Difference float blendDifference(float base, float blend) { return abs(base - blend); } - + float3 blendDifference(float3 base, float3 blend) { return abs(base - blend); } - + // Divide float blendDivide(float base, float blend) { return base / max(blend, 0.0001); } - + float3 blendDivide(float3 base, float3 blend) { return base / max(blend, 0.0001); } - + float blendMixed(float base, float blend) { return base + base * blend; } - + float3 blendMixed(float3 base, float3 blend) { return base + base * blend; } - + float3 customBlend(float3 base, float3 blend, float blendType, float alpha = 1) { float3 output = base; @@ -41563,7 +42568,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return output; } - + float3 customBlend(float base, float blend, float blendType, float alpha = 1) { float3 output = base; @@ -41581,7 +42586,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return output; } - + #define REPLACE 0 #define SUBSTRACT 1 #define MULTIPLY 2 @@ -41590,7 +42595,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define MAX 5 #define AVERAGE 6 #define ADD 7 - + float maskBlend(float baseMask, float blendMask, float blendType) { float output = 0; @@ -41607,7 +42612,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return saturate(output); } - + float globalMaskBlend(float baseMask, float globalMaskIndex, float blendType, PoiMods poiMods) { if (globalMaskIndex == 0) @@ -41619,27 +42624,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return maskBlend(baseMask, poiMods.globalMask[globalMaskIndex - 1], blendType); } } - + float random(float2 p) { return frac(sin(dot(p, float2(12.9898, 78.2383))) * 43758.5453123); } - + float2 random2(float2 p) { return frac(sin(float2(dot(p, float2(127.1, 311.7)), dot(p, float2(269.5, 183.3)))) * 43758.5453); } - + float3 random3(float2 p) { return frac(sin(float3(dot(p, float2(127.1, 311.7)), dot(p, float2(269.5, 183.3)), dot(p, float2(248.3, 315.9)))) * 43758.5453); } - + float3 random3(float3 p) { return frac(sin(float3(dot(p, float3(127.1, 311.7, 248.6)), dot(p, float3(269.5, 183.3, 423.3)), dot(p, float3(248.3, 315.9, 184.2)))) * 43758.5453); } - + float3 randomFloat3(float2 Seed, float maximum) { return (.5 + float3( @@ -41648,7 +42653,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453) ) * .5) * (maximum); } - + float3 randomFloat3Range(float2 Seed, float Range) { return (float3( @@ -41657,7 +42662,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453) ) * 2 - 1) * Range; } - + float3 randomFloat3WiggleRange(float2 Seed, float Range, float wiggleSpeed, float timeOffset) { float3 rando = (float3( @@ -41668,7 +42673,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float speed = 1 + wiggleSpeed; return float3(sin(((_Time.x + timeOffset) + rando.x * PI) * speed), sin(((_Time.x + timeOffset) + rando.y * PI) * speed), sin(((_Time.x + timeOffset) + rando.z * PI) * speed)) * Range; } - + void poiDither(float4 In, float4 ScreenPosition, out float4 Out) { float2 uv = ScreenPosition.xy * _ScreenParams.xy; @@ -41689,7 +42694,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" static const float HCLmaxL = 0.530454533953517; // == exp(HCLgamma / HCLy0) - 0.5 static const float3 wref = float3(1.0, 1.0, 1.0); #define TAU 6.28318531 - + float3 HUEtoRGB(in float H) { float R = abs(H * 6 - 3) - 1; @@ -41697,7 +42702,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float B = 2 - abs(H * 6 - 4); return saturate(float3(R, G, B)); } - + float3 RGBtoHCV(in float3 RGB) { // Based on work by Sam Hocevar and Emil Persson @@ -41707,27 +42712,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float H = abs((Q.w - Q.y) / (6 * C + Epsilon) + Q.z); return float3(H, C, Q.x); } - - float3 HSVtoRGB(in float3 HSV) - { - float3 RGB = HUEtoRGB(HSV.x); - return ((RGB - 1) * HSV.y + 1) * HSV.z; + + float3 RGBtoHSV(float3 c){ + float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); + float4 p = lerp(float4(c.bg, K.wz), float4(c.gb, K.xy), step(c.b, c.g)); + float4 q = lerp(float4(p.xyw, c.r), float4(c.r, p.yzx), step(p.x, c.r)); + + float d = q.x - min(q.w, q.y); + float e = 1.0e-10; + return float3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); } - - float3 RGBtoHSV(in float3 RGB) - { - float3 HCV = RGBtoHCV(RGB); - float S = HCV.y / (HCV.z + Epsilon); - return float3(HCV.x, S, HCV.z); + + float3 HSVtoRGB(float3 c){ + float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); + float3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www); + return c.z * lerp(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); } - + float3 HSLtoRGB(in float3 HSL) { float3 RGB = HUEtoRGB(HSL.x); float C = (1 - abs(2 * HSL.z - 1)) * HSL.y; return (RGB - 0.5) * C + HSL.z; } - + float3 RGBtoHSL(in float3 RGB) { float3 HCV = RGBtoHCV(RGB); @@ -41735,24 +42743,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon); return float3(HCV.x, S, L); } - + void DecomposeHDRColor(in float3 linearColorHDR, out float3 baseLinearColor, out float exposure) { // Optimization/adaptation of https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/GUI/ColorMutator.cs#L23 but skips weird photoshop stuff float maxColorComponent = max(linearColorHDR.r, max(linearColorHDR.g, linearColorHDR.b)); bool isSDR = maxColorComponent <= 1.0; - + float scaleFactor = isSDR ? 1.0 : (1.0 / maxColorComponent); exposure = isSDR ? 0.0 : log(maxColorComponent) * 1.44269504089; // ln(2) - + baseLinearColor = scaleFactor * linearColorHDR; } - + float3 ApplyHDRExposure(float3 linearColor, float exposure) { return linearColor * pow(2, exposure); } - + // Transforms an RGB color using a matrix. Note that S and V are absolute values here float3 ModifyViaHSV(float3 color, float h, float s, float v) { @@ -41762,12 +42770,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" colorHSV.z = saturate(colorHSV.z + v); return HSVtoRGB(colorHSV); } - + float3 ModifyViaHSV(float3 color, float3 HSVMod) { return ModifyViaHSV(color, HSVMod.x, HSVMod.y, HSVMod.z); } - + float4x4 brightnessMatrix(float brightness) { return float4x4( @@ -41777,11 +42785,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" brightness, brightness, brightness, 1 ); } - + float4x4 contrastMatrix(float contrast) { float t = (1.0 - contrast) / 2.0; - + return float4x4( contrast, 0, 0, 0, 0, contrast, 0, 0, @@ -41789,22 +42797,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" t, t, t, 1 ); } - + float4x4 saturationMatrix(float saturation) { float3 luminance = float3(0.3086, 0.6094, 0.0820); - + float oneMinusSat = 1.0 - saturation; - + float3 red = luminance.x * oneMinusSat; red += float3(saturation, 0, 0); - + float3 green = luminance.y * oneMinusSat; green += float3(0, saturation, 0); - + float3 blue = luminance.z * oneMinusSat; blue += float3(0, 0, saturation); - + return float4x4( red, 0, green, 0, @@ -41812,7 +42820,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, 0, 0, 1 ); } - + float4 PoiColorBCS(float4 color, float brightness, float contrast, float saturation) { return mul(color, mul(brightnessMatrix(brightness), mul(contrastMatrix(contrast), saturationMatrix(saturation)))); @@ -41821,68 +42829,87 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return mul(float4(color, 1), mul(brightnessMatrix(brightness), mul(contrastMatrix(contrast), saturationMatrix(saturation)))).rgb; } - + float3 linear_srgb_to_oklab(float3 c) { float l = 0.4122214708 * c.x + 0.5363325363 * c.y + 0.0514459929 * c.z; float m = 0.2119034982 * c.x + 0.6806995451 * c.y + 0.1073969566 * c.z; float s = 0.0883024619 * c.x + 0.2817188376 * c.y + 0.6299787005 * c.z; - + float l_ = pow(l, 1.0 / 3.0); float m_ = pow(m, 1.0 / 3.0); float s_ = pow(s, 1.0 / 3.0); - + return float3( 0.2104542553 * l_ + 0.7936177850 * m_ - 0.0040720468 * s_, 1.9779984951 * l_ - 2.4285922050 * m_ + 0.4505937099 * s_, 0.0259040371 * l_ + 0.7827717662 * m_ - 0.8086757660 * s_ ); } - + float3 oklab_to_linear_srgb(float3 c) { float l_ = c.x + 0.3963377774 * c.y + 0.2158037573 * c.z; float m_ = c.x - 0.1055613458 * c.y - 0.0638541728 * c.z; float s_ = c.x - 0.0894841775 * c.y - 1.2914855480 * c.z; - + float l = l_ * l_ * l_; float m = m_ * m_ * m_; float s = s_ * s_ * s_; - + return float3( + 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s, - 1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s, - 0.0041960863 * l - 0.7034186147 * m + 1.7076147010 * s ); } - + float3 hueShift(float3 color, float shift) { - float3 oklab = linear_srgb_to_oklab(max(color, 0.0000000001)); + float3 oklab = linear_srgb_to_oklab(color); + float chroma = length(oklab.yz); + + if (chroma < 1e-5) { + // No hue to shift for achromatic colors + return color; + } + float hue = atan2(oklab.z, oklab.y); hue += shift * PI * 2; // Add the hue shift - - float chroma = length(oklab.yz); + oklab.y = cos(hue) * chroma; oklab.z = sin(hue) * chroma; - + return oklab_to_linear_srgb(oklab); } - - float3 hueShift(float4 color, float shift) + + float3 hueShiftHSV(float3 color, float hueOffset) { - return hueShift(color.rgb, shift); + float3 hsv = float3(hueOffset, 0, 0); + float3 hsvCol = RGBtoHSV(color); + return HSVtoRGB(hsvCol + hsv); } - - /* - float3 hueShift(float3 color, float hueOffset) + + float3 hueShift(float3 color, float shift, float ColorSpace) { - color = RGBtoHSV(color); - color.x = frac(hueOffset +color.x); - return HSVtoRGB(color); + switch(ColorSpace) + { + // OkLab Hue Shift + case 0.0: + return hueShift(color, shift); + // HSV Hue Shift + case 1.0: + return hueShiftHSV(color, shift); + default: + return float3(1.0, 0.0, 0.0); + } } - */ - + + float3 hueShift(float4 color, float shift, float ColorSpace) + { + return hueShift(color.rgb, shift, ColorSpace); + } + // LCH float xyzF(float t) { @@ -41892,7 +42919,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655)); } - + float4x4 poiRotationMatrixFromAngles(float x, float y, float z) { float angleX = radians(x); @@ -41902,7 +42929,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1); - + float angleY = radians(y); c = cos(angleY); s = sin(angleY); @@ -41910,7 +42937,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, 1, 0, 0, - s, 0, c, 0, 0, 0, 0, 1); - + float angleZ = radians(z); c = cos(angleZ); s = sin(angleZ); @@ -41918,10 +42945,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); - + return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix); } - + float4x4 poiRotationMatrixFromAngles(float3 angles) { float angleX = radians(angles.x); @@ -41931,7 +42958,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1); - + float angleY = radians(angles.y); c = cos(angleY); s = sin(angleY); @@ -41939,7 +42966,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, 1, 0, 0, - s, 0, c, 0, 0, 0, 0, 1); - + float angleZ = radians(angles.z); c = cos(angleZ); s = sin(angleZ); @@ -41947,10 +42974,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); - + return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix); } - + float3 getCameraPosition() { #ifdef USING_STEREO_MATRICES @@ -41958,7 +42985,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif return _WorldSpaceCameraPos; } - + float2 calcPixelScreenUVs(half4 grabPos) { half2 uv = grabPos.xy / (grabPos.w + 0.0000000001); @@ -41967,60 +42994,60 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else uv.xy *= _ScreenParams.xy; #endif - + return uv; } - + float CalcMipLevel(float2 texture_coord) { float2 dx = ddx(texture_coord); float2 dy = ddy(texture_coord); float delta_max_sqr = max(dot(dx, dx), dot(dy, dy)); - + return 0.5 * log2(delta_max_sqr); } - + float inverseLerp(float A, float B, float T) { return (T - A) / (B - A); } - + float inverseLerp2(float2 a, float2 b, float2 value) { float2 AB = b - a; float2 AV = value - a; return dot(AV, AB) / dot(AB, AB); } - + float inverseLerp3(float3 a, float3 b, float3 value) { float3 AB = b - a; float3 AV = value - a; return dot(AV, AB) / dot(AB, AB); } - + float inverseLerp4(float4 a, float4 b, float4 value) { float4 AB = b - a; float4 AV = value - a; return dot(AV, AB) / dot(AB, AB); } - + /* MIT License - + Copyright (c) 2019 wraikny - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -42028,29 +43055,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + VertexTransformShader is dependent on: */ - + float4 quaternion_conjugate(float4 v) { return float4( v.x, -v.yzw ); } - + float4 quaternion_mul(float4 v1, float4 v2) { float4 result1 = (v1.x * v2 + v1 * v2.x); - + float4 result2 = float4( - dot(v1.yzw, v2.yzw), cross(v1.yzw, v2.yzw) ); - + return float4(result1 + result2); } - + // angle : radians float4 get_quaternion_from_angle(float3 axis, float angle) { @@ -42058,45 +43085,45 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float cs = cos(angle * 0.5); return float4(axis * sn, cs); } - + float4 quaternion_from_vector(float3 inVec) { return float4(0.0, inVec); } - + float degree_to_radius(float degree) { return ( degree / 180.0 * PI ); } - + float3 rotate_with_quaternion(float3 inVec, float3 rotation) { float4 qx = get_quaternion_from_angle(float3(1, 0, 0), radians(rotation.x)); float4 qy = get_quaternion_from_angle(float3(0, 1, 0), radians(rotation.y)); float4 qz = get_quaternion_from_angle(float3(0, 0, 1), radians(rotation.z)); - + #define MUL3(A, B, C) quaternion_mul(quaternion_mul((A), (B)), (C)) float4 quaternion = normalize(MUL3(qx, qy, qz)); float4 conjugate = quaternion_conjugate(quaternion); - + float4 inVecQ = quaternion_from_vector(inVec); - + float3 rotated = ( MUL3(quaternion, inVecQ, conjugate) ).yzw; - + return rotated; } - + float4 transform(float4 input, float4 pos, float4 rotation, float4 scale) { input.rgb *= (scale.xyz * scale.w); input = float4(rotate_with_quaternion(input.xyz, rotation.xyz * rotation.w) + (pos.xyz * pos.w), input.w); return input; } - + float2 RotateUV(float2 _uv, float _radian, float2 _piv, float _time) { float RotateUV_ang = _radian; @@ -42104,17 +43131,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float RotateUV_sin = sin(_time * RotateUV_ang); return (mul(_uv - _piv, float2x2(RotateUV_cos, -RotateUV_sin, RotateUV_sin, RotateUV_cos)) + _piv); } - + /* MIT END */ - + float3 RotateAroundAxis(float3 original, float3 axis, float radian) { float s = sin(radian); float c = cos(radian); float one_minus_c = 1.0 - c; - + axis = normalize(axis); float3x3 rot_mat = { one_minus_c * axis.x * axis.x + c, one_minus_c * axis.x * axis.y - axis.z * s, one_minus_c * axis.z * axis.x + axis.y * s, @@ -42123,14 +43150,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" }; return mul(rot_mat, original); } - + float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex) { float3 outputColor = srcColor; if (themeIndex != 0) { themeIndex = max(themeIndex - 1, 0); - + if (themeIndex <= 3) { outputColor = poiMods.globalColorTheme[themeIndex]; @@ -42147,7 +43174,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return outputColor; } - + float3 lilToneCorrection(float3 c, float4 hsvg) { // gamma @@ -42163,7 +43190,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // hsv - > rgb return hsv.z - hsv.z * hsv.y + hsv.z * hsv.y * saturate(abs(frac(hsv.x + float3(1.0, 2.0 / 3.0, 1.0 / 3.0)) * 6.0 - 3.0) - 1.0); } - + float3 lilBlendColor(float3 dstCol, float3 srcCol, float3 srcA, int blendMode) { float3 ad = dstCol + srcCol; @@ -42175,24 +43202,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (blendMode == 3) outCol = mu; // Multiply return lerp(dstCol, outCol, srcA); } - + float lilIsIn0to1(float f) { float value = 0.5 - abs(f - 0.5); return saturate(value / clamp(fwidth(value), 0.0001, 1.0)); } - + float lilIsIn0to1(float f, float nv) { float value = 0.5 - abs(f - 0.5); return saturate(value / clamp(fwidth(value), 0.0001, nv)); } - + float poiEdgeLinearNoSaturate(float value, float border) { return (value - border) / clamp(fwidth(value), 0.0001, 1.0); } - + float3 poiEdgeLinearNoSaturate(float value, float3 border) { return float3( @@ -42201,29 +43228,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" (value - border.z) / clamp(fwidth(value), 0.0001, 1.0) ); } - + float poiEdgeLinearNoSaturate(float value, float border, float blur) { float borderMin = saturate(border - blur * 0.5); float borderMax = saturate(border + blur * 0.5); return (value - borderMin) / saturate(borderMax - borderMin + fwidth(value)); } - + float poiEdgeLinearNoSaturate(float value, float border, float blur, float borderRange) { float borderMin = saturate(border - blur * 0.5 - borderRange); float borderMax = saturate(border + blur * 0.5); return (value - borderMin) / saturate(borderMax - borderMin + fwidth(value)); } - + float poiEdgeNonLinearNoSaturate(float value, float border) { // return (value - border) / clamp(fwidth(value), 0.0001, 1.0); - + float fwidthValue = fwidth(value); return smoothstep(border - fwidthValue, border + fwidthValue, value); } - + float poiEdgeNonLinearNoSaturate(float value, float border, float blur) { float fwidthValue = fwidth(value); @@ -42231,7 +43258,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float borderMax = saturate(border + blur * 0.5); return smoothstep(borderMin - fwidthValue, borderMax + fwidthValue, value); } - + float poiEdgeNonLinearNoSaturate(float value, float border, float blur, float borderRange) { float fwidthValue = fwidth(value); @@ -42239,32 +43266,32 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float borderMax = saturate(border + blur * 0.5); return smoothstep(borderMin - fwidthValue, borderMax + fwidthValue, value); } - + float poiEdgeNonLinear(float value, float border) { return saturate(poiEdgeNonLinearNoSaturate(value, border)); } - + float poiEdgeNonLinear(float value, float border, float blur) { return saturate(poiEdgeNonLinearNoSaturate(value, border, blur)); } - + float poiEdgeNonLinear(float value, float border, float blur, float borderRange) { return saturate(poiEdgeNonLinearNoSaturate(value, border, blur, borderRange)); } - + float poiEdgeLinear(float value, float border) { return saturate(poiEdgeLinearNoSaturate(value, border)); } - + float poiEdgeLinear(float value, float border, float blur) { return saturate(poiEdgeLinearNoSaturate(value, border, blur)); } - + float poiEdgeLinear(float value, float border, float blur, float borderRange) { return saturate(poiEdgeLinearNoSaturate(value, border, blur, borderRange)); @@ -42274,12 +43301,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return LinearToGammaSpace(col); } - + float3 OpenLitSRGBToLinear(float3 col) { return GammaToLinearSpace(col); } - + float OpenLitLuminance(float3 rgb) { #if defined(UNITY_COLORSPACE_GAMMA) @@ -42288,7 +43315,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return dot(rgb, float3(0.0396819152, 0.458021790, 0.00609653955)); #endif } - + float3 AdjustLitLuminance(float3 rgb, float targetLuminance) { float currentLuminance; @@ -42297,11 +43324,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else currentLuminance = dot(rgb, float3(0.0396819152, 0.458021790, 0.00609653955)); #endif - + float luminanceRatio = targetLuminance / currentLuminance; return rgb * luminanceRatio; } - + float3 ClampLuminance(float3 rgb, float minLuminance, float maxLuminance) { float currentLuminance = dot(rgb, float3(0.299, 0.587, 0.114)); @@ -42310,19 +43337,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float luminanceRatio = clamp(min(maxRatio, max(minRatio, 1.0)), 0.0, 1.0); return lerp(rgb, rgb * luminanceRatio, luminanceRatio < 1.0); } - + float3 MaxLuminance(float3 rgb, float maxLuminance) { float currentLuminance = dot(rgb, float3(0.299, 0.587, 0.114)); float luminanceRatio = (currentLuminance != 0) ? maxLuminance / max(currentLuminance, 0.00001) : 1.0; return lerp(rgb, rgb * luminanceRatio, currentLuminance > maxLuminance); } - + float OpenLitGray(float3 rgb) { return dot(rgb, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); } - + void OpenLitShadeSH9ToonDouble(float3 lightDirection, out float3 shMax, out float3 shMin) { #if !defined(LIGHTMAP_ON) @@ -42350,13 +43377,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" shMin = 0.0; #endif } - + float3 OpenLitComputeCustomLightDirection(float4 lightDirectionOverride) { float3 customDir = length(lightDirectionOverride.xyz) * normalize(mul((float3x3)unity_ObjectToWorld, lightDirectionOverride.xyz)); return lightDirectionOverride.w ? customDir : lightDirectionOverride.xyz; // .w isn't doc'd anywhere and is always 0 unless end user changes it + } - + float3 OpenLitLightingDirectionForSH9() { float3 mainDir = _WorldSpaceLightPos0.xyz * OpenLitLuminance(_LightColor0.rgb); @@ -42367,12 +43395,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 sh9Dir = 0; float3 sh9DirAbs = 0; #endif - + float3 lightDirectionForSH9 = sh9Dir + mainDir; lightDirectionForSH9 = dot(lightDirectionForSH9, lightDirectionForSH9) < 0.000001 ? 0 : normalize(lightDirectionForSH9); return lightDirectionForSH9; } - + float3 OpenLitLightingDirection(float4 lightDirectionOverride) { float3 mainDir = _WorldSpaceLightPos0.xyz * OpenLitLuminance(_LightColor0.rgb); @@ -42384,28 +43412,28 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 sh9DirAbs = 0; #endif float3 customDir = OpenLitComputeCustomLightDirection(lightDirectionOverride); - + return normalize(sh9DirAbs + mainDir + customDir); } - + float3 OpenLitLightingDirection() { float4 customDir = float4(0.001, 0.002, 0.001, 0.0); return OpenLitLightingDirection(customDir); } - + inline float4 CalculateFrustumCorrection() { float x1 = -UNITY_MATRIX_P._31 / (UNITY_MATRIX_P._11 * UNITY_MATRIX_P._34); float x2 = -UNITY_MATRIX_P._32 / (UNITY_MATRIX_P._22 * UNITY_MATRIX_P._34); return float4(x1, x2, 0, UNITY_MATRIX_P._33 / UNITY_MATRIX_P._34 + x1 * UNITY_MATRIX_P._13 + x2 * UNITY_MATRIX_P._23); } - + inline float CorrectedLinearEyeDepth(float z, float B) { return 1.0 / (z / UNITY_MATRIX_P._34 + B); } - + // Silent's code float2 sharpSample(float4 texelSize, float2 p) { @@ -42415,7 +43443,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" p = (p - 0.5) * texelSize.xy; return p; } - + void applyToGlobalMask(inout PoiMods poiMods, int index, int blendType, float val) { float valBlended = saturate(maskBlend(poiMods.globalMask[index], val, blendType)); @@ -42439,7 +43467,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" case 15: poiMods.globalMask[15] = valBlended; break; } } - + void assignValueToVectorFromIndex(inout float4 vec, int index, float value) { switch(index) @@ -42450,7 +43478,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" case 3: vec[3] = value; break; } } - + // SNose float3 mod289(float3 x) { @@ -42464,7 +43492,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return mod289(((x * 34.0) + 1.0) * x); } - + float snoise(float2 v) { const float4 C = float4(0.211324865405187, // (3.0 - sqrt(3.0)) / 6.0 @@ -42480,7 +43508,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" i = mod289(i); // Avoid truncation effects in permutation float3 p = permute(permute(i.y + float3(0.0, i1.y, 1.0)) + i.x + float3(0.0, i1.x, 1.0)); - + float3 m = max(0.5 - float3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0); m = m * m ; m = m * m ; @@ -42494,35 +43522,35 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" g.yz = a0.yz * x12.xz + h.yz * x12.yw; return 130.0 * dot(m, g); } - + float nsqDistance(float2 a, float2 b) { return dot(a - b, a - b); } - + float poiInvertToggle(in float value, in float toggle) { return (toggle == 0 ? value : 1 - value); } - + float3 PoiBlendNormal(float3 dstNormal, float3 srcNormal) { return float3(dstNormal.xy + srcNormal.xy, dstNormal.z * srcNormal.z); } - + float3 lilTransformDirOStoWS(float3 directionOS, bool doNormalize) { if (doNormalize) return normalize(mul((float3x3)unity_ObjectToWorld, directionOS)); else return mul((float3x3)unity_ObjectToWorld, directionOS); } - + float2 poiGetWidthAndHeight(Texture2D tex) { uint width, height; tex.GetDimensions(width, height); return float2(width, height); } - + float2 poiGetWidthAndHeight(Texture2DArray tex) { uint width, height, element; @@ -42531,25 +43559,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } //ifex _EnableAudioLink==0 #ifdef POI_AUDIOLINK - + // Convenient mechanism to read from the AudioLink texture that handles reading off the end of one line and onto the next above it. float4 AudioLinkDataMultiline(uint2 xycoord) { return AudioLinkData(uint2(xycoord.x % AUDIOLINK_WIDTH, xycoord.y + xycoord.x / AUDIOLINK_WIDTH)); } - + // Mechanism to sample between two adjacent pixels and lerp between them, like "linear" supesampling float4 AudioLinkLerp(float2 xy) { return lerp(AudioLinkData(xy), AudioLinkData(xy + int2(1, 0)), frac(xy.x)); } - + // Same as AudioLinkLerp but properly handles multiline reading. float4 AudioLinkLerpMultiline(float2 xy) { return lerp(AudioLinkDataMultiline(xy), AudioLinkDataMultiline(xy + float2(1, 0)), frac(xy.x)); } - + //Tests to see if Audio Link texture is available bool AudioLinkIsAvailable() { @@ -42561,7 +43589,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return _AudioTexture_TexelSize.z > 16; #endif } - + //Get version of audiolink present in the world, 0 if no audiolink is present float AudioLinkGetVersion() { @@ -42571,7 +43599,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else dims = _AudioTexture_TexelSize.zw; #endif - + if (dims.x >= 128) return AudioLinkData(ALPASS_GENERALVU).x; else if (dims.x > 16) @@ -42579,17 +43607,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" else return 0; } - + // This pulls data from this texture. #define AudioLinkGetSelfPixelData(xy) _SelfTexture2D[xy] - + // Extra utility functions for time. uint AudioLinkDecodeDataAsUInt(uint2 indexloc) { uint4 rpx = AudioLinkData(indexloc); return rpx.r + rpx.g * 1024 + rpx.b * 1048576 + rpx.a * 1073741824; } - + //Note: This will truncate time to every 134,217.728 seconds (~1.5 days of an instance being up) to prevent floating point aliasing. // if your code will alias sooner, you will need to use a different function. It should be safe to use this on all times. float AudioLinkDecodeDataAsSeconds(uint2 indexloc) @@ -42598,15 +43626,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //Can't just divide by float. Bug in Unity's HLSL compiler. return float(time / 1000) + float(time % 1000) / 1000.; } - + #define ALDecodeDataAsSeconds(x) AudioLinkDecodeDataAsSeconds(x) #define ALDecodeDataAsUInt(x) AudioLinkDecodeDataAsUInt(x) - + float AudioLinkRemap(float t, float a, float b, float u, float v) { return ((t - a) / (b - a)) * (v - u) + u; } - + float3 AudioLinkHSVtoRGB(float3 HSV) { float3 RGB = 0; @@ -42644,11 +43672,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float M = HSV.z - C; return RGB + M; } - + float3 AudioLinkCCtoRGB(float bin, float intensity, int rootNote) { float note = bin / AUDIOLINK_EXPBINS; - + float hue = 0.0; note *= 12.0; note = glsl_mod(4. - note + rootNote, 12.0); @@ -42674,48 +43702,48 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float val = intensity - 0.1; return AudioLinkHSVtoRGB(float3(fmod(hue, 1.0), 1.0, clamp(val, 0.0, 1.0))); } - + // Sample the amplitude of a given frequency in the DFT, supports frequencies in [13.75; 14080]. float4 AudioLinkGetAmplitudeAtFrequency(float hertz) { float note = AUDIOLINK_EXPBINS * log2(hertz / AUDIOLINK_BOTTOM_FREQUENCY); return AudioLinkLerpMultiline(ALPASS_DFT + float2(note, 0)); } - + // Sample the amplitude of a given semitone in an octave. Octave is in [0; 9] while note is [0; 11]. float AudioLinkGetAmplitudeAtNote(float octave, float note) { float quarter = note * 2.0; return AudioLinkLerpMultiline(ALPASS_DFT + float2(octave * AUDIOLINK_EXPBINS + quarter, 0)); } - + // Get a reasonable drop-in replacement time value for _Time.y with the // given chronotensity index [0; 7] and AudioLink band [0; 3]. float AudioLinkGetChronoTime(uint index, uint band) { return (AudioLinkDecodeDataAsUInt(ALPASS_CHRONOTENSITY + uint2(index, band))) / 100000.0; } - + // Get a chronotensity value in the interval [0; 1], modulated by the speed input, // with the given chronotensity index [0; 7] and AudioLink band [0; 3]. float AudioLinkGetChronoTimeNormalized(uint index, uint band, float speed) { return frac(AudioLinkGetChronoTime(index, band) * speed); } - + // Get a chronotensity value in the interval [0; interval], modulated by the speed input, // with the given chronotensity index [0; 7] and AudioLink band [0; 3]. float AudioLinkGetChronoTimeInterval(uint index, uint band, float speed, float interval) { return AudioLinkGetChronoTimeNormalized(index, band, speed) * interval; } - + float getBandAtTime(float band, float time, float size = 1.0f) { //return remap(UNITY_SAMPLE_TEX2D(_AudioTexture, float2(time * width, band/128.0)).r, min(size,.9999), 1); return remapClamped(min(size, .9999), 1, AudioLinkData(ALPASS_AUDIOBASS + uint2(time * AUDIOLINK_WIDTH, band)).r); } - + fixed3 maximize(fixed3 c) { if (c.x == 0 && c.y == 0 && c.z == 0) @@ -42723,11 +43751,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" else return c / max(c.r, max(c.g, c.b)); } - + void initPoiAudioLink(inout PoiMods poiMods) { if (!_AudioLinkAnimToggle) return; - + if (AudioLinkIsAvailable()) { poiMods.audioLinkAvailable = true; @@ -42742,25 +43770,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalColorTheme[5] = AudioLinkData( ALPASS_CCCOLORS + uint2( 1, 0 ) ); poiMods.globalColorTheme[6] = AudioLinkData( ALPASS_CCCOLORS + uint2( 2, 0 ) ); poiMods.globalColorTheme[7] = AudioLinkData( ALPASS_CCCOLORS + uint2( 3, 0 ) ); - + poiMods.globalColorTheme[4] = float4(maximize(AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) )),1.0); poiMods.globalColorTheme[5] = float4(maximize(AudioLinkData( ALPASS_CCCOLORS + uint2( 1, 0 ) )),1.0); poiMods.globalColorTheme[6] = float4(maximize(AudioLinkData( ALPASS_CCCOLORS + uint2( 2, 0 ) )),1.0); poiMods.globalColorTheme[7] = float4(maximize(AudioLinkData( ALPASS_CCCOLORS + uint2( 3, 0 ) )),1.0); */ - + poiMods.globalColorTheme[4] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(2, 0))[0], AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0); poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0))[0], AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0); poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0))[0], AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0); poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0))[0], AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0); - + poiMods.globalColorTheme[8] = AudioLinkData(ALPASS_THEME_COLOR0); poiMods.globalColorTheme[9] = AudioLinkData(ALPASS_THEME_COLOR1); poiMods.globalColorTheme[10] = AudioLinkData(ALPASS_THEME_COLOR2); poiMods.globalColorTheme[11] = AudioLinkData(ALPASS_THEME_COLOR3); return; } - + if (_AudioLinkBandOverridesEnabled) { poiMods.audioLinkAvailable = true; @@ -42770,7 +43798,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.audioLink[3] = _AudioLinkBandOverrideSliders.w; } } - + void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) { if (_DebugWaveform) @@ -42819,21 +43847,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.emission += (AudioLinkDecodeDataAsUInt(ALPASS_CHRONOTENSITY + uint2(1, 0)) % 1000000) / 1000000.0; } } - + void SetupAudioLink(inout PoiFragData poiFragData, inout PoiMods poiMods, in PoiMesh poiMesh) { initPoiAudioLink(poiMods); DebugVisualizer(poiFragData, poiMesh, poiMods); - + if (_AudioLinkCCStripY) { poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].y * AUDIOLINK_WIDTH, 0)).rgb * .5; } } - + #endif //endex - + //ifex _BSSEnabled!=1 #ifdef POIBS_ENABLE //ifex _BSSBloomfog!=1 @@ -42848,7 +43876,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" (screenPosNormalized.y + - 0.5) * _CustomFogTextureToScreenRatio.y + 0.5 ,clipPos.z,clipPos.w); } - + inline float GetHeightFogIntensity(float3 worldPos, float fogHeightOffset, float fogHeightScale) { float heightFogIntensity = _CustomFogHeightFogHeight + _CustomFogHeightFogStartY; @@ -42857,7 +43885,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" heightFogIntensity = clamp(heightFogIntensity, 0, 1); return ((-heightFogIntensity * 2) + 3) * (heightFogIntensity * heightFogIntensity); } - + inline float GetFogIntensity(float3 distance, float fogStartOffset, float fogScale) { float fogIntensity = max(dot(distance, distance) + - fogStartOffset, 0); @@ -42869,7 +43897,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex #endif //endex - + VertexOut vert( #ifndef POI_TESSELLATED appdata v @@ -42886,7 +43914,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v); #endif UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - + //ifex _EnableUDIMDiscardOptions==0 #ifdef POI_UDIMDISCARD UNITY_BRANCH @@ -42899,20 +43927,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" udim += (v.uv1.xy * (_UDIMDiscardUV == 1)); udim += (v.uv2.xy * (_UDIMDiscardUV == 2)); udim += (v.uv3.xy * (_UDIMDiscardUV == 3)); - + float isDiscarded = 0; float4 xMask = float4( (udim.x >= 0 && udim.x < 1), (udim.x >= 1 && udim.x < 2), (udim.x >= 2 && udim.x < 3), (udim.x >= 3 && udim.x < 4)); - + isDiscarded += (udim.y >= 0 && udim.y < 1) * dot(float4(_UDIMDiscardRow0_0, _UDIMDiscardRow0_1, _UDIMDiscardRow0_2, _UDIMDiscardRow0_3), xMask); isDiscarded += (udim.y >= 1 && udim.y < 2) * dot(float4(_UDIMDiscardRow1_0, _UDIMDiscardRow1_1, _UDIMDiscardRow1_2, _UDIMDiscardRow1_3), xMask); isDiscarded += (udim.y >= 2 && udim.y < 3) * dot(float4(_UDIMDiscardRow2_0, _UDIMDiscardRow2_1, _UDIMDiscardRow2_2, _UDIMDiscardRow2_3), xMask); isDiscarded += (udim.y >= 3 && udim.y < 4) * dot(float4(_UDIMDiscardRow3_0, _UDIMDiscardRow3_1, _UDIMDiscardRow3_2, _UDIMDiscardRow3_3), xMask); - + isDiscarded *= any(float4(udim.y >= 0, udim.y < 4, udim.x >= 0, udim.x < 4)); // never discard outside 4x4 grid in pos coords - + // Use a threshold so that there's some room for animations to be close to 0, but not exactly 0 const float threshold = 0.001; if(isDiscarded > threshold) // Early Return skips rest of vertex shader @@ -42922,7 +43950,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _VertexManipulationsEnabled==0 #ifdef AUTO_EXPOSURE float4 audioLinkBands = 0; @@ -42941,7 +43969,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" audioLinkBands.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r; audioLinkBands.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r; audioLinkBands.w = AudioLinkData(ALPASS_AUDIOTREBLE).r; - + if (any(_VertexLocalTranslationALMin) || any(_VertexLocalTranslationALMax)) { ALLocalTranslation = lerp(_VertexLocalTranslationALMin, _VertexLocalTranslationALMax, audioLinkBands[_VertexLocalTranslationALBand]); @@ -42978,37 +44006,37 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } #endif - + // Local Transformation float4 rotation = float4(_VertexManipulationLocalRotation.xyz + float3(180, 0, 0) + _VertexManipulationLocalRotationSpeed * _Time.x + ALrotation + CTALRotation, _VertexManipulationLocalRotation.w); v.normal = rotate_with_quaternion(v.normal, rotation.xyz); v.tangent.xyz = rotate_with_quaternion(v.tangent.xyz, rotation.xyz); v.vertex = transform(v.vertex, _VertexManipulationLocalTranslation + float4(ALLocalTranslation, 0) + ALSpectrumLocalOffset, rotation, _VertexManipulationLocalScale + float4(ALScale, 0)); o.normal = UnityObjectToWorldNormal(v.normal); - + #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED) float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(vertexUV(v, _VertexManipulationHeightMaskUV), _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0))[_VertexManipulationHeightMaskChannel] - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal; #else float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal; #endif - + if (_VertexBarrelMode) { v.vertex.xz = lerp(v.vertex.xz, normalize(v.vertex.xz) * _VertexBarrelWidth + v.vertex.xz * _VertexBarrelHeight, _VertexBarrelAlpha); } - + if (_VertexSphereMode) { v.vertex.xyz = lerp(v.vertex.xyz, normalize(v.vertex.xyz + _VertexSphereCenter.xyz) * _VertexSphereRadius + v.vertex.xyz * _VertexSphereHeight, _VertexSphereAlpha); } - + if (_VertexTornadoMode) { v.vertex.xz = lerp(v.vertex.xz, float3(v.vertex.xz + float2(cos(_Time.y * _VertexTornadoSpeed + v.vertex.y * _VertexTornadoIntensity) * _VertexTornadoRadius, sin(_Time.y * _VertexTornadoSpeed + v.vertex.y * _VertexTornadoIntensity) * _VertexTornadoRadius), v.vertex.y), smoothstep(_VertexTornadoBaseHeight, _VertexTornadoTopHeight, v.vertex.y)); } - + v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz; - + // rounding UNITY_BRANCH if (_VertexRoundingEnabled) @@ -43027,7 +44055,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _EnableDissolve==0 #ifdef DISTORT UNITY_BRANCH @@ -43040,41 +44068,41 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" dissolveUdim += (v.uv1.xy * (_UVTileDissolveUV == 1)); dissolveUdim += (v.uv2.xy * (_UVTileDissolveUV == 2)); dissolveUdim += (v.uv3.xy * (_UVTileDissolveUV == 3)); - + float isDiscardedFromDissolve = 0; float4 xMaskDissolve = float4((dissolveUdim.x >= 0 && dissolveUdim.x < 1), (dissolveUdim.x >= 1 && dissolveUdim.x < 2), (dissolveUdim.x >= 2 && dissolveUdim.x < 3), (dissolveUdim.x >= 3 && dissolveUdim.x < 4)); - + isDiscardedFromDissolve += (dissolveUdim.y >= 0 && dissolveUdim.y < 1) * dot(float4(_UVTileDissolveAlpha_Row0_0, _UVTileDissolveAlpha_Row0_1, _UVTileDissolveAlpha_Row0_2, _UVTileDissolveAlpha_Row0_3), xMaskDissolve); isDiscardedFromDissolve += (dissolveUdim.y >= 1 && dissolveUdim.y < 2) * dot(float4(_UVTileDissolveAlpha_Row1_0, _UVTileDissolveAlpha_Row1_1, _UVTileDissolveAlpha_Row1_2, _UVTileDissolveAlpha_Row1_3), xMaskDissolve); isDiscardedFromDissolve += (dissolveUdim.y >= 2 && dissolveUdim.y < 3) * dot(float4(_UVTileDissolveAlpha_Row2_0, _UVTileDissolveAlpha_Row2_1, _UVTileDissolveAlpha_Row2_2, _UVTileDissolveAlpha_Row2_3), xMaskDissolve); isDiscardedFromDissolve += (dissolveUdim.y >= 3 && dissolveUdim.y < 4) * dot(float4(_UVTileDissolveAlpha_Row3_0, _UVTileDissolveAlpha_Row3_1, _UVTileDissolveAlpha_Row3_2, _UVTileDissolveAlpha_Row3_3), xMaskDissolve); - + isDiscardedFromDissolve *= any(float4(dissolveUdim.y >= 0, dissolveUdim.y < 4, dissolveUdim.x >= 0, dissolveUdim.x < 4)); // never discard outside 4x4 grid in pos coords - + // Use a threshold so that there's some room for animations to be close to 1, but not exactly 1 const float threshold = 0.999; if (isDiscardedFromDissolve > threshold) // Early Return skips rest of vertex shader - + { return (VertexOut)POI_NAN; } } #endif //endex - + //ifex _EnableMirrorOptions==0 #ifdef POI_MIRROR float notVisible = 0; - + if (_VisibilityMode == 1) // VRC - + { float mirrorMode = VRCMirrorMode(); float cameraMode = VRCCameraMode(); - + notVisible += (!_VisibilityVRCRegular && ((mirrorMode == 0) && (cameraMode == 0))); notVisible += (!_VisibilityVRCMirrorVR && (mirrorMode == 1)); notVisible += (!_VisibilityVRCMirrorDesktop && (mirrorMode == 2)); @@ -43083,50 +44111,50 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" notVisible += (!_VisibilityVRCCameraScreenshot && (cameraMode == 3)); } else if (_Mirror != 0) // Generic (CVR, etc) - + { notVisible += (_Mirror == 1) ^ IsInMirror(); } - + if (notVisible) // Early Return skips rest of vertex shader - + { return (VertexOut)POI_NAN; } #endif //endex - + o.normal = UnityObjectToWorldNormal(v.normal); o.tangent.xyz = UnityObjectToWorldDir(v.tangent); o.tangent.w = v.tangent.w; o.vertexColor = v.color; - + o.uv[0] = float4(v.uv0.xy, v.uv1.xy); o.uv[1] = float4(v.uv2.xy, v.uv3.xy); - + #if defined(LIGHTMAP_ON) o.lightmapUV.xy = v.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw; #endif #ifdef DYNAMICLIGHTMAP_ON o.lightmapUV.zw = v.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; #endif - + o.localPos = v.vertex; o.worldPos = mul(unity_ObjectToWorld, o.localPos); - + float3 localOffset = float3(0, 0, 0); float3 worldOffset = float3(0, 0, 0); - + //ifex _EnableOutlines!=1 #ifdef POI_PASS_OUTLINE float outlineMask = tex2Dlod(_OutlineMask, float4(poiUV(vertexUV(v, _OutlineMaskUV), _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0))[_OutlineMaskChannel]; - + //UNITY_BRANCH if (_OutlineVertexColorMask > 0) { outlineMask *= lerp(1, v.color[_OutlineVertexColorMask - 1], _OutlineVertexColorMaskStrength); } - + float3 outlineNormal = _OutlineSpace ? o.normal : v.normal; //UNITY_BRANCH if (_OutlineUseVertexColorNormals) @@ -43134,7 +44162,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 outlineTangent; float3 outlineBinormal; if (_OutlineSpace) // 0 Local, 1 World - + { outlineTangent = o.tangent; outlineBinormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w); @@ -43147,7 +44175,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 outlineVectorTS = v.color.rgb * 2.0 - 1.0; outlineNormal = outlineVectorTS.x * outlineTangent + outlineVectorTS.y * outlineBinormal + outlineVectorTS.z * outlineNormal; } - + float offsetMultiplier = 1; float distanceOffset = 1; //UNITY_BRANCH @@ -43155,7 +44183,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { distanceOffset *= lerp(1.0, clamp((distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz)), 0.0f, _OutlinesMaxDistance), _OutlineFixWidth); } - + float lineWidth = _LineWidth; #ifdef POI_AUDIOLINK // Due to PoiMods.audioLink being frag only I'll just @@ -43169,9 +44197,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } #endif - + float3 offset = outlineNormal * (lineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset; - + //UNITY_BRANCH if (_OutlineExpansionMode == 2) { @@ -43184,7 +44212,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { float3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal); offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy))); - + offset *= offsetMultiplier; offset *= distanceOffset; } @@ -43205,10 +44233,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _VertexGlitchingEnabled==0 #if defined(POI_VERTEX_GLITCHING) - + bool canGlitch = true; if (_VertexGlitchMirrorEnable && _VertexGlitchMirror > 0) { @@ -43222,26 +44250,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" forward.y = 0; forward = normalize(forward); float3 glitchDirection = normalize(cross(float3(0, 1, 0), forward)); - + float glitchAmount = 0; - + #if defined(POI_VERTEX_GLITCHING_TEXTURE) // if(_VertexGlitchingUseTexture) // { float uvl = o.worldPos.y * _VertexGlitchDensity + _Time.x * _VertexGlitchMapPanSpeed; float uvr = o.worldPos.y * _VertexGlitchDensity - _Time.x * _VertexGlitchMapPanSpeed; - + float3 glitchTextureL = 1; float3 glitchTextureR = 1; - + #if defined(POI_VERTEX_GLITCHING_TEXTURE) || !defined(OPTIMIZER_ENABLED) glitchTextureL = tex2Dlod(_VertexGlitchMap, float4(uvl, uvl, 0, 0)).rgb; glitchTextureR = tex2Dlod(_VertexGlitchMap, float4(uvr, uvr, 0, 0)).rgb; #endif - + glitchAmount += (glitchTextureL.r - 0.5) * 2; glitchAmount += - (glitchTextureR.r - 0.5) * 2; - + glitchAmount += (glitchTextureL.g - 0.5) * 2; glitchAmount += - (glitchTextureR.b - 0.5) * 2; // } else { @@ -43249,24 +44277,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" glitchAmount += frac(sin(dot(_Time.xy + o.worldPos.y, float2(12.9898, 78.233))) * 43758.5453123) * 2 - 1; // } #endif - + float time = _Time.y * _VertexGlitchFrequency; - + float randomGlitch = (sin(time) + sin(2.2 * time + 5.52) + sin(2.9 * time + 0.93) + sin(4.6 * time + 8.94)) / 4; float3 glitchOffset = 0; - + #ifdef POI_AUDIOLINK if (AudioLinkIsAvailable() && _VertexGlitchingAudioLinkEnabled) { // float4 audioLinkData = AudioLinkData(ALPASS_AUDIOBASS); - + float audioIntensity = AudioLinkData(ALPASS_AUDIOBASS).r * (_VertexGlitchingAudioLinkBand == 0) + AudioLinkData(ALPASS_AUDIOLOWMIDS).r * (_VertexGlitchingAudioLinkBand == 1) + AudioLinkData(ALPASS_AUDIOHIGHMIDS).r * (_VertexGlitchingAudioLinkBand == 2) + AudioLinkData(ALPASS_AUDIOTREBLE).r * (_VertexGlitchingAudioLinkBand == 3) + AudioLinkData(ALPASS_FILTEREDVU_INTENSITY).r * (_VertexGlitchingAudioLinkBand == 4); - + if(_VertexGlitchingAudiolinkOverride) { glitchOffset = glitchAmount * glitchDirection * (_VertexGlitchStrength * .01) * audioIntensity; @@ -43281,22 +44309,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else glitchOffset = glitchAmount * glitchDirection * (_VertexGlitchStrength * .01) * step(_VertexGlitchThreshold, randomGlitch); #endif - + localOffset += glitchOffset; worldOffset += mul(unity_ObjectToWorld, glitchOffset); } #endif //endex - + o.localPos.rgb += localOffset; o.worldPos.rgb += worldOffset; - + //ifex _EnableDepthBulge==0 #if defined(POI_DEPTHBULGE) && (defined(POI_PASS_BASE) || defined(POI_PASS_ADD)) applyDepthBulgeFX(o); #endif //endex - + //ifex _BSSEnabled!=1 #ifdef POIBS_ENABLE //ifex _BSSBloomfog!=1 @@ -43307,9 +44335,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex #endif //endex - + o.pos = UnityObjectToClipPos(o.localPos); - + #ifdef POI_PASS_OUTLINE #if defined(UNITY_REVERSED_Z) //DX @@ -43320,7 +44348,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //o.grabPos = ComputeGrabScreenPos(o.pos); - + #ifndef FORWARD_META_PASS #if !defined(UNITY_PASS_SHADOWCASTER) UNITY_TRANSFER_SHADOW(o, o.uv[0].xy); @@ -43329,9 +44357,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" TRANSFER_SHADOW_CASTER_NOPOS(o, o.pos); #endif #endif - + UNITY_TRANSFER_FOG(o, o.pos); - + if (_RenderingReduceClipDistance) { if (o.pos.w < _ProjectionParams.y * 1.01 && o.pos.w > 0) @@ -43343,14 +44371,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif } } - + #ifdef POI_PASS_META o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST); #endif - + return o; } - + #if defined(_STOCHASTICMODE_DELIOT_HEITZ) #define POI2D_SAMPLER_STOCHASTIC(tex, texSampler, uv, useStochastic) (useStochastic ? DeliotHeitzSampleTexture(tex, sampler##texSampler, uv) : POI2D_SAMPLER(tex, texSampler, uv)) #define POI2D_SAMPLER_PAN_STOCHASTIC(tex, texSampler, uv, pan, useStochastic) (useStochastic ? DeliotHeitzSampleTexture(tex, sampler##texSampler, POI_PAN_UV(uv, pan)) : POI2D_SAMPLER_PAN(tex, texSampler, uv, pan)) @@ -43361,7 +44389,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define POI2D_SAMPLER_PAN_STOCHASTIC(tex, texSampler, uv, pan, useStochastic) (useStochastic ? HextileSampleTexture(tex, sampler##texSampler, POI_PAN_UV(uv, pan), false) : POI2D_SAMPLER_PAN(tex, texSampler, uv, pan)) #define POI2D_SAMPLER_PANGRAD_STOCHASTIC(tex, texSampler, uv, pan, dx, dy, useStochastic) (useStochastic ? HextileSampleTexture(tex, sampler##texSampler, POI_PAN_UV(uv, pan), false, dx, dy) : POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, dx, dy)) #endif - + #ifndef POI2D_SAMPLER_STOCHASTIC #define POI2D_SAMPLER_STOCHASTIC(tex, texSampler, uv, useStochastic) (POI2D_SAMPLER(tex, texSampler, uv)) #endif @@ -43371,17 +44399,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #ifndef POI2D_SAMPLER_PANGRAD_STOCHASTIC #define POI2D_SAMPLER_PANGRAD_STOCHASTIC(tex, texSampler, uv, pan, dx, dy, useStochastic) (POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, dx, dy)) #endif - + // When using, properties won't properly lock at optimize time; needs macro evaluation implemented // #define POI2D_SAMPLER_STOCHASTIC_INLINED(tex, texSampler) (POI2D_SAMPLER_STOCHASTIC(tex, texSampler, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Stochastic)) // #define POI2D_SAMPLER_PAN_STOCHASTIC_INLINED(tex, texSampler) (POI2D_SAMPLER_PAN_STOCHASTIC(tex, texSampler, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Pan, tex##Stochastic)) - + // #define POI2D_MAINTEX_SAMPLER_STOCHASTIC_INLINED(tex) (POI2D_SAMPLER_STOCHASTIC(tex, _MainTex, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Stochastic)) // #define POI2D_MAINTEX_SAMPLER_PAN_STOCHASTIC_INLINED(tex) (POI2D_SAMPLER_PAN_STOCHASTIC(tex, _MainTex, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Pan, tex##Stochastic)) - + // Deliot, Heitz 2019 - Fast, but non-histogram-preserving (ends up looking a bit blurry and lower contrast) // https://eheitzresearch.wordpress.com/738-2/ - + // Classic Magic Numbers fracsin #if !defined(_STOCHASTICMODE_NONE) float2 StochasticHash2D2D (float2 s) @@ -43389,7 +44417,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return frac(sin(glsl_mod(float2(dot(s, float2(127.1,311.7)), dot(s, float2(269.5,183.3))), 3.14159)) * 43758.5453); } #endif - + #if defined(_STOCHASTICMODE_DELIOT_HEITZ) // UV Offsets and blend weights // UVBW[0...2].xy = UV Offsets @@ -43399,46 +44427,46 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // UV transformed into triangular grid space with UV scaled by approximation of 2*sqrt(3) const float2x2 stochasticSkewedGrid = float2x2(1.0, -0.57735027, 0.0, 1.15470054); float2 skewUV = mul(stochasticSkewedGrid, uv * 3.4641 * _StochasticDeliotHeitzDensity); - + // Vertex IDs and barycentric coords float2 vxID = floor(skewUV); float3 bary = float3(frac(skewUV), 0); bary.z = 1.0 - bary.x - bary.y; - + float3x3 pos = float3x3( float3(vxID, bary.z), float3(vxID + float2(0, 1), bary.y), float3(vxID + float2(1, 0), bary.x) ); - + float3x3 neg = float3x3( float3(vxID + float2(1, 1), -bary.z), float3(vxID + float2(1, 0), 1.0 - bary.y), float3(vxID + float2(0, 1), 1.0 - bary.x) ); - + return (bary.z > 0) ? pos : neg; } - + float4 DeliotHeitzSampleTexture(Texture2D tex, SamplerState texSampler, float2 uv, float2 dx, float2 dy) { // UVBW[0...2].xy = UV Offsets // UVBW[0...2].z = Blend Weights float3x3 UVBW = DeliotHeitzStochasticUVBW(uv); - + //blend samples with calculated weights return mul(tex.SampleGrad(texSampler, uv + StochasticHash2D2D(UVBW[0].xy), dx, dy), UVBW[0].z) + mul(tex.SampleGrad(texSampler, uv + StochasticHash2D2D(UVBW[1].xy), dx, dy), UVBW[1].z) + mul(tex.SampleGrad(texSampler, uv + StochasticHash2D2D(UVBW[2].xy), dx, dy), UVBW[2].z) ; } - + float4 DeliotHeitzSampleTexture(Texture2D tex, SamplerState texSampler, float2 uv) { float2 dx = ddx(uv), dy = ddy(uv); return DeliotHeitzSampleTexture(tex, texSampler, uv, dx, dy); } #endif // defined(_STOCHASTICMODE_DELIOT_HEITZ) - + #if defined(_STOCHASTICMODE_HEXTILE) // HexTiling: Slower, but histogram-preserving // SPDX-License-Idenfitier: MIT @@ -43450,22 +44478,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" const float2x2 stochasticInverseSkewedGrid = float2x2(1.0, 0.5, 0.0, 1.0/1.15470054); return mul(stochasticInverseSkewedGrid, vertex) * 0.288675; } - + float2x2 HextileLoadRot2x2(float2 idx, float rotStrength) { float angle = abs(idx.x * idx.y) + abs(idx.x + idx.y) + PI; - + // remap to +/-pi angle = glsl_mod(angle, 2 * PI); if(angle < 0) angle += 2 * PI; if(angle > PI) angle -= 2 * PI; - + angle *= rotStrength; - + float cs = cos(angle), si = sin(angle); return float2x2(cs, -si, si, cs); } - + // UV Offsets and base blend weights // UVBWR[0...2].xy = UV Offsets // UVBWR[0...2].zw = rotation costh/sinth -> reconstruct rotation matrix with float2x2(UVBWR[n].z, -UVBWR[n].w, UVBWR[n].w, UVBWR[n].z) @@ -43476,30 +44504,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // Skew input space into simplex triangle grid (3.4641 ~= 2*sqrt(3)) const float2x2 stochasticSkewedGrid = float2x2(1.0, -0.57735027, 0.0, 1.15470054); float2 skewedCoord = mul(stochasticSkewedGrid, uv * 3.4641 * _StochasticHexGridDensity); - + float2 baseId = float2(floor(skewedCoord)); float3 temp = float3(frac(skewedCoord), 0); temp.z = 1 - temp.x - temp.y; - + float s = step(0.0, -temp.z); float s2 = 2 * s - 1; - + float3 weights = float3(-temp.z * s2, s - temp.y * s2, s - temp.x * s2); - + float2 vertex0 = baseId + float2(s, s); float2 vertex1 = baseId + float2(s, 1 - s); float2 vertex2 = baseId + float2(1 - s, s); - + float2 cen0 = HextileMakeCenUV(vertex0), cen1 = HextileMakeCenUV(vertex1), cen2 = HextileMakeCenUV(vertex2); float2x2 rot0 = float2x2(1, 0, 0, 1), rot1 = float2x2(1, 0, 0, 1), rot2 = float2x2(1, 0, 0, 1); - + if(_StochasticHexRotationStrength > 0) { rot0 = HextileLoadRot2x2(vertex0, _StochasticHexRotationStrength); rot1 = HextileLoadRot2x2(vertex1, _StochasticHexRotationStrength); rot2 = HextileLoadRot2x2(vertex2, _StochasticHexRotationStrength); } - + return float4x4( float4(mul(uv - cen0, rot0) + cen0 + StochasticHash2D2D(vertex0), rot0[0].x, -rot0[0].y), float4(mul(uv - cen1, rot1) + cen1 + StochasticHash2D2D(vertex1), rot1[0].x, -rot1[0].y), @@ -43507,68 +44535,68 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4(weights, 0) ); } - + float4 HextileSampleTexture(Texture2D tex, SamplerState texSampler, float2 uv, bool isNormalMap, float2 dUVdx, float2 dUVdy) { // For some reason doing this instead of just calculating it directly prevents it from \ // breaking after a certain number of textures use it. I don't understand why yet float4x4 UVBWR = HextileUVBWR(uv); - + // 2D Rotation Matrices for dUVdx/dy // Not sure if this constant folds during compiling when rot is locked at 0, so force it float2x2 rot0 = float2x2(1, 0, 0, 1), rot1 = float2x2(1, 0, 0, 1), rot2 = float2x2(1, 0, 0, 1); - + if(_StochasticHexRotationStrength > 0) { rot0 = float2x2(UVBWR[0].z, -UVBWR[0].w, UVBWR[0].w, UVBWR[0].z); rot1 = float2x2(UVBWR[1].z, -UVBWR[1].w, UVBWR[1].w, UVBWR[1].z); rot2 = float2x2(UVBWR[2].z, -UVBWR[2].w, UVBWR[2].w, UVBWR[2].z); } - + // Weights float3 W = UVBWR[3].xyz; - + // Sample texture // float3x4 c = float3x4( // tex.SampleGrad(texSampler, UVBWR[0].xy, mul(dUVdx, rot0), mul(dUVdy, rot0)), // tex.SampleGrad(texSampler, UVBWR[1].xy, mul(dUVdx, rot1), mul(dUVdy, rot1)), // tex.SampleGrad(texSampler, UVBWR[2].xy, mul(dUVdx, rot2), mul(dUVdy, rot2)) // ); - + float4 c0 = tex.SampleGrad(texSampler, UVBWR[0].xy, mul(dUVdx, rot0), mul(dUVdy, rot0)); float4 c1 = tex.SampleGrad(texSampler, UVBWR[1].xy, mul(dUVdx, rot1), mul(dUVdy, rot1)); float4 c2 = tex.SampleGrad(texSampler, UVBWR[2].xy, mul(dUVdx, rot2), mul(dUVdy, rot2)); - + // Blend samples using luminance // This is technically incorrect for normal maps, but produces very similar // results to blending using normal map gradients (steepness) const float3 Lw = float3(0.299, 0.587, 0.114); float3 Dw = float3(dot(c0.xyz, Lw), dot(c1.xyz, Lw), dot(c2.xyz, Lw)); - + Dw = lerp(1.0, Dw, _StochasticHexFallOffContrast); W = Dw * pow(W, _StochasticHexFallOffPower); // In the original hextiling there's a Gain3 step here, but it seems to slow things down \ // and cause the UVs to break, so I've omitted it. Looks fine without - + W /= (W.x + W.y + W.z); return W.x * c0 + W.y * c1 + W.z * c2; } - + float4 HextileSampleTexture(Texture2D tex, SamplerState texSampler, float2 uv, bool isNormalMap) { return HextileSampleTexture(tex, texSampler, uv, isNormalMap, ddx(uv), ddy(uv)); } #endif // defined(_STOCHASTICMODE_HEXTILE) - + void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods) { poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod); - + if (_AlphaGlobalMask > 0) { poiFragData.alpha = maskBlend(poiFragData.alpha, poiMods.globalMask[_AlphaGlobalMask - 1], _AlphaGlobalMaskBlendType); } - + //ifex _AlphaDistanceFade==0 && isNotAnimated(_AlphaDistanceFade) if (_AlphaDistanceFade) { @@ -43581,7 +44609,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.alpha *= distanceFadeMultiplier; } //endex - + //ifex _AlphaFresnel==0 && isNotAnimated(_AlphaFresnel) if (_AlphaFresnel) { @@ -43595,7 +44623,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.alpha *= holoRim; } //endex - + //ifex _AlphaAngular==0 && isNotAnimated(_AlphaAngular) if (_AlphaAngular) { @@ -43628,7 +44656,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.alpha *= angularAlphaMod; } //endex - + //ifex _AlphaAudioLinkEnabled==0 && isNotAnimated(_AlphaAudioLinkEnabled) #ifdef POI_AUDIOLINK if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled) @@ -43637,9 +44665,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + } - + //ifex _AlphaDithering==0 && isNotAnimated(_AlphaDithering) inline half Dither8x8Bayer(int x, int y) { @@ -43657,12 +44685,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int r = y * 8 + x; return dither[r]; } - + half calcDither(half2 grabPos) { return Dither8x8Bayer(glsl_mod(grabPos.x, 8), glsl_mod(grabPos.y, 8)); } - + void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam) { if (_AlphaDithering) @@ -43672,7 +44700,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } //endex - + //ifex _AlphaToCoverage==0 && isNotAnimated(_AlphaToCoverage) void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh) { @@ -43692,7 +44720,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } //endex - + //ifex _EnableOutlines!=1 #ifdef POI_PASS_OUTLINE void applyOutlineColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods, in PoiCam poiCam) @@ -43724,7 +44752,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" outlineColor = lerp(outlineColor, _AudioLinkOutlineColor, smoothstep(_AudioLinkOutlineColorMod.x, _AudioLinkOutlineColorMod.y, poiMods.audioLink[_AudioLinkOutlineColorBand])); } #endif - + poiFragData.baseColor *= poiThemeColor(poiMods, outlineColor.rgb, _LineColorThemeIndex); col.a *= outlineColor.a; if (_OutlineHueShift) @@ -43734,12 +44762,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" hsvg.r += _OutlineHueOffsetSpeed * _Time.x; poiFragData.baseColor.rgb = lilToneCorrection(poiFragData.baseColor.rgb, hsvg); } - + if (_OutlineExpansionMode == 2) { poiFragData.baseColor = lerp(poiFragData.baseColor, poiLight.directColor, _OutlineRimLightBlend); } - + if (_OutlineOverrideAlpha) { poiFragData.alpha = col.a; @@ -43748,13 +44776,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { poiFragData.alpha *= col.a; } - + if (_OutlineAlphaDistanceFade) { float3 position = _OutlineAlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition; poiFragData.alpha *= lerp(_OutlineAlphaDistanceFadeMinAlpha, _OutlineAlphaDistanceFadeMaxAlpha, smoothstep(_OutlineAlphaDistanceFadeMin, _OutlineAlphaDistanceFadeMax, distance(position, poiCam.worldPos))); } - + float emission = _OutlineEmission; #ifdef POI_AUDIOLINK //UNITY_BRANCH @@ -43763,29 +44791,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" emission += lerp(_AudioLinkOutlineEmission.x, _AudioLinkOutlineEmission.y, poiMods.audioLink[_AudioLinkOutlineEmissionBand]); } #endif - + poiFragData.emission += poiFragData.baseColor * emission; } #endif //endex - + void calculateGlobalThemes(inout PoiMods poiMods) { // Theme colors are defined as HDR; convert to SDR and do the HSV adjustment, then re-apply exposure float4 themeColorExposures = 0; float4 themeColor0, themeColor1, themeColor2, themeColor3 = 0; - + DecomposeHDRColor(_GlobalThemeColor0.rgb, themeColor0.rgb, themeColorExposures.x); DecomposeHDRColor(_GlobalThemeColor1.rgb, themeColor1.rgb, themeColorExposures.y); DecomposeHDRColor(_GlobalThemeColor2.rgb, themeColor2.rgb, themeColorExposures.z); DecomposeHDRColor(_GlobalThemeColor3.rgb, themeColor3.rgb, themeColorExposures.w); - + poiMods.globalColorTheme[0] = float4(ApplyHDRExposure(ModifyViaHSV(themeColor0.rgb, frac(_GlobalThemeHue0 + _GlobalThemeHueSpeed0 * _Time.x), _GlobalThemeSaturation0, _GlobalThemeValue0), themeColorExposures.x), _GlobalThemeColor0.a); poiMods.globalColorTheme[1] = float4(ApplyHDRExposure(ModifyViaHSV(themeColor1.rgb, frac(_GlobalThemeHue1 + _GlobalThemeHueSpeed1 * _Time.x), _GlobalThemeSaturation1, _GlobalThemeValue1), themeColorExposures.y), _GlobalThemeColor1.a); poiMods.globalColorTheme[2] = float4(ApplyHDRExposure(ModifyViaHSV(themeColor2.rgb, frac(_GlobalThemeHue2 + _GlobalThemeHueSpeed2 * _Time.x), _GlobalThemeSaturation2, _GlobalThemeValue2), themeColorExposures.z), _GlobalThemeColor2.a); poiMods.globalColorTheme[3] = float4(ApplyHDRExposure(ModifyViaHSV(themeColor3.rgb, frac(_GlobalThemeHue3 + _GlobalThemeHueSpeed3 * _Time.x), _GlobalThemeSaturation3, _GlobalThemeValue3), themeColorExposures.w), _GlobalThemeColor3.a); } - + //ifex _GlobalMaskTexturesEnable==0 #ifdef POI_GLOBALMASK_TEXTURES void ApplyGlobalMaskTextures(in PoiMesh poiMesh, inout PoiMods poiMods) @@ -43807,7 +44835,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[3] = gmcol0[3]; } #endif - + #if defined(PROP_GLOBALMASKTEXTURE1) || !defined(OPTIMIZER_ENABLED) float4 gmcol1 = POI2D_SAMPLER_PAN(_GlobalMaskTexture1, _MainTex, poiUV(poiMesh.uv[_GlobalMaskTexture1UV], _GlobalMaskTexture1_ST), _GlobalMaskTexture1Pan); if (_GlobalMaskTexture1Split) @@ -43825,7 +44853,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[7] = gmcol1[3]; } #endif - + #if defined(PROP_GLOBALMASKTEXTURE2) || !defined(OPTIMIZER_ENABLED) float4 gmcol2 = POI2D_SAMPLER_PAN(_GlobalMaskTexture2, _MainTex, poiUV(poiMesh.uv[_GlobalMaskTexture2UV], _GlobalMaskTexture2_ST), _GlobalMaskTexture2Pan); if (_GlobalMaskTexture2Split) @@ -43843,7 +44871,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[11] = gmcol2[3]; } #endif - + #if defined(PROP_GLOBALMASKTEXTURE3) || !defined(OPTIMIZER_ENABLED) float4 gmcol3 = POI2D_SAMPLER_PAN(_GlobalMaskTexture3, _MainTex, poiUV(poiMesh.uv[_GlobalMaskTexture3UV], _GlobalMaskTexture3_ST), _GlobalMaskTexture3Pan); if (_GlobalMaskTexture3Split) @@ -43928,7 +44956,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (_GlobalMaskToggleOn_13) poiMods.globalMask[13] = 1; if (_GlobalMaskToggleOn_14) poiMods.globalMask[14] = 1; if (_GlobalMaskToggleOn_15) poiMods.globalMask[15] = 1; - + poiMods.globalMask[0] *= (1 - _GlobalMaskToggleOff_0); poiMods.globalMask[1] *= (1 - _GlobalMaskToggleOff_1); poiMods.globalMask[2] *= (1 - _GlobalMaskToggleOff_2); @@ -43947,10 +44975,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[15] *= (1 - _GlobalMaskToggleOff_15); } //endex - + } //endex - + float customDistanceBlend(float base, float blend, float blendType) { switch(blendType) @@ -43960,7 +44988,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" default: return 0; break; } } - + void handleGlobalMaskDistance(int index, bool enable, bool type, float minAlpha, float maxAlpha, float min, float max, int blendType, in PoiMesh poiMesh, inout PoiMods poiMods) { if (enable) @@ -43970,7 +44998,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[index] = saturate(customDistanceBlend(poiMods.globalMask[index], val, blendType)); } } - + void ApplyGlobalMaskModifiers(in PoiMesh poiMesh, inout PoiMods poiMods, in PoiCam poiCam) { //ifex _GlobalMaskModifiersBackfaceEnable==0 @@ -43996,7 +45024,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[15] *= _GlobalMaskBackface_15 == 0 ? 1 : (facingMode == (_GlobalMaskBackface_15)); } //endex - + //ifex _GlobalMaskModifiersMirrorEnable==0 if (_GlobalMaskModifiersMirrorEnable) { @@ -44005,7 +45033,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" mirrorMode = VRCMirrorMode() > 0; else // Generic (CVR, etc) mirrorMode = IsInMirror(); - + mirrorMode += 1; // _GlobalMaskMirror is 0 for ignore, 1 for outside mirror only, 2 for in mirror only poiMods.globalMask[0] *= _GlobalMaskMirror_0 == 0 ? 1 : (mirrorMode == (_GlobalMaskMirror_0)); @@ -44026,7 +45054,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[15] *= _GlobalMaskMirror_15 == 0 ? 1 : (mirrorMode == (_GlobalMaskMirror_15)); } //endex - + //ifex _GlobalMaskModifiersCameraEnable==0 if (_GlobalMaskModifiersCameraEnable) { @@ -44102,12 +45130,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _GlobalMaskDistanceEnable_15==0 handleGlobalMaskDistance(15, _GlobalMaskDistanceEnable_15, _GlobalMaskDistanceType_15, _GlobalMaskDistanceMinAlpha_15, _GlobalMaskDistanceMaxAlpha_15, _GlobalMaskDistanceMin_15, _GlobalMaskDistanceMax_15, _GlobalMaskDistanceBlendType_15, poiMesh, poiMods); //endex - + } //endex - + } - + //ifex _GlobalMaskVertexColorRed==0 && _GlobalMaskVertexColorGreen==0 && _GlobalMaskVertexColorBlue==0 && _GlobalMaskVertexColorAlpha==0 void ApplyGlobalMaskVertexColors(in PoiMesh poiMesh, inout PoiMods poiMods) { @@ -44134,7 +45162,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } //endex - + //ifex _EnableUDIMDiscardOptions==0 #ifdef POI_UDIMDISCARD void applyUDIMDiscard(in VertexOut i) @@ -44142,29 +45170,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if(_UDIMDiscardMode == 1) // Don't run if in vertex mode { float2 udim = floor(vertexUV(i, _UDIMDiscardUV)); - + float isDiscarded = 0; float4 xMask = float4( (udim.x >= 0 && udim.x < 1), (udim.x >= 1 && udim.x < 2), (udim.x >= 2 && udim.x < 3), (udim.x >= 3 && udim.x < 4)); - + isDiscarded += (udim.y >= 0 && udim.y < 1) * dot(float4(_UDIMDiscardRow0_0, _UDIMDiscardRow0_1, _UDIMDiscardRow0_2, _UDIMDiscardRow0_3), xMask); isDiscarded += (udim.y >= 1 && udim.y < 2) * dot(float4(_UDIMDiscardRow1_0, _UDIMDiscardRow1_1, _UDIMDiscardRow1_2, _UDIMDiscardRow1_3), xMask); isDiscarded += (udim.y >= 2 && udim.y < 3) * dot(float4(_UDIMDiscardRow2_0, _UDIMDiscardRow2_1, _UDIMDiscardRow2_2, _UDIMDiscardRow2_3), xMask); isDiscarded += (udim.y >= 3 && udim.y < 4) * dot(float4(_UDIMDiscardRow3_0, _UDIMDiscardRow3_1, _UDIMDiscardRow3_2, _UDIMDiscardRow3_3), xMask); - + isDiscarded *= any(float4(udim.y >= 0, udim.y < 4, udim.x >= 0, udim.x < 4)); // never discard outside 4x4 grid in pos coords - + const float threshold = 0.001; clip(threshold - isDiscarded); // Clip if discarded } - + return; } #endif //endex - + float2 calculatePolarCoordinate(in PoiMesh poiMesh) { float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter; @@ -44174,10 +45202,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float phi_frac = frac(phi); angle = fwidth(phi) - 0.0001 < fwidth(phi_frac) ? phi : phi_frac; angle *= _PolarLengthScale; - + return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower); } - + float2 MonoPanoProjection(float3 coords) { float3 normalizedCoords = normalize(coords); @@ -44191,7 +45219,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" sphereCoords = float2(1.0, 1.0) - sphereCoords; return (sphereCoords + float4(0, 1 - unity_StereoEyeIndex, 1, 1.0).xy) * float4(0, 1 - unity_StereoEyeIndex, 1, 1.0).zw; } - + float2 StereoPanoProjection(float3 coords) { float3 normalizedCoords = normalize(coords); @@ -44205,12 +45233,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" sphereCoords = float2(0.5, 1.0) - sphereCoords; return (sphereCoords + float4(0, 1 - unity_StereoEyeIndex, 1, 0.5).xy) * float4(0, 1 - unity_StereoEyeIndex, 1, 0.5).zw; } - + float2 calculateWorldUV(in PoiMesh poiMesh) { return float2(_UVModWorldPos0 != 3 ? poiMesh.worldPos[ _UVModWorldPos0] : 0.0f, _UVModWorldPos1 != 3 ? poiMesh.worldPos[_UVModWorldPos1] : 0.0f); } - + float2 calculatelocalUV(in PoiMesh poiMesh) { float localUVs[8]; @@ -44222,10 +45250,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" localUVs[5] = poiMesh.vertexColor.g; localUVs[6] = poiMesh.vertexColor.b; localUVs[7] = poiMesh.vertexColor.a; - + return float2(localUVs[_UVModLocalPos0],localUVs[_UVModLocalPos1]); } - + float2 calculatePanosphereUV(in PoiMesh poiMesh) { float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1; @@ -44240,22 +45268,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float4 flowVector = -1; #endif - + #if defined(PROP_DISTORTIONFLOWTEXTURE1) || !defined(OPTIMIZER_ENABLED) float4 flowVector1 = POI2D_SAMPLER_PAN(_DistortionFlowTexture1, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTexture1UV], _DistortionFlowTexture1_ST), _DistortionFlowTexture1Pan) * 2 - 1; #else float4 flowVector1 = -1; #endif - + #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED) half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan)[_DistortionMaskChannel]; #else half distortionMask = 1; #endif - + half distortionStrength = _DistortionStrength; half distortionStrength1 = _DistortionStrength1; - + #ifdef POI_AUDIOLINK UNITY_BRANCH if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle) @@ -44264,14 +45292,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" distortionStrength1 += lerp(_DistortionStrength1AudioLink.x, _DistortionStrength1AudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrength1AudioLinkBand))).r); } #endif - + flowVector *= distortionStrength; flowVector1 *= distortionStrength1; return poiMesh.uv[_DistortionUvToDistort] + ((flowVector.xy + flowVector1.xy) / 2) * distortionMask; } #endif //endex - + //ifex _BlackLightMaskingEnabled==0 #ifdef POI_BLACKLIGHTMASKING void calculateBlackLightMasks(in PoiMesh poiMesh, inout PoiMods poiMods) @@ -44289,7 +45317,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" applyToGlobalMask(poiMods, _BlackLightMasking0GlobalMaskIndex - 1, _BlackLightMasking0GlobalMaskBlendType, smoothstep(_BlackLightMasking0Range.y, _BlackLightMasking0Range.x, distance(poiMesh.worldPos, lightPos))); } } - + if (_BlackLightMasking1GlobalMaskIndex > 0) { if (unity_LightColor[lightIndex].a == _BlackLightMasking1Key) @@ -44297,7 +45325,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" applyToGlobalMask(poiMods, _BlackLightMasking1GlobalMaskIndex - 1, _BlackLightMasking1GlobalMaskBlendType, smoothstep(_BlackLightMasking1Range.y, _BlackLightMasking1Range.x, distance(poiMesh.worldPos, lightPos))); } } - + if (_BlackLightMasking2GlobalMaskIndex > 0) { if (unity_LightColor[lightIndex].a == _BlackLightMasking2Key) @@ -44305,7 +45333,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" applyToGlobalMask(poiMods, _BlackLightMasking2GlobalMaskIndex - 1, _BlackLightMasking2GlobalMaskBlendType, smoothstep(_BlackLightMasking0Range.y, _BlackLightMasking0Range.x, distance(poiMesh.worldPos, lightPos))); } } - + if (_BlackLightMasking3GlobalMaskIndex > 0) { if (unity_LightColor[lightIndex].a == _BlackLightMasking3Key) @@ -44320,17 +45348,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { applyToGlobalMask(poiMods, _BlackLightMasking0GlobalMaskIndex - 1, _BlackLightMasking0GlobalMaskBlendType, 0); } - + if (_BlackLightMasking1GlobalMaskIndex > 0) { applyToGlobalMask(poiMods, _BlackLightMasking1GlobalMaskIndex - 1, _BlackLightMasking1GlobalMaskBlendType, 0); } - + if (_BlackLightMasking2GlobalMaskIndex > 0) { applyToGlobalMask(poiMods, _BlackLightMasking2GlobalMaskIndex - 1, _BlackLightMasking2GlobalMaskBlendType, 0); } - + if (_BlackLightMasking3GlobalMaskIndex > 0) { applyToGlobalMask(poiMods, _BlackLightMasking3GlobalMaskIndex - 1, _BlackLightMasking3GlobalMaskBlendType, 0); @@ -44339,7 +45367,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _MainVertexColoringEnabled==0 void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh) { @@ -44353,10 +45381,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } //endex - + //ifex _ShadingEnabled==0 #ifdef VIGNETTE_MASKED - + #ifdef _LIGHTINGMODE_CLOTH float V_SmithGGXCorrelated(float roughness, float NoV, float NoL) { @@ -44371,16 +45399,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // clamp to the maximum value representable in mediump return v; } - + float D_GGX(float roughness, float NoH) { // Walter et al. 2007, "Microfacet Models for Refraction through Rough Surfaces" - + // In mediump, there are two problems computing 1.0 - NoH^2 // 1) 1.0 - NoH^2 suffers floating point cancellation when NoH^2 is close to 1 (highlights) // 2) NoH doesn't have enough precision around 1.0 // Both problem can be fixed by computing 1-NoH^2 in highp and providing NoH in highp as well - + // However, we can do better using Lagrange's identity: // ||a x b||^2 = ||a||^2 ||b||^2 - (a . b)^2 // since N and H are unit vectors: ||N x H||^2 = 1.0 - NoH^2 @@ -44388,13 +45416,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // enough precision). // Overall this yields better performance, keeping all computations in mediump float oneMinusNoHSquared = 1.0 - NoH * NoH; - + float a = NoH * roughness; float k = roughness / (oneMinusNoHSquared + a * a); float d = k * k * (1.0 / UNITY_PI); return d; } - + // https://github.com/google/filament/blob/main/shaders/src/brdf.fs#L94-L100 float D_Charlie(float roughness, float NoH) { @@ -44404,14 +45432,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float sin2h = max(1.0 - cos2h, 0.0078125); // 0.0078125 = 2^(-14/2), so sin2h^2 > 0 in fp16 return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * UNITY_PI); } - + // https://github.com/google/filament/blob/main/shaders/src/brdf.fs#L136-L139 float V_Neubelt(float NoV, float NoL) { // Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886" return 1.0 / (4.0 * (NoL + NoV - NoL * NoV)); } - + float Distribution(float roughness, float NoH, float cloth) { //ifex _ClothLerp==0 @@ -44422,7 +45450,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH); } - + float Visibility(float roughness, float NoV, float NoL, float cloth) { //ifex _ClothLerp==0 @@ -44433,25 +45461,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL); } - + float F_Schlick(float3 f0, float f90, float VoH) { // Schlick 1994, "An Inexpensive BRDF Model for Physically-Based Rendering" return f0 + (f90 - f0) * pow(1.0 - VoH, 5); } - + float F_Schlick(float3 f0, float VoH) { float f = pow(1.0 - VoH, 5.0); return f + f0 * (1.0 - f); } - + float Fresnel(float3 f0, float LoH) { float f90 = saturate(dot(f0, float(50.0 * 0.33).xxx)); return F_Schlick(f0, f90, LoH); } - + float Fd_Burley(float roughness, float NoV, float NoL, float LoH) { // Burley 2012, "Physically-Based Shading at Disney" @@ -44460,23 +45488,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float viewScatter = F_Schlick(1.0, f90, NoV); return lightScatter * viewScatter; } - + // Energy conserving wrap diffuse term, does *not* include the divide by PI float Fd_Wrap(float NoL, float w) { return saturate((NoL + w) / pow(1.0 + w, 2)); } - + float4 SampleDFG(float NoV, float perceptualRoughness) { return _ClothDFG.Sample(sampler_ClothDFG, float3(NoV, perceptualRoughness, 0)); } - + float3 EnvBRDF(float2 dfg, float3 f0) { return f0 * dfg.x + dfg.y; } - + float3 EnvBRDFMultiscatter(float3 dfg, float3 f0, float cloth) { //ifex _ClothLerp==0 @@ -44487,7 +45515,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z; } - + float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth) { //ifex _ClothLerp==0 @@ -44498,7 +45526,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1; } - + // float ClothMetallic(float cloth) { @@ -44510,21 +45538,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex return cloth <= 0.5 ? 1 : 0; } - + float3 Specular(float roughness, PoiLight poiLight, float f0, float3 normal, float cloth) { float NoL = poiLight.nDotLSaturated; float NoH = poiLight.nDotH; float LoH = poiLight.lDotH; float NoV = poiLight.nDotV; - + float D = Distribution(roughness, NoH, cloth); float V = Visibility(roughness, NoV, NoL, cloth); float3 F = Fresnel(f0, LoH); - + return (D * V) * F; } - + float3 getBoxProjection(float3 direction, float3 position, float4 cubemapPosition, float3 boxMin, float3 boxMax) { #if UNITY_SPECCUBE_BOX_PROJECTION @@ -44535,29 +45563,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" direction = direction * scalar + (position - cubemapPosition.xyz); } #endif - + return direction; } - + float SpecularAO(float NoV, float ao, float roughness) { return clamp(pow(NoV + ao, exp2(-16.0 * roughness - 1.0)) - 1.0 + ao, 0.0, 1.0); } - + float3 IndirectSpecular(float3 dfg, float roughness, float occlusion, float energyCompensation, float cloth, float3 indirectDiffuse, float f0, PoiLight poiLight, PoiFragData poiFragData, PoiCam poiCam, PoiMesh poiMesh) { float3 normal = poiMesh.normals[1]; - + float3 reflDir = reflect(-poiCam.viewDir, normal); - + Unity_GlossyEnvironmentData envData; envData.roughness = roughness; envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin.xyz, unity_SpecCube0_BoxMax.xyz); - + float3 probe0 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE(unity_SpecCube0), unity_SpecCube0_HDR, envData); float3 indirectSpecular = probe0; - + #if UNITY_SPECCUBE_BLENDING UNITY_BRANCH if (unity_SpecCube0_BoxMin.w < 0.99999) @@ -44567,15 +45595,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirectSpecular = lerp(probe1, probe0, unity_SpecCube0_BoxMin.w); } #endif - + float horizon = min(1 + dot(reflDir, normal), 1); indirectSpecular = indirectSpecular * horizon * horizon * energyCompensation * EnvBRDFMultiscatter(dfg, f0, cloth); - + indirectSpecular *= SpecularAO(poiLight.nDotV, occlusion, roughness); return indirectSpecular; }; #endif - + #ifdef _LIGHTINGMODE_WRAPPED // Wrapped // Green’s model with adjustable energy @@ -44584,7 +45612,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float RTWrapFunc(in float dt, in float w, in float norm) { float cw = saturate(w); - + float o = (dt + cw) / ((1.0 + cw) * (1.0 + cw * norm)); float flt = 1.0 - 0.85 * norm; if (w > 1.0) @@ -44593,21 +45621,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return o; } - + float3 GreenWrapSH(float fA) // Greens unoptimized and non-normalized - + { float fAs = saturate(fA); float4 t = float4(fA + 1, fAs - 1, fA - 2, fAs + 1); // DJL edit: allow wrapping to L0-only at w=2 return float3(t.x, -t.z * t.x / 3, 0.25 * t.y * t.y * t.w); } float3 GreenWrapSHOpt(float fW) // optimised and normalized https://blog.selfshadow.com/2012/01/07/righting-wrap-part-2/ - + { const float4 t0 = float4(0.0, 1.0 / 4.0, -1.0 / 3.0, -1.0 / 2.0); const float4 t1 = float4(1.0, 2.0 / 3.0, 1.0 / 4.0, 0.0); float3 fWs = float3(fW, fW, saturate(fW)); // DJL edit: allow wrapping to L0-only at w=2 - + float3 r; r.xyz = t0.xxy * fWs + t0.xzw; r.xyz = r.xyz * fWs + t1.xyz; @@ -44618,33 +45646,33 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 x0, x1, x2; float3 conv = lerp(GreenWrapSH(wrap), GreenWrapSHOpt(wrap), _LightingWrappedNormalization); // Should try optimizing this... conv *= float3(1, 1.5, 4); // Undo pre-applied cosine convolution by using the inverse - + // Constant (L0) x0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w); // Remove pre-applied constant part from L(2,0) to apply correct convolution float3 L2_0 = float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / - 3.0; x0 -= L2_0; - + // Linear (L1) polynomial terms x1.r = dot(unity_SHAr.xyz, normal); x1.g = dot(unity_SHAg.xyz, normal); x1.b = dot(unity_SHAb.xyz, normal); - + // 4 of the quadratic (L2) polynomials float4 vB = normal.xyzz * normal.yzzx; x2.r = dot(unity_SHBr, vB); x2.g = dot(unity_SHBg, vB); x2.b = dot(unity_SHBb, vB); - + // Final (5th) quadratic (L2) polynomial float vC = normal.x * normal.x - normal.y * normal.y; x2 += unity_SHC.rgb * vC; // Move back the constant part of L(2,0) x2 += L2_0; - + return x0 * conv.x + x1 * conv.y + x2 * conv.z; } - + float3 GetSHDirectionL1() { // For efficiency, we only get the direction from L1. @@ -44659,7 +45687,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return ShadeSH9_wrapped(maxDirection, 0); } #endif - + #ifdef _LIGHTINGMODE_SHADEMAP void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight) { @@ -44669,37 +45697,37 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" shadowAttenuation = lerp(1, poiLight.additiveShadow, poiLight.attenuationStrength); //attenuation = poiLight.attenuation; #endif - + float MainColorFeatherStep = _BaseColor_Step - _BaseShade_Feather; float firstColorFeatherStep = _ShadeColor_Step - _1st2nd_Shades_Feather; - + #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED) float4 firstShadeMap = POI2D_SAMPLER_PAN(_1st_ShadeMap, _MainTex, poiUV(poiMesh.uv[_1st_ShadeMapUV], _1st_ShadeMap_ST), _1st_ShadeMapPan); #else float4 firstShadeMap = float4(1, 1, 1, 1); #endif firstShadeMap = lerp(firstShadeMap, float4(poiFragData.baseColor, 1), _Use_BaseAs1st); - + #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED) float4 secondShadeMap = POI2D_SAMPLER_PAN(_2nd_ShadeMap, _MainTex, poiUV(poiMesh.uv[_2nd_ShadeMapUV], _2nd_ShadeMap_ST), _2nd_ShadeMapPan); #else float4 secondShadeMap = float4(1, 1, 1, 1); #endif secondShadeMap = lerp(secondShadeMap, firstShadeMap, _Use_1stAs2nd); - + firstShadeMap.rgb *= _1st_ShadeColor.rgb; //* lighColor secondShadeMap.rgb *= _2nd_ShadeColor.rgb; //* LightColor; - + float shadowMask = 1; shadowMask *= _Use_1stShadeMapAlpha_As_ShadowMask ? (_1stShadeMapMask_Inverse ? (1.0 - firstShadeMap.a) : firstShadeMap.a) : 1; shadowMask *= _Use_2ndShadeMapAlpha_As_ShadowMask ? (_2ndShadeMapMask_Inverse ? (1.0 - secondShadeMap.a) : secondShadeMap.a) : 1; - + float mainShadowMask = saturate(1 - ((poiLight.lightMap) - MainColorFeatherStep) / (_BaseColor_Step - MainColorFeatherStep) * (shadowMask)); float firstSecondShadowMask = saturate(1 - ((poiLight.lightMap) - firstColorFeatherStep) / (_ShadeColor_Step - firstColorFeatherStep) * (shadowMask)); - + mainShadowMask *= poiLight.shadowMask * _ShadowStrength; firstSecondShadowMask *= poiLight.shadowMask * _ShadowStrength; - + // 0 lerp | 1 multiply if (_ShadingShadeMapBlendType == 0) { @@ -44712,7 +45740,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.rampedLightMap = 1 - mainShadowMask; } #endif - + #ifdef _LIGHTINGMODE_REALISTIC // For https://docs.unity3d.com/Manual/LightMode-Mixed-Subtractive.html #if defined(LIGHTMAP_ON) && defined(SHADOWS_SCREEN) @@ -44720,13 +45748,32 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define SUBTRACTIVE_LIGHTING 1 #endif #endif - - void ApplySubtractiveLighting(inout UnityIndirect indirectLight) + + float FadeShadows(float attenuation, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiCam poiCam) + { + #if HANDLE_SHADOWS_BLENDING_IN_GI || ADDITIONAL_MASKED_DIRECTIONAL_SHADOWS + // UNITY_LIGHT_ATTENUATION doesn't fade shadows for us. + + #if ADDITIONAL_MASKED_DIRECTIONAL_SHADOWS + attenuation = poiLight.attenuation; + #endif + + float viewZ = dot(_WorldSpaceCameraPos - poiMesh.worldPos, UNITY_MATRIX_V[2].xyz); + float shadowFadeDistance = UnityComputeShadowFadeDistance(poiMesh.worldPos, viewZ); + float shadowFade = UnityComputeShadowFade(shadowFadeDistance); + float bakedAttenuation = UnitySampleBakedOcclusion(poiMesh.lightmapUV.xy, poiMesh.worldPos); + attenuation = UnityMixRealtimeAndBakedShadows(attenuation, bakedAttenuation, shadowFade); + #endif + + return attenuation; + } + + void ApplySubtractiveLighting(inout UnityIndirect indirectLight, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiCam poiCam) { #if SUBTRACTIVE_LIGHTING - poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier)); - - float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz)); + poiLight.attenuation = FadeShadows(poiLight.attenuation, poiLight, poiMesh, poiCam); + + float ndotl = saturate(dot(poiMesh.normals[0], _WorldSpaceLightPos0.xyz)); float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb; float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate; subtractedLight = max(subtractedLight, unity_ShadowColor.rgb); @@ -44734,45 +45781,37 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirectLight.diffuse = min(subtractedLight, indirectLight.diffuse); #endif } - + UnityIndirect CreateIndirectLight(in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight) { UnityIndirect indirectLight; indirectLight.diffuse = 0; indirectLight.specular = 0; - + #if defined(LIGHTMAP_ON) indirectLight.diffuse = DecodeLightmap(UNITY_SAMPLE_TEX2D(unity_Lightmap, poiMesh.lightmapUV.xy)); - + #if defined(DIRLIGHTMAP_COMBINED) - float4 lightmapDirection = UNITY_SAMPLE_TEX2D_SAMPLER( - unity_LightmapInd, unity_Lightmap, poiMesh.lightmapUV.xy - ); - indirectLight.diffuse = DecodeDirectionalLightmap( - indirectLight.diffuse, lightmapDirection, poiMesh.normals[1] - ); + float4 lightmapDirection = UNITY_SAMPLE_TEX2D_SAMPLER(unity_LightmapInd, unity_Lightmap, poiMesh.lightmapUV.xy); + indirectLight.diffuse = DecodeDirectionalLightmap(indirectLight.diffuse, lightmapDirection, poiMesh.normals[1]); #endif - ApplySubtractiveLighting(indirectLight); + + ApplySubtractiveLighting(indirectLight, poiLight, poiMesh, poiCam); #endif - + #if defined(DYNAMICLIGHTMAP_ON) float3 dynamicLightDiffuse = DecodeRealtimeLightmap( UNITY_SAMPLE_TEX2D(unity_DynamicLightmap, poiMesh.lightmapUV.zw) ); - + #if defined(DIRLIGHTMAP_COMBINED) - float4 dynamicLightmapDirection = UNITY_SAMPLE_TEX2D_SAMPLER( - unity_DynamicDirectionality, unity_DynamicLightmap, - poiMesh.lightmapUV.zw - ); - indirectLight.diffuse += DecodeDirectionalLightmap( - dynamicLightDiffuse, dynamicLightmapDirection, poiMesh.normals[1] - ); + float4 dynamicLightmapDirection = UNITY_SAMPLE_TEX2D_SAMPLER(unity_DynamicDirectionality, unity_DynamicLightmap, poiMesh.lightmapUV.zw); + indirectLight.diffuse += DecodeDirectionalLightmap(dynamicLightDiffuse, dynamicLightmapDirection, poiMesh.normals[1]); #else indirectLight.diffuse += dynamicLightDiffuse; #endif #endif - + #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON) #if UNITY_LIGHT_PROBE_PROXY_VOLUME if (unity_ProbeVolumeParams.x == 1) @@ -44793,24 +45832,45 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1))); #endif #endif - + indirectLight.diffuse *= poiLight.occlusion; - + return indirectLight; } #endif - + float GetRemapMinValue(float scale, float offset) { return clamp(-offset / scale, -0.01f, 1.01f); // Remap min - + } float GetRemapMaxValue(float scale, float offset) { return clamp((1.0f - offset) / scale, -0.01f, 1.01f); // Remap Max - + } - + + half4 POI_BRDF_PBS(half3 diffColor, half3 specColor, half oneMinusReflectivity, half smoothness, float3 normal, float3 viewDir, UnityLight light, UnityIndirect gi) + { + float3 reflDir = reflect(viewDir, normal); + + half nl = saturate(dot(normal, light.dir)); + half nv = saturate(dot(normal, viewDir)); + + // Vectorize Pow4 to save instructions + half2 rlPow4AndFresnelTerm = Pow4(float2(dot(reflDir, light.dir), 1 - nv)); // use R.L instead of N.H to save couple of instructions + half rlPow4 = rlPow4AndFresnelTerm.x; // power exponent must match kHorizontalWarpExp in NHxRoughness() function in GeneratedTextures.cpp + half fresnelTerm = rlPow4AndFresnelTerm.y; + + half grazingTerm = saturate(smoothness + (1 - oneMinusReflectivity)); + + half3 color = BRDF3_Direct(diffColor, specColor, rlPow4, smoothness); + color *= light.color * nl; + color += BRDF3_Indirect(diffColor, specColor, gi, grazingTerm, fresnelTerm); + + return half4(color, 1); + } + void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam) { float shadowAttenuation = lerp(1, poiLight.attenuation, poiLight.attenuationStrength); @@ -44819,7 +45879,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" shadowAttenuation = lerp(1, poiLight.additiveShadow, poiLight.attenuationStrength); //attenuation = poiLight.attenuation; #endif - + #ifdef POI_PASS_ADD if (_LightingAdditiveType == 3) { @@ -44846,11 +45906,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float passthrough = _LightingAdditivePassthrough; #endif - + float2 ToonAddGradient = float2(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd); - + if (ToonAddGradient.x == ToonAddGradient.y) ToonAddGradient.y += 0.0001; - + poiLight.rampedLightMap = smoothstep(ToonAddGradient.y, ToonAddGradient.x, 1 - (.5 * poiLight.nDotL + .5)); #if defined(POINT) || defined(SPOT) poiLight.finalLighting = lerp(poiLight.directColor * max(min(poiLight.additiveShadow, poiLight.detailShadow), passthrough), poiLight.indirectColor, smoothstep(ToonAddGradient.x, ToonAddGradient.y, 1 - (.5 * poiLight.nDotL + .5))); @@ -44860,20 +45920,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return; } #endif - + float shadowStrength = _ShadowStrength * poiLight.shadowMask; - + #ifdef POI_PASS_OUTLINE shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength); #endif - + // These blocks shouldn't need ifex, they should be removed on lock when their keywords aren't present - + #ifdef _LIGHTINGMODE_FLAT poiLight.finalLighting = poiLight.directColor * attenuation * shadowAttenuation; - poiLight.rampedLightMap = poiLight.nDotLSaturated; + if (_ForceFlatRampedLightmap) + { + poiLight.rampedLightMap = smoothstep(0.4, 0.6, poiLight.nDotLNormalized); + } + else + { + poiLight.rampedLightMap = 1; + } #endif - + #ifdef _LIGHTINGMODE_TEXTURERAMP float2 rampUVs = poiLight.lightMap + _ShadowOffset; if (_ToonRampCount > 1) @@ -44883,26 +45950,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D_SAMPLER(_ToonRamp, _linear_clamp, rampUVs).rgb, shadowStrength); poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap) * attenuation; #endif - + #ifdef _LIGHTINGMODE_MULTILAYER_MATH #if defined(PROP_MULTILAYERMATHBLURMAP) || !defined(OPTIMIZER_ENABLED) float4 blurMap = POI2D_SAMPLER_PAN(_MultilayerMathBlurMap, _MainTex, poiUV(poiMesh.uv[_MultilayerMathBlurMapUV], _MultilayerMathBlurMap_ST), _MultilayerMathBlurMapPan); #else float4 blurMap = 1; #endif - + float4 lns = float4(1, 1, 1, 1); - + float shadowAttenuationNoStrength = poiLight.attenuation; #if defined(POINT) || defined(SPOT) shadowAttenuationNoStrength = poiLight.additiveShadow; #endif - + float3 lightMap = poiLight.lightMapNoAttenuation.xxx; lightMap.x *= lerp(1.0, shadowAttenuationNoStrength, _ShadowReceive); lightMap.y *= lerp(1.0, shadowAttenuationNoStrength, _Shadow2ndReceive); lightMap.z *= lerp(1.0, shadowAttenuationNoStrength, _Shadow3rdReceive); - + float4 shadowBorderMask = 1; if (_ShadowBorderMapToggle) { @@ -44910,19 +45977,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 shadowShift0 = float2(_ShadowAOShift.x, _ShadowAOShift.y); float2 shadowShift1 = float2(_ShadowAOShift.z, _ShadowAOShift.w); float2 shadowShift2 = float2(_ShadowAOShift2.x, _ShadowAOShift2.y); - + //float2 shadowShift0 = float2(GetRemapMinValue(_ShadowAOShift.x, _ShadowAOShift.y), GetRemapMaxValue(_ShadowAOShift.x, _ShadowAOShift.y)); //float2 shadowShift1 = float2(GetRemapMinValue(_ShadowAOShift.z, _ShadowAOShift.w), GetRemapMaxValue(_ShadowAOShift.z, _ShadowAOShift.w)); //float2 shadowShift2 = float2(GetRemapMinValue(_ShadowAOShift2.x, _ShadowAOShift2.y), GetRemapMaxValue(_ShadowAOShift2.x, _ShadowAOShift2.y)); - + shadowShift0.y = (shadowShift0.x == shadowShift0.y) ? (shadowShift0.y + 0.001f) : shadowShift0.y; shadowShift1.y = (shadowShift1.x == shadowShift1.y) ? (shadowShift1.y + 0.001f) : shadowShift1.y; shadowShift2.y = (shadowShift2.x == shadowShift2.y) ? (shadowShift2.y + 0.001f) : shadowShift2.y; - + shadowShift0 = float2(1.0f / (shadowShift0.y - shadowShift0.x), shadowShift0.x / (shadowShift0.x - shadowShift0.y)); shadowShift1 = float2(1.0f / (shadowShift1.y - shadowShift1.x), shadowShift1.x / (shadowShift1.x - shadowShift1.y)); shadowShift2 = float2(1.0f / (shadowShift2.y - shadowShift2.x), shadowShift2.x / (shadowShift2.x - shadowShift2.y)); - + #if defined(PROP_SHADOWBORDERMASK) || !defined(OPTIMIZER_ENABLED) float2 shadowBorderMaskUV = poiUV(poiMesh.uv[_ShadowBorderMaskUV], _ShadowBorderMask_ST); if (_ShadowBorderMaskLOD) @@ -44934,14 +46001,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" shadowBorderMask = POI2D_SAMPLER_PAN(_ShadowBorderMask, _linear_repeat, shadowBorderMaskUV, _ShadowBorderMaskPan); } #endif - + shadowBorderMask.r = saturate(shadowBorderMask.r * shadowShift0.x + shadowShift0.y); shadowBorderMask.g = saturate(shadowBorderMask.g * shadowShift1.x + shadowShift1.y); shadowBorderMask.b = saturate(shadowBorderMask.b * shadowShift2.x + shadowShift2.y); - + lightMap.xyz = _ShadowPostAO ? lightMap.xyz : lightMap.xyz * shadowBorderMask.rgb; } - + if (_LightingMulitlayerNonLinear) { lns.x = poiEdgeNonLinearNoSaturate(lightMap.x, _ShadowBorder, _ShadowBlur * blurMap.r); @@ -44963,7 +46030,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //poiLight.finalLighting = lns.rgb; //return; float3 indirectColor = 1; - + if (_ShadowColor.a > 0) { #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED) @@ -44995,7 +46062,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a; indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z); } - + indirectColor = lerp(indirectColor, indirectColor * poiFragData.baseColor, _ShadowMainStrength); poiLight.rampedLightMap = lns.x; indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb * _ShadowBorderColor.a); @@ -45003,11 +46070,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirectColor = lerp(poiLight.directColor, indirectColor, shadowStrength * poiLight.shadowMask); poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x) * attenuation; #endif - + #ifdef _LIGHTINGMODE_SHADEMAP poiLight.finalLighting = poiLight.directColor * attenuation; #endif - + #ifdef _LIGHTINGMODE_REALISTIC UnityLight light; light.dir = poiLight.direction; @@ -45023,11 +46090,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirectLight.diffuse = max(indirectLight.diffuse * _PPLightingMultiplier, 0); indirectLight.diffuse = max(indirectLight.diffuse + _PPLightingAddition, 0); #endif - + poiLight.rampedLightMap = poiLight.nDotLSaturated; - poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, indirectLight).xyz, _LightingMinLightBrightness); + poiLight.finalLighting = max(POI_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, indirectLight).xyz, _LightingMinLightBrightness); #endif - + #ifdef _LIGHTINGMODE_CLOTH #if defined(PROP_CLOTHMETALLICSMOOTHNESSMAP) || !defined(OPTIMIZER_ENABLED) float4 clothmapsample = POI2D_SAMPLER_PAN(_ClothMetallicSmoothnessMap, _MainTex, poiUV(poiMesh.uv[_ClothMetallicSmoothnessMapUV], _ClothMetallicSmoothnessMap_ST), _ClothMetallicSmoothnessMapPan); @@ -45042,22 +46109,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float reflectance = _ClothReflectance; float clothmask = 1; #endif - + float perceptualRoughness = pow(roughness, 2); float clampedRoughness = max(0.002, perceptualRoughness); - + float f0 = 0.16 * reflectance * reflectance * (1 - metallic) + poiFragData.baseColor * metallic; float3 fresnel = Fresnel(f0, poiLight.nDotV); - + float3 dfg = SampleDFG(poiLight.nDotV, perceptualRoughness); - + float energyCompensation = EnvBRDFEnergyCompensation(dfg, f0, clothmask); - + poiLight.finalLighting = Fd_Burley(perceptualRoughness, poiLight.nDotV, poiLight.nDotLSaturated, poiLight.lDotH); - poiLight.finalLighting *= _LightColor0 * attenuation * shadowAttenuation * poiLight.nDotLSaturated; + poiLight.finalLighting *= poiLight.directColor * attenuation * shadowAttenuation * poiLight.nDotLSaturated; poiLight.rampedLightMap = poiLight.nDotLSaturated; + float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F - + #ifdef UNITY_PASS_FORWARDBASE float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w); float3 indirectDiffuse; @@ -45065,15 +46133,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirectDiffuse.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, poiMesh.normals[1]); indirectDiffuse.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, poiMesh.normals[1]); indirectDiffuse = max(0, indirectDiffuse); - + indirectDiffuse = lerp(indirectDiffuse, dot(indirectDiffuse, float3(0.299, 0.587, 0.114)), _LightingMonochromatic); + float3 indirectSpecular = IndirectSpecular(dfg, roughness, poiLight.occlusion, energyCompensation, clothmask, indirectDiffuse, f0, poiLight, poiFragData, poiCam, poiMesh); poiLight.finalLightAdd += max(0, specular + indirectSpecular); poiLight.finalLighting += indirectDiffuse * poiLight.occlusion; + #endif - + poiFragData.baseColor.xyz *= (1 - metallic); #endif - + #ifdef _LIGHTINGMODE_WRAPPED #define GREYSCALE_VECTOR float3(.33333, .33333, .33333) float3 directColor = _LightColor0.rgb * saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)); @@ -45083,19 +46153,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif directColor = lerp(directColor, dot(directColor, float3(0.299, 0.587, 0.114)), _LightingMonochromatic); // Duplicated from Lightdata due to recreating the light colour indirectColor = lerp(indirectColor, dot(indirectColor, float3(0.299, 0.587, 0.114)), _LightingMonochromatic); // Ditto^ - + float3 ShadeSH9Plus_2 = GetSHMaxL1(); float bw_topDirectLighting_2 = dot(_LightColor0.rgb, GREYSCALE_VECTOR); float bw_directLighting = dot(directColor, GREYSCALE_VECTOR); float bw_indirectLighting = dot(indirectColor, GREYSCALE_VECTOR); float bw_topIndirectLighting = dot(ShadeSH9Plus_2, GREYSCALE_VECTOR); - + poiLight.lightMap = smoothstep(0, bw_topIndirectLighting + bw_topDirectLighting_2, bw_indirectLighting + bw_directLighting) * min(poiLight.detailShadow, shadowAttenuation); poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap))); float3 mathRamp = lerp(float3(1, 1, 1), saturate(lerp((_LightingShadowColor * lerp(indirectColor, 1, _LightingIgnoreAmbientColor)), float3(1, 1, 1), saturate(poiLight.rampedLightMap))), _ShadowStrength); - + directColor *= saturate(poiLight.rampedLightMap + 1 - _ShadowStrength) * _LightingWrappedColor; - + float3 finalWrap = directColor + indirectColor; if (_LightingCapEnabled) { @@ -45108,11 +46178,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //finalWrap *= attenuation; poiLight.finalLighting = finalWrap * saturate(mathRamp + 1 - _ShadowStrength); #endif - + #ifdef _LIGHTINGMODE_SKIN float3 ambientNormalWorld = poiMesh.normals[1];//aTangentToWorld(s, s.blurredNormalTangent); poiLight.rampedLightMap = poiLight.nDotLSaturated; - + // Scattering mask. #if defined(PROP_SKINTHICKNESS) || !defined(OPTIMIZER_ENABLED) float subsurface = 1 - POI2D_SAMPLER_PAN(_SkinThicknessMap, _MainTex, poiUV(poiMesh.uv[_SkinThicknessMapUV], _SkinThicknessMap_ST), _SkinThicknessMapPan).r; @@ -45128,33 +46198,33 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" subsurface = pow(subsurface, _SkinThicknessPower); } float skinScattering = saturate(subsurface * _SssScale * 2); - + // Skin subsurface depth absorption tint. // cf http://www.crytek.com/download/2014_03_25_CRYENGINE_GDC_Schultz.pdf pg 35 // link dead, https://ia600902.us.archive.org/25/items/crytek_presentations/2014_03_25_CRYENGINE_GDC_Schultz.pdf half3 absorption = exp((1.0h - subsurface) * _SssTransmissionAbsorption.rgb); - + // Albedo scale for absorption assumes ~0.5 luminance for Caucasian skin. absorption *= saturate(poiFragData.baseColor * unity_ColorSpaceDouble.rgb); - + // Blurred normals for indirect diffuse and direct scattering. ambientNormalWorld = normalize(lerp(poiMesh.normals[1], ambientNormalWorld, _SssBumpBlur)); - + float ndlBlur = dot(poiMesh.normals[1], poiLight.direction) * 0.5h + 0.5h; float lumi = dot(poiLight.directColor, half3(0.2126h, 0.7152h, 0.0722h)); float4 sssLookupUv = float4(ndlBlur, skinScattering * lumi, 0.0f, 0.0f); half3 sss = poiLight.lightMap * tex2Dlod(_SkinLUT, sssLookupUv).rgb; poiLight.finalLighting = lerp(poiLight.directColor, min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) * poiLight.occlusion + (sss * poiLight.directColor), poiLight.directColor), _ShadowStrength * poiLight.shadowMask) * attenuation; #endif - + #ifdef _LIGHTINGMODE_SDF float3 forward = normalize(UnityObjectToWorldDir(float4(_SDFForward.xyz, 1))); float3 left = normalize(UnityObjectToWorldDir(float4(_SDFLeft.xyz, 1))); float3 lightDirHorizontal = normalize(float3(poiLight.direction.x, 0, poiLight.direction.z)); - + float lightAtten = 1 - (dot(lightDirHorizontal, forward) * 0.5 + 0.5); float filpU = sign(dot(lightDirHorizontal, left)); - + #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED) float shadowSDF = POI2D_SAMPLER_PAN(_SDFShadingTexture, _MainTex, poiUV(poiMesh.uv[_SDFShadingTextureUV], _SDFShadingTexture_ST) * float2(filpU, 1), _SDFShadingTexturePan).r; #else @@ -45162,14 +46232,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif float blur = _SDFBlur * 0.1; float faceShadow = smoothstep(lightAtten - blur, lightAtten + blur, shadowSDF) * poiLight.detailShadow; - + float3 indirectColor = _LightingShadowColor.rgb; indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor); indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask); - + poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, faceShadow) * attenuation; #endif - + if (poiFragData.toggleVertexLights) { #if defined(VERTEXLIGHT_ON) @@ -45190,7 +46260,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (lightingMode == 0) { vertexLighting = max(vertexLighting, poiLight.vColor[index] * poiLight.vSaturatedDotNL[index] * poiLight.detailShadow); // Realistic - + } //UNITY_BRANCH // Toon @@ -45208,7 +46278,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _EnableDissolve==0 #ifdef DISTORT void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods, in PoiCam poiCam, in PoiLight poiLight) @@ -45228,19 +46298,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { dissolveMask = maskBlend(dissolveMask, poiMods.globalMask[_DissolveMaskGlobalMask - 1], _DissolveMaskGlobalMaskBlendType); } - + #if defined(PROP_DISSOLVETOTEXTURE) || !defined(OPTIMIZER_ENABLED) dissolveToTexture = POI2D_SAMPLER_PAN(_DissolveToTexture, _MainTex, poiUV(poiMesh.uv[_DissolveToTextureUV], _DissolveToTexture_ST), _DissolveToTexturePan) * float4(poiThemeColor(poiMods, _DissolveTextureColor.rgb, _DissolveTextureColorThemeIndex), _DissolveTextureColor.a); #else - dissolveToTexture = _DissolveTextureColor; + dissolveToTexture = float4(poiThemeColor(poiMods, _DissolveTextureColor.rgb, _DissolveTextureColorThemeIndex), _DissolveTextureColor.a); #endif - + #if defined(PROP_DISSOLVENOISETEXTURE) || !defined(OPTIMIZER_ENABLED) float dissolveNoiseTexture = POI2D_SAMPLER_PAN(_DissolveNoiseTexture, _MainTex, poiUV(poiMesh.uv[_DissolveNoiseTextureUV], _DissolveNoiseTexture_ST), _DissolveNoiseTexturePan).r; #else float dissolveNoiseTexture = 1; #endif - + float da = _DissolveAlpha + _DissolveAlpha0 + _DissolveAlpha1 @@ -45253,22 +46323,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" + _DissolveAlpha8 + _DissolveAlpha9; float dds = _DissolveDetailStrength; - + if (_UVTileDissolveEnabled) { float2 udim = floor(poiMesh.uv[(int)_UVTileDissolveUV]); - + float4 xMask = float4((udim.x >= 0 && udim.x < 1), (udim.x >= 1 && udim.x < 2), (udim.x >= 2 && udim.x < 3), (udim.x >= 3 && udim.x < 4)); - + da += (udim.y >= 0 && udim.y < 1) * dot(float4(_UVTileDissolveAlpha_Row0_0, _UVTileDissolveAlpha_Row0_1, _UVTileDissolveAlpha_Row0_2, _UVTileDissolveAlpha_Row0_3), xMask); da += (udim.y >= 1 && udim.y < 2) * dot(float4(_UVTileDissolveAlpha_Row1_0, _UVTileDissolveAlpha_Row1_1, _UVTileDissolveAlpha_Row1_2, _UVTileDissolveAlpha_Row1_3), xMask); da += (udim.y >= 2 && udim.y < 3) * dot(float4(_UVTileDissolveAlpha_Row2_0, _UVTileDissolveAlpha_Row2_1, _UVTileDissolveAlpha_Row2_2, _UVTileDissolveAlpha_Row2_3), xMask); da += (udim.y >= 3 && udim.y < 4) * dot(float4(_UVTileDissolveAlpha_Row3_0, _UVTileDissolveAlpha_Row3_1, _UVTileDissolveAlpha_Row3_2, _UVTileDissolveAlpha_Row3_3), xMask); } - + #ifdef POI_AUDIOLINK UNITY_BRANCH if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable) @@ -45277,10 +46347,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]); } #endif - + da = saturate(da); dds = saturate(dds); - + if (_DissolveMaskInvert) { dissolveMask = 1 - dissolveMask; @@ -45305,33 +46375,33 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" da *= dissolveMask; dissolveAlpha = da; edgeAlpha = 0; - + [flatten] switch(_DissolveType) { default: // Basic (case 1) - + { da = remap(da, 0, 1, -_DissolveEdgeWidth, 1); dissolveAlpha = da; //Adjust detail strength to avoid artifacts dds *= smoothstep(1, 0.99, da) * lerp(1, smoothstep(0, lerp(0.01, 0.1, dds), da), _DissolveDetailEdgeSmoothing); float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds); - + noise = saturate(noise * 0.998 + 0.001); dissolveAlpha = dissolveAlpha >= noise; edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha); break; } case 2: // Point to Point - + { float3 direction; float3 currentPos; float distanceTo = 0; direction = normalize(_DissolveEndPoint - _DissolveStartPoint); currentPos = lerp(_DissolveStartPoint, _DissolveEndPoint, dissolveAlpha); - + UNITY_BRANCH if (_DissolveP2PWorldLocal != 1) { @@ -45348,17 +46418,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" dissolveAlpha = (distanceTo < 0) ? 1 : 0; edgeAlpha *= 1 - dissolveAlpha; } - + if (_DissolveP2PClamp) { dissolveAlpha = saturate(dissolveAlpha * smoothstep(0, 0.01, da) + smoothstep(0.99, 1, da)); edgeAlpha *= smoothstep(0, 0.01, da); } - + break; } case 3: // Spherical - + { if (_SphericalDissolveInvert) { @@ -45368,14 +46438,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { da = remap(da, 0, 1, -_DissolveEdgeWidth, 1); } - + dissolveAlpha = da; dds *= smoothstep(0, 0.2 * dds + 0.01, dissolveAlpha) * lerp(1, smoothstep(1, 1 - 0.2 * dds - 0.01, dissolveAlpha), _DissolveDetailEdgeSmoothing); float currentDistance = lerp(0, _SphericalDissolveRadius, dissolveAlpha); float fragDistance = distance(_SphericalDissolveCenter, poiMesh.localPos.xyz); float normalizedDistance; normalizedDistance = (fragDistance - currentDistance) / (_SphericalDissolveRadius + 0.0001) - dissolveDetailNoise * dds; - + if (_SphericalDissolveInvert) { dissolveAlpha = (normalizedDistance > 0) ? 1 : 0; @@ -45386,62 +46456,62 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" dissolveAlpha = (normalizedDistance < 0) ? 1 : 0; edgeAlpha = smoothstep(_DissolveEdgeWidth + .00001, 0, normalizedDistance); } - + if (_SphericalDissolveClamp) { da = lerp(da, 1 - da, _SphericalDissolveInvert); dissolveAlpha = saturate(dissolveAlpha * smoothstep(0, 0.01, da) + smoothstep(0.99, 1, da)); edgeAlpha *= smoothstep(0, 0.01, da); } - + break; } case 4: // CenterOut - + { float ramp = 0.5; float noise; - + [flatten] switch(_CenterOutDissolveMode) { case 1: // View Direction - + { ramp = saturate(lerp(poiLight.vertexNDotV, poiLight.nDotV, _CenterOutDissolveNormals)); break; } case 2: // Custom Direction - + { ramp = dot(normalize(_CenterOutDissolveDirection), lerp(poiMesh.normals[0], poiMesh.normals[1], _CenterOutDissolveNormals)); ramp = saturate(ramp * .5 + 0.5); break; } case 3: // Light Direction - + { ramp = lerp(poiLight.vertexNDotL, poiLight.nDotL, _CenterOutDissolveNormals); ramp = saturate(ramp * .5 + 0.5); break; } } - + if (_CenterOutDissolvePower != 1) { ramp = pow(ramp, _CenterOutDissolvePower); } - + if (!_CenterOutDissolveInvert) { ramp = 1 - ramp; } - + da = remap(da, 0, 1, -_DissolveEdgeWidth, 1); dissolveAlpha = da; //Adjust detail strength to avoid artifacts dds *= smoothstep(1, 0.99, da) * lerp(1, smoothstep(0, lerp(0.01, 0.1, dds), da), _DissolveDetailEdgeSmoothing); - + noise = saturate(ramp - dissolveDetailNoise * dds); noise = saturate(noise * 0.998 + 0.001); dissolveAlpha = dissolveAlpha >= noise; @@ -45449,27 +46519,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" break; } } - + #ifndef POI_SHADOW UNITY_BRANCH if (_DissolveHueShiftEnabled) { - dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed); + dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed, _DissolveHueShiftColorSpace); } #endif - + poiFragData.alpha = lerp(poiFragData.alpha, dissolveToTexture.a, dissolveAlpha * .999999); - + #if !defined(POI_PASS_OUTLINE) && !defined(UNITY_PASS_SHADOWCASTER) poiFragData.baseColor = lerp(poiFragData.baseColor, dissolveToTexture.rgb, dissolveAlpha * .999999); - + if (_DissolveApplyGlobalMaskIndex > 0) { applyToGlobalMask(poiMods, _DissolveApplyGlobalMaskIndex - 1, _DissolveApplyGlobalMaskBlendType, dissolveAlpha * .999999); } if (_DissolveInverseApplyGlobalMaskIndex > 0) { - applyToGlobalMask(poiMods, _DissolveInverseApplyGlobalMaskIndex - 1, _DissolveInverseApplyGlobalMaskBlendType, 1-(dissolveAlpha * .999999)); + applyToGlobalMask(poiMods, _DissolveInverseApplyGlobalMaskIndex - 1, _DissolveInverseApplyGlobalMaskBlendType, 1 - (dissolveAlpha * .999999)); } UNITY_BRANCH if (_DissolveEdgeWidth || (_DissolveType == 2 && _DissolveP2PEdgeLength != 0)) @@ -45479,18 +46549,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" UNITY_BRANCH if (_DissolveEdgeHueShiftEnabled) { - edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed); + edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed, _DissolveEdgeHueShiftColorSpace); } #endif poiFragData.baseColor = lerp(poiFragData.baseColor, edgeColor.rgb, smoothstep(0, 1 - _DissolveEdgeHardness * .99999999999, edgeAlpha)); } - + poiFragData.emission += lerp(0, dissolveToTexture * _DissolveToEmissionStrength, dissolveAlpha) + lerp(0, edgeColor.rgb * _DissolveEdgeEmission, smoothstep(0, 1 - _DissolveEdgeHardness * .99999999999, edgeAlpha)); #endif } #endif //endex - + //ifex _EnableALDecal==0 #ifdef POI_AUDIOLINK #ifdef POI_AL_DECAL @@ -45504,7 +46574,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { colorAndMask.a = customBlend(colorAndMask.a, poiMods.globalMask[_ALDecalGlobalMask-1], _ALDecalGlobalMaskBlendType); } - + float2 uv = poiMesh.uv[_ALDecalUV]; float2 decalCenter = _ALUVPosition; float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed); @@ -45512,10 +46582,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) - _ALUVScale.xz / 2 + _ALUVPosition, _ALUVScale.yw / 2 + _ALUVPosition, float2(0, 0), float2(1, 1)); - + // Mask float4 audioLinkMask = 1.0; - + // UV float2 aluv = uv; if (_ALDecalUVMode == 1) @@ -45524,7 +46594,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" aluv.x = frac(atan2(uvdir.y, uvdir.x) * UNITY_INV_TWO_PI); aluv.y = length(uvdir); } - + // Scale / Offset / Step float maskY = aluv.y; if (_ALDecalUVMode == 1) @@ -45536,29 +46606,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { maskX = remap(maskX, _ALDecaldCircleDimensions.z, _ALDecaldCircleDimensions.w, 0, 1); } - + float maskVolume = _ALDecalVolumeStep != 0.0 ? floor(maskY * _ALDecalVolumeStep) / _ALDecalVolumeStep : maskY; float maskBand = _ALDecalBandStep != 0.0 ? floor(maskX * _ALDecalBandStep) / _ALDecalBandStep : maskX; - + // Copy audioLinkMask.r = maskVolume; audioLinkMask.g = maskBand; - + // Clip audioLinkMask.b = maskVolume < _ALDecalVolumeClipMin || maskVolume > _ALDecalVolumeClipMax ? 0.0 : audioLinkMask.b; audioLinkMask.b = maskBand < _ALDecalBandClipMin || maskBand > _ALDecalBandClipMax ? 0.0 : audioLinkMask.b; - + // Shape Clip if (_ALDecalShapeClip) { float volumeth = _ALDecalShapeClipVolumeWidth; if (_ALDecalVolumeStep != 0.0) audioLinkMask.b = frac(maskY * _ALDecalVolumeStep) > volumeth ? 0.0 : audioLinkMask.b; - + float bandwidth = _ALDecalUVMode == 1 ? _ALDecalShapeClipBandWidth / aluv.y : _ALDecalShapeClipBandWidth; float bandth = 1.0 - bandwidth; if (_ALDecalBandStep != 0.0) audioLinkMask.b = frac(maskX * _ALDecalBandStep + bandth * 0.5) < bandth ? 0.0 : audioLinkMask.b; } - + // AudioLink float2 audioLinkUV = float2(frac(audioLinkMask.g * 2.0), 4.5 / 4.0 + floor(audioLinkMask.g * 2.0) / 4.0); audioLinkUV.y *= 0.0625; @@ -45568,27 +46638,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" audioLinkValue = saturate(audioLinkValue) * audioLinkMask.b; //clip(audioLinkValue - .5); audioLinkValue *= colorAndMask.a; - + if (!poiMods.audioLinkAvailable) { audioLinkValue = 0; } - + float3 alColorChord = _AudioTexture.Sample(sampler_linear_clamp, float2(maskX, 24.5 / 64.0)).rgb; float volumeColorSrc = audioLinkMask.g; if (_ALDecalVolumeColorSource == 1) volumeColorSrc = audioLinkMask.r; if (_ALDecalVolumeColorSource == 2) volumeColorSrc = audioVal; - + float3 lowColor = _ALDecalVolumeColorLow.rgb * poiThemeColor(poiMods, _ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorLowThemeIndex); float3 midColor = _ALDecalVolumeColorMid.rgb * poiThemeColor(poiMods, _ALDecalVolumeColorMid.rgb, _ALDecalVolumeColorMidThemeIndex); float3 highColor = _ALDecalVolumeColorHigh.rgb * poiThemeColor(poiMods, _ALDecalVolumeColorHigh.rgb, _ALDecalVolumeColorHighThemeIndex); - + float3 volumeColor = lerp(lowColor, midColor, saturate(volumeColorSrc * 2)); volumeColor = lerp(volumeColor, highColor, saturate(volumeColorSrc * 2 - 1)); - + float3 emissionColor = lerp(lowColor * _ALDecalLowEmission, midColor * _ALDecalMidEmission, saturate(volumeColorSrc * 2)); emissionColor = lerp(emissionColor, highColor * _ALDecalHighEmission, saturate(volumeColorSrc * 2 - 1)); - + //poiFragData.baseColor = lerp(poiFragData.baseColor, volumeColor, audioLinkValue); #if defined(POI_PASS_BASE) || defined(POI_PASS_ADD) poiFragData.emission += emissionColor * audioLinkValue; @@ -45599,10 +46669,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableFlipbook==0 #ifdef _SUNDISK_HIGH_QUALITY - + void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) { #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED) @@ -45617,14 +46687,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" flipBookMask = maskBlend(flipBookMask, poiMods.globalMask[_FlipbookMaskGlobalMask-1], _FlipbookMaskGlobalMaskBlendType); } float4 flipbookScaleOffset = _FlipbookScaleOffset; - + #ifdef POI_AUDIOLINK if (poiMods.audioLinkAvailable) { flipbookScaleOffset.xy += lerp(_AudioLinkFlipbookScale.xy, _AudioLinkFlipbookScale.zw, poiMods.audioLink[_AudioLinkFlipbookScaleBand]); } #endif - + flipbookScaleOffset.xy = 1 - flipbookScaleOffset.xy; float2 uv = frac(poiMesh.uv[_FlipbookTexArrayUV]); float theta = radians(_FlipbookRotation + _Time.z * _FlipbookRotationSpeed); @@ -45635,7 +46705,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" uv = float2((uv.x - spriteCenter.x) * cs - (uv.y - spriteCenter.y) * sn + spriteCenter.x, (uv.x - spriteCenter.x) * sn + (uv.y - spriteCenter.y) * cs + spriteCenter.y); float4 sideOffset = float4(-(_FlipbookSideOffset.x), _FlipbookSideOffset.y, -(_FlipbookSideOffset.z), _FlipbookSideOffset.w); float2 newUV = remap(uv, float2(0, 0) + flipbookScaleOffset.xy / 2 + flipbookScaleOffset.zw + sideOffset.xz, float2(1, 1) - flipbookScaleOffset.xy / 2 + flipbookScaleOffset.zw + sideOffset.yw, float2(0, 0), float2(1, 1)); - + UNITY_BRANCH if (_FlipbookTiled == 0) { @@ -45649,7 +46719,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float height; float totalFrames; _FlipbookTexArray.GetDimensions(width, height, totalFrames); - + if (_FlipbookStartAndEnd) { totalFrames -= (totalFrames - min(max(_FlipbookStartFrame, _FlipbookEndFrame), totalFrames)); @@ -45687,6 +46757,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame))); + UNITY_BRANCH if (_FlipbookCrossfadeEnabled) { @@ -45698,7 +46769,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % totalFramesCF))); flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame))); } - + UNITY_BRANCH if (_FlipbookIntensityControlsAlpha) { @@ -45713,11 +46784,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex); } - + UNITY_BRANCH if (_FlipbookHueShiftEnabled) { - flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed); + flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed, _FlipbookHueShiftColorSpace); } half flipbookAlpha = 1; #ifdef POI_AUDIOLINK @@ -45726,11 +46797,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" flipbookAlpha += saturate(lerp(_AudioLinkFlipbookAlpha.x, _AudioLinkFlipbookAlpha.y, poiMods.audioLink[_AudioLinkFlipbookAlphaBand])); } #endif - + #if !defined(POI_PASS_OUTLINE) && !defined(UNITY_PASS_SHADOWCASTER) - + poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, flipBookPixel.rgb, _FlipbookBlendType), flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha); - + float flipbookEmissionStrength = _FlipbookEmissionStrength; #ifdef POI_AUDIOLINK if (poiMods.audioLinkAvailable) @@ -45738,11 +46809,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" flipbookEmissionStrength += max(lerp(_AudioLinkFlipbookEmission.x, _AudioLinkFlipbookEmission.y, poiMods.audioLink[_AudioLinkFlipbookEmissionBand]), 0); } #endif - + poiFragData.emission += lerp(0, flipBookPixel.rgb * flipbookEmissionStrength, flipBookPixel.a * _FlipbookColor.a * flipBookMask * flipbookAlpha); - + #endif - + UNITY_BRANCH if (_FlipbookAlphaControlsFinalAlpha) { @@ -45750,10 +46821,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif } - + #endif //endex - + //ifex _EnableMirrorOptions==0 #ifdef POI_MIRROR void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) @@ -45769,7 +46840,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { inMirror = IsInMirror(); } - + #if (defined(POI_PASS_BASE) || defined(POI_PASS_ADD)) #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED) float4 mirrorTexture = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiUV(poiMesh.uv[_MirrorTextureUV], _MirrorTexture_ST), _MirrorTexturePan); @@ -45788,7 +46859,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + // normal correct code from https://github.com/yoship1639/UniToon (MIT) //ifex _NormalCorrect==0 #ifdef POI_NORMALCORRECT @@ -45803,14 +46874,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _VideoEffectsEnable==0 #ifdef POI_VIDEO_EFFECTS float3 applyBacklight(float3 videoTexture, half backlightStrength) { return max(backlightStrength, videoTexture.rgb); } - + float3 applyViewAngleTN(float3 videoTexture, PoiCam poiCam, PoiMesh poiMesh) { float3 reflectionVector = normalize(reflect(poiCam.viewDir.rgb, poiMesh.normals[1].rgb)); @@ -45828,7 +46899,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" videoTexture = (lerp(videoTexture, videoTexture.gbr, sideShift)); return videoTexture; } - + float calculateCRTPixelBrightness(float2 uv) { float totalPixels = _VideoResolution.x * _VideoResolution.y; @@ -45837,7 +46908,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float currentPixelAlpha = currentPixelNumber / totalPixels; half electronBeamAlpha = frac(_Time.y * _VideoCRTRefreshRate); float electronBeamPixelNumber = totalPixels * electronBeamAlpha; - + float DistanceInPixelsFromCurrentElectronBeamPixel = 0; if (electronBeamPixelNumber >= currentPixelNumber) { @@ -45849,10 +46920,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } float CRTFrameTime = 1 / _VideoCRTRefreshRate; float timeSincecurrentPixelWasHitByElectronBeam = (DistanceInPixelsFromCurrentElectronBeamPixel / totalPixels); - + return saturate(_VideoCRTPixelEnergizedTime - timeSincecurrentPixelWasHitByElectronBeam); } - + void applyContrastSettings(inout float3 pixel) { #if !UNITY_COLORSPACE_GAMMA @@ -45863,18 +46934,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" pixel = GammaToLinearSpace(pixel); #endif } - + void applySaturationSettings(inout float3 pixel) { pixel = lerp(pixel.rgb, dot(pixel.rgb, float3(0.3, 0.59, 0.11)), - (_VideoSaturation)); } - + void applyVideoSettings(inout float3 pixel) { applySaturationSettings(pixel); applyContrastSettings(pixel); } - + void calculateLCD(inout float4 videoTexture, float3 pixels) { videoTexture.rgb = applyBacklight(videoTexture, _VideoBacklight * .01); @@ -45915,13 +46986,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" void calculateProjector(inout float4 videoTexture) { applyVideoSettings(videoTexture.rgb); - + float3 projectorColor = videoTexture * _VideoBacklight; videoTexture.r = clamp(projectorColor.r, videoTexture.r, 1000); videoTexture.g = clamp(projectorColor.g, videoTexture.g, 1000); videoTexture.b = clamp(projectorColor.b, videoTexture.b, 1000); } - + void applyVideoEffectsMainTex(inout float4 mainTexture, in PoiMesh poiMesh) { float2 uvs = poiMesh.uv[_MainTexUV]; @@ -45953,7 +47024,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 modifiedVideoTexture = 0; modifiedVideoTexture.rgb = poiFragData.baseColor; modifiedVideoTexture.a = poiFragData.alpha; - + // UNITY_BRANCH // if(_VideoRepeatVideoTexture == 1) // { @@ -45962,41 +47033,41 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // return; // } // } - + switch(_VideoType) { case 0: // LCD - + { calculateLCD(modifiedVideoTexture, pixels); break; } case 1: // TN - + { calculateTN(modifiedVideoTexture, pixels, poiCam, poiMesh); break; } case 2: // CRT - + { calculateCRT(modifiedVideoTexture, pixels, uvs); break; } case 3: // OLED - + { calculateOLED(modifiedVideoTexture, pixels); break; } case 4: // Gameboy - + { calculateGameboy(modifiedVideoTexture); break; } case 5: // Projector - + { calculateProjector(modifiedVideoTexture); break; @@ -46007,7 +47078,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float screenMask = 1; #endif - + poiFragData.baseColor = lerp(poiFragData.baseColor, modifiedVideoTexture, screenMask); // UNITY_BRANCH if (_VideoEmissionEnabled) @@ -46017,18 +47088,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _BacklightEnabled!=1 #ifdef POI_BACKLIGHT void ApplyBacklight(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiCam poiCam, inout PoiMods poiMods) { - + // Color float3 backlightColor = _BacklightColor.rgb; #if defined(PROP_BACKLIGHTCOLORTEX) || !defined(OPTIMIZER_ENABLED) backlightColor *= POI2D_SAMPLER_PAN(_BacklightColorTex, _MainTex, poiUV(poiMesh.uv[_BacklightColorTexUV], _BacklightColorTex_ST), _BacklightColorTexPan).rgb; #endif - + float3 normal = lerp(poiMesh.normals[0], poiMesh.normals[1], _BacklightNormalStrength); // Factor float3 headDir = normalize(getCameraPosition() - poiMesh.worldPos.xyz); @@ -46043,14 +47114,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" backlightLN = poiEdgeLinear(backlightLN, _BacklightBorder, _BacklightBlur); float backlight = saturate(backlightFactor * backlightLN); backlight = !poiMesh.isFrontFace && _BacklightBackfaceMask ? 0.0 : backlight; - + // Blend backlightColor = lerp(backlightColor, backlightColor * poiFragData.baseColor, _BacklightMainStrength); poiLight.finalLightAdd += backlight * backlightColor * poiLight.directColor; } #endif //endex - + //ifex _VoronoiEnabled!=1 #ifdef POI_VORONOI //1/7 @@ -46062,7 +47133,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return glsl_mod((34.0 * x + 1.0) * x, 289.0); } - + float3 inoise(float3 P, float jitter, out float3 randomPoint) { P *= 0.7f; // Scale adjustment @@ -46073,10 +47144,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 px = Permutation(Pi.x + oi); float3 py = Permutation(Pi.y + oi); float3 pz = Permutation(Pi.z + oi); - + float3 p, ox, oy, oz, dx, dy, dz; float3 F = 1e6; - + [unroll(3)] for (int i = 0; i < 3; i++) { @@ -46088,19 +47159,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { p = Permutation(px[i] + py[j] + pz[k] + oi); // pij1, pij2, pij3 float3 ogp = p; - + ox = frac(p * VoronoiK) - VoronoiKo; oy = glsl_mod(floor(p * VoronoiK), 7.0) * VoronoiK - VoronoiKo; - + p = Permutation(p); oz = frac(p * VoronoiK) - VoronoiKo; - + dx = Pf.x - of[i] + jitter * ox; dy = Pf.y - of[j] + jitter * oy; dz = Pf.z - of[k] + jitter * oz; - + float3 d = dx * dx + dy * dy + dz * dz; // dij1, dij2 and dij3, squared - + //Find lowest and second lowest distances for (int n = 0; n < 3; n++) { @@ -46118,17 +47189,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } } - + return F; } - + float voronoi2D(in float2 x, float scale, float2 speed, out float2 randomPoint) { x *= scale; x += speed * _Time.x; float2 n = floor(x); float2 f = frac(x); - + // first pass: regular voronoi float2 mg, mr; float md = 8.0; @@ -46139,10 +47210,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 g = float2(float(i), float(j)); float2 o = random2(n + g); float2 currentPoint = o; - + float2 r = g + o - f; float d = dot(r, r); - + if (d < md) { md = d; @@ -46152,7 +47223,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } } - + // second pass: distance to borders md = 8.0; for (int r = -2; r <= 2; r++) @@ -46161,9 +47232,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { float2 g = mg + float2(float(q), float(r)); float2 o = random2(n + g); - + float2 r = g + o - f; - + if (dot(mr - r, mr - r) > 0.00001) { md = min(md, dot(0.5 * (mr + r), normalize(r - mr))); @@ -46172,14 +47243,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return md; } - + float voronoi3D(in float3 x, float scale, float3 speed, out float3 randomPoint) { x *= scale; x += speed * _Time.x; float3 n = floor(x); float3 f = frac(x); - + // first pass: regular voronoi float3 mg, mr; float md = 8.0; @@ -46192,10 +47263,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 g = float3(float(h), float(i), float(j)); float3 o = random3(n + g); float3 currentPoint = o; - + float3 r = g + o - f; float d = dot(r, r); - + if (d < md) { md = d; @@ -46206,7 +47277,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } } - + // second pass: distance to borders md = 8.0; for (int r = -2; r <= 2; r++) @@ -46217,9 +47288,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { float3 g = mg + float3(float(p), float(q), float(r)); float3 o = random3(n + g); - + float3 r = g + o - f; - + if (dot(mr - r, mr - r) > 0.00001) { md = min(md, dot(0.5 * (mr + r), normalize(r - mr))); @@ -46229,7 +47300,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return md; } - + // fracal sum, range -1.0 - 1.0 float VoronoiNoise_Octaves(float3 p, float scale, float3 speed, int octaveNumber, float octaveScale, float octaveAttenuation, float jitter, float time, out float3 randomPoint) { @@ -46240,15 +47311,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // for (int i = 0; i < octaveNumber; i ++) // { float3 F = inoise(p * freq + time * speed, jitter, randomPoint) * weight; - + sum += sqrt(F[0]); - + // freq *= octaveScale; // weight *= 1.0f - octaveAttenuation; // } return sum; } - + float VoronoiNoiseDiff_Octaves(float3 p, float scale, float3 speed, int octaveNumber, float octaveScale, float octaveAttenuation, float jitter, float time, out float3 randomPoint) { float freq = scale; @@ -46258,26 +47329,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // for (int i = 0; i < octaveNumber; i ++) // { float3 F = inoise(p * freq + time * speed, jitter, randomPoint) * weight; - + sum += sqrt(F[1]) - sqrt(F[0]); - + // freq *= octaveScale; // weight *= 1.0f - octaveAttenuation; // } return sum; } - + void ApplyVoronoi(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) { float voronoiOctaveNumber = 1; float voronoiOctaveScale = 1; float voronoiOctaveAttenuation = 1; float3 randomPoint = 0; - + float voronoi = 0; - + float3 position = 0; - + UNITY_BRANCH if (_VoronoiSpace == 0) { @@ -46298,19 +47369,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float mask = 1; #endif - + if (_VoronoiGlobalMask > 0) { mask = maskBlend(mask, poiMods.globalMask[_VoronoiGlobalMask - 1], _VoronoiGlobalMaskBlendType); } - + #if defined(PROP_VORONOINOISE) || !defined(OPTIMIZER_ENABLED) float edgeNoise = POI2D_SAMPLER_PAN(_VoronoiNoise, _MainTex, poiUV(poiMesh.uv[_VoronoiNoiseUV], _VoronoiNoise_ST), _VoronoiNoisePan)[_VoronoiNoiseChannel]; #else float edgeNoise = 0; #endif edgeNoise *= _VoronoiNoiseIntensity; - + float3 voronoiSpeed = _VoronoiSpeed * 10; #ifdef POI_AUDIOLINK if (poiMods.audioLinkAvailable) @@ -46320,30 +47391,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" position.z += AudioLinkGetChronoTime(_AudioLinkVoronoiChronoSpeedZType, _AudioLinkVoronoiChronoSpeedZBand) * _AudioLinkVoronoiChronoSpeedZSpeed * 0.01; } #endif - + if (_VoronoiType == 0) // Basic - + { voronoi = voronoi2D(position.xy, _VoronoiScale, voronoiSpeed, randomPoint.xy); voronoi *= 1.55; // Range adjustment - + } if (_VoronoiType == 1) // Diff - + { voronoi = VoronoiNoiseDiff_Octaves(position, _VoronoiScale, voronoiSpeed, voronoiOctaveNumber, voronoiOctaveScale, voronoiOctaveAttenuation, 1, _Time.x, randomPoint); } if (_VoronoiType == 2) // Fixed Border - + { voronoi = voronoi3D(position, _VoronoiScale, voronoiSpeed, randomPoint); voronoi *= 1.8; // Range adjustment - + } - + float4 outerColor = _VoronoiOuterColor; float4 innerColor = _VoronoiInnerColor; - + if (_VoronoiEnableRandomCellColor == 1) { float3 rando = random3(randomPoint); @@ -46360,7 +47431,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" voronoiGradient.y -= _AudioLinkVoronoiGradientMaxAdd * poiMods.audioLink[_AudioLinkVoronoiGradientMaxAddBand]; #endif float ramp = smoothstep(voronoiGradient.x, voronoiGradient.y, voronoi); - + if (_VoronoiBlend == 0) { float4 voronoiColor = lerp(outerColor, innerColor, ramp); @@ -46382,28 +47453,28 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + float4 frag(VertexOut i, uint facing : SV_IsFrontFace) : SV_Target { UNITY_SETUP_INSTANCE_ID(i); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); - + PoiMesh poiMesh; PoiInitStruct(PoiMesh, poiMesh); - + PoiLight poiLight; PoiInitStruct(PoiLight, poiLight); - + PoiVertexLights poiVertexLights; PoiInitStruct(PoiVertexLights, poiVertexLights); - + PoiCam poiCam; PoiInitStruct(PoiCam, poiCam); - + PoiMods poiMods; PoiInitStruct(PoiMods, poiMods); poiMods.globalEmission = 1; - + PoiFragData poiFragData; poiFragData.smoothness = 1; poiFragData.smoothness2 = 1; @@ -46415,17 +47486,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.finalColor = float3(0, 0, 0); poiFragData.alpha = 1; poiFragData.toggleVertexLights = 0; - + #ifdef POI_UDIMDISCARD applyUDIMDiscard(i); #endif - + //ifex _NormalCorrect==0 #ifdef POI_NORMALCORRECT applyNormalCorrect(i); #endif //endex - + // Mesh Data //poiMesh.objectPosition = mul(unity_ObjectToWorld, float3(0, 0, 0)).xyz; poiMesh.objectPosition = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz; @@ -46439,7 +47510,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMesh.isFrontFace = facing; poiMesh.dx = ddx(poiMesh.uv[0]); poiMesh.dy = ddy(poiMesh.uv[0]); - + poiMesh.isRightHand = i.tangent.w > 0.0; + #ifndef POI_PASS_OUTLINE if (!poiMesh.isFrontFace && _FlipBackfaceNormals) { @@ -46448,14 +47520,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMesh.binormal[0] *= -1; } #endif - + poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22); float3 tanToWorld0 = float3(poiMesh.tangent[0].x, poiMesh.binormal[0].x, poiMesh.normals[0].x); float3 tanToWorld1 = float3(poiMesh.tangent[0].y, poiMesh.binormal[0].y, poiMesh.normals[0].y); float3 tanToWorld2 = float3(poiMesh.tangent[0].z, poiMesh.binormal[0].z, poiMesh.normals[0].z); float3 ase_tanViewDir = tanToWorld0 * poiCam.viewDir.x + tanToWorld1 * poiCam.viewDir.y + tanToWorld2 * poiCam.viewDir.z; poiCam.tangentViewDir = normalize(ase_tanViewDir); - + // 0-3 UV0-UV3 // 4 Panosphere UV // 5 world pos xz @@ -46474,7 +47546,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMesh.uv[6] = poiMesh.uv[0]; poiMesh.uv[7] = poiMesh.uv[0]; poiMesh.uv[8] = poiMesh.uv[0]; - + poiMesh.uv[4] = calculatePanosphereUV(poiMesh); poiMesh.uv[5] = calculateWorldUV(poiMesh); poiMesh.uv[6] = calculatePolarCoordinate(poiMesh); @@ -46489,7 +47561,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp)); poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5; */ - + //ifex _PoiParallax==0 #ifdef POI_PARALLAX #ifndef POI_PASS_OUTLINE @@ -46499,7 +47571,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + poiMods.globalMask[0] = 1; poiMods.globalMask[1] = 1; poiMods.globalMask[2] = 1; @@ -46531,16 +47603,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" ApplyGlobalMaskOptions(poiMods); } //endex - + float2 mainUV = poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST); - + if (_MainPixelMode) { mainUV = sharpSample(_MainTex_TexelSize, mainUV); } - + float4 mainTexture = POI2D_SAMPLER_PAN_STOCHASTIC(_MainTex, _MainTex, mainUV, _MainTexPan, _MainTexStochastic); - + //ifex _VideoEffectsEnable==0 #ifdef POI_VIDEO_EFFECTS if (_VideoEffectsEnable) @@ -46549,48 +47621,48 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + #if defined(PROP_BUMPMAP) || !defined(OPTIMIZER_ENABLED) poiMesh.tangentSpaceNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN_STOCHASTIC(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV].xy, _BumpMap_ST), _BumpMapPan, _BumpMapStochastic), _BumpScale); #else poiMesh.tangentSpaceNormal = UnpackNormal(float4(0.5, 0.5, 1, 1)); #endif - + //ifex _DetailEnabled==0 #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE) ApplyDetailNormal(poiMods, poiMesh); #endif //endex - + //ifex _RGBMaskEnabled==0 #if defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE) calculateRGBNormals(poiMesh, poiMods); #endif - + //endex - + float3 tangentSpaceNormal = UnpackNormal(float4(0.5, 0.5, 1, 1)); poiMesh.normals[0] = normalize( tangentSpaceNormal.x * poiMesh.tangent[0] + tangentSpaceNormal.y * poiMesh.binormal[0] + tangentSpaceNormal.z * poiMesh.normals[0] ); - + poiMesh.normals[1] = normalize( poiMesh.tangentSpaceNormal.x * poiMesh.tangent[0] + poiMesh.tangentSpaceNormal.y * poiMesh.binormal[0] + poiMesh.tangentSpaceNormal.z * poiMesh.normals[0] ); - + poiMesh.tangent[1] = cross(poiMesh.binormal[0], -poiMesh.normals[1]); poiMesh.binormal[1] = cross(-poiMesh.normals[1], poiMesh.tangent[0]); - + //ifex _EnableOutlines!=1 #ifdef POI_PASS_OUTLINE poiMesh.normals[1] = poiMesh.normals[0]; #endif //endex - + // Camera data poiCam.forwardDir = getCameraForward(); poiCam.worldPos = _WorldSpaceCameraPos; @@ -46610,14 +47682,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif poiCam.posScreenPixels = calcPixelScreenUVs(poiCam.posScreenSpace); poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1])); - + poiCam.worldDirection.xyz = poiMesh.worldPos.xyz - poiCam.worldPos; poiCam.worldDirection.w = dot(poiCam.clipPos, CalculateFrustumCorrection()); - + calculateGlobalThemes(poiMods); - + poiLight.finalLightAdd = 0; - + // Ambient Occlusion #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED) float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan); @@ -46625,12 +47697,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else poiLight.occlusion = 1; #endif - + if (_LightDataAOGlobalMaskR > 0) { poiLight.occlusion = maskBlend(poiLight.occlusion, poiMods.globalMask[_LightDataAOGlobalMaskR - 1], _LightDataAOGlobalMaskBlendTypeR); } - + // Detail Shadows #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED) float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan); @@ -46642,12 +47714,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else poiLight.detailShadow = 1; #endif - + if (_LightDataDetailShadowGlobalMaskR > 0) { poiLight.detailShadow = maskBlend(poiLight.detailShadow, poiMods.globalMask[_LightDataDetailShadowGlobalMaskR - 1], _LightDataDetailShadowGlobalMaskBlendTypeR); } - + // Shadow Masks #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED) float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan); @@ -46659,15 +47731,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { poiLight.shadowMask = maskBlend(poiLight.shadowMask, poiMods.globalMask[_LightDataShadowMaskGlobalMaskR - 1], _LightDataShadowMaskGlobalMaskBlendTypeR); } - + #ifdef UNITY_PASS_FORWARDBASE - + bool lightExists = false; if (any(_LightColor0.rgb >= 0.002)) { lightExists = true; } - + if (_LightingVertexLightingEnabled) { poiFragData.toggleVertexLights = 1; @@ -46676,7 +47748,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { poiFragData.toggleVertexLights = 0; } - + if (_LightingVertexLightingEnabled) { #if defined(VERTEXLIGHT_ON) @@ -46687,34 +47759,34 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" lengthSq += toLightX * toLightX; lengthSq += toLightY * toLightY; lengthSq += toLightZ * toLightZ; - + float4 lightAttenSq = unity_4LightAtten0; float4 atten = 1.0 / (1.0 + lengthSq * lightAttenSq); float4 vLightWeight = saturate(1 - (lengthSq * lightAttenSq / 25)); poiLight.vAttenuation = min(atten, vLightWeight * vLightWeight); - + poiLight.vDotNL = 0; poiLight.vDotNL += toLightX * poiMesh.normals[1].x; poiLight.vDotNL += toLightY * poiMesh.normals[1].y; poiLight.vDotNL += toLightZ * poiMesh.normals[1].z; - + float4 corr = rsqrt(lengthSq); poiLight.vertexVDotNL = max(0, poiLight.vDotNL * corr); - + poiLight.vertexVDotNL = 0; poiLight.vertexVDotNL += toLightX * poiMesh.normals[0].x; poiLight.vertexVDotNL += toLightY * poiMesh.normals[0].y; poiLight.vertexVDotNL += toLightZ * poiMesh.normals[0].z; - + poiLight.vertexVDotNL = max(0, poiLight.vDotNL * corr); - + poiLight.vSaturatedDotNL = saturate(poiLight.vDotNL); - + [unroll] for (int index = 0; index < 4; index++) { poiLight.vPosition[index] = float3(unity_4LightPosX0[index], unity_4LightPosY0[index], unity_4LightPosZ0[index]); - + float3 vertexToLightSource = poiLight.vPosition[index] - poiMesh.worldPos; poiLight.vDirection[index] = normalize(vertexToLightSource); poiLight.vColor[index] = _LightingAdditiveLimited ? MaxLuminance(unity_LightColor[index].rgb * poiLight.vAttenuation[index], _LightingAdditiveLimit) : unity_LightColor[index].rgb * poiLight.vAttenuation[index]; @@ -46723,38 +47795,38 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.vDotNL[index] = dot(poiMesh.normals[1], poiLight.vDirection[index]); poiLight.vCorrectedDotNL[index] = .5 * (poiLight.vDotNL[index] + 1); poiLight.vDotLH[index] = saturate(dot(poiLight.vDirection[index], poiLight.vHalfDir[index])); - + poiLight.vDotNH[index] = dot(poiMesh.normals[1], poiLight.vHalfDir[index]); poiLight.vertexVDotNH[index] = saturate(dot(poiMesh.normals[0], poiLight.vHalfDir[index])); } #endif } - + //UNITY_BRANCH if (_LightingColorMode == 0) // Poi Custom Light Color - + { float3 magic = max(BetterSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)), 0); float3 normalLight = _LightColor0.rgb + BetterSH9(float4(0, 0, 0, 1)); - + float magiLumi = calculateluminance(magic); float normaLumi = calculateluminance(normalLight); float maginormalumi = magiLumi + normaLumi; - + float magiratio = magiLumi / maginormalumi; float normaRatio = normaLumi / maginormalumi; - + float target = calculateluminance(magic * magiratio + normalLight * normaRatio); float3 properLightColor = magic + normalLight; float properLuminance = calculateluminance(magic + normalLight); poiLight.directColor = properLightColor * max(0.0001, (target / properLuminance)); - + poiLight.indirectColor = BetterSH9(float4(lerp(0, poiMesh.normals[1], _LightingIndirectUsesNormals), 1)); } - + //UNITY_BRANCH if (_LightingColorMode == 1) // More standard approach to light color - + { float3 indirectColor = BetterSH9(float4(poiMesh.normals[1], 1)); if (lightExists) @@ -46768,24 +47840,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.indirectColor = indirectColor * 0.5; } } - + if (_LightingColorMode == 2) // UTS style - + { poiLight.indirectColor = saturate(max(half3(0.05, 0.05, 0.05) * _Unlit_Intensity, max(ShadeSH9(half4(0.0, 0.0, 0.0, 1.0)), ShadeSH9(half4(0.0, -1.0, 0.0, 1.0)).rgb) * _Unlit_Intensity)); poiLight.directColor = max(poiLight.indirectColor, _LightColor0.rgb); } - + if (_LightingColorMode == 3) // OpenLit - + { float3 lightDirectionForSH9 = OpenLitLightingDirectionForSH9(); OpenLitShadeSH9ToonDouble(lightDirectionForSH9, poiLight.directColor, poiLight.indirectColor); poiLight.directColor += _LightColor0.rgb; // OpenLit does a few other things by default like clamp direct colour // see https://github.com/lilxyzw/OpenLit/blob/main/Assets/OpenLit/core.hlsl#L174 + } - + float lightMapMode = _LightingMapMode; //UNITY_BRANCH if (_LightingDirectionMode == 0) @@ -46809,23 +47882,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" lightMapMode == 1; } } - + if (_LightingDirectionMode == 3) // UTS - + { float3 defaultLightDirection = normalize(UNITY_MATRIX_V[2].xyz + UNITY_MATRIX_V[1].xyz); float3 lightDirection = normalize(lerp(defaultLightDirection, _WorldSpaceLightPos0.xyz, any(_WorldSpaceLightPos0.xyz))); poiLight.direction = lightDirection; } if (_LightingDirectionMode == 4) // OpenLit - + { poiLight.direction = OpenLitLightingDirection(); // float4 customDir = 0; // Do we want to give users to alter this (OpenLit always does!)? - + } - + if (_LightingDirectionMode == 5) // View Direction - + { float3 upViewDir = normalize(UNITY_MATRIX_V[1].xyz); float3 rightViewDir = normalize(UNITY_MATRIX_V[0].xyz); @@ -46836,12 +47909,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 rotatedViewPitch = RotateAroundAxis(rotatedViewCameraMeshOffset, rotatedViewYaw, pitchOffset_Rads); poiLight.direction = normalize(rotatedViewPitch); } - + if (!any(poiLight.direction)) { poiLight.direction = float3(.4, 1, .4); } - + poiLight.direction = normalize(poiLight.direction); poiLight.attenuationStrength = _LightingCastedShadows; poiLight.attenuation = 1; @@ -46850,7 +47923,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos) poiLight.attenuation *= attenuation; } - + + #if defined(HANDLE_SHADOWS_BLENDING_IN_GI) + half bakedAtten = UnitySampleBakedOcclusion(poiMesh.lightmapUV.xy, poiMesh.worldPos); + float zDist = dot(_WorldSpaceCameraPos - poiMesh.worldPos, UNITY_MATRIX_V[2].xyz); + float fadeDist = UnityComputeShadowFadeDistance(poiMesh.worldPos, zDist); + poiLight.attenuation = UnityMixRealtimeAndBakedShadows(poiLight.attenuation, bakedAtten, UnityComputeShadowFade(fadeDist)); + #endif + if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0) { lightMapMode = 1; @@ -46859,7 +47939,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.direction = normalize(float3(.4, 1, .4)); } } - + poiLight.halfDir = normalize(poiLight.direction + poiCam.viewDir); poiLight.vertexNDotL = dot(poiMesh.normals[0], poiLight.direction); poiLight.nDotL = dot(poiMesh.normals[1], poiLight.direction); @@ -46871,13 +47951,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.vertexNDotH = max(0.00001, dot(poiMesh.normals[0], poiLight.halfDir)); poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir); poiLight.lDotH = max(0.00001, dot(poiLight.direction, poiLight.halfDir)); - + // Poi special light map if (lightMapMode == 0) { float3 ShadeSH9Plus = GetSHLength(); float3 ShadeSH9Minus = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0; - + float3 greyScaleVector = float3(.33333, .33333, .33333); float bw_lightColor = dot(poiLight.directColor, greyScaleVector); float bw_directLighting = (((poiLight.nDotL * 0.5 + 0.5) * bw_lightColor * lerp(1, poiLight.attenuation, poiLight.attenuationStrength)) + dot(ShadeSH9(float4(poiMesh.normals[1], 1)), greyScaleVector)); @@ -46885,7 +47965,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float bw_bottomIndirectLighting = dot(ShadeSH9Minus, greyScaleVector); float bw_topIndirectLighting = dot(ShadeSH9Plus, greyScaleVector); float lightDifference = ((bw_topIndirectLighting + bw_lightColor) - bw_bottomIndirectLighting); - + poiLight.lightMap = smoothstep(0, lightDifference, bw_directLighting - bw_bottomIndirectLighting); poiLight.lightMapNoAttenuation = smoothstep(0, lightDifference, bw_directLightingNoAtten - bw_bottomIndirectLighting); } @@ -46908,10 +47988,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } poiLight.lightMapNoAttenuation *= poiLight.detailShadow; poiLight.lightMap *= poiLight.detailShadow; - + poiLight.directColor = max(poiLight.directColor, 0.0001); poiLight.indirectColor = max(poiLight.indirectColor, 0.0001); - + if (_LightingColorMode == 3) { // OpenLit @@ -46922,50 +48002,50 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.directColor = max(poiLight.directColor, poiLight.directColor * min(10000, (_LightingMinLightBrightness * rcp(calculateluminance(poiLight.directColor))))); poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor * min(10000, (_LightingMinLightBrightness * rcp(calculateluminance(poiLight.indirectColor))))); } - + poiLight.directColor = lerp(poiLight.directColor, dot(poiLight.directColor, float3(0.299, 0.587, 0.114)), _LightingMonochromatic); poiLight.indirectColor = lerp(poiLight.indirectColor, dot(poiLight.indirectColor, float3(0.299, 0.587, 0.114)), _LightingMonochromatic); - + if (_LightingCapEnabled) { poiLight.directColor = min(poiLight.directColor, _LightingCap); poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap); } - + if (_LightingForceColorEnabled) { poiLight.directColor = poiThemeColor(poiMods, _LightingForcedColor, _LightingForcedColorThemeIndex); } - + #ifdef UNITY_PASS_FORWARDBASE poiLight.directColor = max(poiLight.directColor * _PPLightingMultiplier, 0); poiLight.directColor = max(poiLight.directColor + _PPLightingAddition, 0); poiLight.indirectColor = max(poiLight.indirectColor * _PPLightingMultiplier, 0); poiLight.indirectColor = max(poiLight.indirectColor + _PPLightingAddition, 0); #endif - + #endif - + #ifdef POI_PASS_ADD if (!_LightingAdditiveEnable) { return float4(mainTexture.rgb * .0001, 1); } - + #if defined(DIRECTIONAL) if (_DisableDirectionalInAdd) { return float4(mainTexture.rgb * .0001, 1); } #endif - + poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz * _WorldSpaceLightPos0.w); #if defined(POINT) || defined(SPOT) #ifdef POINT unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz; poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r; #endif - + #ifdef SPOT unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)); poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz); @@ -46976,18 +48056,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos); poiLight.attenuationStrength = _LightingAdditiveCastedShadows; - poiLight.directColor = _LightingAdditiveLimited ? MaxLuminance(_LightColor0.rgb * poiLight.attenuation, _LightingAdditiveLimit) : _LightColor0.rgb * poiLight.attenuation; - + poiLight.directColor = _LightingAdditiveLimited ? MaxLuminance(_LightColor0.rgb * poiLight.attenuation, _LightingAdditiveLimit) : _LightColor0.rgb * poiLight.attenuation; + #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE) poiLight.indirectColor = 0; #else poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough); poiLight.indirectColor = _LightingAdditiveLimited ? MaxLuminance(poiLight.indirectColor, _LightingAdditiveLimit) : poiLight.indirectColor; #endif - + poiLight.directColor = lerp(poiLight.directColor, dot(poiLight.directColor, float3(0.299, 0.587, 0.114)), _LightingAdditiveMonochromatic); poiLight.indirectColor = lerp(poiLight.indirectColor, dot(poiLight.indirectColor, float3(0.299, 0.587, 0.114)), _LightingAdditiveMonochromatic); - + poiLight.halfDir = normalize(poiLight.direction + poiCam.viewDir); poiLight.nDotL = dot(poiMesh.normals[1], poiLight.direction); poiLight.nDotLSaturated = saturate(poiLight.nDotL); @@ -46999,7 +48079,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.vertexNDotL = dot(poiMesh.normals[0], poiLight.direction); poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir)); poiLight.vertexNDotH = max(0.00001, dot(poiMesh.normals[0], poiLight.halfDir)); - + // Normalized nDotL if (_LightingMapMode == 0 || _LightingMapMode == 1 || _LightingMapMode == 2) { @@ -47013,7 +48093,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiLight.lightMapNoAttenuation = poiLight.lightMap; poiLight.lightMap *= lerp(1, poiLight.additiveShadow, poiLight.attenuationStrength); #endif - + //ifex _LightDataDebugEnabled==0 if (_LightDataDebugEnabled) { @@ -47081,22 +48161,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif } //endex - + //ifex _EnableAudioLink==0 #ifdef POI_AUDIOLINK SetupAudioLink(poiFragData, poiMods, poiMesh); #endif //endex - + //ifex _BlackLightMaskingEnabled==0 #ifdef POI_BLACKLIGHTMASKING calculateBlackLightMasks(poiMesh, poiMods); #endif //endex - + poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex); poiFragData.alpha = mainTexture.a * _Color.a; - + //ifex _MainColorAdjustToggle==0 #ifdef COLOR_GRADING_HDR #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED) @@ -47104,7 +48184,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float4 hueShiftAlpha = 1; #endif - + if (_MainHueGlobalMask > 0) { hueShiftAlpha.r = maskBlend(hueShiftAlpha.r, poiMods.globalMask[_MainHueGlobalMask - 1], _MainHueGlobalMaskBlendType); @@ -47117,8 +48197,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { hueShiftAlpha.g = maskBlend(hueShiftAlpha.g, poiMods.globalMask[_MainBrightnessGlobalMask - 1], _MainBrightnessGlobalMaskBlendType); } - - if (_MainHueShiftToggle) + + if (_MainHueShiftToggle == 1) { float shift = _MainHueShift; #ifdef POI_AUDIOLINK @@ -47130,18 +48210,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif if (_MainHueShiftReplace) { - poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r); + poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x, _MainHueShiftColorSpace), hueShiftAlpha.r); } else { - poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x))); + poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)), _MainHueShiftColorSpace); } } - + if (_MainGradationStrength && _ColorGradingToggle) { #if !defined(UNITY_COLORSPACE_GAMMA) float3 tempColor = OpenLitLinearToSRGB(poiFragData.baseColor); + #else + float3 tempColor = poiFragData.baseColor; #endif #if defined(PROP_MAINGRADATIONTEX) || !defined(OPTIMIZER_ENABLED) tempColor.r = POI_SAMPLE_1D_X(_MainGradationTex, sampler_linear_clamp, tempColor.r).r; @@ -47155,18 +48237,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif poiFragData.baseColor = lerp(poiFragData.baseColor, tempColor, _MainGradationStrength); } - + poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), - (_Saturation) * hueShiftAlpha.b); poiFragData.baseColor = saturate(lerp(poiFragData.baseColor, poiFragData.baseColor * (_MainBrightness + 1), hueShiftAlpha.g)); #endif //endex - + #if defined(PROP_ALPHAMASK) || !defined(OPTIMIZER_ENABLED) - + if (_MainAlphaMaskMode) { float alphaMask = POI2D_SAMPLER_PAN(_AlphaMask, _MainTex, poiUV(poiMesh.uv[_AlphaMaskUV], _AlphaMask_ST), _AlphaMaskPan.xy).r; - alphaMask = saturate(alphaMask * _AlphaMaskScale + _AlphaMaskValue); + alphaMask = saturate(alphaMask * _AlphaMaskBlendStrength + (_AlphaMaskInvert ?_AlphaMaskValue * -1 : _AlphaMaskValue)); if (_AlphaMaskInvert) alphaMask = 1 - alphaMask; if (_MainAlphaMaskMode == 1) poiFragData.alpha = alphaMask; if (_MainAlphaMaskMode == 2) poiFragData.alpha = poiFragData.alpha * alphaMask; @@ -47174,7 +48256,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (_MainAlphaMaskMode == 4) poiFragData.alpha = saturate(poiFragData.alpha - alphaMask); } #endif - + //ifex _VideoEffectsEnable==0 #ifdef POI_VIDEO_EFFECTS if (_VideoEffectsEnable) @@ -47183,19 +48265,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods); - + //ifex _MainVertexColoringEnabled==0 applyVertexColor(poiFragData, poiMesh); //endex - + //ifex _EnableDissolve==0 #ifdef DISTORT applyDissolve(poiFragData, poiMesh, poiMods, poiCam, poiLight); #endif //endex - + //ifex _ShadingEnabled==0 #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED) #ifndef POI_PASS_OUTLINE @@ -47205,7 +48287,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _ShadingEnabled==0 #ifdef VIGNETTE_MASKED #ifdef POI_PASS_OUTLINE @@ -47235,18 +48317,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { applyToGlobalMask(poiMods, _ShadingRampedLightMapInverseApplyGlobalMaskIndex - 1, _ShadingRampedLightMapInverseApplyGlobalMaskBlendType, 1 - poiLight.rampedLightMap); } - + poiLight.directLuminance = dot(poiLight.directColor, float3(0.299, 0.587, 0.114)); poiLight.indirectLuminance = dot(poiLight.directColor, float3(0.299, 0.587, 0.114)); poiLight.finalLuminance = dot(poiLight.finalLighting, float3(0.299, 0.587, 0.114)); //endex - + //ifex _EnableOutlines!=1 #ifdef POI_PASS_OUTLINE applyOutlineColor(poiFragData, poiMesh, poiLight, poiMods, poiCam); #endif //endex - + //ifex _EnableALDecal==0 #ifdef POI_AUDIOLINK #ifdef POI_AL_DECAL @@ -47254,73 +48336,73 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableFlipbook==0 #ifdef _SUNDISK_HIGH_QUALITY applyFlipbook(poiFragData, poiMesh, poiMods); #endif //endex - + //ifex _EnableMirrorOptions==0 #ifdef POI_MIRROR applyMirror(poiFragData, poiMesh, poiMods); #endif //endex - + //ifex _VoronoiEnabled!=1 #ifdef POI_VORONOI ApplyVoronoi(poiFragData, poiMesh, poiMods); #endif //endex - + UNITY_BRANCH if (_AlphaPremultiply) { poiFragData.baseColor *= saturate(poiFragData.alpha); } poiFragData.finalColor = poiFragData.baseColor; - + poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting; - + //ifex _BacklightEnabled!=1 #ifdef POI_BACKLIGHT ApplyBacklight(poiFragData, poiMesh, poiLight, poiCam, poiMods); #endif //endex - + //UNITY_BRANCH if (_IgnoreFog == 0) { UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor); } - + poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha; - + //ifex _AlphaToCoverage==0 && isNotAnimated(_AlphaToCoverage) ApplyAlphaToCoverage(poiFragData, poiMesh); //endex - + //ifex _AlphaDithering==0 && isNotAnimated(_AlphaDithering) applyDithering(poiFragData, poiCam); //endex - + if (_Mode == POI_MODE_OPAQUE) { poiFragData.alpha = 1; } - + //ifex _BSSEnabled!=1 #ifdef POIBS_ENABLE poiFragData.finalColor += poiFragData.emission * poiMods.globalEmission; poiFragData.alpha = poiFragData.alpha * poiFragData.emission.z; poiFragData.emission = 0; - + //ifex _BSSBloomfog!=1 #ifdef POIBS_BLOOMFOG float3 fogDistance = i.worldPos + - _WorldSpaceCameraPos; float4 fogCol = -float4(poiFragData.finalColor, 1) + tex2D(_BloomPrePassTexture, i.fogCoord.xy); fogCol.a = -poiFragData.alpha; - + #ifdef BSSBLOOMFOGTYPE_HEIGHT poiFragData.finalColor = poiFragData.finalColor + (((GetHeightFogIntensity(i.worldPos, _FogHeightOffset, _FogHeightScale) * GetFogIntensity(fogDistance, _FogStartOffset, _FogScale)) + 1) * fogCol.rgb); poiFragData.alpha = poiFragData.alpha + (((GetHeightFogIntensity(i.worldPos, _FogHeightOffset, _FogHeightScale) * GetFogIntensity(fogDistance, _FogStartOffset, _FogScale)) + 1) * fogCol.a); @@ -47332,21 +48414,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex #endif //endex - + clip(poiFragData.alpha - _Cutoff); - + return float4(poiFragData.finalColor + poiFragData.emission * poiMods.globalEmission, poiFragData.alpha) + POI_SAFE_RGB0; } - + ENDCG } //endex - + Pass { Name "ShadowCaster" Tags { "LightMode" = "ShadowCaster" } - + Stencil { Ref [_StencilRef] @@ -47358,30 +48440,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" Fail [_StencilFailOp] ZFail [_StencilZFailOp] //endex - + //ifex _StencilType==0 CompBack [_StencilBackCompareFunction] PassBack [_StencilBackPassOp] FailBack [_StencilBackFailOp] ZFailBack [_StencilBackZFailOp] - + CompFront [_StencilFrontCompareFunction] PassFront [_StencilFrontPassOp] FailFront [_StencilFrontFailOp] ZFailFront [_StencilFrontZFailOp] //endex } - + ZWrite [_ZWrite] Cull [_Cull] AlphaToMask Off ZTest [_ZTest] ColorMask [_ColorMask] Offset [_OffsetFactor], [_OffsetUnits] - + BlendOp [_BlendOp], [_BlendOpAlpha] Blend [_SrcBlend] [_DstBlend], [_SrcBlendAlpha] [_DstBlendAlpha] - + CGPROGRAM /* // Disable warnings we aren't interested in @@ -47396,80 +48478,80 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex 0==0 #pragma skip_optimizations d3d11 //endex - + #pragma shader_feature_local _STOCHASTICMODE_DELIOT_HEITZ _STOCHASTICMODE_HEXTILE _STOCHASTICMODE_NONE - + //ifex _MainColorAdjustToggle==0 #pragma shader_feature COLOR_GRADING_HDR //endex - + //#pragma shader_feature KEYWORD - + #pragma skip_variants LIGHTMAP_ON DYNAMICLIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK DIRLIGHTMAP_COMBINED _MIXED_LIGHTING_SUBTRACTIVE #pragma skip_variants DECALS_OFF DECALS_3RT DECALS_4RT DECAL_SURFACE_GRADIENT _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 #pragma skip_variants _ADDITIONAL_LIGHT_SHADOWS #pragma skip_variants PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 #pragma skip_variants _SCREEN_SPACE_OCCLUSION - + //ifex _GlobalMaskTexturesEnable==0 #pragma shader_feature_local POI_GLOBALMASK_TEXTURES //endex - + //ifex _EnableUDIMDiscardOptions==0 #pragma shader_feature_local POI_UDIMDISCARD //endex - + //ifex _EnableDistortion==0 #pragma shader_feature USER_LUT //endex - + //ifex _PoiParallax==0 #pragma shader_feature_local POI_PARALLAX //endex - + //ifex _EnableAudioLink==0 #pragma shader_feature_local POI_AUDIOLINK //endex - + //ifex _BlackLightMaskingEnabled==0 #pragma shader_feature_local POI_BLACKLIGHTMASKING //endex - + //ifex _DetailEnabled==0 #pragma shader_feature FINALPASS //endex - + //ifex _VertexManipulationsEnabled==0 #pragma shader_feature AUTO_EXPOSURE //endex - + //ifex _VertexGlitchingEnabled==0 #pragma shader_feature_local POI_VERTEX_GLITCHING #pragma shader_feature_local POI_VERTEX_GLITCHING_TEXTURE //endex - + //ifex _EnableDepthBulge==0 #pragma shader_feature_local POI_DEPTHBULGE //endex - + //ifex _BackFaceEnabled!=1 #pragma shader_feature_local POI_BACKFACE //endex - + //ifex _RGBMaskEnabled==0 #pragma shader_feature VIGNETTE #pragma shader_feature GEOM_TYPE_MESH //endex - + //ifex _LTCGIEnabled!=1 #pragma shader_feature_local POI_LTCGI //endex - + //ifex _ShadingEnabled==0 #pragma shader_feature_local VIGNETTE_MASKED #pragma shader_feature_local _LIGHTINGMODE_TEXTURERAMP _LIGHTINGMODE_MULTILAYER_MATH _LIGHTINGMODE_SHADEMAP _LIGHTINGMODE_REALISTIC _LIGHTINGMODE_WRAPPED _LIGHTINGMODE_SKIN _LIGHTINGMODE_FLAT _LIGHTINGMODE_CLOTH _LIGHTINGMODE_SDF //endex - + //ifex _DecalEnabled==0 #pragma shader_feature GEOM_TYPE_BRANCH //endex @@ -47482,15 +48564,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _DecalEnabled3==0 #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW //endex - + //ifex _EnableDissolve==0 #pragma shader_feature DISTORT //endex - + //ifex _EnableAniso==0 #pragma shader_feature_local POI_ANISOTROPICS //endex - + //ifex _MatcapEnable==0 #pragma shader_feature_local POI_MATCAP0 #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL @@ -47507,23 +48589,23 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #pragma shader_feature_local POI_MATCAP3 #pragma shader_feature_local POI_MATCAP3_CUSTOM_NORMAL //endex - + //ifex _CubeMapEnabled==0 #pragma shader_feature_local _CUBEMAP //endex - + //ifex _EnableALDecal==0 #pragma shader_feature_local POI_AL_DECAL //endex - + //ifex _EnableVolumeColor==0 #pragma shader_feature_local POI_AL_VOLUMECOLOR //endex - + //ifex _EnableFlipbook==0 #pragma shader_feature _SUNDISK_HIGH_QUALITY //endex - + //ifex _EnableEmission==0 #pragma shader_feature _EMISSION //endex @@ -47536,7 +48618,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _EnableEmission3==0 #pragma shader_feature_local POI_EMISSION_3 //endex - + //ifex _EnableRimLighting==0 #pragma shader_feature_local _GLOSSYREFLECTIONS_OFF #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2 _RIMSTYLE_LILTOON @@ -47545,70 +48627,70 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #pragma shader_feature_local POI_RIM2 #pragma shader_feature_local _RIM2STYLE_POIYOMI _RIM2STYLE_UTS2 _RIM2STYLE_LILTOON //endex - + //ifex _EnableDepthRimLighting==0 #pragma shader_feature_local _POI_DEPTH_RIMLIGHT //endex - + //ifex _GlitterEnable==0 #pragma shader_feature _SUNDISK_SIMPLE //endex - + //ifex _SubsurfaceScattering==0 #pragma shader_feature_local POI_SUBSURFACESCATTERING //endex - + //ifex _MochieBRDF==0 #pragma shader_feature_local MOCHIE_PBR //endex //ifex _ClearCoatBRDF==0 #pragma shader_feature_local POI_CLEARCOAT //endex - + //ifex _EnableEnvironmentalRim==0 #pragma shader_feature_local POI_ENVIRORIM //endex - + //ifex _StylizedSpecular==0 #pragma shader_feature_local POI_STYLIZED_StylizedSpecular //endex - + //ifex _EnablePathing==0 #pragma shader_feature_local POI_PATHING //endex - + //ifex _EnableMirrorOptions==0 #pragma shader_feature_local POI_MIRROR //endex - + //ifex _EnableTouchGlow==0 #pragma shader_feature GRAIN //endex - + //ifex _TextEnabled==0 #pragma shader_feature EFFECT_BUMP //endex - + //ifex _PostProcess==0 #pragma shader_feature_local POSTPROCESS //endex - + //ifex _PoiInternalParallax==0 #pragma shader_feature_local POI_INTERNALPARALLAX //endex - + //ifex _NormalCorrect==0 #pragma shader_feature_local POI_NORMALCORRECT //endex - + //ifex _VideoEffectsEnable==0 #pragma shader_feature_local POI_VIDEO_EFFECTS //endex - + //ifex _BacklightEnabled!=1 #pragma shader_feature_local POI_BACKLIGHT //endex - + //ifex _BSSEnabled!=1 #pragma shader_feature_local POIBS_ENABLE //ifex _BSSBloomfog!=1 @@ -47616,17 +48698,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #pragma shader_feature_local BSSBLOOMFOGTYPE_HEIGHT //endex //endex - + //ifex _VoronoiEnabled!=1 #pragma shader_feature_local POI_VORONOI //endex - + #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 #pragma multi_compile_instancing #pragma multi_compile_shadowcaster #pragma multi_compile_fog #define POI_PASS_SHADOW - + // UNITY Includes #include "UnityCG.cginc" #include "UnityStandardUtils.cginc" @@ -47637,16 +48719,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #include "UnityMetaPass.cginc" #endif #pragma vertex vert - + #pragma fragment frag - + #define DielectricSpec float4(0.04, 0.04, 0.04, 1.0 - 0.04) #define PI float(3.14159265359) #define Epsilon float(1e-10) - + #define POI2D_SAMPLE_TEX2D_SAMPLERGRAD(tex, samplertex, coord, dx, dy) tex.SampleGrad(sampler##samplertex, coord, dx, dy) #define POI2D_SAMPLE_TEX2D_SAMPLERGRADD(tex, samp, uv, pan, dx, dy) tex.SampleGrad(samp, POI_PAN_UV(uv, pan), dx, dy) - + #define POI_PAN_UV(uv, pan) (uv + _Time.x * pan) #define POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, POI_PAN_UV(uv, pan))) #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, dx, dy) (POI2D_SAMPLE_TEX2D_SAMPLERGRAD(tex, texSampler, POI_PAN_UV(uv, pan), dx, dy)) @@ -47659,29 +48741,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv)) #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, POI_PAN_UV(uv, pan))) #define POI_SAMPLE_CUBE_LOD(tex, samp, uv, lod) texCUBElod(tex, float4(uv, 0, lod)) - + #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED) #define POI_SAMPLE_SCREEN(tex, samp, uv) tex.Sample(samp, float3(uv, unity_StereoEyeIndex)) #else #define POI_SAMPLE_SCREEN(tex, samp, uv) tex.Sample(samp, uv) #endif - + // When using, properties won't properly lock at optimize time; needs macro evaluation implemented // #define POI2D_MAINTEX_SAMPLER_PAN_INLINED(tex, poiMesh) (POI2D_SAMPLER_PAN(tex, _MainTex, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Pan)) - + #define POI_SAFE_RGB0 float4(mainTexture.rgb * .0001, 0) #define POI_SAFE_RGB1 float4(mainTexture.rgb * .0001, 1) #define POI_SAFE_RGBA mainTexture - + #if defined(UNITY_COMPILER_HLSL) #define PoiInitStruct(type, name) name = (type)0; #else #define PoiInitStruct(type, name) #endif - + #define POI_ERROR(poiMesh, gridSize) lerp(float3(1, 0, 1), float3(0, 0, 0), fmod(floor((poiMesh.worldPos.x) * gridSize) + floor((poiMesh.worldPos.y) * gridSize) + floor((poiMesh.worldPos.z) * gridSize), 2) == 0) #define POI_NAN (asfloat(-1)) - + #define POI_MODE_OPAQUE 0 #define POI_MODE_CUTOUT 1 #define POI_MODE_FADE 2 @@ -47691,17 +48773,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define POI_MODE_MULTIPLICATIVE 6 #define POI_MODE_2XMULTIPLICATIVE 7 #define POI_MODE_TRANSCLIPPING 9 - + /* Texture2D ; float4 _ST; float2 Pan; float UV; float Stochastic; - + [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )] */ - + //ifex _EnableAudioLink==0 #ifdef POI_AUDIOLINK // Map of where features in AudioLink are. @@ -47734,7 +48816,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define ALPASS_FILTEREDVU uint2(24, 28) //Size: 4, 4 #define ALPASS_FILTEREDVU_INTENSITY uint2(24, 28) //Size: 4, 1 #define ALPASS_FILTEREDVU_MARKER uint2(24, 29) //Size: 4, 1 - + // Some basic constants to use (Note, these should be compatible with // future version of AudioLink, but may change. #define AUDIOLINK_SAMPHIST 3069 // Internal use for algos, do not change. @@ -47753,7 +48835,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define AUDIOLINK_DELAY_COEFFICIENT_MAX 0.9 #define AUDIOLINK_DFT_Q 4.0 #define AUDIOLINK_TREBLE_CORRECTION 5.0 - + // ColorChord constants #define COLORCHORD_EMAXBIN 192 #define COLORCHORD_IIR_DECAY_1 0.90 @@ -47763,13 +48845,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define COLORCHORD_NOTE_CLOSEST 3.0 #define COLORCHORD_NEW_NOTE_GAIN 8.0 #define COLORCHORD_MAX_NOTES 10 - + uniform float4 _AudioTexture_TexelSize; - + #ifdef SHADER_TARGET_SURFACE_ANALYSIS #define AUDIOLINK_STANDARD_INDEXING #endif - + // Mechanism to index into texture. #ifdef AUDIOLINK_STANDARD_INDEXING sampler2D _AudioTexture; @@ -47783,22 +48865,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" uniform float4 _Stored_TexelSize; #endif //endex - + float _GrabMode; float _Mode; - + float _StochasticDeliotHeitzDensity; float _StochasticHexGridDensity; float _StochasticHexRotationStrength; float _StochasticHexFallOffContrast; float _StochasticHexFallOffPower; - + float _IgnoreFog; float _RenderingReduceClipDistance; int _FlipBackfaceNormals; float _AddBlendOp; float _Cull; - + float4 _Color; float _ColorThemeIndex; UNITY_DECLARE_TEX2D(_MainTex); @@ -47824,7 +48906,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaMaskUV; float _AlphaMaskInvert; float _MainAlphaMaskMode; - float _AlphaMaskScale; + float _AlphaMaskBlendStrength; float _AlphaMaskValue; #endif float _Cutoff; @@ -47837,25 +48919,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _MainColorAdjustTexture_ST; float2 _MainColorAdjustTexturePan; float _MainColorAdjustTextureUV; + float _MainHueShiftColorSpace; float _MainHueShiftToggle; float _MainHueShiftReplace; float _MainHueShift; float _MainHueShiftSpeed; float _Saturation; float _MainBrightness; - + float _MainHueALCTEnabled; float _MainALHueShiftBand; float _MainALHueShiftCTIndex; float _MainHueALMotionSpeed; - + float _MainHueGlobalMask; float _MainHueGlobalMaskBlendType; float _MainSaturationGlobalMask; float _MainSaturationGlobalMaskBlendType; float _MainBrightnessGlobalMask; float _MainBrightnessGlobalMaskBlendType; - + #if defined(PROP_MAINGRADATIONTEX) || !defined(OPTIMIZER_ENABLED) Texture2D _MainGradationTex; #endif @@ -47863,11 +48946,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _MainGradationStrength; #endif //endex - + SamplerState sampler_linear_clamp; SamplerState sampler_linear_repeat; SamplerState sampler_trilinear_repeat; - + float _AlphaForceOpaque; float _AlphaMod; float _AlphaPremultiply; @@ -47877,13 +48960,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaSharpenedA2C; float _AlphaMipScale; //endex - + //ifex _AlphaDithering==0 && isNotAnimated(_AlphaDithering) float _AlphaDithering; float _AlphaDitherGradient; float _AlphaDitherBias; //endex - + //ifex _AlphaDistanceFade==0 && isNotAnimated(_AlphaDistanceFade) float _AlphaDistanceFade; float _AlphaDistanceFadeType; @@ -47894,7 +48977,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaDistanceFadeGlobalMask; float _AlphaDistanceFadeGlobalMaskBlendType; //endex - + //ifex _AlphaFresnel==0 && isNotAnimated(_AlphaFresnel) float _AlphaFresnel; float _AlphaFresnelAlpha; @@ -47904,7 +48987,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaFresnelGlobalMask; float _AlphaFresnelGlobalMaskBlendType; //endex - + //ifex _AlphaAngular==0 && isNotAnimated(_AlphaAngular) float _AlphaAngular; float _AngleType; @@ -47918,16 +49001,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AlphaAngularGlobalMask; float _AlphaAngularGlobalMaskBlendType; //endex - + //ifex _AlphaAudioLinkEnabled==0 && isNotAnimated(_AlphaAudioLinkEnabled) float _AlphaAudioLinkEnabled; float2 _AlphaAudioLinkAddRange; float _AlphaAudioLinkAddBand; //endex - + float _AlphaGlobalMask; float _AlphaGlobalMaskBlendType; - + //ifex _GlobalMaskTexturesEnable==0 #ifdef POI_GLOBALMASK_TEXTURES #if defined(PROP_GLOBALMASKTEXTURE0) || !defined(OPTIMIZER_ENABLED) @@ -47943,7 +49026,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _GlobalMaskTexture0SplitPan_B; float4 _GlobalMaskTexture0SplitTilingOffset_A; float4 _GlobalMaskTexture0SplitPan_A; - + #if defined(PROP_GLOBALMASKTEXTURE1) || !defined(OPTIMIZER_ENABLED) Texture2D _GlobalMaskTexture1; #endif @@ -47957,7 +49040,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _GlobalMaskTexture1SplitPan_B; float4 _GlobalMaskTexture1SplitTilingOffset_A; float4 _GlobalMaskTexture1SplitPan_A; - + #if defined(PROP_GLOBALMASKTEXTURE2) || !defined(OPTIMIZER_ENABLED) Texture2D _GlobalMaskTexture2; #endif @@ -47971,7 +49054,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _GlobalMaskTexture2SplitPan_B; float4 _GlobalMaskTexture2SplitTilingOffset_A; float4 _GlobalMaskTexture2SplitPan_A; - + #if defined(PROP_GLOBALMASKTEXTURE3) || !defined(OPTIMIZER_ENABLED) Texture2D _GlobalMaskTexture3; #endif @@ -47990,7 +49073,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _GlobalMaskOptionsEnable==0 float _GlobalMaskOptionsEnable; int _GlobalMaskOptionsType; - + //ifex _GlobalMaskOptionsType!=0 float _GlobalMaskSlider_0; float _GlobalMaskSlider_1; @@ -48009,7 +49092,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskSlider_14; float _GlobalMaskSlider_15; //endex - + //ifex _GlobalMaskOptionsType!=1 float2 _GlobalMaskMinMaxSlider_0; float2 _GlobalMaskMinMaxSlider_1; @@ -48028,7 +49111,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _GlobalMaskMinMaxSlider_14; float2 _GlobalMaskMinMaxSlider_15; //endex - + //ifex _GlobalMaskOptionsType!=2 int _GlobalMaskToggleOn_0; int _GlobalMaskToggleOff_0; @@ -48083,7 +49166,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskBackface_14; float _GlobalMaskBackface_15; //endex - + //ifex _GlobalMaskModifiersMirrorEnable==0 float _GlobalMaskModifiersMirrorEnable; float _GlobalMaskMirrorVisibilityMode; @@ -48104,7 +49187,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskMirror_14; float _GlobalMaskMirror_15; //endex - + //ifex _GlobalMaskModifiersCameraEnable==0 float _GlobalMaskModifiersCameraEnable; float _GlobalMaskCamera_0; @@ -48124,10 +49207,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskCamera_14; float _GlobalMaskCamera_15; //endex - + //ifex _GlobalMaskModifiersDistanceEnable==0 int _GlobalMaskModifiersDistanceEnable; - + //ifex _GlobalMaskDistanceEnable_0==0 int _GlobalMaskDistanceEnable_0; int _GlobalMaskDistanceType_0; @@ -48137,7 +49220,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_0; int _GlobalMaskDistanceBlendType_0; //endex - + //ifex _GlobalMaskDistanceEnable_1==0 int _GlobalMaskDistanceEnable_1; int _GlobalMaskDistanceType_1; @@ -48147,7 +49230,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_1; int _GlobalMaskDistanceBlendType_1; //endex - + //ifex _GlobalMaskDistanceEnable_2==0 int _GlobalMaskDistanceEnable_2; int _GlobalMaskDistanceType_2; @@ -48157,7 +49240,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_2; int _GlobalMaskDistanceBlendType_2; //endex - + //ifex _GlobalMaskDistanceEnable_3==0 int _GlobalMaskDistanceEnable_3; int _GlobalMaskDistanceType_3; @@ -48167,7 +49250,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_3; int _GlobalMaskDistanceBlendType_3; //endex - + //ifex _GlobalMaskDistanceEnable_4==0 int _GlobalMaskDistanceEnable_4; int _GlobalMaskDistanceType_4; @@ -48177,7 +49260,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_4; int _GlobalMaskDistanceBlendType_4; //endex - + //ifex _GlobalMaskDistanceEnable_5==0 int _GlobalMaskDistanceEnable_5; int _GlobalMaskDistanceType_5; @@ -48187,7 +49270,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_5; int _GlobalMaskDistanceBlendType_5; //endex - + //ifex _GlobalMaskDistanceEnable_6==0 int _GlobalMaskDistanceEnable_6; int _GlobalMaskDistanceType_6; @@ -48197,7 +49280,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_6; int _GlobalMaskDistanceBlendType_6; //endex - + //ifex _GlobalMaskDistanceEnable_7==0 int _GlobalMaskDistanceEnable_7; int _GlobalMaskDistanceType_7; @@ -48207,7 +49290,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_7; int _GlobalMaskDistanceBlendType_7; //endex - + //ifex _GlobalMaskDistanceEnable_8==0 int _GlobalMaskDistanceEnable_8; int _GlobalMaskDistanceType_8; @@ -48217,7 +49300,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_8; int _GlobalMaskDistanceBlendType_8; //endex - + //ifex _GlobalMaskDistanceEnable_9==0 int _GlobalMaskDistanceEnable_9; int _GlobalMaskDistanceType_9; @@ -48227,7 +49310,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_9; int _GlobalMaskDistanceBlendType_9; //endex - + //ifex _GlobalMaskDistanceEnable_10==0 int _GlobalMaskDistanceEnable_10; int _GlobalMaskDistanceType_10; @@ -48237,7 +49320,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_10; int _GlobalMaskDistanceBlendType_10; //endex - + //ifex _GlobalMaskDistanceEnable_11==0 int _GlobalMaskDistanceEnable_11; int _GlobalMaskDistanceType_11; @@ -48247,7 +49330,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_11; int _GlobalMaskDistanceBlendType_11; //endex - + //ifex _GlobalMaskDistanceEnable_12==0 int _GlobalMaskDistanceEnable_12; int _GlobalMaskDistanceType_12; @@ -48257,7 +49340,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_12; int _GlobalMaskDistanceBlendType_12; //endex - + //ifex _GlobalMaskDistanceEnable_13==0 int _GlobalMaskDistanceEnable_13; int _GlobalMaskDistanceType_13; @@ -48267,7 +49350,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_13; int _GlobalMaskDistanceBlendType_13; //endex - + //ifex _GlobalMaskDistanceEnable_14==0 int _GlobalMaskDistanceEnable_14; int _GlobalMaskDistanceType_14; @@ -48277,7 +49360,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _GlobalMaskDistanceMaxAlpha_14; int _GlobalMaskDistanceBlendType_14; //endex - + //ifex _GlobalMaskDistanceEnable_15==0 int _GlobalMaskDistanceEnable_15; int _GlobalMaskDistanceType_15; @@ -48288,7 +49371,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _GlobalMaskDistanceBlendType_15; //endex //endex - + int _GlobalMaskVertexColorLinearSpace; //ifex _GlobalMaskVertexColorRed==0 int _GlobalMaskVertexColorRed; @@ -48306,7 +49389,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _GlobalMaskVertexColorAlpha; int _GlobalMaskVertexColorAlphaBlendType; //endex - + //ifex _EnableUDIMDiscardOptions==0 #ifdef POI_UDIMDISCARD float _UDIMDiscardMode; @@ -48329,7 +49412,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _UDIMDiscardRow0_3; #endif //endex - + //ifex _EnableDistortion==0 #ifdef USER_LUT #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED) @@ -48338,14 +49421,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _DistortionFlowTexturePan; float _DistortionFlowTextureUV; #endif - + #if defined(PROP_DISTORTIONFLOWTEXTURE1) || !defined(OPTIMIZER_ENABLED) Texture2D _DistortionFlowTexture1; float4 _DistortionFlowTexture1_ST; float2 _DistortionFlowTexture1Pan; float _DistortionFlowTexture1UV; #endif - + #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _DistortionMask; float4 _DistortionMask_ST; @@ -48353,11 +49436,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DistortionMaskUV; float _DistortionMaskChannel; #endif - + float _DistortionUvToDistort; float _DistortionStrength; float _DistortionStrength1; - + #ifdef POI_AUDIOLINK half _EnableDistortionAudioLink; half2 _DistortionStrengthAudioLink; @@ -48374,20 +49457,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _PolarLengthScale; float _PolarSpiralPower; float _PanoUseBothEyes; - + float _UVModWorldPos0; float _UVModWorldPos1; float _UVModLocalPos0; float _UVModLocalPos1; - + //ifex _PoiParallax==0 #ifdef POI_PARALLAX - + sampler2D _HeightMap; float4 _HeightMap_ST; float2 _HeightMapPan; float _HeightMapUV; - + #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _Heightmask; float4 _Heightmask_ST; @@ -48397,29 +49480,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _HeightmaskInvert; SamplerState _linear_repeat; #endif - + float _ParallaxUV; float _HeightStrength; float _HeightOffset; float _HeightStepsMin; float _HeightStepsMax; - + float _CurvatureU; float _CurvatureV; float _CurvFix; #endif //endex - + //ifex _EnableAudioLink==0 #ifdef POI_AUDIOLINK float _AudioLinkDelay; float _AudioLinkAnimToggle; - + float _AudioLinkSmoothingBass; float _AudioLinkSmoothingLowMid; float _AudioLinkSmoothingHighMid; float _AudioLinkSmoothingTreble; - + float _DebugWaveform; float _DebugDFT; float _DebugBass; @@ -48432,36 +49515,36 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DebugAutocorrelator; float _DebugChronotensity; float _AudioLinkCCStripY; - + float _AudioLinkBandOverridesEnabled; float4 _AudioLinkBandOverrideSliders; #endif //endex - + //ifex _BlackLightMaskingEnabled==0 #ifdef POI_BLACKLIGHTMASKING float _BlackLightMasking0Key; float2 _BlackLightMasking0Range; float _BlackLightMasking0GlobalMaskIndex; float _BlackLightMasking0GlobalMaskBlendType; - + float _BlackLightMasking1Key; float2 _BlackLightMasking1Range; float _BlackLightMasking1GlobalMaskIndex; float _BlackLightMasking1GlobalMaskBlendType; - + float _BlackLightMasking2Key; float2 _BlackLightMasking2Range; float _BlackLightMasking2GlobalMaskIndex; float _BlackLightMasking2GlobalMaskBlendType; - + float _BlackLightMasking3Key; float2 _BlackLightMasking3Range; float _BlackLightMasking3GlobalMaskIndex; float _BlackLightMasking3GlobalMaskBlendType; #endif //endex - + //ifex _VertexManipulationsEnabled==0 #ifdef AUTO_EXPOSURE float4 _VertexManipulationLocalTranslation; @@ -48479,16 +49562,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VertexRoundingEnabled; int _VertexRoundingSpace; float _VertexRoundingDivision; - + //AL float _VertexAudioLinkEnabled; float3 _VertexLocalTranslationALMin; float3 _VertexLocalTranslationALMax; float _VertexLocalTranslationALBand; - + float3 _VertexLocalRotationAL; float _VertexLocalRotationALBand; - + float3 _VertexLocalRotationCTALSpeed; float _VertexLocalRotationCTALBandX; float _VertexLocalRotationCTALBandY; @@ -48496,39 +49579,39 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VertexLocalRotationCTALTypeX; float _VertexLocalRotationCTALTypeY; float _VertexLocalRotationCTALTypeZ; - + float4 _VertexLocalScaleALMin; float4 _VertexLocalScaleALMax; float _VertexLocalScaleALBand; - + float3 _VertexWorldTranslationALMin; float3 _VertexWorldTranslationALMax; float _VertexWorldTranslationALBand; - + float2 _VertexManipulationHeightAL; float _VertexManipulationHeightBand; - + float2 _VertexRoundingRangeAL; float _VertexRoundingRangeBand; - + float _VertexBarrelMode; float _VertexBarrelWidth; float _VertexBarrelAlpha; float _VertexBarrelHeight; - + float _VertexSphereMode; float _VertexSphereRadius; float _VertexSphereHeight; float _VertexSphereAlpha; float4 _VertexSphereCenter; - + float _VertexTornadoMode; float _VertexTornadoRadius; float _VertexTornadoSpeed; float _VertexTornadoIntensity; float _VertexTornadoBaseHeight; float _VertexTornadoTopHeight; - + float _VertexSpectrumMotion; float3 _VertexSpectrumOffsetMin; float3 _VertexSpectrumOffsetMax; @@ -48536,7 +49619,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VertexSpectrumUVDirection; #endif //endex - + //ifex _VertexGlitchingEnabled==0 #ifdef POI_VERTEX_GLITCHING //Vertex Glitching @@ -48549,24 +49632,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VertexGlitchFrequency; float _VertexGlitchStrength; float _VertexGlitchDensity; - + float _VertexGlitchMirrorEnable; float _VertexGlitchMirror; - + float _VertexGlitchMapPanSpeed; float _VertexGlitchingAudioLinkEnabled; float _VertexGlitchingAudioLinkBand; float _VertexGlitchingAudiolinkOverride; #endif //endex - + //ifex _MainVertexColoringEnabled==0 float _MainVertexColoringEnabled; float _MainVertexColoringLinearSpace; float _MainVertexColoring; float _MainUseVertexColorAlpha; //endex - + //ifex _BackFaceEnabled!=1 #ifdef POI_BACKFACE float _BackFaceEnabled; @@ -48576,14 +49659,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _BackFaceColor; float _BackFaceColorThemeIndex; float _BackFaceReplaceAlpha; - + #if defined(PROP_BACKFACETEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _BackFaceTexture; #endif float4 _BackFaceTexture_ST; float2 _BackFaceTexturePan; float _BackFaceTextureUV; - + #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _BackFaceMask; #endif @@ -48591,16 +49674,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 _BackFaceMaskPan; float _BackFaceMaskUV; float _BackFaceMaskChannel; - + float _BackFaceHueShiftEnabled; float _BackFaceHueShift; + float _BackFaceShiftColorSpace; float _BackFaceHueShiftSpeed; float _BackFaceEmissionLimiter; #endif - + //TODO detail strength stuff //endex - + //ifex _EnableDissolve==0 #ifdef DISTORT float _DissolveType; @@ -48614,35 +49698,35 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _DissolveTextureColor; float _DissolveEdgeColorThemeIndex; float _DissolveTextureColorThemeIndex; - + #if defined(PROP_DISSOLVETOTEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _DissolveToTexture; #endif float4 _DissolveToTexture_ST; float2 _DissolveToTexturePan; float _DissolveToTextureUV; - + #if defined(PROP_DISSOLVENOISETEXTURE) || !defined(OPTIMIZER_ENABLED) Texture2D _DissolveNoiseTexture; #endif float4 _DissolveNoiseTexture_ST; float2 _DissolveNoiseTexturePan; float _DissolveNoiseTextureUV; - + #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED) Texture2D _DissolveDetailNoise; #endif float4 _DissolveDetailNoise_ST; float2 _DissolveDetailNoisePan; float _DissolveDetailNoiseUV; - + #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _DissolveMask; #endif float4 _DissolveMask_ST; float2 _DissolveMaskPan; float _DissolveMaskUV; - + float _DissolveMaskGlobalMask; float _DissolveMaskGlobalMaskBlendType; float _DissolveApplyGlobalMaskIndex; @@ -48658,27 +49742,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DissolveInvertNoise; float _DissolveInvertDetailNoise; float _DissolveToEmissionStrength; - + // Point to Point float _DissolveP2PWorldLocal; float _DissolveP2PEdgeLength; float _DissolveP2PClamp; float4 _DissolveStartPoint; float4 _DissolveEndPoint; - + // Spherical float3 _SphericalDissolveCenter; float _SphericalDissolveRadius; float _SphericalDissolveInvert; float _SphericalDissolveClamp; - + // CenterOut float _CenterOutDissolveMode; float3 _CenterOutDissolveDirection; float _CenterOutDissolveInvert; float _CenterOutDissolveNormals; float _CenterOutDissolvePower; - + // World Dissolve float _DissolveWorldShape; float4 _DissolveShapePosition; @@ -48686,12 +49770,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DissolveShapeScale; float _DissolveInvertShape; float _DissolveShapeEdgeLength; - + // UV Tile Dissolve float _UVTileDissolveEnabled; float _UVTileDissolveDiscardAtMax; float _UVTileDissolveUV; - + float _UVTileDissolveAlpha_Row3_0; float _UVTileDissolveAlpha_Row3_1; float _UVTileDissolveAlpha_Row3_2; @@ -48708,7 +49792,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _UVTileDissolveAlpha_Row0_1; float _UVTileDissolveAlpha_Row0_2; float _UVTileDissolveAlpha_Row0_3; - + float _DissolveAlpha0; float _DissolveAlpha1; float _DissolveAlpha2; @@ -48723,19 +49807,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DissolveEmissionSide; float _DissolveEmission1Side; float _DissolveUseVertexColors; - + float4 edgeColor; float edgeAlpha; float dissolveAlpha; float4 dissolveToTexture; - + + float _DissolveHueShiftColorSpace; + float _DissolveEdgeHueShiftColorSpace; float _DissolveHueShiftEnabled; float _DissolveHueShiftSpeed; float _DissolveHueShift; float _DissolveEdgeHueShiftEnabled; float _DissolveEdgeHueShiftSpeed; float _DissolveEdgeHueShift; - + // Audio Link #ifdef POI_AUDIOLINK fixed _EnableDissolveAudioLink; @@ -48746,7 +49832,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableALDecal==0 #ifdef POI_AUDIOLINK #ifdef POI_AL_DECAL @@ -48756,28 +49842,28 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _ALUVRotation; float _ALUVRotationSpeed; float4 _ALDecaldCircleDimensions; - + float _ALDecalUVMode; - + float _ALDecalVolumeStep; float _ALDecalVolumeClipMin; float _ALDecalVolumeClipMax; - + float _ALDecalBandStep; float _ALDecalBandClipMin; float _ALDecalBandClipMax; - + float _ALDecalShapeClip; float _ALDecalShapeClipVolumeWidth; float _ALDecalShapeClipBandWidth; - + #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED) Texture2D _ALDecalColorMask; float4 _ALDecalColorMask_ST; float2 _ALDecalColorMaskPan; float _ALDecalColorMaskUV; #endif - + float _ALDecalVolume; float _ALDecalBaseBoost; float _ALDecalTrebleBoost; @@ -48800,13 +49886,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableFlipbook==0 #ifdef _SUNDISK_HIGH_QUALITY - + UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray); float4 _FlipbookTexArray_ST; - + float4 _FlipbookColor; float _FlipbookColorThemeIndex; float _FlipbookFPS; @@ -48834,7 +49920,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _FlipbookMultiply; float _FlipbookAdd; float _FlipbookBlendType; - + #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED) Texture2D _FlipbookMask; #endif @@ -48844,21 +49930,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _FlipbookMaskChannel; float _FlipbookMaskGlobalMask; float _FlipbookMaskGlobalMaskBlendType; - + // anim float _FlipbookMovementType; float4 _FlipbookStartEndOffset; float _FlipbookMovementSpeed; - + // Crossfade float _FlipbookCrossfadeEnabled; float2 _FlipbookCrossfadeRange; - + // Hueshift float _FlipbookHueShiftEnabled; + float _FlipbookHueShiftColorSpace; float _FlipbookHueShiftSpeed; float _FlipbookHueShift; - + #ifdef POI_AUDIOLINK float _FlipbookChronotensityEnabled; float _FlipbookChronotensityBand; @@ -48875,7 +49962,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableMirrorOptions==0 #ifdef POI_MIRROR float _VisibilityMode; @@ -48899,7 +49986,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VisibilityVRCCameraScreenshot; #endif //endex - + //ifex _EnableTouchGlow==0 #ifdef GRAIN #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED) @@ -48911,7 +49998,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DepthMaskChannel; float _DepthMaskGlobalMask; float _DepthMaskGlobalMaskBlendType; - + // Color float _DepthColorToggle; float _DepthColorBlendMode; @@ -48921,7 +50008,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 _DepthTexture_ST; float2 _DepthTexturePan; float _DepthTextureUV; - + float3 _DepthColor; float _DepthColorThemeIndex; float _DepthColorMinDepth; @@ -48929,9 +50016,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DepthColorMinValue; float _DepthColorMaxValue; float _DepthEmissionStrength; - + // Emission - + // Alpha float _DepthAlphaToggle; float _DepthAlphaMinValue; @@ -48940,14 +50027,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _DepthAlphaMaxDepth; #endif //endex - + //ifex _NormalCorrect==0 #ifdef POI_NORMALCORRECT float _NormalCorrectAmount; float3 _NormalCorrectOrigin; #endif //endex - + //ifex _VideoEffectsEnable==0 #ifdef POI_VIDEO_EFFECTS float _VideoEffectsEnable; @@ -48963,7 +50050,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VideoMaskTextureUV; float _VideoMaskTextureChannel; #endif - + float _VideoType; float2 _VideoResolution; sampler2D _VideoGameboyRamp; @@ -48973,13 +50060,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _VideoRepeatVideoTexture; float _VideoPixelateToResolution; float2 _VideoMaskPanning; - + float _VideoSaturation; float _VideoContrast; float _VideoEmissionEnabled; #endif //endex - + //ifex _BacklightEnabled!=1 #ifdef POI_BACKLIGHT float4 _BacklightColor; @@ -48999,7 +50086,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _BacklightBackfaceMask; #endif //endex - + //ifex _BSSEnabled!=1 #ifdef POIBS_ENABLE float _CustomColors; @@ -49009,10 +50096,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _FogScale; float _FogHeightOffset; float _FogHeightScale; - + uniform float2 _CustomFogTextureToScreenRatio; uniform float _StereoCameraEyeOffset; - + uniform float _CustomFogOffset; uniform float _CustomFogAttenuation; uniform float _CustomFogHeightFogStartY; @@ -49022,7 +50109,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex #endif //endex - + //ifex _VoronoiEnabled!=1 #ifdef POI_VORONOI #if defined(PROP_VORONOIMASK) || !defined(OPTIMIZER_ENABLED) @@ -49057,18 +50144,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int _VoronoiAffectsMaterialAlpha; float _VoronoiGlobalMask; float _VoronoiGlobalMaskBlendType; - + // AudioLink int _AudioLinkVoronoiInnerEmissionBand; float2 _AudioLinkVoronoiInnerEmission; int _AudioLinkVoronoiOuterEmissionBand; float2 _AudioLinkVoronoiOuterEmission; - + int _AudioLinkVoronoiGradientMinAddBand; float _AudioLinkVoronoiGradientMinAdd; int _AudioLinkVoronoiGradientMaxAddBand; float _AudioLinkVoronoiGradientMaxAdd; - + int _AudioLinkVoronoiChronoSpeedXType; int _AudioLinkVoronoiChronoSpeedXBand; float _AudioLinkVoronoiChronoSpeedXSpeed; @@ -49080,7 +50167,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float _AudioLinkVoronoiChronoSpeedZSpeed; #endif //endex - + struct appdata { float4 vertex : POSITION; @@ -49093,9 +50180,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 uv3 : TEXCOORD3; uint vertexId : SV_VertexID; UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO }; - + struct VertexOut { float4 pos : SV_POSITION; @@ -49108,14 +50194,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 lightmapUV : TEXCOORD7; float2 fogCoord: TEXCOORD10; UNITY_SHADOW_COORDS(11) - + UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; - + struct PoiMesh { - + // 0 Vertex normal // 1 Fragment normal float3 normals[2]; @@ -49138,8 +50224,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 parallaxUV; float2 dx; float2 dy; + uint isRightHand; }; - + struct PoiCam { float3 viewDir; @@ -49156,9 +50243,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 screenUV; float vDotN; float4 worldDirection; - + }; - + struct PoiMods { float4 Mask; @@ -49173,10 +50260,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float globalMask[16]; float ALTime[8]; }; - + struct PoiLight { - + float3 direction; float attenuation; float attenuationStrength; @@ -49209,7 +50296,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float directLuminance; float indirectLuminance; float finalLuminance; - + #if defined(VERTEXLIGHT_ON) // Non Important Lights float4 vDotNL; @@ -49226,17 +50313,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" half4 vertexVDotNH; half4 vDotLH; #endif - + }; - + struct PoiVertexLights { - + float3 direction; float3 color; float attenuation; }; - + struct PoiFragData { float smoothness; @@ -49244,34 +50331,34 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float metallic; float specularMask; float reflectionMask; - + float3 baseColor; float3 finalColor; float alpha; float3 emission; float toggleVertexLights; }; - + float4 poiTransformClipSpacetoScreenSpaceFrag(float4 clipPos) { float4 positionSS = float4(clipPos.xyz * clipPos.w, clipPos.w); positionSS.xy = positionSS.xy / _ScreenParams.xy; return positionSS; } - + // glsl_mod behaves better on negative numbers, and // in some situations actually outperforms HLSL's fmod() #ifndef glsl_mod #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y)))) #endif - + uniform float random_uniform_float_only_used_to_stop_compiler_warnings = 0.0f; - + float2 poiUV(float2 uv, float4 tex_st) { return uv * tex_st.xy + tex_st.zw; } - + float2 vertexUV(in VertexOut o, int index) { switch(index) @@ -49288,7 +50375,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return o.uv[0].xy; } } - + float2 vertexUV(in appdata v, int index) { switch(index) @@ -49305,67 +50392,67 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return v.uv0.xy; } } - + //Lighting Helpers float calculateluminance(float3 color) { return color.r * 0.299 + color.g * 0.587 + color.b * 0.114; } - + // Set by VRChat (as of open beta 1245) // _VRChatCameraMode: 0 => Normal, 1 => VR HandCam, 2 => Desktop Handcam, 3 => Screenshot/Photo // _VRChatMirrorMode: 0 => Normal, 1 => Mirror (VR), 2 => Mirror (Deskie) float _VRChatCameraMode; float _VRChatMirrorMode; - + float VRCCameraMode() { return _VRChatCameraMode; } - + float VRCMirrorMode() { return _VRChatMirrorMode; } - + bool IsInMirror() { return unity_CameraProjection[2][0] != 0.f || unity_CameraProjection[2][1] != 0.f; } - + bool IsOrthographicCamera() { return unity_OrthoParams.w == 1 || UNITY_MATRIX_P[3][3] == 1; } - + float shEvaluateDiffuseL1Geomerics_local(float L0, float3 L1, float3 n) { // average energy float R0 = max(0, L0); - + // avg direction of incoming light float3 R1 = 0.5f * L1; - + // directional brightness float lenR1 = length(R1); - + // linear angle between normal and direction 0-1 //float q = 0.5f * (1.0f + dot(R1 / lenR1, n)); //float q = dot(R1 / lenR1, n) * 0.5 + 0.5; float q = dot(normalize(R1), n) * 0.5 + 0.5; q = saturate(q); // Thanks to ScruffyRuffles for the bug identity. - + // power for q // lerps from 1 (linear) to 3 (cubic) based on directionality float p = 1.0f + 2.0f * lenR1 / R0; - + // dynamic range constant // should vary between 4 (highly directional) and 0 (ambient) float a = (1.0f - lenR1 / R0) / (1.0f + lenR1 / R0); - + return R0 * (a + (1.0f - a) * (p + 1.0f) * pow(q, p)); } - + half3 BetterSH9(half4 normal) { float3 indirect; @@ -49377,9 +50464,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" indirect += SHEvalLinearL2(normal); return indirect; } - + // Silent's code ends here - + float3 getCameraForward() { #if UNITY_SINGLE_PASS_STEREO @@ -49391,7 +50478,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif return normalize(p2 - p1); } - + half3 GetSHLength() { half3 x, x1; @@ -49403,7 +50490,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" x1.b = length(unity_SHBb); return x + x1; } - + float3 BoxProjection(float3 direction, float3 position, float4 cubemapPosition, float3 boxMin, float3 boxMax) { #if UNITY_SPECCUBE_BOX_PROJECTION @@ -49417,22 +50504,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif return direction; } - + float poiMax(float2 i) { return max(i.x, i.y); } - + float poiMax(float3 i) { return max(max(i.x, i.y), i.z); } - + float poiMax(float4 i) { return max(max(max(i.x, i.y), i.z), i.w); } - + float3 calculateNormal(in float3 baseNormal, in PoiMesh poiMesh, in Texture2D normalTexture, in float4 normal_ST, in float2 normalPan, in float normalUV, in float normalIntensity) { float3 normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(normalTexture, _MainTex, poiUV(poiMesh.uv[normalUV], normal_ST), normalPan), normalIntensity); @@ -49442,42 +50529,42 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" normal.z * baseNormal ); } - + float remap(float x, float minOld, float maxOld, float minNew = 0, float maxNew = 1) { return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); } - + float2 remap(float2 x, float2 minOld, float2 maxOld, float2 minNew = 0, float2 maxNew = 1) { return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); } - + float3 remap(float3 x, float3 minOld, float3 maxOld, float3 minNew = 0, float3 maxNew = 1) { return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); } - + float4 remap(float4 x, float4 minOld, float4 maxOld, float4 minNew = 0, float4 maxNew = 1) { return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld); } - + float remapClamped(float minOld, float maxOld, float x, float minNew = 0, float maxNew = 1) { return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); } - + float2 remapClamped(float2 minOld, float2 maxOld, float2 x, float2 minNew, float2 maxNew) { return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); } - + float3 remapClamped(float3 minOld, float3 maxOld, float3 x, float3 minNew, float3 maxNew) { return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); } - + float4 remapClamped(float4 minOld, float4 maxOld, float4 x, float4 minNew, float4 maxNew) { return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew); @@ -49486,7 +50573,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return ((height * - 1) + 1) * (poiCam.tangentViewDir.xy / poiCam.tangentViewDir.z); } - + /* 0: Zero float4(0.0, 0.0, 0.0, 0.0), 1: One float4(1.0, 1.0, 1.0, 1.0), @@ -49500,7 +50587,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 9: SrcAlphaSaturate saturate(sourceColor.aaaa), 10: OneMinusSrcAlpha float4(1.0, 1.0, 1.0, 1.0) - sourceColor.aaaa, */ - + float4 poiBlend(const float sourceFactor, const float4 sourceColor, const float destinationFactor, const float4 destinationColor, const float4 blendFactor) { float4 sA = 1 - blendFactor; @@ -49517,10 +50604,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" saturate(sourceColor.aaaa), 1 - sA, }; - + return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA); } - + // Average float blendAverage(float base, float blend) { @@ -49530,40 +50617,40 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return (base + blend) / 2.0; } - + // Color burn float blendColorBurn(float base, float blend) { return (blend == 0.0) ? blend : max((1.0 - ((1.0 - base) * rcp(random_uniform_float_only_used_to_stop_compiler_warnings + blend))), 0.0); } - + float3 blendColorBurn(float3 base, float3 blend) { return float3(blendColorBurn(base.r, blend.r), blendColorBurn(base.g, blend.g), blendColorBurn(base.b, blend.b)); } - + // Color Dodge float blendColorDodge(float base, float blend) { return (blend == 1.0) ? blend : min(base / (1.0 - blend), 1.0); } - + float3 blendColorDodge(float3 base, float3 blend) { return float3(blendColorDodge(base.r, blend.r), blendColorDodge(base.g, blend.g), blendColorDodge(base.b, blend.b)); } - + // Darken float blendDarken(float base, float blend) { return min(blend, base); } - + float3 blendDarken(float3 base, float3 blend) { return float3(blendDarken(base.r, blend.r), blendDarken(base.g, blend.g), blendDarken(base.b, blend.b)); } - + // Exclusion float blendExclusion(float base, float blend) { @@ -49573,18 +50660,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return base + blend - 2.0 * base * blend; } - + // Reflect float blendReflect(float base, float blend) { return (blend == 1.0) ? blend : min(base * base / (1.0 - blend), 1.0); } - + float3 blendReflect(float3 base, float3 blend) { return float3(blendReflect(base.r, blend.r), blendReflect(base.g, blend.g), blendReflect(base.b, blend.b)); } - + // Glow float blendGlow(float base, float blend) { @@ -49594,18 +50681,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return blendReflect(blend, base); } - + // Overlay float blendOverlay(float base, float blend) { return base < 0.5 ? (2.0 * base * blend) : (1.0 - 2.0 * (1.0 - base) * (1.0 - blend)); } - + float3 blendOverlay(float3 base, float3 blend) { return float3(blendOverlay(base.r, blend.r), blendOverlay(base.g, blend.g), blendOverlay(base.b, blend.b)); } - + // Hard Light float blendHardLight(float base, float blend) { @@ -49615,77 +50702,77 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return blendOverlay(blend, base); } - + // Vivid light float blendVividLight(float base, float blend) { return (blend < 0.5) ? blendColorBurn(base, (2.0 * blend)) : blendColorDodge(base, (2.0 * (blend - 0.5))); } - + float3 blendVividLight(float3 base, float3 blend) { return float3(blendVividLight(base.r, blend.r), blendVividLight(base.g, blend.g), blendVividLight(base.b, blend.b)); } - + // Hard mix float blendHardMix(float base, float blend) { return (blendVividLight(base, blend) < 0.5) ? 0.0 : 1.0; } - + float3 blendHardMix(float3 base, float3 blend) { return float3(blendHardMix(base.r, blend.r), blendHardMix(base.g, blend.g), blendHardMix(base.b, blend.b)); } - + // Lighten float blendLighten(float base, float blend) { return max(blend, base); } - + float3 blendLighten(float3 base, float3 blend) { return float3(blendLighten(base.r, blend.r), blendLighten(base.g, blend.g), blendLighten(base.b, blend.b)); } - + // Linear Burn float blendLinearBurn(float base, float blend) { // Note : Same implementation as BlendSubtractf return max(base + blend - 1.0, 0.0); } - + float3 blendLinearBurn(float3 base, float3 blend) { // Note : Same implementation as BlendSubtract return max(base + blend - float3(1.0, 1.0, 1.0), float3(0.0, 0.0, 0.0)); } - + // Linear Dodge float blendLinearDodge(float base, float blend) { // Note : Same implementation as BlendAddf return min(base + blend, 1.0); } - + float3 blendLinearDodge(float3 base, float3 blend) { // Note : Same implementation as BlendAdd return base + blend; } - + // Linear light float blendLinearLight(float base, float blend) { return blend < 0.5 ? blendLinearBurn(base, (2.0 * blend)) : blendLinearDodge(base, (2.0 * (blend - 0.5))); } - + float3 blendLinearLight(float3 base, float3 blend) { return float3(blendLinearLight(base.r, blend.r), blendLinearLight(base.g, blend.g), blendLinearLight(base.b, blend.b)); } - + // Multiply float blendMultiply(float base, float blend) { @@ -49695,7 +50782,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return base * blend; } - + // Negation float blendNegation(float base, float blend) { @@ -49705,7 +50792,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend); } - + // Normal float blendNormal(float base, float blend) { @@ -49715,7 +50802,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return blend; } - + // Phoenix float blendPhoenix(float base, float blend) { @@ -49725,83 +50812,83 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return min(base, blend) - max(base, blend) + float3(1.0, 1.0, 1.0); } - + // Pin light float blendPinLight(float base, float blend) { return (blend < 0.5) ? blendDarken(base, (2.0 * blend)) : blendLighten(base, (2.0 * (blend - 0.5))); } - + float3 blendPinLight(float3 base, float3 blend) { return float3(blendPinLight(base.r, blend.r), blendPinLight(base.g, blend.g), blendPinLight(base.b, blend.b)); } - + // Screen float blendScreen(float base, float blend) { return 1.0 - ((1.0 - base) * (1.0 - blend)); } - + float3 blendScreen(float3 base, float3 blend) { return float3(blendScreen(base.r, blend.r), blendScreen(base.g, blend.g), blendScreen(base.b, blend.b)); } - + // Soft Light float blendSoftLight(float base, float blend) { return (blend < 0.5) ? (2.0 * base * blend + base * base * (1.0 - 2.0 * blend)) : (sqrt(base) * (2.0 * blend - 1.0) + 2.0 * base * (1.0 - blend)); } - + float3 blendSoftLight(float3 base, float3 blend) { return float3(blendSoftLight(base.r, blend.r), blendSoftLight(base.g, blend.g), blendSoftLight(base.b, blend.b)); } - + // Subtract float blendSubtract(float base, float blend) { return max(base - blend, 0.0); } - + float3 blendSubtract(float3 base, float3 blend) { return max(base - blend, 0.0); } - + // Difference float blendDifference(float base, float blend) { return abs(base - blend); } - + float3 blendDifference(float3 base, float3 blend) { return abs(base - blend); } - + // Divide float blendDivide(float base, float blend) { return base / max(blend, 0.0001); } - + float3 blendDivide(float3 base, float3 blend) { return base / max(blend, 0.0001); } - + float blendMixed(float base, float blend) { return base + base * blend; } - + float3 blendMixed(float3 base, float3 blend) { return base + base * blend; } - + float3 customBlend(float3 base, float3 blend, float blendType, float alpha = 1) { float3 output = base; @@ -49820,7 +50907,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return output; } - + float3 customBlend(float base, float blend, float blendType, float alpha = 1) { float3 output = base; @@ -49838,7 +50925,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return output; } - + #define REPLACE 0 #define SUBSTRACT 1 #define MULTIPLY 2 @@ -49847,7 +50934,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define MAX 5 #define AVERAGE 6 #define ADD 7 - + float maskBlend(float baseMask, float blendMask, float blendType) { float output = 0; @@ -49864,7 +50951,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return saturate(output); } - + float globalMaskBlend(float baseMask, float globalMaskIndex, float blendType, PoiMods poiMods) { if (globalMaskIndex == 0) @@ -49876,27 +50963,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return maskBlend(baseMask, poiMods.globalMask[globalMaskIndex - 1], blendType); } } - + float random(float2 p) { return frac(sin(dot(p, float2(12.9898, 78.2383))) * 43758.5453123); } - + float2 random2(float2 p) { return frac(sin(float2(dot(p, float2(127.1, 311.7)), dot(p, float2(269.5, 183.3)))) * 43758.5453); } - + float3 random3(float2 p) { return frac(sin(float3(dot(p, float2(127.1, 311.7)), dot(p, float2(269.5, 183.3)), dot(p, float2(248.3, 315.9)))) * 43758.5453); } - + float3 random3(float3 p) { return frac(sin(float3(dot(p, float3(127.1, 311.7, 248.6)), dot(p, float3(269.5, 183.3, 423.3)), dot(p, float3(248.3, 315.9, 184.2)))) * 43758.5453); } - + float3 randomFloat3(float2 Seed, float maximum) { return (.5 + float3( @@ -49905,7 +50992,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453) ) * .5) * (maximum); } - + float3 randomFloat3Range(float2 Seed, float Range) { return (float3( @@ -49914,7 +51001,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453) ) * 2 - 1) * Range; } - + float3 randomFloat3WiggleRange(float2 Seed, float Range, float wiggleSpeed, float timeOffset) { float3 rando = (float3( @@ -49925,7 +51012,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float speed = 1 + wiggleSpeed; return float3(sin(((_Time.x + timeOffset) + rando.x * PI) * speed), sin(((_Time.x + timeOffset) + rando.y * PI) * speed), sin(((_Time.x + timeOffset) + rando.z * PI) * speed)) * Range; } - + void poiDither(float4 In, float4 ScreenPosition, out float4 Out) { float2 uv = ScreenPosition.xy * _ScreenParams.xy; @@ -49946,7 +51033,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" static const float HCLmaxL = 0.530454533953517; // == exp(HCLgamma / HCLy0) - 0.5 static const float3 wref = float3(1.0, 1.0, 1.0); #define TAU 6.28318531 - + float3 HUEtoRGB(in float H) { float R = abs(H * 6 - 3) - 1; @@ -49954,7 +51041,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float B = 2 - abs(H * 6 - 4); return saturate(float3(R, G, B)); } - + float3 RGBtoHCV(in float3 RGB) { // Based on work by Sam Hocevar and Emil Persson @@ -49964,27 +51051,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float H = abs((Q.w - Q.y) / (6 * C + Epsilon) + Q.z); return float3(H, C, Q.x); } - - float3 HSVtoRGB(in float3 HSV) - { - float3 RGB = HUEtoRGB(HSV.x); - return ((RGB - 1) * HSV.y + 1) * HSV.z; + + float3 RGBtoHSV(float3 c){ + float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); + float4 p = lerp(float4(c.bg, K.wz), float4(c.gb, K.xy), step(c.b, c.g)); + float4 q = lerp(float4(p.xyw, c.r), float4(c.r, p.yzx), step(p.x, c.r)); + + float d = q.x - min(q.w, q.y); + float e = 1.0e-10; + return float3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); } - - float3 RGBtoHSV(in float3 RGB) - { - float3 HCV = RGBtoHCV(RGB); - float S = HCV.y / (HCV.z + Epsilon); - return float3(HCV.x, S, HCV.z); + + float3 HSVtoRGB(float3 c){ + float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); + float3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www); + return c.z * lerp(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); } - + float3 HSLtoRGB(in float3 HSL) { float3 RGB = HUEtoRGB(HSL.x); float C = (1 - abs(2 * HSL.z - 1)) * HSL.y; return (RGB - 0.5) * C + HSL.z; } - + float3 RGBtoHSL(in float3 RGB) { float3 HCV = RGBtoHCV(RGB); @@ -49992,24 +51082,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon); return float3(HCV.x, S, L); } - + void DecomposeHDRColor(in float3 linearColorHDR, out float3 baseLinearColor, out float exposure) { // Optimization/adaptation of https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/GUI/ColorMutator.cs#L23 but skips weird photoshop stuff float maxColorComponent = max(linearColorHDR.r, max(linearColorHDR.g, linearColorHDR.b)); bool isSDR = maxColorComponent <= 1.0; - + float scaleFactor = isSDR ? 1.0 : (1.0 / maxColorComponent); exposure = isSDR ? 0.0 : log(maxColorComponent) * 1.44269504089; // ln(2) - + baseLinearColor = scaleFactor * linearColorHDR; } - + float3 ApplyHDRExposure(float3 linearColor, float exposure) { return linearColor * pow(2, exposure); } - + // Transforms an RGB color using a matrix. Note that S and V are absolute values here float3 ModifyViaHSV(float3 color, float h, float s, float v) { @@ -50019,12 +51109,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" colorHSV.z = saturate(colorHSV.z + v); return HSVtoRGB(colorHSV); } - + float3 ModifyViaHSV(float3 color, float3 HSVMod) { return ModifyViaHSV(color, HSVMod.x, HSVMod.y, HSVMod.z); } - + float4x4 brightnessMatrix(float brightness) { return float4x4( @@ -50034,11 +51124,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" brightness, brightness, brightness, 1 ); } - + float4x4 contrastMatrix(float contrast) { float t = (1.0 - contrast) / 2.0; - + return float4x4( contrast, 0, 0, 0, 0, contrast, 0, 0, @@ -50046,22 +51136,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" t, t, t, 1 ); } - + float4x4 saturationMatrix(float saturation) { float3 luminance = float3(0.3086, 0.6094, 0.0820); - + float oneMinusSat = 1.0 - saturation; - + float3 red = luminance.x * oneMinusSat; red += float3(saturation, 0, 0); - + float3 green = luminance.y * oneMinusSat; green += float3(0, saturation, 0); - + float3 blue = luminance.z * oneMinusSat; blue += float3(0, 0, saturation); - + return float4x4( red, 0, green, 0, @@ -50069,7 +51159,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, 0, 0, 1 ); } - + float4 PoiColorBCS(float4 color, float brightness, float contrast, float saturation) { return mul(color, mul(brightnessMatrix(brightness), mul(contrastMatrix(contrast), saturationMatrix(saturation)))); @@ -50078,68 +51168,87 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return mul(float4(color, 1), mul(brightnessMatrix(brightness), mul(contrastMatrix(contrast), saturationMatrix(saturation)))).rgb; } - + float3 linear_srgb_to_oklab(float3 c) { float l = 0.4122214708 * c.x + 0.5363325363 * c.y + 0.0514459929 * c.z; float m = 0.2119034982 * c.x + 0.6806995451 * c.y + 0.1073969566 * c.z; float s = 0.0883024619 * c.x + 0.2817188376 * c.y + 0.6299787005 * c.z; - + float l_ = pow(l, 1.0 / 3.0); float m_ = pow(m, 1.0 / 3.0); float s_ = pow(s, 1.0 / 3.0); - + return float3( 0.2104542553 * l_ + 0.7936177850 * m_ - 0.0040720468 * s_, 1.9779984951 * l_ - 2.4285922050 * m_ + 0.4505937099 * s_, 0.0259040371 * l_ + 0.7827717662 * m_ - 0.8086757660 * s_ ); } - + float3 oklab_to_linear_srgb(float3 c) { float l_ = c.x + 0.3963377774 * c.y + 0.2158037573 * c.z; float m_ = c.x - 0.1055613458 * c.y - 0.0638541728 * c.z; float s_ = c.x - 0.0894841775 * c.y - 1.2914855480 * c.z; - + float l = l_ * l_ * l_; float m = m_ * m_ * m_; float s = s_ * s_ * s_; - + return float3( + 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s, - 1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s, - 0.0041960863 * l - 0.7034186147 * m + 1.7076147010 * s ); } - + float3 hueShift(float3 color, float shift) { - float3 oklab = linear_srgb_to_oklab(max(color, 0.0000000001)); + float3 oklab = linear_srgb_to_oklab(color); + float chroma = length(oklab.yz); + + if (chroma < 1e-5) { + // No hue to shift for achromatic colors + return color; + } + float hue = atan2(oklab.z, oklab.y); hue += shift * PI * 2; // Add the hue shift - - float chroma = length(oklab.yz); + oklab.y = cos(hue) * chroma; oklab.z = sin(hue) * chroma; - + return oklab_to_linear_srgb(oklab); } - - float3 hueShift(float4 color, float shift) + + float3 hueShiftHSV(float3 color, float hueOffset) { - return hueShift(color.rgb, shift); + float3 hsv = float3(hueOffset, 0, 0); + float3 hsvCol = RGBtoHSV(color); + return HSVtoRGB(hsvCol + hsv); } - - /* - float3 hueShift(float3 color, float hueOffset) + + float3 hueShift(float3 color, float shift, float ColorSpace) + { + switch(ColorSpace) + { + // OkLab Hue Shift + case 0.0: + return hueShift(color, shift); + // HSV Hue Shift + case 1.0: + return hueShiftHSV(color, shift); + default: + return float3(1.0, 0.0, 0.0); + } + } + + float3 hueShift(float4 color, float shift, float ColorSpace) { - color = RGBtoHSV(color); - color.x = frac(hueOffset +color.x); - return HSVtoRGB(color); + return hueShift(color.rgb, shift, ColorSpace); } - */ - + // LCH float xyzF(float t) { @@ -50149,7 +51258,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655)); } - + float4x4 poiRotationMatrixFromAngles(float x, float y, float z) { float angleX = radians(x); @@ -50159,7 +51268,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1); - + float angleY = radians(y); c = cos(angleY); s = sin(angleY); @@ -50167,7 +51276,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, 1, 0, 0, - s, 0, c, 0, 0, 0, 0, 1); - + float angleZ = radians(z); c = cos(angleZ); s = sin(angleZ); @@ -50175,10 +51284,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); - + return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix); } - + float4x4 poiRotationMatrixFromAngles(float3 angles) { float angleX = radians(angles.x); @@ -50188,7 +51297,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1); - + float angleY = radians(angles.y); c = cos(angleY); s = sin(angleY); @@ -50196,7 +51305,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 0, 1, 0, 0, - s, 0, c, 0, 0, 0, 0, 1); - + float angleZ = radians(angles.z); c = cos(angleZ); s = sin(angleZ); @@ -50204,10 +51313,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); - + return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix); } - + float3 getCameraPosition() { #ifdef USING_STEREO_MATRICES @@ -50215,7 +51324,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif return _WorldSpaceCameraPos; } - + float2 calcPixelScreenUVs(half4 grabPos) { half2 uv = grabPos.xy / (grabPos.w + 0.0000000001); @@ -50224,60 +51333,60 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else uv.xy *= _ScreenParams.xy; #endif - + return uv; } - + float CalcMipLevel(float2 texture_coord) { float2 dx = ddx(texture_coord); float2 dy = ddy(texture_coord); float delta_max_sqr = max(dot(dx, dx), dot(dy, dy)); - + return 0.5 * log2(delta_max_sqr); } - + float inverseLerp(float A, float B, float T) { return (T - A) / (B - A); } - + float inverseLerp2(float2 a, float2 b, float2 value) { float2 AB = b - a; float2 AV = value - a; return dot(AV, AB) / dot(AB, AB); } - + float inverseLerp3(float3 a, float3 b, float3 value) { float3 AB = b - a; float3 AV = value - a; return dot(AV, AB) / dot(AB, AB); } - + float inverseLerp4(float4 a, float4 b, float4 value) { float4 AB = b - a; float4 AV = value - a; return dot(AV, AB) / dot(AB, AB); } - + /* MIT License - + Copyright (c) 2019 wraikny - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -50285,29 +51394,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + VertexTransformShader is dependent on: */ - + float4 quaternion_conjugate(float4 v) { return float4( v.x, -v.yzw ); } - + float4 quaternion_mul(float4 v1, float4 v2) { float4 result1 = (v1.x * v2 + v1 * v2.x); - + float4 result2 = float4( - dot(v1.yzw, v2.yzw), cross(v1.yzw, v2.yzw) ); - + return float4(result1 + result2); } - + // angle : radians float4 get_quaternion_from_angle(float3 axis, float angle) { @@ -50315,45 +51424,45 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float cs = cos(angle * 0.5); return float4(axis * sn, cs); } - + float4 quaternion_from_vector(float3 inVec) { return float4(0.0, inVec); } - + float degree_to_radius(float degree) { return ( degree / 180.0 * PI ); } - + float3 rotate_with_quaternion(float3 inVec, float3 rotation) { float4 qx = get_quaternion_from_angle(float3(1, 0, 0), radians(rotation.x)); float4 qy = get_quaternion_from_angle(float3(0, 1, 0), radians(rotation.y)); float4 qz = get_quaternion_from_angle(float3(0, 0, 1), radians(rotation.z)); - + #define MUL3(A, B, C) quaternion_mul(quaternion_mul((A), (B)), (C)) float4 quaternion = normalize(MUL3(qx, qy, qz)); float4 conjugate = quaternion_conjugate(quaternion); - + float4 inVecQ = quaternion_from_vector(inVec); - + float3 rotated = ( MUL3(quaternion, inVecQ, conjugate) ).yzw; - + return rotated; } - + float4 transform(float4 input, float4 pos, float4 rotation, float4 scale) { input.rgb *= (scale.xyz * scale.w); input = float4(rotate_with_quaternion(input.xyz, rotation.xyz * rotation.w) + (pos.xyz * pos.w), input.w); return input; } - + float2 RotateUV(float2 _uv, float _radian, float2 _piv, float _time) { float RotateUV_ang = _radian; @@ -50361,17 +51470,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float RotateUV_sin = sin(_time * RotateUV_ang); return (mul(_uv - _piv, float2x2(RotateUV_cos, -RotateUV_sin, RotateUV_sin, RotateUV_cos)) + _piv); } - + /* MIT END */ - + float3 RotateAroundAxis(float3 original, float3 axis, float radian) { float s = sin(radian); float c = cos(radian); float one_minus_c = 1.0 - c; - + axis = normalize(axis); float3x3 rot_mat = { one_minus_c * axis.x * axis.x + c, one_minus_c * axis.x * axis.y - axis.z * s, one_minus_c * axis.z * axis.x + axis.y * s, @@ -50380,14 +51489,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" }; return mul(rot_mat, original); } - + float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex) { float3 outputColor = srcColor; if (themeIndex != 0) { themeIndex = max(themeIndex - 1, 0); - + if (themeIndex <= 3) { outputColor = poiMods.globalColorTheme[themeIndex]; @@ -50404,7 +51513,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return outputColor; } - + float3 lilToneCorrection(float3 c, float4 hsvg) { // gamma @@ -50420,7 +51529,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // hsv - > rgb return hsv.z - hsv.z * hsv.y + hsv.z * hsv.y * saturate(abs(frac(hsv.x + float3(1.0, 2.0 / 3.0, 1.0 / 3.0)) * 6.0 - 3.0) - 1.0); } - + float3 lilBlendColor(float3 dstCol, float3 srcCol, float3 srcA, int blendMode) { float3 ad = dstCol + srcCol; @@ -50432,24 +51541,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (blendMode == 3) outCol = mu; // Multiply return lerp(dstCol, outCol, srcA); } - + float lilIsIn0to1(float f) { float value = 0.5 - abs(f - 0.5); return saturate(value / clamp(fwidth(value), 0.0001, 1.0)); } - + float lilIsIn0to1(float f, float nv) { float value = 0.5 - abs(f - 0.5); return saturate(value / clamp(fwidth(value), 0.0001, nv)); } - + float poiEdgeLinearNoSaturate(float value, float border) { return (value - border) / clamp(fwidth(value), 0.0001, 1.0); } - + float3 poiEdgeLinearNoSaturate(float value, float3 border) { return float3( @@ -50458,29 +51567,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" (value - border.z) / clamp(fwidth(value), 0.0001, 1.0) ); } - + float poiEdgeLinearNoSaturate(float value, float border, float blur) { float borderMin = saturate(border - blur * 0.5); float borderMax = saturate(border + blur * 0.5); return (value - borderMin) / saturate(borderMax - borderMin + fwidth(value)); } - + float poiEdgeLinearNoSaturate(float value, float border, float blur, float borderRange) { float borderMin = saturate(border - blur * 0.5 - borderRange); float borderMax = saturate(border + blur * 0.5); return (value - borderMin) / saturate(borderMax - borderMin + fwidth(value)); } - + float poiEdgeNonLinearNoSaturate(float value, float border) { // return (value - border) / clamp(fwidth(value), 0.0001, 1.0); - + float fwidthValue = fwidth(value); return smoothstep(border - fwidthValue, border + fwidthValue, value); } - + float poiEdgeNonLinearNoSaturate(float value, float border, float blur) { float fwidthValue = fwidth(value); @@ -50488,7 +51597,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float borderMax = saturate(border + blur * 0.5); return smoothstep(borderMin - fwidthValue, borderMax + fwidthValue, value); } - + float poiEdgeNonLinearNoSaturate(float value, float border, float blur, float borderRange) { float fwidthValue = fwidth(value); @@ -50496,32 +51605,32 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float borderMax = saturate(border + blur * 0.5); return smoothstep(borderMin - fwidthValue, borderMax + fwidthValue, value); } - + float poiEdgeNonLinear(float value, float border) { return saturate(poiEdgeNonLinearNoSaturate(value, border)); } - + float poiEdgeNonLinear(float value, float border, float blur) { return saturate(poiEdgeNonLinearNoSaturate(value, border, blur)); } - + float poiEdgeNonLinear(float value, float border, float blur, float borderRange) { return saturate(poiEdgeNonLinearNoSaturate(value, border, blur, borderRange)); } - + float poiEdgeLinear(float value, float border) { return saturate(poiEdgeLinearNoSaturate(value, border)); } - + float poiEdgeLinear(float value, float border, float blur) { return saturate(poiEdgeLinearNoSaturate(value, border, blur)); } - + float poiEdgeLinear(float value, float border, float blur, float borderRange) { return saturate(poiEdgeLinearNoSaturate(value, border, blur, borderRange)); @@ -50531,12 +51640,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return LinearToGammaSpace(col); } - + float3 OpenLitSRGBToLinear(float3 col) { return GammaToLinearSpace(col); } - + float OpenLitLuminance(float3 rgb) { #if defined(UNITY_COLORSPACE_GAMMA) @@ -50545,7 +51654,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return dot(rgb, float3(0.0396819152, 0.458021790, 0.00609653955)); #endif } - + float3 AdjustLitLuminance(float3 rgb, float targetLuminance) { float currentLuminance; @@ -50554,11 +51663,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else currentLuminance = dot(rgb, float3(0.0396819152, 0.458021790, 0.00609653955)); #endif - + float luminanceRatio = targetLuminance / currentLuminance; return rgb * luminanceRatio; } - + float3 ClampLuminance(float3 rgb, float minLuminance, float maxLuminance) { float currentLuminance = dot(rgb, float3(0.299, 0.587, 0.114)); @@ -50567,19 +51676,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float luminanceRatio = clamp(min(maxRatio, max(minRatio, 1.0)), 0.0, 1.0); return lerp(rgb, rgb * luminanceRatio, luminanceRatio < 1.0); } - + float3 MaxLuminance(float3 rgb, float maxLuminance) { float currentLuminance = dot(rgb, float3(0.299, 0.587, 0.114)); float luminanceRatio = (currentLuminance != 0) ? maxLuminance / max(currentLuminance, 0.00001) : 1.0; return lerp(rgb, rgb * luminanceRatio, currentLuminance > maxLuminance); } - + float OpenLitGray(float3 rgb) { return dot(rgb, float3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0)); } - + void OpenLitShadeSH9ToonDouble(float3 lightDirection, out float3 shMax, out float3 shMin) { #if !defined(LIGHTMAP_ON) @@ -50607,13 +51716,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" shMin = 0.0; #endif } - + float3 OpenLitComputeCustomLightDirection(float4 lightDirectionOverride) { float3 customDir = length(lightDirectionOverride.xyz) * normalize(mul((float3x3)unity_ObjectToWorld, lightDirectionOverride.xyz)); return lightDirectionOverride.w ? customDir : lightDirectionOverride.xyz; // .w isn't doc'd anywhere and is always 0 unless end user changes it + } - + float3 OpenLitLightingDirectionForSH9() { float3 mainDir = _WorldSpaceLightPos0.xyz * OpenLitLuminance(_LightColor0.rgb); @@ -50624,12 +51734,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 sh9Dir = 0; float3 sh9DirAbs = 0; #endif - + float3 lightDirectionForSH9 = sh9Dir + mainDir; lightDirectionForSH9 = dot(lightDirectionForSH9, lightDirectionForSH9) < 0.000001 ? 0 : normalize(lightDirectionForSH9); return lightDirectionForSH9; } - + float3 OpenLitLightingDirection(float4 lightDirectionOverride) { float3 mainDir = _WorldSpaceLightPos0.xyz * OpenLitLuminance(_LightColor0.rgb); @@ -50641,28 +51751,28 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 sh9DirAbs = 0; #endif float3 customDir = OpenLitComputeCustomLightDirection(lightDirectionOverride); - + return normalize(sh9DirAbs + mainDir + customDir); } - + float3 OpenLitLightingDirection() { float4 customDir = float4(0.001, 0.002, 0.001, 0.0); return OpenLitLightingDirection(customDir); } - + inline float4 CalculateFrustumCorrection() { float x1 = -UNITY_MATRIX_P._31 / (UNITY_MATRIX_P._11 * UNITY_MATRIX_P._34); float x2 = -UNITY_MATRIX_P._32 / (UNITY_MATRIX_P._22 * UNITY_MATRIX_P._34); return float4(x1, x2, 0, UNITY_MATRIX_P._33 / UNITY_MATRIX_P._34 + x1 * UNITY_MATRIX_P._13 + x2 * UNITY_MATRIX_P._23); } - + inline float CorrectedLinearEyeDepth(float z, float B) { return 1.0 / (z / UNITY_MATRIX_P._34 + B); } - + // Silent's code float2 sharpSample(float4 texelSize, float2 p) { @@ -50672,7 +51782,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" p = (p - 0.5) * texelSize.xy; return p; } - + void applyToGlobalMask(inout PoiMods poiMods, int index, int blendType, float val) { float valBlended = saturate(maskBlend(poiMods.globalMask[index], val, blendType)); @@ -50696,7 +51806,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" case 15: poiMods.globalMask[15] = valBlended; break; } } - + void assignValueToVectorFromIndex(inout float4 vec, int index, float value) { switch(index) @@ -50707,7 +51817,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" case 3: vec[3] = value; break; } } - + // SNose float3 mod289(float3 x) { @@ -50721,7 +51831,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return mod289(((x * 34.0) + 1.0) * x); } - + float snoise(float2 v) { const float4 C = float4(0.211324865405187, // (3.0 - sqrt(3.0)) / 6.0 @@ -50737,7 +51847,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" i = mod289(i); // Avoid truncation effects in permutation float3 p = permute(permute(i.y + float3(0.0, i1.y, 1.0)) + i.x + float3(0.0, i1.x, 1.0)); - + float3 m = max(0.5 - float3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0); m = m * m ; m = m * m ; @@ -50751,35 +51861,35 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" g.yz = a0.yz * x12.xz + h.yz * x12.yw; return 130.0 * dot(m, g); } - + float nsqDistance(float2 a, float2 b) { return dot(a - b, a - b); } - + float poiInvertToggle(in float value, in float toggle) { return (toggle == 0 ? value : 1 - value); } - + float3 PoiBlendNormal(float3 dstNormal, float3 srcNormal) { return float3(dstNormal.xy + srcNormal.xy, dstNormal.z * srcNormal.z); } - + float3 lilTransformDirOStoWS(float3 directionOS, bool doNormalize) { if (doNormalize) return normalize(mul((float3x3)unity_ObjectToWorld, directionOS)); else return mul((float3x3)unity_ObjectToWorld, directionOS); } - + float2 poiGetWidthAndHeight(Texture2D tex) { uint width, height; tex.GetDimensions(width, height); return float2(width, height); } - + float2 poiGetWidthAndHeight(Texture2DArray tex) { uint width, height, element; @@ -50788,25 +51898,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } //ifex _EnableAudioLink==0 #ifdef POI_AUDIOLINK - + // Convenient mechanism to read from the AudioLink texture that handles reading off the end of one line and onto the next above it. float4 AudioLinkDataMultiline(uint2 xycoord) { return AudioLinkData(uint2(xycoord.x % AUDIOLINK_WIDTH, xycoord.y + xycoord.x / AUDIOLINK_WIDTH)); } - + // Mechanism to sample between two adjacent pixels and lerp between them, like "linear" supesampling float4 AudioLinkLerp(float2 xy) { return lerp(AudioLinkData(xy), AudioLinkData(xy + int2(1, 0)), frac(xy.x)); } - + // Same as AudioLinkLerp but properly handles multiline reading. float4 AudioLinkLerpMultiline(float2 xy) { return lerp(AudioLinkDataMultiline(xy), AudioLinkDataMultiline(xy + float2(1, 0)), frac(xy.x)); } - + //Tests to see if Audio Link texture is available bool AudioLinkIsAvailable() { @@ -50818,7 +51928,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return _AudioTexture_TexelSize.z > 16; #endif } - + //Get version of audiolink present in the world, 0 if no audiolink is present float AudioLinkGetVersion() { @@ -50828,7 +51938,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else dims = _AudioTexture_TexelSize.zw; #endif - + if (dims.x >= 128) return AudioLinkData(ALPASS_GENERALVU).x; else if (dims.x > 16) @@ -50836,17 +51946,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" else return 0; } - + // This pulls data from this texture. #define AudioLinkGetSelfPixelData(xy) _SelfTexture2D[xy] - + // Extra utility functions for time. uint AudioLinkDecodeDataAsUInt(uint2 indexloc) { uint4 rpx = AudioLinkData(indexloc); return rpx.r + rpx.g * 1024 + rpx.b * 1048576 + rpx.a * 1073741824; } - + //Note: This will truncate time to every 134,217.728 seconds (~1.5 days of an instance being up) to prevent floating point aliasing. // if your code will alias sooner, you will need to use a different function. It should be safe to use this on all times. float AudioLinkDecodeDataAsSeconds(uint2 indexloc) @@ -50855,15 +51965,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //Can't just divide by float. Bug in Unity's HLSL compiler. return float(time / 1000) + float(time % 1000) / 1000.; } - + #define ALDecodeDataAsSeconds(x) AudioLinkDecodeDataAsSeconds(x) #define ALDecodeDataAsUInt(x) AudioLinkDecodeDataAsUInt(x) - + float AudioLinkRemap(float t, float a, float b, float u, float v) { return ((t - a) / (b - a)) * (v - u) + u; } - + float3 AudioLinkHSVtoRGB(float3 HSV) { float3 RGB = 0; @@ -50901,11 +52011,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float M = HSV.z - C; return RGB + M; } - + float3 AudioLinkCCtoRGB(float bin, float intensity, int rootNote) { float note = bin / AUDIOLINK_EXPBINS; - + float hue = 0.0; note *= 12.0; note = glsl_mod(4. - note + rootNote, 12.0); @@ -50931,48 +52041,48 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float val = intensity - 0.1; return AudioLinkHSVtoRGB(float3(fmod(hue, 1.0), 1.0, clamp(val, 0.0, 1.0))); } - + // Sample the amplitude of a given frequency in the DFT, supports frequencies in [13.75; 14080]. float4 AudioLinkGetAmplitudeAtFrequency(float hertz) { float note = AUDIOLINK_EXPBINS * log2(hertz / AUDIOLINK_BOTTOM_FREQUENCY); return AudioLinkLerpMultiline(ALPASS_DFT + float2(note, 0)); } - + // Sample the amplitude of a given semitone in an octave. Octave is in [0; 9] while note is [0; 11]. float AudioLinkGetAmplitudeAtNote(float octave, float note) { float quarter = note * 2.0; return AudioLinkLerpMultiline(ALPASS_DFT + float2(octave * AUDIOLINK_EXPBINS + quarter, 0)); } - + // Get a reasonable drop-in replacement time value for _Time.y with the // given chronotensity index [0; 7] and AudioLink band [0; 3]. float AudioLinkGetChronoTime(uint index, uint band) { return (AudioLinkDecodeDataAsUInt(ALPASS_CHRONOTENSITY + uint2(index, band))) / 100000.0; } - + // Get a chronotensity value in the interval [0; 1], modulated by the speed input, // with the given chronotensity index [0; 7] and AudioLink band [0; 3]. float AudioLinkGetChronoTimeNormalized(uint index, uint band, float speed) { return frac(AudioLinkGetChronoTime(index, band) * speed); } - + // Get a chronotensity value in the interval [0; interval], modulated by the speed input, // with the given chronotensity index [0; 7] and AudioLink band [0; 3]. float AudioLinkGetChronoTimeInterval(uint index, uint band, float speed, float interval) { return AudioLinkGetChronoTimeNormalized(index, band, speed) * interval; } - + float getBandAtTime(float band, float time, float size = 1.0f) { //return remap(UNITY_SAMPLE_TEX2D(_AudioTexture, float2(time * width, band/128.0)).r, min(size,.9999), 1); return remapClamped(min(size, .9999), 1, AudioLinkData(ALPASS_AUDIOBASS + uint2(time * AUDIOLINK_WIDTH, band)).r); } - + fixed3 maximize(fixed3 c) { if (c.x == 0 && c.y == 0 && c.z == 0) @@ -50980,11 +52090,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" else return c / max(c.r, max(c.g, c.b)); } - + void initPoiAudioLink(inout PoiMods poiMods) { if (!_AudioLinkAnimToggle) return; - + if (AudioLinkIsAvailable()) { poiMods.audioLinkAvailable = true; @@ -50999,25 +52109,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalColorTheme[5] = AudioLinkData( ALPASS_CCCOLORS + uint2( 1, 0 ) ); poiMods.globalColorTheme[6] = AudioLinkData( ALPASS_CCCOLORS + uint2( 2, 0 ) ); poiMods.globalColorTheme[7] = AudioLinkData( ALPASS_CCCOLORS + uint2( 3, 0 ) ); - + poiMods.globalColorTheme[4] = float4(maximize(AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) )),1.0); poiMods.globalColorTheme[5] = float4(maximize(AudioLinkData( ALPASS_CCCOLORS + uint2( 1, 0 ) )),1.0); poiMods.globalColorTheme[6] = float4(maximize(AudioLinkData( ALPASS_CCCOLORS + uint2( 2, 0 ) )),1.0); poiMods.globalColorTheme[7] = float4(maximize(AudioLinkData( ALPASS_CCCOLORS + uint2( 3, 0 ) )),1.0); */ - + poiMods.globalColorTheme[4] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(2, 0))[0], AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0); poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0))[0], AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0); poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0))[0], AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0); poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0))[0], AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0); - + poiMods.globalColorTheme[8] = AudioLinkData(ALPASS_THEME_COLOR0); poiMods.globalColorTheme[9] = AudioLinkData(ALPASS_THEME_COLOR1); poiMods.globalColorTheme[10] = AudioLinkData(ALPASS_THEME_COLOR2); poiMods.globalColorTheme[11] = AudioLinkData(ALPASS_THEME_COLOR3); return; } - + if (_AudioLinkBandOverridesEnabled) { poiMods.audioLinkAvailable = true; @@ -51027,7 +52137,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.audioLink[3] = _AudioLinkBandOverrideSliders.w; } } - + void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) { if (_DebugWaveform) @@ -51076,21 +52186,21 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.emission += (AudioLinkDecodeDataAsUInt(ALPASS_CHRONOTENSITY + uint2(1, 0)) % 1000000) / 1000000.0; } } - + void SetupAudioLink(inout PoiFragData poiFragData, inout PoiMods poiMods, in PoiMesh poiMesh) { initPoiAudioLink(poiMods); DebugVisualizer(poiFragData, poiMesh, poiMods); - + if (_AudioLinkCCStripY) { poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].y * AUDIOLINK_WIDTH, 0)).rgb * .5; } } - + #endif //endex - + //ifex _BSSEnabled!=1 #ifdef POIBS_ENABLE //ifex _BSSBloomfog!=1 @@ -51105,7 +52215,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" (screenPosNormalized.y + - 0.5) * _CustomFogTextureToScreenRatio.y + 0.5 ,clipPos.z,clipPos.w); } - + inline float GetHeightFogIntensity(float3 worldPos, float fogHeightOffset, float fogHeightScale) { float heightFogIntensity = _CustomFogHeightFogHeight + _CustomFogHeightFogStartY; @@ -51114,7 +52224,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" heightFogIntensity = clamp(heightFogIntensity, 0, 1); return ((-heightFogIntensity * 2) + 3) * (heightFogIntensity * heightFogIntensity); } - + inline float GetFogIntensity(float3 distance, float fogStartOffset, float fogScale) { float fogIntensity = max(dot(distance, distance) + - fogStartOffset, 0); @@ -51126,7 +52236,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex #endif //endex - + VertexOut vert( #ifndef POI_TESSELLATED appdata v @@ -51143,7 +52253,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(v); #endif UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - + //ifex _EnableUDIMDiscardOptions==0 #ifdef POI_UDIMDISCARD UNITY_BRANCH @@ -51156,20 +52266,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" udim += (v.uv1.xy * (_UDIMDiscardUV == 1)); udim += (v.uv2.xy * (_UDIMDiscardUV == 2)); udim += (v.uv3.xy * (_UDIMDiscardUV == 3)); - + float isDiscarded = 0; float4 xMask = float4( (udim.x >= 0 && udim.x < 1), (udim.x >= 1 && udim.x < 2), (udim.x >= 2 && udim.x < 3), (udim.x >= 3 && udim.x < 4)); - + isDiscarded += (udim.y >= 0 && udim.y < 1) * dot(float4(_UDIMDiscardRow0_0, _UDIMDiscardRow0_1, _UDIMDiscardRow0_2, _UDIMDiscardRow0_3), xMask); isDiscarded += (udim.y >= 1 && udim.y < 2) * dot(float4(_UDIMDiscardRow1_0, _UDIMDiscardRow1_1, _UDIMDiscardRow1_2, _UDIMDiscardRow1_3), xMask); isDiscarded += (udim.y >= 2 && udim.y < 3) * dot(float4(_UDIMDiscardRow2_0, _UDIMDiscardRow2_1, _UDIMDiscardRow2_2, _UDIMDiscardRow2_3), xMask); isDiscarded += (udim.y >= 3 && udim.y < 4) * dot(float4(_UDIMDiscardRow3_0, _UDIMDiscardRow3_1, _UDIMDiscardRow3_2, _UDIMDiscardRow3_3), xMask); - + isDiscarded *= any(float4(udim.y >= 0, udim.y < 4, udim.x >= 0, udim.x < 4)); // never discard outside 4x4 grid in pos coords - + // Use a threshold so that there's some room for animations to be close to 0, but not exactly 0 const float threshold = 0.001; if(isDiscarded > threshold) // Early Return skips rest of vertex shader @@ -51179,7 +52289,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _VertexManipulationsEnabled==0 #ifdef AUTO_EXPOSURE float4 audioLinkBands = 0; @@ -51198,7 +52308,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" audioLinkBands.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r; audioLinkBands.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r; audioLinkBands.w = AudioLinkData(ALPASS_AUDIOTREBLE).r; - + if (any(_VertexLocalTranslationALMin) || any(_VertexLocalTranslationALMax)) { ALLocalTranslation = lerp(_VertexLocalTranslationALMin, _VertexLocalTranslationALMax, audioLinkBands[_VertexLocalTranslationALBand]); @@ -51235,37 +52345,37 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } #endif - + // Local Transformation float4 rotation = float4(_VertexManipulationLocalRotation.xyz + float3(180, 0, 0) + _VertexManipulationLocalRotationSpeed * _Time.x + ALrotation + CTALRotation, _VertexManipulationLocalRotation.w); v.normal = rotate_with_quaternion(v.normal, rotation.xyz); v.tangent.xyz = rotate_with_quaternion(v.tangent.xyz, rotation.xyz); v.vertex = transform(v.vertex, _VertexManipulationLocalTranslation + float4(ALLocalTranslation, 0) + ALSpectrumLocalOffset, rotation, _VertexManipulationLocalScale + float4(ALScale, 0)); o.normal = UnityObjectToWorldNormal(v.normal); - + #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED) float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(vertexUV(v, _VertexManipulationHeightMaskUV), _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0))[_VertexManipulationHeightMaskChannel] - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal; #else float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal; #endif - + if (_VertexBarrelMode) { v.vertex.xz = lerp(v.vertex.xz, normalize(v.vertex.xz) * _VertexBarrelWidth + v.vertex.xz * _VertexBarrelHeight, _VertexBarrelAlpha); } - + if (_VertexSphereMode) { v.vertex.xyz = lerp(v.vertex.xyz, normalize(v.vertex.xyz + _VertexSphereCenter.xyz) * _VertexSphereRadius + v.vertex.xyz * _VertexSphereHeight, _VertexSphereAlpha); } - + if (_VertexTornadoMode) { v.vertex.xz = lerp(v.vertex.xz, float3(v.vertex.xz + float2(cos(_Time.y * _VertexTornadoSpeed + v.vertex.y * _VertexTornadoIntensity) * _VertexTornadoRadius, sin(_Time.y * _VertexTornadoSpeed + v.vertex.y * _VertexTornadoIntensity) * _VertexTornadoRadius), v.vertex.y), smoothstep(_VertexTornadoBaseHeight, _VertexTornadoTopHeight, v.vertex.y)); } - + v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz; - + // rounding UNITY_BRANCH if (_VertexRoundingEnabled) @@ -51284,7 +52394,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _EnableDissolve==0 #ifdef DISTORT UNITY_BRANCH @@ -51297,41 +52407,41 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" dissolveUdim += (v.uv1.xy * (_UVTileDissolveUV == 1)); dissolveUdim += (v.uv2.xy * (_UVTileDissolveUV == 2)); dissolveUdim += (v.uv3.xy * (_UVTileDissolveUV == 3)); - + float isDiscardedFromDissolve = 0; float4 xMaskDissolve = float4((dissolveUdim.x >= 0 && dissolveUdim.x < 1), (dissolveUdim.x >= 1 && dissolveUdim.x < 2), (dissolveUdim.x >= 2 && dissolveUdim.x < 3), (dissolveUdim.x >= 3 && dissolveUdim.x < 4)); - + isDiscardedFromDissolve += (dissolveUdim.y >= 0 && dissolveUdim.y < 1) * dot(float4(_UVTileDissolveAlpha_Row0_0, _UVTileDissolveAlpha_Row0_1, _UVTileDissolveAlpha_Row0_2, _UVTileDissolveAlpha_Row0_3), xMaskDissolve); isDiscardedFromDissolve += (dissolveUdim.y >= 1 && dissolveUdim.y < 2) * dot(float4(_UVTileDissolveAlpha_Row1_0, _UVTileDissolveAlpha_Row1_1, _UVTileDissolveAlpha_Row1_2, _UVTileDissolveAlpha_Row1_3), xMaskDissolve); isDiscardedFromDissolve += (dissolveUdim.y >= 2 && dissolveUdim.y < 3) * dot(float4(_UVTileDissolveAlpha_Row2_0, _UVTileDissolveAlpha_Row2_1, _UVTileDissolveAlpha_Row2_2, _UVTileDissolveAlpha_Row2_3), xMaskDissolve); isDiscardedFromDissolve += (dissolveUdim.y >= 3 && dissolveUdim.y < 4) * dot(float4(_UVTileDissolveAlpha_Row3_0, _UVTileDissolveAlpha_Row3_1, _UVTileDissolveAlpha_Row3_2, _UVTileDissolveAlpha_Row3_3), xMaskDissolve); - + isDiscardedFromDissolve *= any(float4(dissolveUdim.y >= 0, dissolveUdim.y < 4, dissolveUdim.x >= 0, dissolveUdim.x < 4)); // never discard outside 4x4 grid in pos coords - + // Use a threshold so that there's some room for animations to be close to 1, but not exactly 1 const float threshold = 0.999; if (isDiscardedFromDissolve > threshold) // Early Return skips rest of vertex shader - + { return (VertexOut)POI_NAN; } } #endif //endex - + //ifex _EnableMirrorOptions==0 #ifdef POI_MIRROR float notVisible = 0; - + if (_VisibilityMode == 1) // VRC - + { float mirrorMode = VRCMirrorMode(); float cameraMode = VRCCameraMode(); - + notVisible += (!_VisibilityVRCRegular && ((mirrorMode == 0) && (cameraMode == 0))); notVisible += (!_VisibilityVRCMirrorVR && (mirrorMode == 1)); notVisible += (!_VisibilityVRCMirrorDesktop && (mirrorMode == 2)); @@ -51340,50 +52450,50 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" notVisible += (!_VisibilityVRCCameraScreenshot && (cameraMode == 3)); } else if (_Mirror != 0) // Generic (CVR, etc) - + { notVisible += (_Mirror == 1) ^ IsInMirror(); } - + if (notVisible) // Early Return skips rest of vertex shader - + { return (VertexOut)POI_NAN; } #endif //endex - + o.normal = UnityObjectToWorldNormal(v.normal); o.tangent.xyz = UnityObjectToWorldDir(v.tangent); o.tangent.w = v.tangent.w; o.vertexColor = v.color; - + o.uv[0] = float4(v.uv0.xy, v.uv1.xy); o.uv[1] = float4(v.uv2.xy, v.uv3.xy); - + #if defined(LIGHTMAP_ON) o.lightmapUV.xy = v.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw; #endif #ifdef DYNAMICLIGHTMAP_ON o.lightmapUV.zw = v.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; #endif - + o.localPos = v.vertex; o.worldPos = mul(unity_ObjectToWorld, o.localPos); - + float3 localOffset = float3(0, 0, 0); float3 worldOffset = float3(0, 0, 0); - + //ifex _EnableOutlines!=1 #ifdef POI_PASS_OUTLINE float outlineMask = tex2Dlod(_OutlineMask, float4(poiUV(vertexUV(v, _OutlineMaskUV), _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0))[_OutlineMaskChannel]; - + //UNITY_BRANCH if (_OutlineVertexColorMask > 0) { outlineMask *= lerp(1, v.color[_OutlineVertexColorMask - 1], _OutlineVertexColorMaskStrength); } - + float3 outlineNormal = _OutlineSpace ? o.normal : v.normal; //UNITY_BRANCH if (_OutlineUseVertexColorNormals) @@ -51391,7 +52501,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 outlineTangent; float3 outlineBinormal; if (_OutlineSpace) // 0 Local, 1 World - + { outlineTangent = o.tangent; outlineBinormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w); @@ -51404,7 +52514,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 outlineVectorTS = v.color.rgb * 2.0 - 1.0; outlineNormal = outlineVectorTS.x * outlineTangent + outlineVectorTS.y * outlineBinormal + outlineVectorTS.z * outlineNormal; } - + float offsetMultiplier = 1; float distanceOffset = 1; //UNITY_BRANCH @@ -51412,7 +52522,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { distanceOffset *= lerp(1.0, clamp((distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz)), 0.0f, _OutlinesMaxDistance), _OutlineFixWidth); } - + float lineWidth = _LineWidth; #ifdef POI_AUDIOLINK // Due to PoiMods.audioLink being frag only I'll just @@ -51426,9 +52536,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } #endif - + float3 offset = outlineNormal * (lineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset; - + //UNITY_BRANCH if (_OutlineExpansionMode == 2) { @@ -51441,7 +52551,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { float3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal); offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy))); - + offset *= offsetMultiplier; offset *= distanceOffset; } @@ -51462,10 +52572,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _VertexGlitchingEnabled==0 #if defined(POI_VERTEX_GLITCHING) - + bool canGlitch = true; if (_VertexGlitchMirrorEnable && _VertexGlitchMirror > 0) { @@ -51479,26 +52589,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" forward.y = 0; forward = normalize(forward); float3 glitchDirection = normalize(cross(float3(0, 1, 0), forward)); - + float glitchAmount = 0; - + #if defined(POI_VERTEX_GLITCHING_TEXTURE) // if(_VertexGlitchingUseTexture) // { float uvl = o.worldPos.y * _VertexGlitchDensity + _Time.x * _VertexGlitchMapPanSpeed; float uvr = o.worldPos.y * _VertexGlitchDensity - _Time.x * _VertexGlitchMapPanSpeed; - + float3 glitchTextureL = 1; float3 glitchTextureR = 1; - + #if defined(POI_VERTEX_GLITCHING_TEXTURE) || !defined(OPTIMIZER_ENABLED) glitchTextureL = tex2Dlod(_VertexGlitchMap, float4(uvl, uvl, 0, 0)).rgb; glitchTextureR = tex2Dlod(_VertexGlitchMap, float4(uvr, uvr, 0, 0)).rgb; #endif - + glitchAmount += (glitchTextureL.r - 0.5) * 2; glitchAmount += - (glitchTextureR.r - 0.5) * 2; - + glitchAmount += (glitchTextureL.g - 0.5) * 2; glitchAmount += - (glitchTextureR.b - 0.5) * 2; // } else { @@ -51506,24 +52616,24 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" glitchAmount += frac(sin(dot(_Time.xy + o.worldPos.y, float2(12.9898, 78.233))) * 43758.5453123) * 2 - 1; // } #endif - + float time = _Time.y * _VertexGlitchFrequency; - + float randomGlitch = (sin(time) + sin(2.2 * time + 5.52) + sin(2.9 * time + 0.93) + sin(4.6 * time + 8.94)) / 4; float3 glitchOffset = 0; - + #ifdef POI_AUDIOLINK if (AudioLinkIsAvailable() && _VertexGlitchingAudioLinkEnabled) { // float4 audioLinkData = AudioLinkData(ALPASS_AUDIOBASS); - + float audioIntensity = AudioLinkData(ALPASS_AUDIOBASS).r * (_VertexGlitchingAudioLinkBand == 0) + AudioLinkData(ALPASS_AUDIOLOWMIDS).r * (_VertexGlitchingAudioLinkBand == 1) + AudioLinkData(ALPASS_AUDIOHIGHMIDS).r * (_VertexGlitchingAudioLinkBand == 2) + AudioLinkData(ALPASS_AUDIOTREBLE).r * (_VertexGlitchingAudioLinkBand == 3) + AudioLinkData(ALPASS_FILTEREDVU_INTENSITY).r * (_VertexGlitchingAudioLinkBand == 4); - + if(_VertexGlitchingAudiolinkOverride) { glitchOffset = glitchAmount * glitchDirection * (_VertexGlitchStrength * .01) * audioIntensity; @@ -51538,22 +52648,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else glitchOffset = glitchAmount * glitchDirection * (_VertexGlitchStrength * .01) * step(_VertexGlitchThreshold, randomGlitch); #endif - + localOffset += glitchOffset; worldOffset += mul(unity_ObjectToWorld, glitchOffset); } #endif //endex - + o.localPos.rgb += localOffset; o.worldPos.rgb += worldOffset; - + //ifex _EnableDepthBulge==0 #if defined(POI_DEPTHBULGE) && (defined(POI_PASS_BASE) || defined(POI_PASS_ADD)) applyDepthBulgeFX(o); #endif //endex - + //ifex _BSSEnabled!=1 #ifdef POIBS_ENABLE //ifex _BSSBloomfog!=1 @@ -51564,9 +52674,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //endex #endif //endex - + o.pos = UnityObjectToClipPos(o.localPos); - + #ifdef POI_PASS_OUTLINE #if defined(UNITY_REVERSED_Z) //DX @@ -51577,7 +52687,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //o.grabPos = ComputeGrabScreenPos(o.pos); - + #ifndef FORWARD_META_PASS #if !defined(UNITY_PASS_SHADOWCASTER) UNITY_TRANSFER_SHADOW(o, o.uv[0].xy); @@ -51586,9 +52696,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" TRANSFER_SHADOW_CASTER_NOPOS(o, o.pos); #endif #endif - + UNITY_TRANSFER_FOG(o, o.pos); - + if (_RenderingReduceClipDistance) { if (o.pos.w < _ProjectionParams.y * 1.01 && o.pos.w > 0) @@ -51600,14 +52710,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif } } - + #ifdef POI_PASS_META o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST); #endif - + return o; } - + #if defined(_STOCHASTICMODE_DELIOT_HEITZ) #define POI2D_SAMPLER_STOCHASTIC(tex, texSampler, uv, useStochastic) (useStochastic ? DeliotHeitzSampleTexture(tex, sampler##texSampler, uv) : POI2D_SAMPLER(tex, texSampler, uv)) #define POI2D_SAMPLER_PAN_STOCHASTIC(tex, texSampler, uv, pan, useStochastic) (useStochastic ? DeliotHeitzSampleTexture(tex, sampler##texSampler, POI_PAN_UV(uv, pan)) : POI2D_SAMPLER_PAN(tex, texSampler, uv, pan)) @@ -51618,7 +52728,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #define POI2D_SAMPLER_PAN_STOCHASTIC(tex, texSampler, uv, pan, useStochastic) (useStochastic ? HextileSampleTexture(tex, sampler##texSampler, POI_PAN_UV(uv, pan), false) : POI2D_SAMPLER_PAN(tex, texSampler, uv, pan)) #define POI2D_SAMPLER_PANGRAD_STOCHASTIC(tex, texSampler, uv, pan, dx, dy, useStochastic) (useStochastic ? HextileSampleTexture(tex, sampler##texSampler, POI_PAN_UV(uv, pan), false, dx, dy) : POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, dx, dy)) #endif - + #ifndef POI2D_SAMPLER_STOCHASTIC #define POI2D_SAMPLER_STOCHASTIC(tex, texSampler, uv, useStochastic) (POI2D_SAMPLER(tex, texSampler, uv)) #endif @@ -51628,17 +52738,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #ifndef POI2D_SAMPLER_PANGRAD_STOCHASTIC #define POI2D_SAMPLER_PANGRAD_STOCHASTIC(tex, texSampler, uv, pan, dx, dy, useStochastic) (POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, dx, dy)) #endif - + // When using, properties won't properly lock at optimize time; needs macro evaluation implemented // #define POI2D_SAMPLER_STOCHASTIC_INLINED(tex, texSampler) (POI2D_SAMPLER_STOCHASTIC(tex, texSampler, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Stochastic)) // #define POI2D_SAMPLER_PAN_STOCHASTIC_INLINED(tex, texSampler) (POI2D_SAMPLER_PAN_STOCHASTIC(tex, texSampler, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Pan, tex##Stochastic)) - + // #define POI2D_MAINTEX_SAMPLER_STOCHASTIC_INLINED(tex) (POI2D_SAMPLER_STOCHASTIC(tex, _MainTex, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Stochastic)) // #define POI2D_MAINTEX_SAMPLER_PAN_STOCHASTIC_INLINED(tex) (POI2D_SAMPLER_PAN_STOCHASTIC(tex, _MainTex, poiUV(poiMesh.uv[tex##UV], tex##_ST), tex##Pan, tex##Stochastic)) - + // Deliot, Heitz 2019 - Fast, but non-histogram-preserving (ends up looking a bit blurry and lower contrast) // https://eheitzresearch.wordpress.com/738-2/ - + // Classic Magic Numbers fracsin #if !defined(_STOCHASTICMODE_NONE) float2 StochasticHash2D2D (float2 s) @@ -51646,7 +52756,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return frac(sin(glsl_mod(float2(dot(s, float2(127.1,311.7)), dot(s, float2(269.5,183.3))), 3.14159)) * 43758.5453); } #endif - + #if defined(_STOCHASTICMODE_DELIOT_HEITZ) // UV Offsets and blend weights // UVBW[0...2].xy = UV Offsets @@ -51656,46 +52766,46 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // UV transformed into triangular grid space with UV scaled by approximation of 2*sqrt(3) const float2x2 stochasticSkewedGrid = float2x2(1.0, -0.57735027, 0.0, 1.15470054); float2 skewUV = mul(stochasticSkewedGrid, uv * 3.4641 * _StochasticDeliotHeitzDensity); - + // Vertex IDs and barycentric coords float2 vxID = floor(skewUV); float3 bary = float3(frac(skewUV), 0); bary.z = 1.0 - bary.x - bary.y; - + float3x3 pos = float3x3( float3(vxID, bary.z), float3(vxID + float2(0, 1), bary.y), float3(vxID + float2(1, 0), bary.x) ); - + float3x3 neg = float3x3( float3(vxID + float2(1, 1), -bary.z), float3(vxID + float2(1, 0), 1.0 - bary.y), float3(vxID + float2(0, 1), 1.0 - bary.x) ); - + return (bary.z > 0) ? pos : neg; } - + float4 DeliotHeitzSampleTexture(Texture2D tex, SamplerState texSampler, float2 uv, float2 dx, float2 dy) { // UVBW[0...2].xy = UV Offsets // UVBW[0...2].z = Blend Weights float3x3 UVBW = DeliotHeitzStochasticUVBW(uv); - + //blend samples with calculated weights return mul(tex.SampleGrad(texSampler, uv + StochasticHash2D2D(UVBW[0].xy), dx, dy), UVBW[0].z) + mul(tex.SampleGrad(texSampler, uv + StochasticHash2D2D(UVBW[1].xy), dx, dy), UVBW[1].z) + mul(tex.SampleGrad(texSampler, uv + StochasticHash2D2D(UVBW[2].xy), dx, dy), UVBW[2].z) ; } - + float4 DeliotHeitzSampleTexture(Texture2D tex, SamplerState texSampler, float2 uv) { float2 dx = ddx(uv), dy = ddy(uv); return DeliotHeitzSampleTexture(tex, texSampler, uv, dx, dy); } #endif // defined(_STOCHASTICMODE_DELIOT_HEITZ) - + #if defined(_STOCHASTICMODE_HEXTILE) // HexTiling: Slower, but histogram-preserving // SPDX-License-Idenfitier: MIT @@ -51707,22 +52817,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" const float2x2 stochasticInverseSkewedGrid = float2x2(1.0, 0.5, 0.0, 1.0/1.15470054); return mul(stochasticInverseSkewedGrid, vertex) * 0.288675; } - + float2x2 HextileLoadRot2x2(float2 idx, float rotStrength) { float angle = abs(idx.x * idx.y) + abs(idx.x + idx.y) + PI; - + // remap to +/-pi angle = glsl_mod(angle, 2 * PI); if(angle < 0) angle += 2 * PI; if(angle > PI) angle -= 2 * PI; - + angle *= rotStrength; - + float cs = cos(angle), si = sin(angle); return float2x2(cs, -si, si, cs); } - + // UV Offsets and base blend weights // UVBWR[0...2].xy = UV Offsets // UVBWR[0...2].zw = rotation costh/sinth -> reconstruct rotation matrix with float2x2(UVBWR[n].z, -UVBWR[n].w, UVBWR[n].w, UVBWR[n].z) @@ -51733,30 +52843,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // Skew input space into simplex triangle grid (3.4641 ~= 2*sqrt(3)) const float2x2 stochasticSkewedGrid = float2x2(1.0, -0.57735027, 0.0, 1.15470054); float2 skewedCoord = mul(stochasticSkewedGrid, uv * 3.4641 * _StochasticHexGridDensity); - + float2 baseId = float2(floor(skewedCoord)); float3 temp = float3(frac(skewedCoord), 0); temp.z = 1 - temp.x - temp.y; - + float s = step(0.0, -temp.z); float s2 = 2 * s - 1; - + float3 weights = float3(-temp.z * s2, s - temp.y * s2, s - temp.x * s2); - + float2 vertex0 = baseId + float2(s, s); float2 vertex1 = baseId + float2(s, 1 - s); float2 vertex2 = baseId + float2(1 - s, s); - + float2 cen0 = HextileMakeCenUV(vertex0), cen1 = HextileMakeCenUV(vertex1), cen2 = HextileMakeCenUV(vertex2); float2x2 rot0 = float2x2(1, 0, 0, 1), rot1 = float2x2(1, 0, 0, 1), rot2 = float2x2(1, 0, 0, 1); - + if(_StochasticHexRotationStrength > 0) { rot0 = HextileLoadRot2x2(vertex0, _StochasticHexRotationStrength); rot1 = HextileLoadRot2x2(vertex1, _StochasticHexRotationStrength); rot2 = HextileLoadRot2x2(vertex2, _StochasticHexRotationStrength); } - + return float4x4( float4(mul(uv - cen0, rot0) + cen0 + StochasticHash2D2D(vertex0), rot0[0].x, -rot0[0].y), float4(mul(uv - cen1, rot1) + cen1 + StochasticHash2D2D(vertex1), rot1[0].x, -rot1[0].y), @@ -51764,68 +52874,68 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4(weights, 0) ); } - + float4 HextileSampleTexture(Texture2D tex, SamplerState texSampler, float2 uv, bool isNormalMap, float2 dUVdx, float2 dUVdy) { // For some reason doing this instead of just calculating it directly prevents it from \ // breaking after a certain number of textures use it. I don't understand why yet float4x4 UVBWR = HextileUVBWR(uv); - + // 2D Rotation Matrices for dUVdx/dy // Not sure if this constant folds during compiling when rot is locked at 0, so force it float2x2 rot0 = float2x2(1, 0, 0, 1), rot1 = float2x2(1, 0, 0, 1), rot2 = float2x2(1, 0, 0, 1); - + if(_StochasticHexRotationStrength > 0) { rot0 = float2x2(UVBWR[0].z, -UVBWR[0].w, UVBWR[0].w, UVBWR[0].z); rot1 = float2x2(UVBWR[1].z, -UVBWR[1].w, UVBWR[1].w, UVBWR[1].z); rot2 = float2x2(UVBWR[2].z, -UVBWR[2].w, UVBWR[2].w, UVBWR[2].z); } - + // Weights float3 W = UVBWR[3].xyz; - + // Sample texture // float3x4 c = float3x4( // tex.SampleGrad(texSampler, UVBWR[0].xy, mul(dUVdx, rot0), mul(dUVdy, rot0)), // tex.SampleGrad(texSampler, UVBWR[1].xy, mul(dUVdx, rot1), mul(dUVdy, rot1)), // tex.SampleGrad(texSampler, UVBWR[2].xy, mul(dUVdx, rot2), mul(dUVdy, rot2)) // ); - + float4 c0 = tex.SampleGrad(texSampler, UVBWR[0].xy, mul(dUVdx, rot0), mul(dUVdy, rot0)); float4 c1 = tex.SampleGrad(texSampler, UVBWR[1].xy, mul(dUVdx, rot1), mul(dUVdy, rot1)); float4 c2 = tex.SampleGrad(texSampler, UVBWR[2].xy, mul(dUVdx, rot2), mul(dUVdy, rot2)); - + // Blend samples using luminance // This is technically incorrect for normal maps, but produces very similar // results to blending using normal map gradients (steepness) const float3 Lw = float3(0.299, 0.587, 0.114); float3 Dw = float3(dot(c0.xyz, Lw), dot(c1.xyz, Lw), dot(c2.xyz, Lw)); - + Dw = lerp(1.0, Dw, _StochasticHexFallOffContrast); W = Dw * pow(W, _StochasticHexFallOffPower); // In the original hextiling there's a Gain3 step here, but it seems to slow things down \ // and cause the UVs to break, so I've omitted it. Looks fine without - + W /= (W.x + W.y + W.z); return W.x * c0 + W.y * c1 + W.z * c2; } - + float4 HextileSampleTexture(Texture2D tex, SamplerState texSampler, float2 uv, bool isNormalMap) { return HextileSampleTexture(tex, texSampler, uv, isNormalMap, ddx(uv), ddy(uv)); } #endif // defined(_STOCHASTICMODE_HEXTILE) - + void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods) { poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod); - + if (_AlphaGlobalMask > 0) { poiFragData.alpha = maskBlend(poiFragData.alpha, poiMods.globalMask[_AlphaGlobalMask - 1], _AlphaGlobalMaskBlendType); } - + //ifex _AlphaDistanceFade==0 && isNotAnimated(_AlphaDistanceFade) if (_AlphaDistanceFade) { @@ -51838,7 +52948,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.alpha *= distanceFadeMultiplier; } //endex - + //ifex _AlphaFresnel==0 && isNotAnimated(_AlphaFresnel) if (_AlphaFresnel) { @@ -51852,7 +52962,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.alpha *= holoRim; } //endex - + //ifex _AlphaAngular==0 && isNotAnimated(_AlphaAngular) if (_AlphaAngular) { @@ -51885,7 +52995,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.alpha *= angularAlphaMod; } //endex - + //ifex _AlphaAudioLinkEnabled==0 && isNotAnimated(_AlphaAudioLinkEnabled) #ifdef POI_AUDIOLINK if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled) @@ -51894,9 +53004,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + } - + //ifex _AlphaDithering==0 && isNotAnimated(_AlphaDithering) inline half Dither8x8Bayer(int x, int y) { @@ -51914,12 +53024,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" int r = y * 8 + x; return dither[r]; } - + half calcDither(half2 grabPos) { return Dither8x8Bayer(glsl_mod(grabPos.x, 8), glsl_mod(grabPos.y, 8)); } - + void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam) { if (_AlphaDithering) @@ -51929,7 +53039,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } //endex - + //ifex _AlphaToCoverage==0 && isNotAnimated(_AlphaToCoverage) void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh) { @@ -51949,7 +53059,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } //endex - + //ifex _GlobalMaskTexturesEnable==0 #ifdef POI_GLOBALMASK_TEXTURES void ApplyGlobalMaskTextures(in PoiMesh poiMesh, inout PoiMods poiMods) @@ -51971,7 +53081,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[3] = gmcol0[3]; } #endif - + #if defined(PROP_GLOBALMASKTEXTURE1) || !defined(OPTIMIZER_ENABLED) float4 gmcol1 = POI2D_SAMPLER_PAN(_GlobalMaskTexture1, _MainTex, poiUV(poiMesh.uv[_GlobalMaskTexture1UV], _GlobalMaskTexture1_ST), _GlobalMaskTexture1Pan); if (_GlobalMaskTexture1Split) @@ -51989,7 +53099,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[7] = gmcol1[3]; } #endif - + #if defined(PROP_GLOBALMASKTEXTURE2) || !defined(OPTIMIZER_ENABLED) float4 gmcol2 = POI2D_SAMPLER_PAN(_GlobalMaskTexture2, _MainTex, poiUV(poiMesh.uv[_GlobalMaskTexture2UV], _GlobalMaskTexture2_ST), _GlobalMaskTexture2Pan); if (_GlobalMaskTexture2Split) @@ -52007,7 +53117,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[11] = gmcol2[3]; } #endif - + #if defined(PROP_GLOBALMASKTEXTURE3) || !defined(OPTIMIZER_ENABLED) float4 gmcol3 = POI2D_SAMPLER_PAN(_GlobalMaskTexture3, _MainTex, poiUV(poiMesh.uv[_GlobalMaskTexture3UV], _GlobalMaskTexture3_ST), _GlobalMaskTexture3Pan); if (_GlobalMaskTexture3Split) @@ -52092,7 +53202,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (_GlobalMaskToggleOn_13) poiMods.globalMask[13] = 1; if (_GlobalMaskToggleOn_14) poiMods.globalMask[14] = 1; if (_GlobalMaskToggleOn_15) poiMods.globalMask[15] = 1; - + poiMods.globalMask[0] *= (1 - _GlobalMaskToggleOff_0); poiMods.globalMask[1] *= (1 - _GlobalMaskToggleOff_1); poiMods.globalMask[2] *= (1 - _GlobalMaskToggleOff_2); @@ -52111,10 +53221,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[15] *= (1 - _GlobalMaskToggleOff_15); } //endex - + } //endex - + float customDistanceBlend(float base, float blend, float blendType) { switch(blendType) @@ -52124,7 +53234,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" default: return 0; break; } } - + void handleGlobalMaskDistance(int index, bool enable, bool type, float minAlpha, float maxAlpha, float min, float max, int blendType, in PoiMesh poiMesh, inout PoiMods poiMods) { if (enable) @@ -52134,7 +53244,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[index] = saturate(customDistanceBlend(poiMods.globalMask[index], val, blendType)); } } - + void ApplyGlobalMaskModifiers(in PoiMesh poiMesh, inout PoiMods poiMods, in PoiCam poiCam) { //ifex _GlobalMaskModifiersBackfaceEnable==0 @@ -52160,7 +53270,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[15] *= _GlobalMaskBackface_15 == 0 ? 1 : (facingMode == (_GlobalMaskBackface_15)); } //endex - + //ifex _GlobalMaskModifiersMirrorEnable==0 if (_GlobalMaskModifiersMirrorEnable) { @@ -52169,7 +53279,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" mirrorMode = VRCMirrorMode() > 0; else // Generic (CVR, etc) mirrorMode = IsInMirror(); - + mirrorMode += 1; // _GlobalMaskMirror is 0 for ignore, 1 for outside mirror only, 2 for in mirror only poiMods.globalMask[0] *= _GlobalMaskMirror_0 == 0 ? 1 : (mirrorMode == (_GlobalMaskMirror_0)); @@ -52190,7 +53300,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMods.globalMask[15] *= _GlobalMaskMirror_15 == 0 ? 1 : (mirrorMode == (_GlobalMaskMirror_15)); } //endex - + //ifex _GlobalMaskModifiersCameraEnable==0 if (_GlobalMaskModifiersCameraEnable) { @@ -52266,12 +53376,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" //ifex _GlobalMaskDistanceEnable_15==0 handleGlobalMaskDistance(15, _GlobalMaskDistanceEnable_15, _GlobalMaskDistanceType_15, _GlobalMaskDistanceMinAlpha_15, _GlobalMaskDistanceMaxAlpha_15, _GlobalMaskDistanceMin_15, _GlobalMaskDistanceMax_15, _GlobalMaskDistanceBlendType_15, poiMesh, poiMods); //endex - + } //endex - + } - + //ifex _GlobalMaskVertexColorRed==0 && _GlobalMaskVertexColorGreen==0 && _GlobalMaskVertexColorBlue==0 && _GlobalMaskVertexColorAlpha==0 void ApplyGlobalMaskVertexColors(in PoiMesh poiMesh, inout PoiMods poiMods) { @@ -52298,7 +53408,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } //endex - + //ifex _EnableUDIMDiscardOptions==0 #ifdef POI_UDIMDISCARD void applyUDIMDiscard(in VertexOut i) @@ -52306,29 +53416,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if(_UDIMDiscardMode == 1) // Don't run if in vertex mode { float2 udim = floor(vertexUV(i, _UDIMDiscardUV)); - + float isDiscarded = 0; float4 xMask = float4( (udim.x >= 0 && udim.x < 1), (udim.x >= 1 && udim.x < 2), (udim.x >= 2 && udim.x < 3), (udim.x >= 3 && udim.x < 4)); - + isDiscarded += (udim.y >= 0 && udim.y < 1) * dot(float4(_UDIMDiscardRow0_0, _UDIMDiscardRow0_1, _UDIMDiscardRow0_2, _UDIMDiscardRow0_3), xMask); isDiscarded += (udim.y >= 1 && udim.y < 2) * dot(float4(_UDIMDiscardRow1_0, _UDIMDiscardRow1_1, _UDIMDiscardRow1_2, _UDIMDiscardRow1_3), xMask); isDiscarded += (udim.y >= 2 && udim.y < 3) * dot(float4(_UDIMDiscardRow2_0, _UDIMDiscardRow2_1, _UDIMDiscardRow2_2, _UDIMDiscardRow2_3), xMask); isDiscarded += (udim.y >= 3 && udim.y < 4) * dot(float4(_UDIMDiscardRow3_0, _UDIMDiscardRow3_1, _UDIMDiscardRow3_2, _UDIMDiscardRow3_3), xMask); - + isDiscarded *= any(float4(udim.y >= 0, udim.y < 4, udim.x >= 0, udim.x < 4)); // never discard outside 4x4 grid in pos coords - + const float threshold = 0.001; clip(threshold - isDiscarded); // Clip if discarded } - + return; } #endif //endex - + float2 calculatePolarCoordinate(in PoiMesh poiMesh) { float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter; @@ -52338,10 +53448,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float phi_frac = frac(phi); angle = fwidth(phi) - 0.0001 < fwidth(phi_frac) ? phi : phi_frac; angle *= _PolarLengthScale; - + return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower); } - + float2 MonoPanoProjection(float3 coords) { float3 normalizedCoords = normalize(coords); @@ -52355,7 +53465,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" sphereCoords = float2(1.0, 1.0) - sphereCoords; return (sphereCoords + float4(0, 1 - unity_StereoEyeIndex, 1, 1.0).xy) * float4(0, 1 - unity_StereoEyeIndex, 1, 1.0).zw; } - + float2 StereoPanoProjection(float3 coords) { float3 normalizedCoords = normalize(coords); @@ -52369,12 +53479,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" sphereCoords = float2(0.5, 1.0) - sphereCoords; return (sphereCoords + float4(0, 1 - unity_StereoEyeIndex, 1, 0.5).xy) * float4(0, 1 - unity_StereoEyeIndex, 1, 0.5).zw; } - + float2 calculateWorldUV(in PoiMesh poiMesh) { return float2(_UVModWorldPos0 != 3 ? poiMesh.worldPos[ _UVModWorldPos0] : 0.0f, _UVModWorldPos1 != 3 ? poiMesh.worldPos[_UVModWorldPos1] : 0.0f); } - + float2 calculatelocalUV(in PoiMesh poiMesh) { float localUVs[8]; @@ -52386,10 +53496,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" localUVs[5] = poiMesh.vertexColor.g; localUVs[6] = poiMesh.vertexColor.b; localUVs[7] = poiMesh.vertexColor.a; - + return float2(localUVs[_UVModLocalPos0],localUVs[_UVModLocalPos1]); } - + float2 calculatePanosphereUV(in PoiMesh poiMesh) { float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1; @@ -52404,22 +53514,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float4 flowVector = -1; #endif - + #if defined(PROP_DISTORTIONFLOWTEXTURE1) || !defined(OPTIMIZER_ENABLED) float4 flowVector1 = POI2D_SAMPLER_PAN(_DistortionFlowTexture1, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTexture1UV], _DistortionFlowTexture1_ST), _DistortionFlowTexture1Pan) * 2 - 1; #else float4 flowVector1 = -1; #endif - + #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED) half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan)[_DistortionMaskChannel]; #else half distortionMask = 1; #endif - + half distortionStrength = _DistortionStrength; half distortionStrength1 = _DistortionStrength1; - + #ifdef POI_AUDIOLINK UNITY_BRANCH if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle) @@ -52428,14 +53538,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" distortionStrength1 += lerp(_DistortionStrength1AudioLink.x, _DistortionStrength1AudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrength1AudioLinkBand))).r); } #endif - + flowVector *= distortionStrength; flowVector1 *= distortionStrength1; return poiMesh.uv[_DistortionUvToDistort] + ((flowVector.xy + flowVector1.xy) / 2) * distortionMask; } #endif //endex - + //ifex _PoiParallax==0 #ifdef POI_PARALLAX inline float2 POM(in PoiLight poiLight, sampler2D heightMap, in PoiMesh poiMesh, float3 worldViewDir, float3 viewDirTan, int minSamples, int maxSamples, float parallax, float refPlane, float2 tilling, float2 curv) @@ -52449,7 +53559,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float heightMask = 1; #endif - + float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST); float2 dx = ddx(uvs); float2 dy = ddy(uvs); @@ -52523,7 +53633,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #ifdef UNITY_PASS_SHADOWCASTER } #endif - + return uvs + finalTexOffset; } /* @@ -52536,7 +53646,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 uvDelta = tangentViewDir.xy * (stepSize * strength); float prevStepHeight = stepHeight; float prevSurfaceHeight = surfaceHeight; - + [unroll(20)] for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++) { @@ -52547,13 +53657,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" stepHeight -= stepSize; surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset; } - + [unroll(3)] for (int k = 0; k < 3; k++) { uvDelta *= 0.5; stepSize *= 0.5; - + if (stepHeight < surfaceHeight) { uvOffset += uvDelta; @@ -52594,7 +53704,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" if (_ParallaxUV == 7) poiMesh.uv[7] += offset; #endif */ - + #if defined(OPTIMIZER_ENABLED) poiMesh.uv[_ParallaxUV] = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV)); #else @@ -52611,7 +53721,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _BlackLightMaskingEnabled==0 #ifdef POI_BLACKLIGHTMASKING void calculateBlackLightMasks(in PoiMesh poiMesh, inout PoiMods poiMods) @@ -52629,7 +53739,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" applyToGlobalMask(poiMods, _BlackLightMasking0GlobalMaskIndex - 1, _BlackLightMasking0GlobalMaskBlendType, smoothstep(_BlackLightMasking0Range.y, _BlackLightMasking0Range.x, distance(poiMesh.worldPos, lightPos))); } } - + if (_BlackLightMasking1GlobalMaskIndex > 0) { if (unity_LightColor[lightIndex].a == _BlackLightMasking1Key) @@ -52637,7 +53747,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" applyToGlobalMask(poiMods, _BlackLightMasking1GlobalMaskIndex - 1, _BlackLightMasking1GlobalMaskBlendType, smoothstep(_BlackLightMasking1Range.y, _BlackLightMasking1Range.x, distance(poiMesh.worldPos, lightPos))); } } - + if (_BlackLightMasking2GlobalMaskIndex > 0) { if (unity_LightColor[lightIndex].a == _BlackLightMasking2Key) @@ -52645,7 +53755,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" applyToGlobalMask(poiMods, _BlackLightMasking2GlobalMaskIndex - 1, _BlackLightMasking2GlobalMaskBlendType, smoothstep(_BlackLightMasking0Range.y, _BlackLightMasking0Range.x, distance(poiMesh.worldPos, lightPos))); } } - + if (_BlackLightMasking3GlobalMaskIndex > 0) { if (unity_LightColor[lightIndex].a == _BlackLightMasking3Key) @@ -52660,17 +53770,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { applyToGlobalMask(poiMods, _BlackLightMasking0GlobalMaskIndex - 1, _BlackLightMasking0GlobalMaskBlendType, 0); } - + if (_BlackLightMasking1GlobalMaskIndex > 0) { applyToGlobalMask(poiMods, _BlackLightMasking1GlobalMaskIndex - 1, _BlackLightMasking1GlobalMaskBlendType, 0); } - + if (_BlackLightMasking2GlobalMaskIndex > 0) { applyToGlobalMask(poiMods, _BlackLightMasking2GlobalMaskIndex - 1, _BlackLightMasking2GlobalMaskBlendType, 0); } - + if (_BlackLightMasking3GlobalMaskIndex > 0) { applyToGlobalMask(poiMods, _BlackLightMasking3GlobalMaskIndex - 1, _BlackLightMasking3GlobalMaskBlendType, 0); @@ -52679,7 +53789,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _MainVertexColoringEnabled==0 void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh) { @@ -52693,7 +53803,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } //endex - + //ifex _BackFaceEnabled!=1 #ifdef POI_BACKFACE void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods) @@ -52705,8 +53815,12 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #if defined(PROP_BACKFACETEXTURE) || !defined(OPTIMIZER_ENABLED) backFaceColor *= POI2D_SAMPLER_PAN(_BackFaceTexture, _MainTex, poiUV(poiMesh.uv[_BackFaceTextureUV], _BackFaceTexture_ST), _BackFaceTexturePan); #endif - backFaceColor.rgb = hueShift(backFaceColor.rgb, frac(_BackFaceHueShift + _BackFaceHueShiftSpeed * _Time.x) * _BackFaceHueShiftEnabled); - + + if (_BackFaceHueShiftEnabled) + { + backFaceColor.rgb = hueShift(backFaceColor.rgb, frac(_BackFaceHueShift + _BackFaceHueShiftSpeed * _Time.x), _BackFaceShiftColorSpace); + } + float backFaceMask = 1; #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED) backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan)[_BackFaceMaskChannel]; @@ -52715,22 +53829,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { backFaceMask *= backFaceColor.a; } - + poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask); - + UNITY_BRANCH if (_BackFaceReplaceAlpha) { poiFragData.alpha = backFaceColor.a; } - + poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask; poiMods.globalEmission = poiMods.globalEmission * _BackFaceEmissionLimiter; } } #endif //endex - + //ifex _EnableDissolve==0 #ifdef DISTORT void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods, in PoiCam poiCam, in PoiLight poiLight) @@ -52750,19 +53864,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { dissolveMask = maskBlend(dissolveMask, poiMods.globalMask[_DissolveMaskGlobalMask - 1], _DissolveMaskGlobalMaskBlendType); } - + #if defined(PROP_DISSOLVETOTEXTURE) || !defined(OPTIMIZER_ENABLED) dissolveToTexture = POI2D_SAMPLER_PAN(_DissolveToTexture, _MainTex, poiUV(poiMesh.uv[_DissolveToTextureUV], _DissolveToTexture_ST), _DissolveToTexturePan) * float4(poiThemeColor(poiMods, _DissolveTextureColor.rgb, _DissolveTextureColorThemeIndex), _DissolveTextureColor.a); #else - dissolveToTexture = _DissolveTextureColor; + dissolveToTexture = float4(poiThemeColor(poiMods, _DissolveTextureColor.rgb, _DissolveTextureColorThemeIndex), _DissolveTextureColor.a); #endif - + #if defined(PROP_DISSOLVENOISETEXTURE) || !defined(OPTIMIZER_ENABLED) float dissolveNoiseTexture = POI2D_SAMPLER_PAN(_DissolveNoiseTexture, _MainTex, poiUV(poiMesh.uv[_DissolveNoiseTextureUV], _DissolveNoiseTexture_ST), _DissolveNoiseTexturePan).r; #else float dissolveNoiseTexture = 1; #endif - + float da = _DissolveAlpha + _DissolveAlpha0 + _DissolveAlpha1 @@ -52775,22 +53889,22 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" + _DissolveAlpha8 + _DissolveAlpha9; float dds = _DissolveDetailStrength; - + if (_UVTileDissolveEnabled) { float2 udim = floor(poiMesh.uv[(int)_UVTileDissolveUV]); - + float4 xMask = float4((udim.x >= 0 && udim.x < 1), (udim.x >= 1 && udim.x < 2), (udim.x >= 2 && udim.x < 3), (udim.x >= 3 && udim.x < 4)); - + da += (udim.y >= 0 && udim.y < 1) * dot(float4(_UVTileDissolveAlpha_Row0_0, _UVTileDissolveAlpha_Row0_1, _UVTileDissolveAlpha_Row0_2, _UVTileDissolveAlpha_Row0_3), xMask); da += (udim.y >= 1 && udim.y < 2) * dot(float4(_UVTileDissolveAlpha_Row1_0, _UVTileDissolveAlpha_Row1_1, _UVTileDissolveAlpha_Row1_2, _UVTileDissolveAlpha_Row1_3), xMask); da += (udim.y >= 2 && udim.y < 3) * dot(float4(_UVTileDissolveAlpha_Row2_0, _UVTileDissolveAlpha_Row2_1, _UVTileDissolveAlpha_Row2_2, _UVTileDissolveAlpha_Row2_3), xMask); da += (udim.y >= 3 && udim.y < 4) * dot(float4(_UVTileDissolveAlpha_Row3_0, _UVTileDissolveAlpha_Row3_1, _UVTileDissolveAlpha_Row3_2, _UVTileDissolveAlpha_Row3_3), xMask); } - + #ifdef POI_AUDIOLINK UNITY_BRANCH if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable) @@ -52799,10 +53913,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]); } #endif - + da = saturate(da); dds = saturate(dds); - + if (_DissolveMaskInvert) { dissolveMask = 1 - dissolveMask; @@ -52827,33 +53941,33 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" da *= dissolveMask; dissolveAlpha = da; edgeAlpha = 0; - + [flatten] switch(_DissolveType) { default: // Basic (case 1) - + { da = remap(da, 0, 1, -_DissolveEdgeWidth, 1); dissolveAlpha = da; //Adjust detail strength to avoid artifacts dds *= smoothstep(1, 0.99, da) * lerp(1, smoothstep(0, lerp(0.01, 0.1, dds), da), _DissolveDetailEdgeSmoothing); float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds); - + noise = saturate(noise * 0.998 + 0.001); dissolveAlpha = dissolveAlpha >= noise; edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha); break; } case 2: // Point to Point - + { float3 direction; float3 currentPos; float distanceTo = 0; direction = normalize(_DissolveEndPoint - _DissolveStartPoint); currentPos = lerp(_DissolveStartPoint, _DissolveEndPoint, dissolveAlpha); - + UNITY_BRANCH if (_DissolveP2PWorldLocal != 1) { @@ -52870,17 +53984,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" dissolveAlpha = (distanceTo < 0) ? 1 : 0; edgeAlpha *= 1 - dissolveAlpha; } - + if (_DissolveP2PClamp) { dissolveAlpha = saturate(dissolveAlpha * smoothstep(0, 0.01, da) + smoothstep(0.99, 1, da)); edgeAlpha *= smoothstep(0, 0.01, da); } - + break; } case 3: // Spherical - + { if (_SphericalDissolveInvert) { @@ -52890,14 +54004,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { da = remap(da, 0, 1, -_DissolveEdgeWidth, 1); } - + dissolveAlpha = da; dds *= smoothstep(0, 0.2 * dds + 0.01, dissolveAlpha) * lerp(1, smoothstep(1, 1 - 0.2 * dds - 0.01, dissolveAlpha), _DissolveDetailEdgeSmoothing); float currentDistance = lerp(0, _SphericalDissolveRadius, dissolveAlpha); float fragDistance = distance(_SphericalDissolveCenter, poiMesh.localPos.xyz); float normalizedDistance; normalizedDistance = (fragDistance - currentDistance) / (_SphericalDissolveRadius + 0.0001) - dissolveDetailNoise * dds; - + if (_SphericalDissolveInvert) { dissolveAlpha = (normalizedDistance > 0) ? 1 : 0; @@ -52908,62 +54022,62 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" dissolveAlpha = (normalizedDistance < 0) ? 1 : 0; edgeAlpha = smoothstep(_DissolveEdgeWidth + .00001, 0, normalizedDistance); } - + if (_SphericalDissolveClamp) { da = lerp(da, 1 - da, _SphericalDissolveInvert); dissolveAlpha = saturate(dissolveAlpha * smoothstep(0, 0.01, da) + smoothstep(0.99, 1, da)); edgeAlpha *= smoothstep(0, 0.01, da); } - + break; } case 4: // CenterOut - + { float ramp = 0.5; float noise; - + [flatten] switch(_CenterOutDissolveMode) { case 1: // View Direction - + { ramp = saturate(lerp(poiLight.vertexNDotV, poiLight.nDotV, _CenterOutDissolveNormals)); break; } case 2: // Custom Direction - + { ramp = dot(normalize(_CenterOutDissolveDirection), lerp(poiMesh.normals[0], poiMesh.normals[1], _CenterOutDissolveNormals)); ramp = saturate(ramp * .5 + 0.5); break; } case 3: // Light Direction - + { ramp = lerp(poiLight.vertexNDotL, poiLight.nDotL, _CenterOutDissolveNormals); ramp = saturate(ramp * .5 + 0.5); break; } } - + if (_CenterOutDissolvePower != 1) { ramp = pow(ramp, _CenterOutDissolvePower); } - + if (!_CenterOutDissolveInvert) { ramp = 1 - ramp; } - + da = remap(da, 0, 1, -_DissolveEdgeWidth, 1); dissolveAlpha = da; //Adjust detail strength to avoid artifacts dds *= smoothstep(1, 0.99, da) * lerp(1, smoothstep(0, lerp(0.01, 0.1, dds), da), _DissolveDetailEdgeSmoothing); - + noise = saturate(ramp - dissolveDetailNoise * dds); noise = saturate(noise * 0.998 + 0.001); dissolveAlpha = dissolveAlpha >= noise; @@ -52971,27 +54085,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" break; } } - + #ifndef POI_SHADOW UNITY_BRANCH if (_DissolveHueShiftEnabled) { - dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed); + dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed, _DissolveHueShiftColorSpace); } #endif - + poiFragData.alpha = lerp(poiFragData.alpha, dissolveToTexture.a, dissolveAlpha * .999999); - + #if !defined(POI_PASS_OUTLINE) && !defined(UNITY_PASS_SHADOWCASTER) poiFragData.baseColor = lerp(poiFragData.baseColor, dissolveToTexture.rgb, dissolveAlpha * .999999); - + if (_DissolveApplyGlobalMaskIndex > 0) { applyToGlobalMask(poiMods, _DissolveApplyGlobalMaskIndex - 1, _DissolveApplyGlobalMaskBlendType, dissolveAlpha * .999999); } if (_DissolveInverseApplyGlobalMaskIndex > 0) { - applyToGlobalMask(poiMods, _DissolveInverseApplyGlobalMaskIndex - 1, _DissolveInverseApplyGlobalMaskBlendType, 1-(dissolveAlpha * .999999)); + applyToGlobalMask(poiMods, _DissolveInverseApplyGlobalMaskIndex - 1, _DissolveInverseApplyGlobalMaskBlendType, 1 - (dissolveAlpha * .999999)); } UNITY_BRANCH if (_DissolveEdgeWidth || (_DissolveType == 2 && _DissolveP2PEdgeLength != 0)) @@ -53001,18 +54115,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" UNITY_BRANCH if (_DissolveEdgeHueShiftEnabled) { - edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed); + edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed, _DissolveEdgeHueShiftColorSpace); } #endif poiFragData.baseColor = lerp(poiFragData.baseColor, edgeColor.rgb, smoothstep(0, 1 - _DissolveEdgeHardness * .99999999999, edgeAlpha)); } - + poiFragData.emission += lerp(0, dissolveToTexture * _DissolveToEmissionStrength, dissolveAlpha) + lerp(0, edgeColor.rgb * _DissolveEdgeEmission, smoothstep(0, 1 - _DissolveEdgeHardness * .99999999999, edgeAlpha)); #endif } #endif //endex - + //ifex _EnableALDecal==0 #ifdef POI_AUDIOLINK #ifdef POI_AL_DECAL @@ -53026,7 +54140,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { colorAndMask.a = customBlend(colorAndMask.a, poiMods.globalMask[_ALDecalGlobalMask-1], _ALDecalGlobalMaskBlendType); } - + float2 uv = poiMesh.uv[_ALDecalUV]; float2 decalCenter = _ALUVPosition; float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed); @@ -53034,10 +54148,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" 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) - _ALUVScale.xz / 2 + _ALUVPosition, _ALUVScale.yw / 2 + _ALUVPosition, float2(0, 0), float2(1, 1)); - + // Mask float4 audioLinkMask = 1.0; - + // UV float2 aluv = uv; if (_ALDecalUVMode == 1) @@ -53046,7 +54160,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" aluv.x = frac(atan2(uvdir.y, uvdir.x) * UNITY_INV_TWO_PI); aluv.y = length(uvdir); } - + // Scale / Offset / Step float maskY = aluv.y; if (_ALDecalUVMode == 1) @@ -53058,29 +54172,29 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { maskX = remap(maskX, _ALDecaldCircleDimensions.z, _ALDecaldCircleDimensions.w, 0, 1); } - + float maskVolume = _ALDecalVolumeStep != 0.0 ? floor(maskY * _ALDecalVolumeStep) / _ALDecalVolumeStep : maskY; float maskBand = _ALDecalBandStep != 0.0 ? floor(maskX * _ALDecalBandStep) / _ALDecalBandStep : maskX; - + // Copy audioLinkMask.r = maskVolume; audioLinkMask.g = maskBand; - + // Clip audioLinkMask.b = maskVolume < _ALDecalVolumeClipMin || maskVolume > _ALDecalVolumeClipMax ? 0.0 : audioLinkMask.b; audioLinkMask.b = maskBand < _ALDecalBandClipMin || maskBand > _ALDecalBandClipMax ? 0.0 : audioLinkMask.b; - + // Shape Clip if (_ALDecalShapeClip) { float volumeth = _ALDecalShapeClipVolumeWidth; if (_ALDecalVolumeStep != 0.0) audioLinkMask.b = frac(maskY * _ALDecalVolumeStep) > volumeth ? 0.0 : audioLinkMask.b; - + float bandwidth = _ALDecalUVMode == 1 ? _ALDecalShapeClipBandWidth / aluv.y : _ALDecalShapeClipBandWidth; float bandth = 1.0 - bandwidth; if (_ALDecalBandStep != 0.0) audioLinkMask.b = frac(maskX * _ALDecalBandStep + bandth * 0.5) < bandth ? 0.0 : audioLinkMask.b; } - + // AudioLink float2 audioLinkUV = float2(frac(audioLinkMask.g * 2.0), 4.5 / 4.0 + floor(audioLinkMask.g * 2.0) / 4.0); audioLinkUV.y *= 0.0625; @@ -53090,27 +54204,27 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" audioLinkValue = saturate(audioLinkValue) * audioLinkMask.b; //clip(audioLinkValue - .5); audioLinkValue *= colorAndMask.a; - + if (!poiMods.audioLinkAvailable) { audioLinkValue = 0; } - + float3 alColorChord = _AudioTexture.Sample(sampler_linear_clamp, float2(maskX, 24.5 / 64.0)).rgb; float volumeColorSrc = audioLinkMask.g; if (_ALDecalVolumeColorSource == 1) volumeColorSrc = audioLinkMask.r; if (_ALDecalVolumeColorSource == 2) volumeColorSrc = audioVal; - + float3 lowColor = _ALDecalVolumeColorLow.rgb * poiThemeColor(poiMods, _ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorLowThemeIndex); float3 midColor = _ALDecalVolumeColorMid.rgb * poiThemeColor(poiMods, _ALDecalVolumeColorMid.rgb, _ALDecalVolumeColorMidThemeIndex); float3 highColor = _ALDecalVolumeColorHigh.rgb * poiThemeColor(poiMods, _ALDecalVolumeColorHigh.rgb, _ALDecalVolumeColorHighThemeIndex); - + float3 volumeColor = lerp(lowColor, midColor, saturate(volumeColorSrc * 2)); volumeColor = lerp(volumeColor, highColor, saturate(volumeColorSrc * 2 - 1)); - + float3 emissionColor = lerp(lowColor * _ALDecalLowEmission, midColor * _ALDecalMidEmission, saturate(volumeColorSrc * 2)); emissionColor = lerp(emissionColor, highColor * _ALDecalHighEmission, saturate(volumeColorSrc * 2 - 1)); - + //poiFragData.baseColor = lerp(poiFragData.baseColor, volumeColor, audioLinkValue); #if defined(POI_PASS_BASE) || defined(POI_PASS_ADD) poiFragData.emission += emissionColor * audioLinkValue; @@ -53121,10 +54235,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + //ifex _EnableFlipbook==0 #ifdef _SUNDISK_HIGH_QUALITY - + void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) { #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED) @@ -53139,14 +54253,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" flipBookMask = maskBlend(flipBookMask, poiMods.globalMask[_FlipbookMaskGlobalMask-1], _FlipbookMaskGlobalMaskBlendType); } float4 flipbookScaleOffset = _FlipbookScaleOffset; - + #ifdef POI_AUDIOLINK if (poiMods.audioLinkAvailable) { flipbookScaleOffset.xy += lerp(_AudioLinkFlipbookScale.xy, _AudioLinkFlipbookScale.zw, poiMods.audioLink[_AudioLinkFlipbookScaleBand]); } #endif - + flipbookScaleOffset.xy = 1 - flipbookScaleOffset.xy; float2 uv = frac(poiMesh.uv[_FlipbookTexArrayUV]); float theta = radians(_FlipbookRotation + _Time.z * _FlipbookRotationSpeed); @@ -53157,7 +54271,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" uv = float2((uv.x - spriteCenter.x) * cs - (uv.y - spriteCenter.y) * sn + spriteCenter.x, (uv.x - spriteCenter.x) * sn + (uv.y - spriteCenter.y) * cs + spriteCenter.y); float4 sideOffset = float4(-(_FlipbookSideOffset.x), _FlipbookSideOffset.y, -(_FlipbookSideOffset.z), _FlipbookSideOffset.w); float2 newUV = remap(uv, float2(0, 0) + flipbookScaleOffset.xy / 2 + flipbookScaleOffset.zw + sideOffset.xz, float2(1, 1) - flipbookScaleOffset.xy / 2 + flipbookScaleOffset.zw + sideOffset.yw, float2(0, 0), float2(1, 1)); - + UNITY_BRANCH if (_FlipbookTiled == 0) { @@ -53171,7 +54285,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float height; float totalFrames; _FlipbookTexArray.GetDimensions(width, height, totalFrames); - + if (_FlipbookStartAndEnd) { totalFrames -= (totalFrames - min(max(_FlipbookStartFrame, _FlipbookEndFrame), totalFrames)); @@ -53209,6 +54323,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame))); + UNITY_BRANCH if (_FlipbookCrossfadeEnabled) { @@ -53220,7 +54335,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % totalFramesCF))); flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame))); } - + UNITY_BRANCH if (_FlipbookIntensityControlsAlpha) { @@ -53235,11 +54350,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex); } - + UNITY_BRANCH if (_FlipbookHueShiftEnabled) { - flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed); + flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed, _FlipbookHueShiftColorSpace); } half flipbookAlpha = 1; #ifdef POI_AUDIOLINK @@ -53248,11 +54363,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" flipbookAlpha += saturate(lerp(_AudioLinkFlipbookAlpha.x, _AudioLinkFlipbookAlpha.y, poiMods.audioLink[_AudioLinkFlipbookAlphaBand])); } #endif - + #if !defined(POI_PASS_OUTLINE) && !defined(UNITY_PASS_SHADOWCASTER) - + poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, flipBookPixel.rgb, _FlipbookBlendType), flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha); - + float flipbookEmissionStrength = _FlipbookEmissionStrength; #ifdef POI_AUDIOLINK if (poiMods.audioLinkAvailable) @@ -53260,11 +54375,11 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" flipbookEmissionStrength += max(lerp(_AudioLinkFlipbookEmission.x, _AudioLinkFlipbookEmission.y, poiMods.audioLink[_AudioLinkFlipbookEmissionBand]), 0); } #endif - + poiFragData.emission += lerp(0, flipBookPixel.rgb * flipbookEmissionStrength, flipBookPixel.a * _FlipbookColor.a * flipBookMask * flipbookAlpha); - + #endif - + UNITY_BRANCH if (_FlipbookAlphaControlsFinalAlpha) { @@ -53272,10 +54387,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif } - + #endif //endex - + //ifex _EnableMirrorOptions==0 #ifdef POI_MIRROR void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) @@ -53291,7 +54406,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { inMirror = IsInMirror(); } - + #if (defined(POI_PASS_BASE) || defined(POI_PASS_ADD)) #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED) float4 mirrorTexture = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiUV(poiMesh.uv[_MirrorTextureUV], _MirrorTexture_ST), _MirrorTexturePan); @@ -53310,50 +54425,50 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _EnableTouchGlow==0 #ifdef GRAIN void applyDepthFX(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods) { float3 touchEmission = 0; - + float perspectiveDivide = 1.0f / poiCam.clipPos.w; float4 direction = poiCam.worldDirection * perspectiveDivide; float2 screenPos = poiCam.posScreenSpace * perspectiveDivide; float z = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, screenPos); - + #if UNITY_REVERSED_Z if (z == 0) #else if (z == 1) #endif return; - + float depth = CorrectedLinearEyeDepth(z, direction.w); float3 worldpos = direction * depth + _WorldSpaceCameraPos.xyz; /* finalColor.rgb = frac(worldpos); return; */ - + float diff = distance(worldpos, poiMesh.worldPos); //poiFragData.finalColor = diff; - + #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED) float depthMask = POI2D_SAMPLER_PAN(_DepthMask, _MainTex, poiUV(poiMesh.uv[_DepthMaskUV], _DepthMask_ST), _DepthMaskPan)[_DepthMaskChannel]; #else float depthMask = 1; #endif - + if (_DepthMaskGlobalMask > 0) { depthMask = maskBlend(depthMask, poiMods.globalMask[_DepthMaskGlobalMask - 1], _DepthMaskGlobalMaskBlendType); } - + if (_DepthColorToggle) { float colorBlendAlpha = lerp(_DepthColorMinValue, _DepthColorMaxValue, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff)); - + #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED) float2 depthTextureUV = float2(0, 0); if (_DepthTextureUV == 8) @@ -53368,7 +54483,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex); #endif - + switch(_DepthColorBlendMode) { case 0: @@ -53389,7 +54504,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask; } - + if (_DepthAlphaToggle) { poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask); @@ -53397,7 +54512,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + // normal correct code from https://github.com/yoship1639/UniToon (MIT) //ifex _NormalCorrect==0 #ifdef POI_NORMALCORRECT @@ -53412,14 +54527,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _VideoEffectsEnable==0 #ifdef POI_VIDEO_EFFECTS float3 applyBacklight(float3 videoTexture, half backlightStrength) { return max(backlightStrength, videoTexture.rgb); } - + float3 applyViewAngleTN(float3 videoTexture, PoiCam poiCam, PoiMesh poiMesh) { float3 reflectionVector = normalize(reflect(poiCam.viewDir.rgb, poiMesh.normals[1].rgb)); @@ -53437,7 +54552,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" videoTexture = (lerp(videoTexture, videoTexture.gbr, sideShift)); return videoTexture; } - + float calculateCRTPixelBrightness(float2 uv) { float totalPixels = _VideoResolution.x * _VideoResolution.y; @@ -53446,7 +54561,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float currentPixelAlpha = currentPixelNumber / totalPixels; half electronBeamAlpha = frac(_Time.y * _VideoCRTRefreshRate); float electronBeamPixelNumber = totalPixels * electronBeamAlpha; - + float DistanceInPixelsFromCurrentElectronBeamPixel = 0; if (electronBeamPixelNumber >= currentPixelNumber) { @@ -53458,10 +54573,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } float CRTFrameTime = 1 / _VideoCRTRefreshRate; float timeSincecurrentPixelWasHitByElectronBeam = (DistanceInPixelsFromCurrentElectronBeamPixel / totalPixels); - + return saturate(_VideoCRTPixelEnergizedTime - timeSincecurrentPixelWasHitByElectronBeam); } - + void applyContrastSettings(inout float3 pixel) { #if !UNITY_COLORSPACE_GAMMA @@ -53472,18 +54587,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" pixel = GammaToLinearSpace(pixel); #endif } - + void applySaturationSettings(inout float3 pixel) { pixel = lerp(pixel.rgb, dot(pixel.rgb, float3(0.3, 0.59, 0.11)), - (_VideoSaturation)); } - + void applyVideoSettings(inout float3 pixel) { applySaturationSettings(pixel); applyContrastSettings(pixel); } - + void calculateLCD(inout float4 videoTexture, float3 pixels) { videoTexture.rgb = applyBacklight(videoTexture, _VideoBacklight * .01); @@ -53524,13 +54639,13 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" void calculateProjector(inout float4 videoTexture) { applyVideoSettings(videoTexture.rgb); - + float3 projectorColor = videoTexture * _VideoBacklight; videoTexture.r = clamp(projectorColor.r, videoTexture.r, 1000); videoTexture.g = clamp(projectorColor.g, videoTexture.g, 1000); videoTexture.b = clamp(projectorColor.b, videoTexture.b, 1000); } - + void applyVideoEffectsMainTex(inout float4 mainTexture, in PoiMesh poiMesh) { float2 uvs = poiMesh.uv[_MainTexUV]; @@ -53562,7 +54677,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float4 modifiedVideoTexture = 0; modifiedVideoTexture.rgb = poiFragData.baseColor; modifiedVideoTexture.a = poiFragData.alpha; - + // UNITY_BRANCH // if(_VideoRepeatVideoTexture == 1) // { @@ -53571,41 +54686,41 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // return; // } // } - + switch(_VideoType) { case 0: // LCD - + { calculateLCD(modifiedVideoTexture, pixels); break; } case 1: // TN - + { calculateTN(modifiedVideoTexture, pixels, poiCam, poiMesh); break; } case 2: // CRT - + { calculateCRT(modifiedVideoTexture, pixels, uvs); break; } case 3: // OLED - + { calculateOLED(modifiedVideoTexture, pixels); break; } case 4: // Gameboy - + { calculateGameboy(modifiedVideoTexture); break; } case 5: // Projector - + { calculateProjector(modifiedVideoTexture); break; @@ -53616,7 +54731,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float screenMask = 1; #endif - + poiFragData.baseColor = lerp(poiFragData.baseColor, modifiedVideoTexture, screenMask); // UNITY_BRANCH if (_VideoEmissionEnabled) @@ -53626,18 +54741,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + //ifex _BacklightEnabled!=1 #ifdef POI_BACKLIGHT void ApplyBacklight(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiCam poiCam, inout PoiMods poiMods) { - + // Color float3 backlightColor = _BacklightColor.rgb; #if defined(PROP_BACKLIGHTCOLORTEX) || !defined(OPTIMIZER_ENABLED) backlightColor *= POI2D_SAMPLER_PAN(_BacklightColorTex, _MainTex, poiUV(poiMesh.uv[_BacklightColorTexUV], _BacklightColorTex_ST), _BacklightColorTexPan).rgb; #endif - + float3 normal = lerp(poiMesh.normals[0], poiMesh.normals[1], _BacklightNormalStrength); // Factor float3 headDir = normalize(getCameraPosition() - poiMesh.worldPos.xyz); @@ -53652,14 +54767,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" backlightLN = poiEdgeLinear(backlightLN, _BacklightBorder, _BacklightBlur); float backlight = saturate(backlightFactor * backlightLN); backlight = !poiMesh.isFrontFace && _BacklightBackfaceMask ? 0.0 : backlight; - + // Blend backlightColor = lerp(backlightColor, backlightColor * poiFragData.baseColor, _BacklightMainStrength); poiLight.finalLightAdd += backlight * backlightColor * poiLight.directColor; } #endif //endex - + //ifex _VoronoiEnabled!=1 #ifdef POI_VORONOI //1/7 @@ -53671,7 +54786,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { return glsl_mod((34.0 * x + 1.0) * x, 289.0); } - + float3 inoise(float3 P, float jitter, out float3 randomPoint) { P *= 0.7f; // Scale adjustment @@ -53682,10 +54797,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 px = Permutation(Pi.x + oi); float3 py = Permutation(Pi.y + oi); float3 pz = Permutation(Pi.z + oi); - + float3 p, ox, oy, oz, dx, dy, dz; float3 F = 1e6; - + [unroll(3)] for (int i = 0; i < 3; i++) { @@ -53697,19 +54812,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { p = Permutation(px[i] + py[j] + pz[k] + oi); // pij1, pij2, pij3 float3 ogp = p; - + ox = frac(p * VoronoiK) - VoronoiKo; oy = glsl_mod(floor(p * VoronoiK), 7.0) * VoronoiK - VoronoiKo; - + p = Permutation(p); oz = frac(p * VoronoiK) - VoronoiKo; - + dx = Pf.x - of[i] + jitter * ox; dy = Pf.y - of[j] + jitter * oy; dz = Pf.z - of[k] + jitter * oz; - + float3 d = dx * dx + dy * dy + dz * dz; // dij1, dij2 and dij3, squared - + //Find lowest and second lowest distances for (int n = 0; n < 3; n++) { @@ -53727,17 +54842,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } } - + return F; } - + float voronoi2D(in float2 x, float scale, float2 speed, out float2 randomPoint) { x *= scale; x += speed * _Time.x; float2 n = floor(x); float2 f = frac(x); - + // first pass: regular voronoi float2 mg, mr; float md = 8.0; @@ -53748,10 +54863,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float2 g = float2(float(i), float(j)); float2 o = random2(n + g); float2 currentPoint = o; - + float2 r = g + o - f; float d = dot(r, r); - + if (d < md) { md = d; @@ -53761,7 +54876,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } } - + // second pass: distance to borders md = 8.0; for (int r = -2; r <= 2; r++) @@ -53770,9 +54885,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { float2 g = mg + float2(float(q), float(r)); float2 o = random2(n + g); - + float2 r = g + o - f; - + if (dot(mr - r, mr - r) > 0.00001) { md = min(md, dot(0.5 * (mr + r), normalize(r - mr))); @@ -53781,14 +54896,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return md; } - + float voronoi3D(in float3 x, float scale, float3 speed, out float3 randomPoint) { x *= scale; x += speed * _Time.x; float3 n = floor(x); float3 f = frac(x); - + // first pass: regular voronoi float3 mg, mr; float md = 8.0; @@ -53801,10 +54916,10 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" float3 g = float3(float(h), float(i), float(j)); float3 o = random3(n + g); float3 currentPoint = o; - + float3 r = g + o - f; float d = dot(r, r); - + if (d < md) { md = d; @@ -53815,7 +54930,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } } } - + // second pass: distance to borders md = 8.0; for (int r = -2; r <= 2; r++) @@ -53826,9 +54941,9 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { float3 g = mg + float3(float(p), float(q), float(r)); float3 o = random3(n + g); - + float3 r = g + o - f; - + if (dot(mr - r, mr - r) > 0.00001) { md = min(md, dot(0.5 * (mr + r), normalize(r - mr))); @@ -53838,7 +54953,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } return md; } - + // fracal sum, range -1.0 - 1.0 float VoronoiNoise_Octaves(float3 p, float scale, float3 speed, int octaveNumber, float octaveScale, float octaveAttenuation, float jitter, float time, out float3 randomPoint) { @@ -53849,15 +54964,15 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // for (int i = 0; i < octaveNumber; i ++) // { float3 F = inoise(p * freq + time * speed, jitter, randomPoint) * weight; - + sum += sqrt(F[0]); - + // freq *= octaveScale; // weight *= 1.0f - octaveAttenuation; // } return sum; } - + float VoronoiNoiseDiff_Octaves(float3 p, float scale, float3 speed, int octaveNumber, float octaveScale, float octaveAttenuation, float jitter, float time, out float3 randomPoint) { float freq = scale; @@ -53867,26 +54982,26 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" // for (int i = 0; i < octaveNumber; i ++) // { float3 F = inoise(p * freq + time * speed, jitter, randomPoint) * weight; - + sum += sqrt(F[1]) - sqrt(F[0]); - + // freq *= octaveScale; // weight *= 1.0f - octaveAttenuation; // } return sum; } - + void ApplyVoronoi(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods) { float voronoiOctaveNumber = 1; float voronoiOctaveScale = 1; float voronoiOctaveAttenuation = 1; float3 randomPoint = 0; - + float voronoi = 0; - + float3 position = 0; - + UNITY_BRANCH if (_VoronoiSpace == 0) { @@ -53907,19 +55022,19 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float mask = 1; #endif - + if (_VoronoiGlobalMask > 0) { mask = maskBlend(mask, poiMods.globalMask[_VoronoiGlobalMask - 1], _VoronoiGlobalMaskBlendType); } - + #if defined(PROP_VORONOINOISE) || !defined(OPTIMIZER_ENABLED) float edgeNoise = POI2D_SAMPLER_PAN(_VoronoiNoise, _MainTex, poiUV(poiMesh.uv[_VoronoiNoiseUV], _VoronoiNoise_ST), _VoronoiNoisePan)[_VoronoiNoiseChannel]; #else float edgeNoise = 0; #endif edgeNoise *= _VoronoiNoiseIntensity; - + float3 voronoiSpeed = _VoronoiSpeed * 10; #ifdef POI_AUDIOLINK if (poiMods.audioLinkAvailable) @@ -53929,30 +55044,30 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" position.z += AudioLinkGetChronoTime(_AudioLinkVoronoiChronoSpeedZType, _AudioLinkVoronoiChronoSpeedZBand) * _AudioLinkVoronoiChronoSpeedZSpeed * 0.01; } #endif - + if (_VoronoiType == 0) // Basic - + { voronoi = voronoi2D(position.xy, _VoronoiScale, voronoiSpeed, randomPoint.xy); voronoi *= 1.55; // Range adjustment - + } if (_VoronoiType == 1) // Diff - + { voronoi = VoronoiNoiseDiff_Octaves(position, _VoronoiScale, voronoiSpeed, voronoiOctaveNumber, voronoiOctaveScale, voronoiOctaveAttenuation, 1, _Time.x, randomPoint); } if (_VoronoiType == 2) // Fixed Border - + { voronoi = voronoi3D(position, _VoronoiScale, voronoiSpeed, randomPoint); voronoi *= 1.8; // Range adjustment - + } - + float4 outerColor = _VoronoiOuterColor; float4 innerColor = _VoronoiInnerColor; - + if (_VoronoiEnableRandomCellColor == 1) { float3 rando = random3(randomPoint); @@ -53969,7 +55084,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" voronoiGradient.y -= _AudioLinkVoronoiGradientMaxAdd * poiMods.audioLink[_AudioLinkVoronoiGradientMaxAddBand]; #endif float ramp = smoothstep(voronoiGradient.x, voronoiGradient.y, voronoi); - + if (_VoronoiBlend == 0) { float4 voronoiColor = lerp(outerColor, innerColor, ramp); @@ -53991,7 +55106,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + float4 frag(VertexOut i, uint facing : SV_IsFrontFace) : SV_Target { //ifex _EnableDepthBulge==0 @@ -54000,33 +55115,33 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" return 0; #endif //endex - + //ifex _EnableTouchGlow==0 #ifdef GRAIN clip(-1); return 0; #endif //endex - + UNITY_SETUP_INSTANCE_ID(i); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); - + PoiMesh poiMesh; PoiInitStruct(PoiMesh, poiMesh); - + PoiLight poiLight; PoiInitStruct(PoiLight, poiLight); - + PoiVertexLights poiVertexLights; PoiInitStruct(PoiVertexLights, poiVertexLights); - + PoiCam poiCam; PoiInitStruct(PoiCam, poiCam); - + PoiMods poiMods; PoiInitStruct(PoiMods, poiMods); poiMods.globalEmission = 1; - + PoiFragData poiFragData; poiFragData.smoothness = 1; poiFragData.smoothness2 = 1; @@ -54038,17 +55153,17 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiFragData.finalColor = float3(0, 0, 0); poiFragData.alpha = 1; poiFragData.toggleVertexLights = 0; - + #ifdef POI_UDIMDISCARD applyUDIMDiscard(i); #endif - + //ifex _NormalCorrect==0 #ifdef POI_NORMALCORRECT applyNormalCorrect(i); #endif //endex - + // Mesh Data //poiMesh.objectPosition = mul(unity_ObjectToWorld, float3(0, 0, 0)).xyz; poiMesh.objectPosition = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz; @@ -54062,7 +55177,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMesh.isFrontFace = facing; poiMesh.dx = ddx(poiMesh.uv[0]); poiMesh.dy = ddy(poiMesh.uv[0]); - + poiMesh.isRightHand = i.tangent.w > 0.0; + #ifndef POI_PASS_OUTLINE if (!poiMesh.isFrontFace && _FlipBackfaceNormals) { @@ -54071,14 +55187,14 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMesh.binormal[0] *= -1; } #endif - + poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22); float3 tanToWorld0 = float3(poiMesh.tangent[0].x, poiMesh.binormal[0].x, poiMesh.normals[0].x); float3 tanToWorld1 = float3(poiMesh.tangent[0].y, poiMesh.binormal[0].y, poiMesh.normals[0].y); float3 tanToWorld2 = float3(poiMesh.tangent[0].z, poiMesh.binormal[0].z, poiMesh.normals[0].z); float3 ase_tanViewDir = tanToWorld0 * poiCam.viewDir.x + tanToWorld1 * poiCam.viewDir.y + tanToWorld2 * poiCam.viewDir.z; poiCam.tangentViewDir = normalize(ase_tanViewDir); - + // 0-3 UV0-UV3 // 4 Panosphere UV // 5 world pos xz @@ -54097,7 +55213,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" poiMesh.uv[6] = poiMesh.uv[0]; poiMesh.uv[7] = poiMesh.uv[0]; poiMesh.uv[8] = poiMesh.uv[0]; - + poiMesh.uv[4] = calculatePanosphereUV(poiMesh); poiMesh.uv[5] = calculateWorldUV(poiMesh); poiMesh.uv[6] = calculatePolarCoordinate(poiMesh); @@ -54112,7 +55228,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp)); poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5; */ - + //ifex _PoiParallax==0 #ifdef POI_PARALLAX #ifndef POI_PASS_OUTLINE @@ -54122,7 +55238,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif #endif //endex - + poiMods.globalMask[0] = 1; poiMods.globalMask[1] = 1; poiMods.globalMask[2] = 1; @@ -54154,16 +55270,16 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" ApplyGlobalMaskOptions(poiMods); } //endex - + float2 mainUV = poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST); - + if (_MainPixelMode) { mainUV = sharpSample(_MainTex_TexelSize, mainUV); } - + float4 mainTexture = POI2D_SAMPLER_PAN_STOCHASTIC(_MainTex, _MainTex, mainUV, _MainTexPan, _MainTexStochastic); - + //ifex _VideoEffectsEnable==0 #ifdef POI_VIDEO_EFFECTS if (_VideoEffectsEnable) @@ -54172,48 +55288,48 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" } #endif //endex - + #if defined(PROP_BUMPMAP) || !defined(OPTIMIZER_ENABLED) poiMesh.tangentSpaceNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN_STOCHASTIC(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV].xy, _BumpMap_ST), _BumpMapPan, _BumpMapStochastic), _BumpScale); #else poiMesh.tangentSpaceNormal = UnpackNormal(float4(0.5, 0.5, 1, 1)); #endif - + //ifex _DetailEnabled==0 #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE) ApplyDetailNormal(poiMods, poiMesh); #endif //endex - + //ifex _RGBMaskEnabled==0 #if defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE) calculateRGBNormals(poiMesh, poiMods); #endif - + //endex - + float3 tangentSpaceNormal = UnpackNormal(float4(0.5, 0.5, 1, 1)); poiMesh.normals[0] = normalize( tangentSpaceNormal.x * poiMesh.tangent[0] + tangentSpaceNormal.y * poiMesh.binormal[0] + tangentSpaceNormal.z * poiMesh.normals[0] ); - + poiMesh.normals[1] = normalize( poiMesh.tangentSpaceNormal.x * poiMesh.tangent[0] + poiMesh.tangentSpaceNormal.y * poiMesh.binormal[0] + poiMesh.tangentSpaceNormal.z * poiMesh.normals[0] ); - + poiMesh.tangent[1] = cross(poiMesh.binormal[0], -poiMesh.normals[1]); poiMesh.binormal[1] = cross(-poiMesh.normals[1], poiMesh.tangent[0]); - + //ifex _EnableOutlines!=1 #ifdef POI_PASS_OUTLINE poiMesh.normals[1] = poiMesh.normals[0]; #endif //endex - + // Camera data poiCam.forwardDir = getCameraForward(); poiCam.worldPos = _WorldSpaceCameraPos; @@ -54233,25 +55349,25 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif poiCam.posScreenPixels = calcPixelScreenUVs(poiCam.posScreenSpace); poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1])); - + poiCam.worldDirection.xyz = poiMesh.worldPos.xyz - poiCam.worldPos; poiCam.worldDirection.w = dot(poiCam.clipPos, CalculateFrustumCorrection()); - + //ifex _EnableAudioLink==0 #ifdef POI_AUDIOLINK SetupAudioLink(poiFragData, poiMods, poiMesh); #endif //endex - + //ifex _BlackLightMaskingEnabled==0 #ifdef POI_BLACKLIGHTMASKING calculateBlackLightMasks(poiMesh, poiMods); #endif //endex - + poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex); poiFragData.alpha = mainTexture.a * _Color.a; - + //ifex _MainColorAdjustToggle==0 #ifdef COLOR_GRADING_HDR #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED) @@ -54259,7 +55375,7 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #else float4 hueShiftAlpha = 1; #endif - + if (_MainHueGlobalMask > 0) { hueShiftAlpha.r = maskBlend(hueShiftAlpha.r, poiMods.globalMask[_MainHueGlobalMask - 1], _MainHueGlobalMaskBlendType); @@ -54272,8 +55388,8 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" { hueShiftAlpha.g = maskBlend(hueShiftAlpha.g, poiMods.globalMask[_MainBrightnessGlobalMask - 1], _MainBrightnessGlobalMaskBlendType); } - - if (_MainHueShiftToggle) + + if (_MainHueShiftToggle == 1) { float shift = _MainHueShift; #ifdef POI_AUDIOLINK @@ -54285,18 +55401,20 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif if (_MainHueShiftReplace) { - poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r); + poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x, _MainHueShiftColorSpace), hueShiftAlpha.r); } else { - poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x))); + poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)), _MainHueShiftColorSpace); } } - + if (_MainGradationStrength && _ColorGradingToggle) { #if !defined(UNITY_COLORSPACE_GAMMA) float3 tempColor = OpenLitLinearToSRGB(poiFragData.baseColor); + #else + float3 tempColor = poiFragData.baseColor; #endif #if defined(PROP_MAINGRADATIONTEX) || !defined(OPTIMIZER_ENABLED) tempColor.r = POI_SAMPLE_1D_X(_MainGradationTex, sampler_linear_clamp, tempColor.r).r; @@ -54310,18 +55428,18 @@ Shader "Hidden/LightLimitChanger/TextureBaker/Poiyomi Toon" #endif poiFragData.baseColor = lerp(poiFragData.baseColor, tempColor, _MainGradationStrength); } - + poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), - (_Saturation) * hueShiftAlpha.b); poiFragData.baseColor = saturate(lerp(poiFragData.baseColor, poiFragData.baseColor * (_MainBrightness + 1), hueShiftAlpha.g)); #endif //endex - + #if defined(PROP_ALPHAMASK) || !defined(OPTIMIZER_ENABLED) - + if (_MainAlphaMaskMode) { float alphaMask = POI2D_SAMPLER_PAN(_AlphaMask, _MainTex, poiUV(poiMesh.uv[_AlphaMaskUV], _AlphaMask_ST), _AlphaMaskPan.xy).r; - alphaMask = saturate(alphaMask * _AlphaMaskScale + _AlphaMaskValue); + alphaMask = saturate(alphaMask * _AlphaMaskBlendStrength + (_AlphaMaskInvert ?_AlphaMaskValue * -1 : _AlphaMaskValue)); if (_AlphaMaskInvert) alphaMask = 1 - alphaMask; if (_MainAlphaMaskMode == 1) poiFragData.alpha = alphaMask; if (_MainAlphaMaskMode == 2) poiFragData.alpha = poiFragData.alpha * alphaMask; From 81fa9188da4a8067726456ae94711e285cd3bd05 Mon Sep 17 00:00:00 2001 From: NoriDev Date: Wed, 25 Sep 2024 18:31:53 +0900 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20=EA=B7=B8=EB=A6=BC=EC=9E=90=20?= =?UTF-8?q?=EC=A1=B0=EC=A0=95=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 환경광에 의한 그림자 색을 조정할 수 있음 --- CHANGELOG_NRDV.md | 4 ++ Editor/ControlAnimationParameters.cs | 4 +- Editor/LightLimitChangerSettingsEditor.cs | 16 +++++++- Editor/LightLimitControlType.cs | 3 +- Editor/Localization.cs | 40 ++++++++++++++++++++ Editor/NDMF/ParameterProvider.cs | 3 ++ Editor/NDMF/Passes.GenerateAnimationsPass.cs | 8 ++-- Editor/NDMF/Passes.cs | 7 ++++ Editor/ShaderInfo/ShaderInfo.LilToon.cs | 15 ++++++++ Editor/ShaderInfo/ShaderInfo.Poiyomi.cs | 17 +++++++++ Editor/ShaderInfo/ShaderInfo.cs | 6 +++ Runtime/LightLimitChangerParameters.cs | 7 ++++ 12 files changed, 123 insertions(+), 7 deletions(-) diff --git a/CHANGELOG_NRDV.md b/CHANGELOG_NRDV.md index 15b7cf3..d949933 100644 --- a/CHANGELOG_NRDV.md +++ b/CHANGELOG_NRDV.md @@ -30,6 +30,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.x.x] - 2024-x-x 기반 LightLimitChanger 버전: 1.x.x +### Added +- 그림자 조정 기능 추가 + - 환경광에 의한 그림자 색을 조정할 수 있음 + ### Changed - Poiyomi Toon 셰이더 업데이트 (9.0.56 -> 9.0.61) diff --git a/Editor/ControlAnimationParameters.cs b/Editor/ControlAnimationParameters.cs index 0eb3fa8..ce62c7e 100644 --- a/Editor/ControlAnimationParameters.cs +++ b/Editor/ControlAnimationParameters.cs @@ -13,8 +13,9 @@ public readonly struct ControlAnimationParameters public readonly float DefaultMaxLightValue; public readonly float DefaultMonochromeLightingValue; public readonly float DefaultMonochromeAdditiveLightingValue; + public readonly float DefaultShadowEnvStrengthValue; - public ControlAnimationParameters(string targetPath, Type targetType, float minLightValue, float maxLightValue, float defaultMinLightValue, float defaultMaxLightValue, float defaultMonochromeLightingValue, float defaultMonochromeAdditiveLightingValue) + public ControlAnimationParameters(string targetPath, Type targetType, float minLightValue, float maxLightValue, float defaultMinLightValue, float defaultMaxLightValue, float defaultMonochromeLightingValue, float defaultMonochromeAdditiveLightingValue, float defaultShadowEnvStrengthValue) { TargetPath = targetPath; TargetType = targetType; @@ -24,6 +25,7 @@ public ControlAnimationParameters(string targetPath, Type targetType, float minL DefaultMaxLightValue = defaultMaxLightValue; DefaultMonochromeLightingValue = defaultMonochromeLightingValue; DefaultMonochromeAdditiveLightingValue = defaultMonochromeAdditiveLightingValue; + DefaultShadowEnvStrengthValue = defaultShadowEnvStrengthValue; } } } diff --git a/Editor/LightLimitChangerSettingsEditor.cs b/Editor/LightLimitChangerSettingsEditor.cs index 7ee046b..23f17f9 100644 --- a/Editor/LightLimitChangerSettingsEditor.cs +++ b/Editor/LightLimitChangerSettingsEditor.cs @@ -22,6 +22,7 @@ internal sealed class LightLimitChangerSettingsEditor : Editor private SerializedProperty AllowMonochromeControl; private SerializedProperty AllowUnlitControl; private SerializedProperty AllowEmissionControl; + private SerializedProperty AllowShadowControl; private SerializedProperty InitialTempControlValue; private SerializedProperty InitialSaturationControlValue; private SerializedProperty InitialMonochromeControlValue; @@ -33,6 +34,7 @@ internal sealed class LightLimitChangerSettingsEditor : Editor private SerializedProperty Excludes; private SerializedProperty WriteDefaults; private SerializedProperty MonochromeAdditiveLightingValue; + private SerializedProperty ShadowEnvStrengthValue; private static bool _isOptionFoldoutOpen = true; private static bool _isCepareteInitValFoldoutOpen = false; @@ -59,6 +61,7 @@ private void OnEnable() AllowMonochromeControl = parameters.FindPropertyRelative(nameof(LightLimitChangerParameters.AllowMonochromeControl)); AllowUnlitControl = parameters.FindPropertyRelative(nameof(LightLimitChangerParameters.AllowUnlitControl)); AllowEmissionControl = parameters.FindPropertyRelative(nameof(LightLimitChangerParameters.AllowEmissionControl)); + AllowShadowControl = parameters.FindPropertyRelative(nameof(LightLimitChangerParameters.AllowShadowControl)); InitialTempControlValue = parameters.FindPropertyRelative(nameof(LightLimitChangerParameters.InitialTempControlValue)); InitialSaturationControlValue = parameters.FindPropertyRelative(nameof(LightLimitChangerParameters.InitialSaturationControlValue)); InitialMonochromeControlValue = parameters.FindPropertyRelative(nameof(LightLimitChangerParameters.InitialMonochromeControlValue)); @@ -70,6 +73,7 @@ private void OnEnable() Excludes = serializedObject.FindProperty(nameof(LightLimitChangerSettings.Excludes)); WriteDefaults = serializedObject.FindProperty(nameof(LightLimitChangerSettings.WriteDefaults)); MonochromeAdditiveLightingValue = parameters.FindPropertyRelative(nameof(LightLimitChangerParameters.MonochromeAdditiveLightingValue)); + ShadowEnvStrengthValue = parameters.FindPropertyRelative(nameof(LightLimitChangerParameters.ShadowEnvStrengthValue)); } public override void OnInspectorGUI() @@ -159,6 +163,8 @@ public override void OnInspectorGUI() Localization.G("label.allow_color_tmp", "tip.allow_color_tmp")); EditorGUILayout.PropertyField(AllowSaturationControl, Localization.G("label.allow_saturation", "tip.allow_saturation")); + EditorGUILayout.PropertyField(AllowShadowControl, + Localization.G("label.allow_shadow", "tip.allow_shadow")); EditorGUILayout.PropertyField(AllowMonochromeControl, Localization.G("label.allow_monochrome", "tip.allow_monochrome")); EditorGUI.BeginDisabledGroup(AllowMonochromeControl.boolValue == false); @@ -194,7 +200,14 @@ public override void OnInspectorGUI() EditorGUI.BeginDisabledGroup(AllowSaturationControl.boolValue == false); EditorGUILayout.PropertyField(InitialSaturationControlValue, Localization.G("")); EditorGUI.EndDisabledGroup(); - + } + using (new EditorGUILayout.HorizontalScope()) + { + EditorGUILayout.Space(10); + EditorGUILayout.LabelField(Localization.G("label.shadow_env_strength"), GUILayout.MaxWidth(70.0f), GUILayout.ExpandWidth(false)); + EditorGUI.BeginDisabledGroup(AllowShadowControl.boolValue == false); + EditorGUILayout.PropertyField(ShadowEnvStrengthValue, Localization.G("")); + EditorGUI.EndDisabledGroup(); } using (new EditorGUILayout.HorizontalScope()) { @@ -204,7 +217,6 @@ public override void OnInspectorGUI() EditorGUILayout.PropertyField(InitialMonochromeControlValue, Localization.G("")); EditorGUI.EndDisabledGroup(); } - using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.Space(10); diff --git a/Editor/LightLimitControlType.cs b/Editor/LightLimitControlType.cs index 9b50e8a..3ea530d 100644 --- a/Editor/LightLimitControlType.cs +++ b/Editor/LightLimitControlType.cs @@ -14,7 +14,8 @@ public enum LightLimitControlType : long Monochrome = 1 << 6, MonochromeAdditive = 1 << 7, Emission = 1 << 8, + ShadowEnvStrength = 1 << 9, - AdditionalControls = Saturation | Unlit | ColorTemperature | Monochrome | MonochromeAdditive | Emission, + AdditionalControls = Saturation | Unlit | ColorTemperature | Monochrome | MonochromeAdditive | Emission | ShadowEnvStrength, } } diff --git a/Editor/Localization.cs b/Editor/Localization.cs index ceffbfe..7d82b1d 100644 --- a/Editor/Localization.cs +++ b/Editor/Localization.cs @@ -205,6 +205,16 @@ internal static class Localization "채도 조정 활성화" } }, + { + "label.allow_shadow", new [] + { + "Enable Unlit Control", + "影調整を有効にする", + "啟用陰影控制", + "启用陰影控制", + "그림자 조정 활성화" + } + }, { "label.allow_monochrome", new [] { @@ -375,6 +385,16 @@ internal static class Localization "채도" } }, + { + "label.shadow_env_strength", new [] + { + "Shadow Environment Strength", + "環境光", + "環境迷", + "环境迷", + "환경광에 의한 그림자 색" + } + }, { "label.monochrome", new [] { @@ -640,6 +660,16 @@ internal static class Localization "채도 조정 기능을 활성화할 수 있습니다" } }, + { + "tip.allow_shadow", new [] + { + "Enables shadow adjustment functionality", + "影の調整機能を有効化することができます", + "啟用陰影度調整功能", + "启用陰影度调整功能", + "그림자 조정 기능을 활성화할 수 있습니다" + } + }, { "tip.allow_monochrome", new [] { @@ -987,6 +1017,16 @@ 최신 버전의 Poiyomi Shader로 업데이트 해야 기능을 정상적으로 "채도" } }, + { + "ExpressionMenu.shadow_env_strength", new [] + { + "Shadow Env Strength", + "環境光", + "環境迷", + "环境迷", + "환경광" + } + }, { "ExpressionMenu.unlit", new [] { diff --git a/Editor/NDMF/ParameterProvider.cs b/Editor/NDMF/ParameterProvider.cs index e936443..b5ad231 100644 --- a/Editor/NDMF/ParameterProvider.cs +++ b/Editor/NDMF/ParameterProvider.cs @@ -41,6 +41,9 @@ public IEnumerable GetSuppliedParameters(BuildContext context if (parameters.AllowSaturationControl) yield return Parameter(Passes.ParameterName_Saturation); + if (parameters.AllowShadowControl) + yield return Parameter(Passes.ParameterName_ShadowEnvStrength); + if (parameters.AllowMonochromeControl) { yield return Parameter(Passes.ParameterName_Monochrome); diff --git a/Editor/NDMF/Passes.GenerateAnimationsPass.cs b/Editor/NDMF/Passes.GenerateAnimationsPass.cs index 28b4d81..68e024b 100644 --- a/Editor/NDMF/Passes.GenerateAnimationsPass.cs +++ b/Editor/NDMF/Passes.GenerateAnimationsPass.cs @@ -38,12 +38,13 @@ internal static void Run(Session session, LightLimitChangerObjectCache cache) var min = parameters.MinLightValue; var max = parameters.MaxLightValue; - float defaultMinLight, defaultMaxLight, defaultMonochromeLighting, defaultMonochromeAdditiveLighting; + float defaultMinLight, defaultMaxLight, defaultMonochromeLighting, defaultMonochromeAdditiveLighting, defaultShadowEnvStrength; if (!parameters.OverwriteDefaultLightMinMax && renderer.sharedMaterial is Material mat && x.IsTargetShader(mat?.shader) && x.TryGetLightMinMaxValue(mat, out defaultMinLight, out defaultMaxLight) && - x.TryGetMonochromeValue(mat, out defaultMonochromeLighting, out defaultMonochromeAdditiveLighting)) + x.TryGetMonochromeValue(mat, out defaultMonochromeLighting, out defaultMonochromeAdditiveLighting) && + x.TryGetShadowEnvStrengthValue(mat, out defaultShadowEnvStrength)) { // OverwriteDefaultLightMinMax disabled. // Now we get defaultMinLight and defaultMaxLight from first material slot. @@ -52,6 +53,7 @@ renderer.sharedMaterial is Material mat && { defaultMonochromeLighting = parameters.InitialMonochromeControlValue; defaultMonochromeAdditiveLighting = parameters.MonochromeAdditiveLightingValue; + defaultShadowEnvStrength = parameters.ShadowEnvStrengthValue; if (parameters.IsSeparateLightControl) { @@ -67,7 +69,7 @@ renderer.sharedMaterial is Material mat && } } - var param = new ControlAnimationParameters(relativePath, type, min, max, defaultMinLight, defaultMaxLight, defaultMonochromeLighting, defaultMonochromeAdditiveLighting); + var param = new ControlAnimationParameters(relativePath, type, min, max, defaultMinLight, defaultMaxLight, defaultMonochromeLighting, defaultMonochromeAdditiveLighting, defaultShadowEnvStrength); foreach (ref readonly var container in animationContainers) { x.SetControlAnimation(container, param, parameters); diff --git a/Editor/NDMF/Passes.cs b/Editor/NDMF/Passes.cs index 7aa23f5..087c691 100644 --- a/Editor/NDMF/Passes.cs +++ b/Editor/NDMF/Passes.cs @@ -41,6 +41,7 @@ public static void RunningPasses(Sequence sequence) internal const string ParameterName_Reset = "LightLimitReset"; internal const string ParameterName_Monochrome = "LightLimitMonochrome"; internal const string ParameterName_MonochromeAdditive = "LightLimitMonochromeAdditive"; + internal const string ParameterName_ShadowEnvStrength = "LightLimitShadowEnvStrength"; private static Session GetSession(BuildContext context) { @@ -163,6 +164,12 @@ public void InitializeSession(LightLimitChangerSettings settings, LightLimitChan controls.Add(ControlAnimationContainer.Create(LightLimitControlType.Emission, Localization.S("ExpressionMenu.emission"), "Emission", ParameterName_Emission, 1.0f, Icons.Emission, defaultAnimation)); } + if (parameters.AllowShadowControl) + { + targetControl |= LightLimitControlType.ShadowEnvStrength; + controls.Add(ControlAnimationContainer.Create(LightLimitControlType.ShadowEnvStrength, Localization.S("ExpressionMenu.shadow_env_strength"), "Shadow Environment Strength", ParameterName_ShadowEnvStrength, parameters.ShadowEnvStrengthValue, Icons.Unlit, defaultAnimation)); + } + Controls = controls.ToArray(); diff --git a/Editor/ShaderInfo/ShaderInfo.LilToon.cs b/Editor/ShaderInfo/ShaderInfo.LilToon.cs index 0e1c586..87bfbdc 100644 --- a/Editor/ShaderInfo/ShaderInfo.LilToon.cs +++ b/Editor/ShaderInfo/ShaderInfo.LilToon.cs @@ -26,6 +26,7 @@ public sealed class LilToon : ShaderInfo public const string _MonochromeLighting = "_MonochromeLighting"; public const string _EmissionBlend = "_EmissionBlend"; public const string _Emission2ndBlend = "_Emission2ndBlend"; + public const string _ShadowEnvStrength = "_ShadowEnvStrength"; private static class PropertyIDs { @@ -43,6 +44,7 @@ private static class PropertyIDs public static readonly int MainGradationStrength = Shader.PropertyToID(_MainGradationStrength); public static readonly int MainColorAdjustMask = Shader.PropertyToID(_MainColorAdjustMask); public static readonly int MonochromeLighting = Shader.PropertyToID(_MonochromeLighting); + public static readonly int ShadowEnvStrength = Shader.PropertyToID(_ShadowEnvStrength); } private static class DefaultParameters @@ -55,6 +57,7 @@ private static class DefaultParameters public static readonly Vector4 MainTexHSVG = new Vector4(0, 1, 1, 1); public static readonly float MainGradationStrength = 0; public static readonly float MonochromeLighting = 0; + public static readonly float ShadowEnvStrength = 0; } public override bool TryNormalizeMaterial(Material material, LightLimitChangerObjectCache cache) @@ -231,6 +234,12 @@ public override void SetControlAnimation(in ControlAnimationContainer container, container.Control.SetColorTempertureAnimation(parameters, _Color3rd); } + if (container.ControlType.HasFlag(LightLimitControlType.ShadowEnvStrength)) + { + container.Default.SetParameterAnimation(parameters, _ShadowEnvStrength, parameters.DefaultShadowEnvStrengthValue); + container.Control.SetParameterAnimation(parameters, _ShadowEnvStrength, 0, 1); + } + } public override bool TryGetLightMinMaxValue(Material material, out float min, out float max) @@ -246,6 +255,12 @@ public override bool TryGetMonochromeValue(Material material, out float monochro monochromeAdditive = 1; return true; } + + public override bool TryGetShadowEnvStrengthValue(Material material, out float shadowEnvStrength) + { + shadowEnvStrength = material.GetOrDefault(PropertyIDs.ShadowEnvStrength, DefaultParameters.ShadowEnvStrength); + return true; + } } } } diff --git a/Editor/ShaderInfo/ShaderInfo.Poiyomi.cs b/Editor/ShaderInfo/ShaderInfo.Poiyomi.cs index 47ce233..e49bda8 100644 --- a/Editor/ShaderInfo/ShaderInfo.Poiyomi.cs +++ b/Editor/ShaderInfo/ShaderInfo.Poiyomi.cs @@ -13,6 +13,7 @@ public sealed class Poiyomi : ShaderInfo public const string _LightingMinLightBrightness = "_LightingMinLightBrightness"; public const string _LightingCap = "_LightingCap"; public const string _LightingAdditiveLimit = "_LightingAdditiveLimit"; + public const string _LightingIgnoreAmbientColor = "_LightingIgnoreAmbientColor"; public const string _MainColorAdjustToggle = "_MainColorAdjustToggle"; public const string _Saturation = "_Saturation"; public const string _MonochromeLighting = "_LightingMonochromatic"; @@ -31,6 +32,7 @@ private static class PropertyIDs public static readonly int LightingMinLightBrightness = Shader.PropertyToID(_LightingMinLightBrightness); public static readonly int LightingCap = Shader.PropertyToID(_LightingCap); public static readonly int LightingAdditiveLimit = Shader.PropertyToID(_LightingAdditiveLimit); + public static readonly int LightingIgnoreAmbientColor = Shader.PropertyToID(_LightingIgnoreAmbientColor); public static readonly int MainColorAdjustToggle = Shader.PropertyToID(_MainColorAdjustToggle); public static readonly int Saturation = Shader.PropertyToID(_Saturation); public static readonly int Color = Shader.PropertyToID(_Color); @@ -51,6 +53,7 @@ private static class DefaultParameters public static readonly Color Color = Color.white; public static readonly float MonochromeLighting = 0; public static readonly float MonoChromeAdditiveLighting = 0; + public static readonly float LightingIgnoreAmbientColor = 0; } private const string Animated_Suffix = "Animated"; @@ -194,6 +197,7 @@ public override void SetControlAnimation(in ControlAnimationContainer container, container.Default.SetParameterAnimation(parameters, _DissolveTextureColor, DefaultParameters.Color); container.Control.SetColorTempertureAnimation(parameters, _DissolveTextureColor, DefaultParameters.Color); } + if (container.ControlType.HasFlag(LightLimitControlType.Monochrome)) { container.Default.SetParameterAnimation(parameters, _MonochromeLighting, parameters.DefaultMonochromeLightingValue); @@ -205,11 +209,18 @@ public override void SetControlAnimation(in ControlAnimationContainer container, container.Control.SetParameterAnimation(parameters, _MonoChromeAdditiveLighting, 0, 1); } } + if (container.ControlType.HasFlag(LightLimitControlType.MonochromeAdditive)) { container.Default.SetParameterAnimation(parameters, _MonoChromeAdditiveLighting, parameters.DefaultMonochromeAdditiveLightingValue); container.Control.SetParameterAnimation(parameters, _MonoChromeAdditiveLighting, 0, 1); } + + if (container.ControlType.HasFlag(LightLimitControlType.ShadowEnvStrength)) + { + container.Default.SetParameterAnimation(parameters, _LightingIgnoreAmbientColor, parameters.DefaultShadowEnvStrengthValue); + container.Control.SetParameterAnimation(parameters, _LightingIgnoreAmbientColor, 0, 1); + } } public override void AdditionalControl(Material material, in LightLimitChangerParameters parameters) @@ -256,6 +267,12 @@ public override bool TryGetMonochromeValue(Material material, out float monochro monochromeAdditive = material.GetOrDefault(PropertyIDs.MonoChromeAdditiveLighting, DefaultParameters.MonoChromeAdditiveLighting); return true; } + + public override bool TryGetShadowEnvStrengthValue(Material material, out float shadowEnvStrength) + { + shadowEnvStrength = material.GetOrDefault(PropertyIDs.LightingIgnoreAmbientColor, DefaultParameters.LightingIgnoreAmbientColor); + return true; + } } } } diff --git a/Editor/ShaderInfo/ShaderInfo.cs b/Editor/ShaderInfo/ShaderInfo.cs index c9f581a..0dd531a 100644 --- a/Editor/ShaderInfo/ShaderInfo.cs +++ b/Editor/ShaderInfo/ShaderInfo.cs @@ -113,5 +113,11 @@ public virtual bool TryGetMonochromeValue(Material material, out float monochrom monochromeAdditive = 1; return false; } + + public virtual bool TryGetShadowEnvStrengthValue(Material material, out float shadowEnvStrength) + { + shadowEnvStrength = 0; + return false; + } } } diff --git a/Runtime/LightLimitChangerParameters.cs b/Runtime/LightLimitChangerParameters.cs index a6dbf76..b079b76 100644 --- a/Runtime/LightLimitChangerParameters.cs +++ b/Runtime/LightLimitChangerParameters.cs @@ -31,6 +31,7 @@ public class LightLimitChangerParameters public bool AllowColorTempControl = false; public bool AllowSaturationControl = false; + public bool AllowShadowControl = false; public bool AllowMonochromeControl = false; public bool AllowUnlitControl = false; public bool AllowEmissionControl = false; @@ -56,6 +57,12 @@ public class LightLimitChangerParameters [Range(0,1)] public float InitialUnlitControlValue = 0.0f; + + [Range(0,1)] + public float ShadowEnvStrengthValue = 0.0f; + + [Range(0,1)] + public float DefaultShadowEnvStrengthValue = 0.0f; public bool IsSeparateLightControl = false; public bool IsSeparateMonochromeControl = false; From ecc9480b14e1f5b3163e1efcad99311e89c21e34 Mon Sep 17 00:00:00 2001 From: NoriDev Date: Wed, 25 Sep 2024 18:32:31 +0900 Subject: [PATCH 4/4] 1.1.0 --- CHANGELOG_NRDV.md | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG_NRDV.md b/CHANGELOG_NRDV.md index d949933..8b613ae 100644 --- a/CHANGELOG_NRDV.md +++ b/CHANGELOG_NRDV.md @@ -27,8 +27,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 --> -## [1.x.x] - 2024-x-x -기반 LightLimitChanger 버전: 1.x.x +## [1.1.0] - 2024-09-25 +기반 LightLimitChanger 버전: 1.14.0 ### Added - 그림자 조정 기능 추가 diff --git a/package.json b/package.json index e1544c1..f0b2a51 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "moe.noridev.light-limit-changer", - "version": "1.0.4", + "version": "1.1.0", "baseVersion": "1.14.0", "unity": "2019.4", "displayName": "NoriDev - LightLimitChanger",